Skip to content

Conversation

kripken
Copy link
Member

@kripken kripken commented Aug 20, 2025

GlobalTypeRewriter::getTempType had the right logic to handle a
Type, which included the right logic to handle the HeapType of a
Type: Look in typeIndices and use that mapping if it is present. We
need the same thing for HeapTypes as well, which this adds in a
new getTempHeapType.

This was not noticed before because Continuations are the first
thing to have a direct HeapType child which is not through a Type.
So Types worked before, but not direct HeapType children, which
ended up mapped to the old type before the rewriting.

Changes to wasm-type.h are NFC but I think make it easier to read,
as it makes that logic entirely parallel to the lines above it.

One existing test has an update, which fixes it by removing the
ref to the old type.

@kripken kripken requested a review from tlively August 20, 2025 19:30
Comment on lines +1327 to +1329
// XXX This will not scan HeapType children that are not also children of
// Type children, which happens with Continuation (has a HeapType
// child that is not a Type).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear to me whether this is a problem that needs to be fixed or just a helpful note to inform any future changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be a problem if we have features that depend on it. Atm I think we don't.

I was just auditing this code and realized that this was a potential future bug. And, regardless, the right thing here is to scan heap types, not types.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sounds good.

@kripken kripken merged commit a99e765 into WebAssembly:main Aug 20, 2025
16 checks passed
@kripken kripken deleted the abs.cont branch August 20, 2025 21:06
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