diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ctor-eval/ignore-external-input-gc.wast | 33 | ||||
-rw-r--r-- | test/ctor-eval/ignore-external-input-gc.wast.ctors | 1 | ||||
-rw-r--r-- | test/ctor-eval/ignore-external-input-gc.wast.out | 19 | ||||
-rw-r--r-- | test/ctor-eval/ignore-external-input.wast | 13 | ||||
-rw-r--r-- | test/ctor-eval/ignore-external-input.wast.ctors | 2 | ||||
-rw-r--r-- | test/ctor-eval/ignore-external-input.wast.out | 8 | ||||
-rw-r--r-- | test/ctor-eval/params.wast | 4 |
7 files changed, 71 insertions, 9 deletions
diff --git a/test/ctor-eval/ignore-external-input-gc.wast b/test/ctor-eval/ignore-external-input-gc.wast new file mode 100644 index 000000000..16558336c --- /dev/null +++ b/test/ctor-eval/ignore-external-input-gc.wast @@ -0,0 +1,33 @@ +(module + (global $global1 (mut i32) (i32.const 10)) + (global $global2 (mut i32) (i32.const 20)) + + (func "test1" (param $any (ref null any)) + ;; This is ok to call: when ignoring external input we assume 0 for the + ;; parameters, and this parameter is nullable. + (drop + (local.get $any) + ) + (global.set $global1 + (i32.const 11) + ) + ) + + (func "test2" (param $any (ref any)) + ;; This is *not* ok to call: when ignoring external input we assume 0 for + ;; the parameters, and this parameter is not nullable. + (drop + (local.get $any) + ) + (global.set $global2 + (i32.const 22) + ) + ) + + (func "keepalive" (result i32) + (i32.add + (global.get $global1) + (global.get $global2) + ) + ) +) diff --git a/test/ctor-eval/ignore-external-input-gc.wast.ctors b/test/ctor-eval/ignore-external-input-gc.wast.ctors new file mode 100644 index 000000000..e4b83fcba --- /dev/null +++ b/test/ctor-eval/ignore-external-input-gc.wast.ctors @@ -0,0 +1 @@ +test1,test2 diff --git a/test/ctor-eval/ignore-external-input-gc.wast.out b/test/ctor-eval/ignore-external-input-gc.wast.out new file mode 100644 index 000000000..3e7a8f429 --- /dev/null +++ b/test/ctor-eval/ignore-external-input-gc.wast.out @@ -0,0 +1,19 @@ +(module + (type $ref|any|_=>_none (func (param (ref any)))) + (type $none_=>_i32 (func (result i32))) + (global $global1 (mut i32) (i32.const 11)) + (global $global2 (mut i32) (i32.const 20)) + (export "test2" (func $1)) + (export "keepalive" (func $2)) + (func $1 (param $any (ref any)) + (global.set $global2 + (i32.const 22) + ) + ) + (func $2 (result i32) + (i32.add + (global.get $global1) + (global.get $global2) + ) + ) +) diff --git a/test/ctor-eval/ignore-external-input.wast b/test/ctor-eval/ignore-external-input.wast index 0849c67ab..562011605 100644 --- a/test/ctor-eval/ignore-external-input.wast +++ b/test/ctor-eval/ignore-external-input.wast @@ -8,7 +8,7 @@ (import "wasi_snapshot_preview1" "something_else" (func $wasi_something_else (result i32))) (memory 256 256) - (data (i32.const 0) "aaaaaaaaaaaaaaaaaaaaaaaaaaaa") ;; the final 4 'a's will remain + (data (i32.const 0) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") ;; the final 4 'a's will remain (func "test1" ;; This is ok to call: when ignoring external input we assume there is no @@ -48,6 +48,15 @@ ) ) + (func "test2b" (param $x i32) + ;; This is also ok to call: when ignoring external input we assume the + ;; args are zeros. + (i32.store + (i32.const 24) ;; the result (0) will be written to address 24 + (local.get $x) + ) + ) + (func "test3" ;; This is *not* ok to call, and we will *not* reach the final store after ;; this call. This function will not be evalled and will remain in the @@ -56,7 +65,7 @@ (call $wasi_something_else) ) (i32.store - (i32.const 24) + (i32.const 28) (i32.const 100) ) ) diff --git a/test/ctor-eval/ignore-external-input.wast.ctors b/test/ctor-eval/ignore-external-input.wast.ctors index c7060ede5..7b57e4b82 100644 --- a/test/ctor-eval/ignore-external-input.wast.ctors +++ b/test/ctor-eval/ignore-external-input.wast.ctors @@ -1 +1 @@ -test1,test2,test3 +test1,test2,test2b,test3 diff --git a/test/ctor-eval/ignore-external-input.wast.out b/test/ctor-eval/ignore-external-input.wast.out index f728afd0e..d61f2e6b9 100644 --- a/test/ctor-eval/ignore-external-input.wast.out +++ b/test/ctor-eval/ignore-external-input.wast.out @@ -3,14 +3,14 @@ (type $none_=>_none (func)) (import "wasi_snapshot_preview1" "something_else" (func $wasi_something_else (result i32))) (memory $0 256 256) - (data (i32.const 24) "aaaa") - (export "test3" (func $2)) - (func $2 + (data (i32.const 28) "aaaa") + (export "test3" (func $3)) + (func $3 (drop (call $wasi_something_else) ) (i32.store - (i32.const 24) + (i32.const 28) (i32.const 100) ) ) diff --git a/test/ctor-eval/params.wast b/test/ctor-eval/params.wast index fb70debe5..cb346bb3b 100644 --- a/test/ctor-eval/params.wast +++ b/test/ctor-eval/params.wast @@ -1,7 +1,7 @@ (module (func "test1" (param $x i32) - ;; The presence of params stops us from evalling this function (at least - ;; for now). + ;; The presence of params stops us from evalling this function, at least + ;; not with --ignore-external-input (see ignore-external-input.wast) (nop) ) ) |