Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented Dec 13, 2025

TypeSSA already had logic to detect and resolve inadvertent conflicts
between its newly constructed types and existing types. However, this
logic did not take into account the changes that the binary writer can
make when writing types, so it was still possible to construct a
situation where TypeSSA would produce types that would start conflicting
after binary writing.

Fix the problem by adding a new UniqueRecGroups utility to
wasm-type-shape.h. This utility uses the existing RecGroupShape utility,
which is aware of how the binary writer will modify types, to detect
conflicts. It uses the BrandTypeIterator, moved to wasm-type-shape.h
from MinimizeRecGroups.cpp, to create new types to differentiate rec
groups.

Make enough constructors of Type and Field constexpr that we can make
the fieldOptions array in BrandTypeIterator constexpr as well. This lets
us remove logic for initializing this array at runtime.
TypeSSA already had logic to detect and resolve inadvertent conflicts
between its newly constructed types and existing types. However, this
logic did not take into account the changes that the binary writer can
make when writing types, so it was still possible to construct a
situation where TypeSSA would produce types that would start conflicting
after binary writing.

Fix the problem by adding a new UniqueRecGroups utility to
wasm-type-shape.h. This utility uses the existing RecGroupShape utility,
which is aware of how the binary writer will modify types, to detect
conflicts. It uses the BrandTypeIterator, moved to wasm-type-shape.h
from MinimizeRecGroups.cpp, to create new types to differentiate rec
groups.
@tlively tlively requested review from aheejin and kripken December 13, 2025 03:40
Base automatically changed from constexpr-brand-fields to main December 13, 2025 20:51
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.

2 participants