From e6bbff7846cad9daf178b6917d78abe5cfcd5771 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 30 Jul 2024 14:29:47 -0700 Subject: Fix shareability of externalized nulls (#6791) --- src/wasm/literal.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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{}, HeapType::noext); + return Literal(std::shared_ptr{}, 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(heapType, Literals{*this}), extType); -- cgit v1.2.3