summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-02-01 22:44:40 +0000
committerGitHub <noreply@github.com>2021-02-01 14:44:40 -0800
commiteafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc (patch)
tree7284b2c93d1416dd898f297792fc00a11dac0ed7 /src/wasm/wasm-binary.cpp
parent02f8c56aad18a2715904d1d5e0951b25bf7749c3 (diff)
downloadbinaryen-eafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc.tar.gz
binaryen-eafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc.tar.bz2
binaryen-eafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc.zip
[GC] br_on_null (#3528)
This is only partial support, as br_on_null also has an extra optional value in the spec. Implementing that is cumbersome in binaryen, and there is ongoing spec discussions about it (see https://github.com/WebAssembly/function-references/issues/45 ), so for now we only support the simple case without the default value. Also fix prefixed opcodes to be LEBs in RefAs, which was noticed here as the change here made it noticeable whether the values were int8 or LEBs.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 4a90dd698..b7ffcd8d7 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -2879,6 +2879,9 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) {
case BinaryConsts::RefAsNonNull:
visitRefAs((curr = allocator.alloc<RefAs>())->cast<RefAs>(), code);
break;
+ case BinaryConsts::BrOnNull:
+ maybeVisitBrOn(curr, code);
+ break;
case BinaryConsts::Try:
visitTryOrTryInBlock(curr);
break;
@@ -5831,6 +5834,9 @@ bool WasmBinaryBuilder::maybeVisitRefCast(Expression*& out, uint32_t code) {
bool WasmBinaryBuilder::maybeVisitBrOn(Expression*& out, uint32_t code) {
BrOnOp op;
switch (code) {
+ case BinaryConsts::BrOnNull:
+ op = BrOnNull;
+ break;
case BinaryConsts::BrOnCast:
op = BrOnCast;
break;