summaryrefslogtreecommitdiff
path: root/src/wasm/literal.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-07-29 16:27:42 -0700
committerGitHub <noreply@github.com>2024-07-29 16:27:42 -0700
commit6645f0c05b8e9268f35742bb6b0a67e0a9c40795 (patch)
treee8bfed8efcaa4d74a38b31636d1ee34b6c6734ac /src/wasm/literal.cpp
parenteac08461444da84e20d0641e429db7b03e45a21c (diff)
downloadbinaryen-6645f0c05b8e9268f35742bb6b0a67e0a9c40795.tar.gz
binaryen-6645f0c05b8e9268f35742bb6b0a67e0a9c40795.tar.bz2
binaryen-6645f0c05b8e9268f35742bb6b0a67e0a9c40795.zip
Fix shareability of internalized nulls (#6789)
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r--src/wasm/literal.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index b3128025e..afbee4435 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -2700,11 +2700,12 @@ Literal Literal::externalize() const {
}
Literal Literal::internalize() const {
- auto extType = HeapTypes::ext.getBasic(type.getHeapType().getShared());
+ auto share = type.getHeapType().getShared();
+ auto extType = HeapTypes::ext.getBasic(share);
assert(Type::isSubType(type, Type(extType, Nullable)) &&
"can only internalize external references");
if (isNull()) {
- return Literal(std::shared_ptr<GCData>{}, HeapType::none);
+ return Literal(std::shared_ptr<GCData>{}, HeapTypes::none.getBasic(share));
}
if (gcData->type.isMaybeShared(HeapType::i31)) {
assert(gcData->values[0].type.getHeapType().isMaybeShared(HeapType::i31));