File: partial.wast

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (30 lines) | stat: -rw-r--r-- 975 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(module
  (import "import" "import" (func $import))

  (memory 256 256)
  (data (i32.const 10) "_________________")

  (export "test1" (func $test1))

  ;; Use the function in an additional export. We should still get the same
  ;; results if we call this one, so it should point to identical contents as
  ;; earlier
  (export "keepalive" (func $test1))

  (func $test1
    ;; A safe store, should alter memory
    (i32.store8 (i32.const 12) (i32.const 115))

    ;; A call to an import, which prevents evalling.
    (call $import)

    ;; Another safe store, but the import call before us will stop our evalling.
    ;; As a result we will only partially eval this function, applying only
    ;; the first store.
    ;;
    ;; After optimization, the test1 export will point to a function that does
    ;; not have the first store anymore. It will contain just the call to the
    ;; import and then this second store.
    (i32.store8 (i32.const 13) (i32.const 114))
  )
)