summaryrefslogtreecommitdiff
path: root/src/wasm-interpreter.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-07-25 12:47:44 -0700
committerGitHub <noreply@github.com>2022-07-25 19:47:44 +0000
commit68e2ed11e86e72cc4e12a1b4026ef19d5149fda9 (patch)
treead4ee672468c5fdf41be4bb612e070de66c27a5b /src/wasm-interpreter.h
parent2db1e13f731e22fe53fbfebef6e4a15c043a587e (diff)
downloadbinaryen-68e2ed11e86e72cc4e12a1b4026ef19d5149fda9.tar.gz
binaryen-68e2ed11e86e72cc4e12a1b4026ef19d5149fda9.tar.bz2
binaryen-68e2ed11e86e72cc4e12a1b4026ef19d5149fda9.zip
[Wasm GC] Properly represent nulls in i31 (#4819)
The encoding here is simple: we store i31 values in the literal.i32 field. The top bit says if a value exists, which means literal.i32 == 0 is the same as null.
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r--src/wasm-interpreter.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index eb5dcd5a7..399910e7a 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -1419,6 +1419,9 @@ public:
}
const auto& value = flow.getSingleValue();
NOTE_EVAL1(value);
+ if (value.isNull()) {
+ trap("null ref");
+ }
return Literal(value.geti31(curr->signed_));
}