diff options
author | Alon Zakai <azakai@google.com> | 2018-12-11 15:29:02 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-12-11 16:35:55 -0800 |
commit | 3307ca89fc270bdca7e5124dca8dcb54027918c2 (patch) | |
tree | 88c0229245880a0ab64e4f7f3f809aaec2acf2fb /test | |
parent | 60b57973318faca7b5f42a25323209763980283c (diff) | |
download | binaryen-3307ca89fc270bdca7e5124dca8dcb54027918c2.tar.gz binaryen-3307ca89fc270bdca7e5124dca8dcb54027918c2.tar.bz2 binaryen-3307ca89fc270bdca7e5124dca8dcb54027918c2.zip |
wasm-ctor-eval: handle the stack going either up or down
Diffstat (limited to 'test')
-rw-r--r-- | test/ctor-eval/stack-direction.wast | 30 | ||||
-rw-r--r-- | test/ctor-eval/stack-direction.wast.ctors | 1 | ||||
-rw-r--r-- | test/ctor-eval/stack-direction.wast.out | 2 |
3 files changed, 33 insertions, 0 deletions
diff --git a/test/ctor-eval/stack-direction.wast b/test/ctor-eval/stack-direction.wast new file mode 100644 index 000000000..ebd6ef3fc --- /dev/null +++ b/test/ctor-eval/stack-direction.wast @@ -0,0 +1,30 @@ +(module + (type $0 (func)) + (import "env" "memory" (memory $1 256 256)) + (import "env" "STACKTOP" (global $gimport$0 i32)) + (global $global$0 (mut i32) (get_global $gimport$0)) + (export "__post_instantiate" (func $0)) + ;; if the stack goes **down**, this may seem to write to memory we care about + (func $0 (; 0 ;) (type $0) + (local $0 i32) + (i32.store offset=12 + (tee_local $0 + (i32.sub + (get_global $global$0) + (i32.const 16) + ) + ) + (i32.const 10) + ) + (i32.store offset=12 + (get_local $0) + (i32.add + (i32.load offset=12 + (get_local $0) + ) + (i32.const 1) + ) + ) + ) +) + diff --git a/test/ctor-eval/stack-direction.wast.ctors b/test/ctor-eval/stack-direction.wast.ctors new file mode 100644 index 000000000..a9d301395 --- /dev/null +++ b/test/ctor-eval/stack-direction.wast.ctors @@ -0,0 +1 @@ +__post_instantiate diff --git a/test/ctor-eval/stack-direction.wast.out b/test/ctor-eval/stack-direction.wast.out new file mode 100644 index 000000000..4427f36e0 --- /dev/null +++ b/test/ctor-eval/stack-direction.wast.out @@ -0,0 +1,2 @@ +(module +) |