summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-07-23 16:02:59 -0400
committerGitHub <noreply@github.com>2024-07-23 13:02:59 -0700
commit538c5288be3c946b8d6a7ac467d13ebc793ee38a (patch)
treedbc638edb051102b4c9bf7002826e8684972801a /src
parent0973589200fc2b9a5d413a340667811748837289 (diff)
downloadbinaryen-538c5288be3c946b8d6a7ac467d13ebc793ee38a.tar.gz
binaryen-538c5288be3c946b8d6a7ac467d13ebc793ee38a.tar.bz2
binaryen-538c5288be3c946b8d6a7ac467d13ebc793ee38a.zip
[threads] Calculate shared heap type depths in subtypes.h (#6777)
Fixes #6776.
Diffstat (limited to 'src')
-rw-r--r--src/ir/subtypes.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/ir/subtypes.h b/src/ir/subtypes.h
index 8645afb98..767c79fd7 100644
--- a/src/ir/subtypes.h
+++ b/src/ir/subtypes.h
@@ -124,20 +124,27 @@ struct SubTypes {
// Add the max depths of basic types.
for (auto type : types) {
HeapType basic;
+ auto share = type.getShared();
if (type.isStruct()) {
- basic = HeapType::struct_;
+ basic = HeapTypes::struct_.getBasic(share);
} else if (type.isArray()) {
- basic = HeapType::array;
+ basic = HeapTypes::array.getBasic(share);
} else {
assert(type.isSignature());
- basic = HeapType::func;
+ basic = HeapTypes::func.getBasic(share);
}
- depths[basic] = std::max(depths[basic], depths[type] + 1);
+ auto& basicDepth = depths[basic];
+ basicDepth = std::max(basicDepth, depths[type] + 1);
}
- depths[HeapType::eq] =
- std::max(depths[HeapType::struct_], depths[HeapType::array]) + 1;
- depths[HeapType::any] = depths[HeapType::eq] + 1;
+ for (auto share : {Unshared, Shared}) {
+ depths[HeapTypes::eq.getBasic(share)] =
+ std::max(depths[HeapTypes::struct_.getBasic(share)],
+ depths[HeapTypes::array.getBasic(share)]) +
+ 1;
+ depths[HeapTypes::any.getBasic(share)] =
+ depths[HeapTypes::eq.getBasic(share)] + 1;
+ }
return depths;
}