summaryrefslogtreecommitdiff
path: root/test/exception-handling.wast.fromBinary
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2021-12-06 16:42:56 -0800
committerGitHub <noreply@github.com>2021-12-06 16:42:56 -0800
commitf0668172831da496a6a781c82fa4b2dc0f4c9028 (patch)
tree5c50a56d7bf06fc0100172bd273cefd8f8703314 /test/exception-handling.wast.fromBinary
parent464240c0fecc324064b13aacd26f12e69228e0fb (diff)
downloadbinaryen-f0668172831da496a6a781c82fa4b2dc0f4c9028.tar.gz
binaryen-f0668172831da496a6a781c82fa4b2dc0f4c9028.tar.bz2
binaryen-f0668172831da496a6a781c82fa4b2dc0f4c9028.zip
[EH] Fix binary parsing for catchless try + inner delegate (#4370)
We do some postprocessing after parsing `Try` to make sure `delegate` only targets `try`s and not `block`s: https://github.com/WebAssembly/binaryen/blob/9659f9b07c1196447edee68fe04c8d7dd2480652/src/wasm/wasm-binary.cpp#L6404-L6426 But in case the outer `try` has neither of `catch` nor `delegate`, the previous code just return prematurely, skipping the postprocessing part, resulting in a binary parsing error. This PR removes that early-exiting code. Some test outputs have changed because `try`s are assigned labels after the early exit. But those labels can be removed by other optimization passes when there is no inner `rethrow` or `delegate` that targets them. (On a side note, the restriction that `delegate` cannot target a `block` has been removed a few months ago in the spec, so if a `delegate` targets a `block`, it means it is just rethrown from that block. But I still think this is a convenient invariant to hold at least within the binaryen IR. I'm planning to allow parsing of `delegate` targeting `block`s later, but I will make them point to `try` when read in the IR. At the moment the LLVM toolchain does not generate such code.)
Diffstat (limited to 'test/exception-handling.wast.fromBinary')
-rw-r--r--test/exception-handling.wast.fromBinary22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/exception-handling.wast.fromBinary b/test/exception-handling.wast.fromBinary
index 9a89a0beb..29231a943 100644
--- a/test/exception-handling.wast.fromBinary
+++ b/test/exception-handling.wast.fromBinary
@@ -15,7 +15,7 @@
(func $bar
(nop)
)
- (func $eh_test
+ (func $eh-test
(local $x i32)
(local $1 i64)
(local $2 (i32 i64))
@@ -197,7 +197,7 @@
)
)
)
- (try
+ (try $label$37
(do
(throw $tag$0
(i32.const 0)
@@ -382,7 +382,7 @@
)
)
)
- (func $pop_test
+ (func $pop-test
(try $label$5
(do
(nop)
@@ -408,5 +408,21 @@
)
)
)
+ (func $catchless-try-with-inner-delegate
+ (try $label$6
+ (do
+ (block $label$1
+ (try $label$4
+ (do
+ (throw $tag$0
+ (i32.const 0)
+ )
+ )
+ (delegate $label$6)
+ )
+ )
+ )
+ )
+ )
)