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.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp
index d88138075..243b2810b 100644
--- a/src/wasm/wasm-stack.cpp
+++ b/src/wasm/wasm-stack.cpp
@@ -2013,8 +2013,14 @@ void BinaryInstWriter::visitI31Get(I31Get* curr) {
}
void BinaryInstWriter::visitCallRef(CallRef* curr) {
- o << int8_t(curr->isReturn ? BinaryConsts::RetCallRef
- : BinaryConsts::CallRef);
+ if (curr->isReturn) {
+ assert(curr->target->type != Type::unreachable);
+ // TODO: `emitUnreachable` if target has bottom type.
+ o << int8_t(BinaryConsts::RetCallRef);
+ parent.writeIndexedHeapType(curr->target->type.getHeapType());
+ return;
+ }
+ o << int8_t(BinaryConsts::CallRef);
}
void BinaryInstWriter::visitRefTest(RefTest* curr) {