diff options
author | Heejin Ahn <aheejin@gmail.com> | 2021-01-15 18:48:00 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 18:48:00 +0900 |
commit | beccdf70258cd99ea25f10af13103e14dc243ffa (patch) | |
tree | 1081d7d350fbab7f901b917f2f082c8d351c3157 /test/exception-handling.wast.fromBinary.noDebugInfo | |
parent | f18c18e01d03d6d293fe3d701408855bbcea58bd (diff) | |
download | binaryen-beccdf70258cd99ea25f10af13103e14dc243ffa.tar.gz binaryen-beccdf70258cd99ea25f10af13103e14dc243ffa.tar.bz2 binaryen-beccdf70258cd99ea25f10af13103e14dc243ffa.zip |
Basic EH instrucion support for the new spec (#3487)
This updates `try`-`catch`-`catch_all` and `rethrow` instructions to
match the new spec. `delegate` is not included. Now `Try` contains not a
single `catchBody` expression but a vector of catch
bodies and events.
This updates most existing routines, optimizations, and tests modulo the
interpreter and the CFG traversal. Because the interpreter has not been
updated yet, the EH spec test is temporarily disabled in check.py. Also,
because the CFG traversal for EH is not yet updated, several EH tests in
`rse_all-features.wast`, which uses CFG traversal, are temporarily
commented out.
Also added a few more tests in existing EH test functions in
test/passes. In the previous spec, `catch` was catching all exceptions
so it was assumed that anything `try` body throws is caught by its
`catch`, but now we can assume the same only if there is a `catch_all`.
Newly added tests test cases when there is a `catch_all` and cases there
are only `catch`es separately.
Diffstat (limited to 'test/exception-handling.wast.fromBinary.noDebugInfo')
-rw-r--r-- | test/exception-handling.wast.fromBinary.noDebugInfo | 135 |
1 files changed, 116 insertions, 19 deletions
diff --git a/test/exception-handling.wast.fromBinary.noDebugInfo b/test/exception-handling.wast.fromBinary.noDebugInfo index 0b5a7d896..1f1ebdb6f 100644 --- a/test/exception-handling.wast.fromBinary.noDebugInfo +++ b/test/exception-handling.wast.fromBinary.noDebugInfo @@ -1,10 +1,12 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (type $externref_=>_none (func (param externref))) + (type $i64_=>_none (func (param i64))) + (type $i32_i64_=>_none (func (param i32 i64))) (type $exnref_=>_exnref (func (param exnref) (result exnref))) (event $event$0 (attr 0) (param i32)) - (event $event$1 (attr 0) (param externref)) + (event $event$1 (attr 0) (param i64)) + (event $event$2 (attr 0) (param i32 i64)) (func $0 (param $0 exnref) (result exnref) (local.get $0) ) @@ -15,38 +17,72 @@ (nop) ) (func $3 - (local $0 exnref) + (local $0 i32) + (local $1 i64) + (local $2 (i32 i64)) + (local $3 i32) + (local $4 i32) (try (do (throw $event$0 (i32.const 0) ) ) - (catch + (catch $event$0 + (drop + (pop i32) + ) + ) + ) + (try + (do + (throw $event$2 + (i32.const 0) + (i64.const 0) + ) + ) + (catch $event$2 + (local.set $2 + (pop i32 i64) + ) (local.set $0 - (pop exnref) + (block (result i32) + (local.set $3 + (tuple.extract 0 + (local.get $2) + ) + ) + (local.set $1 + (tuple.extract 1 + (local.get $2) + ) + ) + (local.get $3) + ) ) (drop - (block $label$3 (result i32) - (rethrow - (br_on_exn $label$3 $event$0 - (local.get $0) - ) + (block (result i32) + (local.set $4 + (local.get $0) + ) + (drop + (local.get $1) ) + (local.get $4) ) ) ) ) - (block $label$4 + (block $label$5 (try (do - (br $label$4) + (br $label$5) ) - (catch + (catch $event$0 (drop - (pop exnref) + (pop i32) ) - (br $label$4) + (br $label$5) ) ) ) @@ -54,9 +90,9 @@ (do (nop) ) - (catch + (catch $event$0 (drop - (pop exnref) + (pop i32) ) ) ) @@ -65,14 +101,75 @@ (call $1) (call $2) ) - (catch + (catch $event$0 (drop - (pop exnref) + (pop i32) ) (call $1) (call $2) ) ) + (try + (do + (throw $event$0 + (i32.const 0) + ) + ) + (catch $event$0 + (drop + (pop i32) + ) + ) + (catch $event$1 + (drop + (pop i64) + ) + ) + ) + (try + (do + (throw $event$0 + (i32.const 0) + ) + ) + (catch_all + (nop) + ) + ) + (try + (do + (throw $event$0 + (i32.const 0) + ) + ) + (catch $event$0 + (drop + (pop i32) + ) + ) + (catch $event$1 + (drop + (pop i64) + ) + ) + (catch_all + (call $1) + (call $2) + ) + ) + (try + (do + (throw $event$0 + (i32.const 0) + ) + ) + (catch $event$0 + (drop + (pop i32) + ) + (rethrow 0) + ) + ) ) ) |