Skip to content

[GC] GUFA: Handle function subtyping#8112

Merged
kripken merged 11 commits into
WebAssembly:mainfrom
kripken:gufa.func.sub
Dec 11, 2025
Merged

[GC] GUFA: Handle function subtyping#8112
kripken merged 11 commits into
WebAssembly:mainfrom
kripken:gufa.func.sub

Conversation

@kripken

@kripken kripken commented Dec 9, 2025

Copy link
Copy Markdown
Member

We were ignoring subtyping entirely, that is, the pass didn't realize that
an indirect call to a type might call something of a subtype. That situation
seems to not be common in practice, given we've never gotten a bug
report.

We could fully optimize this as we do data reads and writes: we could
consider the type of the flowing reference in CallRef (but not CallIndirect), etc.
However, for now do the far simpler thing and use the static type to connect
results to subtypes as needed.

For params, do something even simpler: Just hook them up at the type
level, which ignores exactness (as this would require even more work to
optimize, see TODO in the code).

@kripken kripken requested a review from tlively December 9, 2025 23:50
Comment thread src/ir/possible-contents.cpp Outdated
Comment thread src/ir/possible-contents.cpp Outdated
Comment on lines +451 to +452
// Subtyping info.
SubTypes* subTypes;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use a reference here to make it impossible to fail to initialize this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

@kripken kripken merged commit 2d61760 into WebAssembly:main Dec 11, 2025
17 checks passed
@kripken kripken deleted the gufa.func.sub branch December 11, 2025 17:08
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