diff options
Diffstat (limited to 'src/wasm')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 6 | ||||
-rw-r--r-- | src/wasm/wasm-stack.cpp | 3 | ||||
-rw-r--r-- | src/wasm/wasm.cpp | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 64a40f2ca..4a90dd698 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2876,6 +2876,9 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) { case BinaryConsts::RefEq: visitRefEq((curr = allocator.alloc<RefEq>())->cast<RefEq>()); break; + case BinaryConsts::RefAsNonNull: + visitRefAs((curr = allocator.alloc<RefAs>())->cast<RefAs>(), code); + break; case BinaryConsts::Try: visitTryOrTryInBlock(curr); break; @@ -5997,6 +6000,9 @@ bool WasmBinaryBuilder::maybeVisitArrayLen(Expression*& out, uint32_t code) { void WasmBinaryBuilder::visitRefAs(RefAs* curr, uint8_t code) { BYN_TRACE("zz node: RefAs\n"); switch (code) { + case BinaryConsts::RefAsNonNull: + curr->op = RefAsNonNull; + break; case BinaryConsts::RefAsFunc: curr->op = RefAsFunc; break; diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index 0ccca0e23..9ac3013b5 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -2090,6 +2090,9 @@ void BinaryInstWriter::visitArrayLen(ArrayLen* curr) { void BinaryInstWriter::visitRefAs(RefAs* curr) { switch (curr->op) { + case RefAsNonNull: + o << int8_t(BinaryConsts::RefAsNonNull); + break; case RefAsFunc: o << int8_t(BinaryConsts::GCPrefix) << int8_t(BinaryConsts::RefAsFunc); break; diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index a62435412..a94bda066 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -1036,6 +1036,10 @@ void RefAs::finalize() { return; } switch (op) { + case RefAsNonNull: + // FIXME: when we support non-nullable types, switch to NonNullable + type = Type(value->type.getHeapType(), Nullable); + break; case RefAsFunc: type = Type::funcref; break; |