summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2021-02-19 05:26:04 +0900
committerGitHub <noreply@github.com>2021-02-19 05:26:04 +0900
commit629012c3f9a58ff2ecbac066788af57c16471969 (patch)
tree94166250455c634d2f59d30379e6892a1ac11094 /src
parentd6ba20b0e43ea2a6cadbd82c236ad5614faafbbc (diff)
downloadbinaryen-629012c3f9a58ff2ecbac066788af57c16471969.tar.gz
binaryen-629012c3f9a58ff2ecbac066788af57c16471969.tar.bz2
binaryen-629012c3f9a58ff2ecbac066788af57c16471969.zip
[EH] Change catch_all's opcode (#3574)
We decided to change `catch_all`'s opcode from 0x05, which is the same as `else`, to 0x19, to avoid some complicated handling in the tools. See: https://github.com/WebAssembly/exception-handling/issues/147 lso this contains the original cpp file used to generate dwarf_with_exceptions.wasm; instructions to generate the wasm from that cpp file are in the comments.
Diffstat (limited to 'src')
-rw-r--r--src/wasm-binary.h4
-rw-r--r--src/wasm/wasm-binary.cpp7
2 files changed, 4 insertions, 7 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 811524d2d..99305acb2 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1026,7 +1026,7 @@ enum ASTNodes {
Try = 0x06,
Catch = 0x07,
- CatchAll = 0x05,
+ CatchAll = 0x19,
Delegate = 0x18,
Throw = 0x08,
Rethrow = 0x09,
@@ -1617,4 +1617,4 @@ private:
#undef DEBUG_TYPE
-#endif // wasm_wasm_binary_h \ No newline at end of file
+#endif // wasm_wasm_binary_h
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index b843aad03..dc0b1ab21 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -2967,16 +2967,13 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) {
}
break;
case BinaryConsts::Else:
- case BinaryConsts::Catch: {
+ case BinaryConsts::Catch:
+ case BinaryConsts::CatchAll: {
curr = nullptr;
if (DWARF && currFunction) {
assert(!controlFlowStack.empty());
auto currControlFlow = controlFlowStack.back();
BinaryLocation delimiterId;
- // Else and CatchAll have the same binary ID, so differentiate them
- // using the control flow stack.
- static_assert(BinaryConsts::CatchAll == BinaryConsts::Else,
- "Else and CatchAll should have identical codes");
if (currControlFlow->is<If>()) {
delimiterId = BinaryLocations::Else;
} else {