diff options
author | Heejin Ahn <aheejin@gmail.com> | 2020-10-23 15:33:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-23 15:33:13 -0700 |
commit | aaf7825293d4f5f767a4a759ab7c1f20703e4c20 (patch) | |
tree | 5f9501d65f81c9744ec4282c319bb9ed057095fa | |
parent | d53f195c27f83afa18d1f35cc97877341eb03be4 (diff) | |
download | binaryen-aaf7825293d4f5f767a4a759ab7c1f20703e4c20.tar.gz binaryen-aaf7825293d4f5f767a4a759ab7c1f20703e4c20.tar.bz2 binaryen-aaf7825293d4f5f767a4a759ab7c1f20703e4c20.zip |
Make pops valid in tests (#3282)
These two tests had pops in invalid locations; pops are valid only after
`catch`. This fixes those invalid wasm files.
This removes pops from Os_print-stack-ir_all-features.wast too.
Fixes #3213 and #3283.
6 files changed, 45 insertions, 87 deletions
diff --git a/test/passes/Os_print-stack-ir_all-features.txt b/test/passes/Os_print-stack-ir_all-features.txt index 7e880985e..7184df236 100644 --- a/test/passes/Os_print-stack-ir_all-features.txt +++ b/test/passes/Os_print-stack-ir_all-features.txt @@ -39,57 +39,3 @@ ) ) ) -(module - (type $none_=>_i32 (func (result i32))) - (type $none_=>_i32_f64 (func (result i32 f64))) - (type $none_=>_i64 (func (result i64))) - (type $none_=>_f32 (func (result f32))) - (type $none_=>_f64 (func (result f64))) - (export "ppi32" (func $0)) - (export "ppi64" (func $1)) - (export "ppf32" (func $2)) - (export "ppf64" (func $3)) - (export "pair" (func $4)) - (func $0 (result i32) - - ) - (func $1 (result i64) - - ) - (func $2 (result f32) - - ) - (func $3 (result f64) - - ) - (func $4 (result i32 f64) - - ) -) -(module - (type $none_=>_i32 (func (result i32))) - (type $none_=>_i32_f64 (func (result i32 f64))) - (type $none_=>_i64 (func (result i64))) - (type $none_=>_f32 (func (result f32))) - (type $none_=>_f64 (func (result f64))) - (export "ppi32" (func $0)) - (export "ppi64" (func $1)) - (export "ppf32" (func $2)) - (export "ppf64" (func $3)) - (export "pair" (func $4)) - (func $0 (; has Stack IR ;) (result i32) - (pop i32) - ) - (func $1 (; has Stack IR ;) (result i64) - (pop i64) - ) - (func $2 (; has Stack IR ;) (result f32) - (pop f32) - ) - (func $3 (; has Stack IR ;) (result f64) - (pop f64) - ) - (func $4 (; has Stack IR ;) (result i32 f64) - (pop i32 f64) - ) -) diff --git a/test/passes/Os_print-stack-ir_all-features.wast b/test/passes/Os_print-stack-ir_all-features.wast index 8521c4047..5c03b5e23 100644 --- a/test/passes/Os_print-stack-ir_all-features.wast +++ b/test/passes/Os_print-stack-ir_all-features.wast @@ -14,23 +14,3 @@ ) ) ) -(module - ;; These are not valid usages of pops - they are not meant to be - ;; used alone. This just tests we can emit them/handle them in the - ;; optimizer. - (func "ppi32" (result i32) - (pop i32) - ) - (func "ppi64" (result i64) - (pop i64) - ) - (func "ppf32" (result f32) - (pop f32) - ) - (func "ppf64" (result f64) - (pop f64) - ) - (func "pair" (result i32 f64) - (pop i32 f64) - ) -) diff --git a/test/passes/instrument-locals_all-features.txt b/test/passes/instrument-locals_all-features.txt index a606813cb..03a5743e5 100644 --- a/test/passes/instrument-locals_all-features.txt +++ b/test/passes/instrument-locals_all-features.txt @@ -242,14 +242,35 @@ ) ) ) - (local.set $F - (pop funcref) + (try + (do + (nop) + ) + (catch + (local.set $F + (pop funcref) + ) + ) ) - (local.set $X - (pop externref) + (try + (do + (nop) + ) + (catch + (local.set $X + (pop externref) + ) + ) ) - (local.set $E - (pop exnref) + (try + (do + (nop) + ) + (catch + (local.set $E + (pop exnref) + ) + ) ) (drop (call $get_v128 diff --git a/test/passes/instrument-locals_all-features.wast b/test/passes/instrument-locals_all-features.wast index 4b396a79b..c709630b5 100644 --- a/test/passes/instrument-locals_all-features.wast +++ b/test/passes/instrument-locals_all-features.wast @@ -42,9 +42,24 @@ (local.set $E (local.get $E)) ;; Pop instructions should not be instrumented - (local.set $F (pop funcref)) - (local.set $X (pop externref)) - (local.set $E (pop exnref)) + (try + (do) + (catch + (local.set $F (pop funcref)) + ) + ) + (try + (do) + (catch + (local.set $X (pop externref)) + ) + ) + (try + (do) + (catch + (local.set $E (pop exnref)) + ) + ) ;; Add new instructions here so expected output doesn't change too much, it ;; depends on order of instructions in this file. diff --git a/test/passes/remove-unused-names_code-folding_all-features.txt b/test/passes/remove-unused-names_code-folding_all-features.txt index c9e9b90e7..9736c3c0a 100644 --- a/test/passes/remove-unused-names_code-folding_all-features.txt +++ b/test/passes/remove-unused-names_code-folding_all-features.txt @@ -1822,9 +1822,6 @@ (block $x (try (do - (local.set $exn - (pop exnref) - ) (call $foo) (call $foo) (call $foo) diff --git a/test/passes/remove-unused-names_code-folding_all-features.wast b/test/passes/remove-unused-names_code-folding_all-features.wast index a35fe6cda..823ed45eb 100644 --- a/test/passes/remove-unused-names_code-folding_all-features.wast +++ b/test/passes/remove-unused-names_code-folding_all-features.wast @@ -1273,7 +1273,6 @@ (try (do ;; Expressions that can throw should NOT be taken out of 'try' scope. - (local.set $exn (pop exnref)) (call $foo) (call $foo) (call $foo) |