From 8265388adc8341d52aa075b937ea3f0b10c05a9f Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Thu, 27 Jan 2022 10:26:31 -0800 Subject: Add a HeapType method for getting the rec group index (#4480) Storing the rec group index on the HeapTypeInfo avoids having to do a linear scan through the rec group to find the index for a particular type. This will be important for isorecursive canonicalization, which uses rec group indices. --- src/wasm-type.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/wasm-type.h') diff --git a/src/wasm-type.h b/src/wasm-type.h index 7b63adf9d..99194b81d 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -356,6 +356,7 @@ public: // Get the recursion group for this non-basic type. RecGroup getRecGroup() const; + size_t getRecGroupIndex() const; constexpr TypeID getID() const { return id; } constexpr BasicHeapType getBasic() const { @@ -392,8 +393,8 @@ class RecGroup { public: explicit RecGroup(uintptr_t id) : id(id) {} - bool operator==(const RecGroup& other) { return id == other.id; } - bool operator!=(const RecGroup& other) { return id != other.id; } + bool operator==(const RecGroup& other) const { return id == other.id; } + bool operator!=(const RecGroup& other) const { return id != other.id; } size_t size() const; struct Iterator : ParentIndexIterator { -- cgit v1.2.3