summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 78470324c..74d74f473 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -7244,13 +7244,19 @@ void WasmBinaryReader::visitCallRef(CallRef* curr) {
}
bool WasmBinaryReader::maybeVisitRefI31(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::RefI31) {
- return false;
+ Shareability share;
+ switch (code) {
+ case BinaryConsts::RefI31:
+ share = Unshared;
+ break;
+ case BinaryConsts::RefI31Shared:
+ share = Shared;
+ break;
+ default:
+ return false;
}
- auto* curr = allocator.alloc<RefI31>();
- curr->value = popNonVoidExpression();
- curr->finalize();
- out = curr;
+ auto* value = popNonVoidExpression();
+ out = Builder(wasm).makeRefI31(value, share);
return true;
}