summaryrefslogtreecommitdiff
path: root/src/tools/wasm-ctor-eval.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-08-16 17:53:37 -0400
committerGitHub <noreply@github.com>2024-08-16 21:53:37 +0000
commit95a4d5de6f65b35a64caf014c2f7febb8a799542 (patch)
treee13e24374714b73ee66ece1b14f9a6daf910e43a /src/tools/wasm-ctor-eval.cpp
parent958ff4115e542ef1d0ae712f4961e342386efe54 (diff)
downloadbinaryen-95a4d5de6f65b35a64caf014c2f7febb8a799542.tar.gz
binaryen-95a4d5de6f65b35a64caf014c2f7febb8a799542.tar.bz2
binaryen-95a4d5de6f65b35a64caf014c2f7febb8a799542.zip
Fix direct comparisons with unshared basic heap types (#6845)
Audit the remaining ocurrences of `== HeapType::` and fix those that did not handle shared types correctly. Add tests for some of the fixes; others are NFC but clarify the code.
Diffstat (limited to 'src/tools/wasm-ctor-eval.cpp')
-rw-r--r--src/tools/wasm-ctor-eval.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp
index 6c72f1c73..9cf552450 100644
--- a/src/tools/wasm-ctor-eval.cpp
+++ b/src/tools/wasm-ctor-eval.cpp
@@ -834,11 +834,13 @@ public:
// logic here, we save the original (possible externalized) value, and then
// look at the internals from here on out.
Literal original = value;
- if (value.type.isRef() && value.type.getHeapType() == HeapType::ext) {
+ if (value.type.isRef() &&
+ value.type.getHeapType().isMaybeShared(HeapType::ext)) {
value = value.internalize();
// We cannot serialize truly external things, only data and i31s.
- assert(value.isData() || value.type.getHeapType() == HeapType::i31);
+ assert(value.isData() ||
+ value.type.getHeapType().isMaybeShared(HeapType::i31));
}
// GC data (structs and arrays) must be handled with the special global-
@@ -920,7 +922,7 @@ public:
Expression* ret = builder.makeGlobalGet(definingGlobalName, value.type);
if (original != value) {
// The original is externalized.
- assert(original.type.getHeapType() == HeapType::ext);
+ assert(original.type.getHeapType().isMaybeShared(HeapType::ext));
ret = builder.makeRefAs(ExternConvertAny, ret);
}
return ret;