Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix propagation bug in Unsubtyping - #8468

#8468
Merged
tlively merged 2 commits into
mainWebAssembly/binaryen:mainfrom
unsubtyping-fix-propagationWebAssembly/binaryen:unsubtyping-fix-propagationCopy head branch name to clipboard
Mar 16, 2026
Merged

Fix propagation bug in Unsubtyping#8468
tlively merged 2 commits into
mainWebAssembly/binaryen:mainfrom
unsubtyping-fix-propagationWebAssembly/binaryen:unsubtyping-fix-propagationCopy head branch name to clipboard

Conversation

@tlively

@tlively tlively commented Mar 14, 2026

Copy link
Copy Markdown
Member

Unsubtyping has to propagate a subtypesExposedToJS marker from supertypes to subtypes. It previously did this by propagating from supertype to subtype whenever a new subtyping relationship was found. But subtyping trees are not always built from top to bottom. In cases where the newly discovered subtype already had subtypes, the previous propagation scheme would fail to propagate to those transitive subtypes.

Fix the problem by propagating to the full subtype tree rooted at a newly discovered subtype. Use a DFS over the tree and avoid traversing subtrees that have already been marked to avoid introducing possible quadratic behavior.

Unsubtyping has to propagate a `subtypesExposedToJS` marker from supertypes to subtypes. It previously did this by propagating from supertype to subtype whenever a new subtyping relationship was found. But subtyping trees are not always built from top to bottom. In cases where the newly discovered subtype already had subtypes, the previous propagation scheme would fail to propagate to those transitive subtypes.

Fix the problem by propagating to the full subtype tree rooted at a newly discovered subtype. Use a DFS over the tree and avoid traversing subtrees that have already been marked to avoid introducing possible quadratic behavior.
@tlively
tlively requested a review from kripken March 14, 2026 03:17
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(@binaryen.js.called)
(func $expose-structref (result anyref)

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.

Suggested change
(func $expose-structref (result anyref)
(func $expose-anyref (result anyref)

@tlively
tlively merged commit 2602030 into main Mar 16, 2026
17 checks passed
@tlively
tlively deleted the unsubtyping-fix-propagation branch March 16, 2026 17:22
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.