summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-07-30 14:29:47 -0700
committerGitHub <noreply@github.com>2024-07-30 14:29:47 -0700
commite6bbff7846cad9daf178b6917d78abe5cfcd5771 (patch)
tree0cef97029997b1c46ebff0a6a665b6caaaf46142 /src
parent5078d4daffb39edb91785e5fd6d28c5ff92478e4 (diff)
downloadbinaryen-e6bbff7846cad9daf178b6917d78abe5cfcd5771.tar.gz
binaryen-e6bbff7846cad9daf178b6917d78abe5cfcd5771.tar.bz2
binaryen-e6bbff7846cad9daf178b6917d78abe5cfcd5771.zip
Fix shareability of externalized nulls (#6791)
Diffstat (limited to 'src')
-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 afbee4435..7e4aeb8c7 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -2687,11 +2687,12 @@ Literal Literal::relaxedFmsF64x2(const Literal& left,
Literal Literal::externalize() const {
assert(type.isRef() && type.getHeapType().getUnsharedTop() == HeapType::any &&
"can only externalize internal references");
+ auto share = type.getHeapType().getShared();
if (isNull()) {
- return Literal(std::shared_ptr<GCData>{}, HeapType::noext);
+ return Literal(std::shared_ptr<GCData>{}, HeapTypes::noext.getBasic(share));
}
auto heapType = type.getHeapType();
- auto extType = HeapTypes::ext.getBasic(heapType.getShared());
+ auto extType = HeapTypes::ext.getBasic(share);
if (heapType.isMaybeShared(HeapType::i31)) {
return Literal(std::make_shared<GCData>(heapType, Literals{*this}),
extType);