diff options
Diffstat (limited to 'src/wasm')
-rw-r--r-- | src/wasm/wasm-type.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index 53de89aa5..f63505b20 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -113,6 +113,7 @@ struct HeapTypeInfo { // In isorecursive mode, the recursion group of this type or null if the // recursion group is trivial (i.e. contains only this type). RecGroupInfo* recGroup = nullptr; + size_t recGroupIndex = 0; enum Kind { BasicKind, SignatureKind, @@ -1263,6 +1264,11 @@ RecGroup HeapType::getRecGroup() const { } } +size_t HeapType::getRecGroupIndex() const { + assert(!isBasic()); + return getHeapTypeInfo(*this)->recGroupIndex; +} + HeapType RecGroup::Iterator::operator*() const { if (parent->id & 1) { // This is a trivial recursion group. Mask off the low bit to recover the @@ -3242,6 +3248,7 @@ std::optional<TypeBuilder::Error> canonicalizeIsorecursive( // Fill out the recursion groups. for (auto& info : state.newInfos) { if (info->recGroup != nullptr) { + info->recGroupIndex = info->recGroup->size(); info->recGroup->push_back(asHeapType(info)); } } |