diff options
Diffstat (limited to 'src/literal.h')
-rw-r--r-- | src/literal.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/literal.h b/src/literal.h index f7703d9e6..1c1128163 100644 --- a/src/literal.h +++ b/src/literal.h @@ -96,7 +96,9 @@ public: // Whether this is GC data, that is, something stored on the heap (aside from // a null or i31). This includes structs, arrays, and also strings. bool isData() const { return type.isData(); } - bool isString() const { return type.isString(); } + bool isString() const { + return type.isRef() && type.getHeapType().isMaybeShared(HeapType::string); + } bool isNull() const { return type.isNull(); } @@ -770,11 +772,11 @@ template<> struct hash<wasm::Literal> { wasm::rehash(digest, a.getFunc()); return digest; } - if (a.type.getHeapType() == wasm::HeapType::i31) { + if (a.type.getHeapType().isMaybeShared(wasm::HeapType::i31)) { wasm::rehash(digest, a.geti31(true)); return digest; } - if (a.type.isString()) { + if (a.type.getHeapType().isMaybeShared(wasm::HeapType::string)) { auto& values = a.getGCData()->values; wasm::rehash(digest, values.size()); for (auto c : values) { |