summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-stack.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-09-22 18:00:50 -0500
committerGitHub <noreply@github.com>2022-09-22 16:00:50 -0700
commit58bedde3ac54f82657d5de092e7142ffb2ff735c (patch)
treee486638a92aeca615439bbcd11b540f4913b98a1 /src/wasm/wasm-stack.cpp
parentb1ba25732c1a02ae3da726c4b01ca3825ef969ef (diff)
downloadbinaryen-58bedde3ac54f82657d5de092e7142ffb2ff735c.tar.gz
binaryen-58bedde3ac54f82657d5de092e7142ffb2ff735c.tar.bz2
binaryen-58bedde3ac54f82657d5de092e7142ffb2ff735c.zip
Add a type annotation to return_call_ref (#5068)
The GC spec has been updated to have heap type annotations on call_ref and return_call_ref. To avoid breaking users, we will have a graceful, multi-step upgrade to the annotated version of call_ref, but since return_call_ref has no users yet, update it in a single step.
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) {