summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/literal.h8
-rw-r--r--src/wasm/literal.cpp3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/literal.h b/src/literal.h
index 317839b72..9d7ac2222 100644
--- a/src/literal.h
+++ b/src/literal.h
@@ -769,6 +769,14 @@ template<> struct hash<wasm::Literal> {
wasm::rehash(digest, a.geti31(true));
return digest;
}
+ if (a.type.isString()) {
+ auto& values = a.getGCData()->values;
+ wasm::rehash(digest, values.size());
+ for (auto c : values) {
+ wasm::rehash(digest, c.getInteger());
+ }
+ return digest;
+ }
// other non-null reference type literals cannot represent concrete
// values, i.e. there is no concrete anyref or eqref other than null.
WASM_UNREACHABLE("unexpected type");
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index 016df2e18..2a7dd1bcf 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -432,6 +432,9 @@ bool Literal::operator==(const Literal& other) const {
assert(func.is() && other.func.is());
return func == other.func;
}
+ if (type.isString()) {
+ return gcData->values == other.gcData->values;
+ }
if (type.isData()) {
return gcData == other.gcData;
}