Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented Jan 14, 2026

UniqueRecGroups compares the shapes of rec groups after considering how
types will be written in the final binary for a particular feature set.
Previously its interface dealt in arbitrary vectors of types, but it
turns out that it could sometimes be subtly incorrect to pass vectors of
types that were not already all in the same rec group.

The problem is that the base case for the RecGroupShape utility that
hashes rec group shapes is either hashing the index in the group for
recursive references to types in the group or the type ID for
non-recursive references. When the type vector contains types from
different rec groups, non-recursive references across groups can
inadvertently appear and be hashed as recursive references.

Fix the problem for UniqueRecGroups by changing the interface to take
RecGroups rather than arbitrary vectors of heap types.

A regression test for this bug will be included in an upcoming PR. It
cannot be included here because it depends on running a pass that does
not exist yet.

UniqueRecGroups compares the shapes of rec groups after considering how
types will be written in the final binary for a particular feature set.
Previously its interface dealt in arbitrary vectors of types, but it
turns out that it could sometimes be subtly incorrect to pass vectors of
types that were not already all in the same rec group.

The problem is that the base case for the RecGroupShape utility that
hashes rec group shapes is either hashing the index in the group for
recursive references to types in the group or the type ID for
non-recursive references. When the type vector contains types from
different rec groups, non-recursive references across groups can
inadvertently appear and be hashed as recursive references.

Fix the problem for UniqueRecGroups by changing the interface to take
RecGroups rather than arbitrary vectors of heap types.

A regression test for this bug will be included in an upcoming PR. It
cannot be included here because it depends on running a pass that does
not exist yet.
@tlively tlively requested a review from kripken January 14, 2026 05:04
@kripken
Copy link
Member

kripken commented Jan 14, 2026

be hashed as recursive references.

Why is this a bug? I would expect an unlucky hash collision to slow things down, but then there is an equality check after it, ensuring correctness (as in the typical hashing data structures).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants