summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-stack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-stack.cpp')
-rw-r--r--src/wasm/wasm-stack.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp
index 911447b48..e24060f2a 100644
--- a/src/wasm/wasm-stack.cpp
+++ b/src/wasm/wasm-stack.cpp
@@ -2025,8 +2025,12 @@ void BinaryInstWriter::visitCallRef(CallRef* curr) {
void BinaryInstWriter::visitRefTest(RefTest* curr) {
o << int8_t(BinaryConsts::GCPrefix);
- o << U32LEB(BinaryConsts::RefTest);
- parent.writeHeapType(curr->intendedType);
+ if (curr->castType.isNullable()) {
+ o << U32LEB(BinaryConsts::RefTestNull);
+ } else {
+ o << U32LEB(BinaryConsts::RefTest);
+ }
+ parent.writeHeapType(curr->castType.getHeapType());
}
void BinaryInstWriter::visitRefCast(RefCast* curr) {