summaryrefslogtreecommitdiff
path: root/src/wasm-stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-stack.h')
-rw-r--r--src/wasm-stack.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wasm-stack.h b/src/wasm-stack.h
index 7003b7b95..007e794b9 100644
--- a/src/wasm-stack.h
+++ b/src/wasm-stack.h
@@ -626,8 +626,9 @@ void StackWriter<Mode, Parent>::visitCall(Call* curr) {
visitChild(operand);
}
if (!justAddToStack(curr)) {
- o << int8_t(BinaryConsts::CallFunction)
- << U32LEB(parent.getFunctionIndex(curr->target));
+ int8_t op = curr->isReturn ? BinaryConsts::RetCallFunction
+ : BinaryConsts::CallFunction;
+ o << op << U32LEB(parent.getFunctionIndex(curr->target));
}
// TODO FIXME: this and similar can be removed
if (curr->type == unreachable) {
@@ -642,8 +643,9 @@ void StackWriter<Mode, Parent>::visitCallIndirect(CallIndirect* curr) {
}
visitChild(curr->target);
if (!justAddToStack(curr)) {
- o << int8_t(BinaryConsts::CallIndirect)
- << U32LEB(parent.getFunctionTypeIndex(curr->fullType))
+ int8_t op = curr->isReturn ? BinaryConsts::RetCallIndirect
+ : BinaryConsts::CallIndirect;
+ o << op << U32LEB(parent.getFunctionTypeIndex(curr->fullType))
<< U32LEB(0); // Reserved flags field
}
if (curr->type == unreachable) {