@@ -828,10 +828,19 @@ template<> struct hash<wasm::Literal> {
828828 wasm::rehash (digest, a.getFunc ());
829829 return digest;
830830 }
831- if (a.type .getHeapType ().isMaybeShared (wasm::HeapType::i31)) {
831+ auto type = a.type .getHeapType ();
832+ if (type.isMaybeShared (wasm::HeapType::i31)) {
832833 wasm::rehash (digest, a.geti31 (true ));
833834 return digest;
834835 }
836+ if (type.isMaybeShared (wasm::HeapType::any)) {
837+ // This may be an extern string that was internalized to |any|. Undo
838+ // that to get the actual value. (Rehash here with the existing digest,
839+ // which contains the |any| type, so that the final hash takes into
840+ // account the fact that it was internalized.)
841+ wasm::rehash (digest, (*this )(a.externalize ()));
842+ return digest;
843+ }
835844 if (a.type .isString ()) {
836845 auto & values = a.getGCData ()->values ;
837846 wasm::rehash (digest, values.size ());
@@ -841,7 +850,8 @@ template<> struct hash<wasm::Literal> {
841850 return digest;
842851 }
843852 // other non-null reference type literals cannot represent concrete
844- // values, i.e. there is no concrete anyref or eqref other than null.
853+ // values, i.e. there is no concrete anyref or eqref other than null and
854+ // internalized strings.
845855 WASM_UNREACHABLE (" unexpected type" );
846856 }
847857 WASM_UNREACHABLE (" unexpected type" );
0 commit comments