]> git.proxmox.com Git - rustc.git/blob - src/binaryen/test/ctor-eval/basics-flatten.wast
New upstream version 1.23.0+dfsg1
[rustc.git] / src / binaryen / test / ctor-eval / basics-flatten.wast
1 (module
2 (type $v (func))
3 (memory 256 256)
4 ;; test flattening of multiple segments
5 (data (i32.const 10) "waka ")
6 (data (i32.const 15) "waka") ;; skip a byte here
7 (data (i32.const 20) "waka waka waka")
8 (table 1 1 anyfunc)
9 (elem (i32.const 0) $call-indirect)
10 (export "test1" $test1)
11 (export "test2" $test2)
12 (export "test3" $test3)
13 (func $test1
14 (drop (i32.const 0)) ;; no work at all, really
15 (call $safe-to-call) ;; safe to call
16 (call_indirect (type $v) (i32.const 0)) ;; safe to call
17 )
18 (func $test2
19 (drop (i32.load (i32.const 12))) ;; a safe load
20 (drop (i32.load16 (i32.const 12)))
21 (drop (i32.load8 (i32.const 12)))
22 )
23 (func $test3
24 (i32.store (i32.const 12) (i32.const 115)) ;; a safe store, should alter memory
25 (i32.store16 (i32.const 20) (i32.const 31353))
26 (i32.store8 (i32.const 23) (i32.const 120))
27 )
28 (func $safe-to-call
29 (drop (i32.const 1))
30 (i32.store8 (i32.const 10) (i32.const 110)) ;; safe write too (lowest possible)
31 (i32.store8 (i32.const 33) (i32.const 109)) ;; safe write too (highest possible)
32 )
33 (func $call-indirect
34 (i32.store8 (i32.const 40) (i32.const 67))
35 )
36 )