Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC] Use SubtypingDiscoverer in StringLowering #6325

Merged
merged 9 commits into from
Feb 21, 2024

Conversation

kripken
Copy link
Member

@kripken kripken commented Feb 20, 2024

This replaces horrible hacks to find which nulls need to switch (from none to
noext) with general code using SubtypingDiscoverer. That helper is aware of
where each expression is written, so we can find those nulls trivially.

This is NFC on existing usage but should fix any remaining bugs in that area.
It is also shorter code.

@kripken kripken requested a review from tlively February 20, 2024 21:47
Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

This is a clear improvement over the previous hacks, but it's still not complete because it only handles the case of ref.null instructions and not other sources of string bottom types that could appear in practice, such as local.gets of locals holding string nulls. Do you plan to make this correct in more cases proactively or just as they come up in practice?

@kripken
Copy link
Member Author

kripken commented Feb 21, 2024

Interesting, I guess that's a possible problem: local.get of the initial value of null would get optimized away, but without opts it's a a risk.

Overall I wasn't intending to do proactive work here as it isn't clear how important this pass is for our users.

@kripken
Copy link
Member Author

kripken commented Feb 21, 2024

We could, I suppose, add a extern.externalize when we see such a local.get (or anything else) flowing into a place of type externref. Though there might be a better way.

@kripken kripken merged commit 1c30853 into WebAssembly:main Feb 21, 2024
14 checks passed
@kripken kripken deleted the subtype.exprs.2 branch February 21, 2024 00:23
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
This replaces horrible hacks to find which nulls need to switch (from none to
noext) with general code using SubtypingDiscoverer. That helper is aware of
where each expression is written, so we can find those nulls trivially.

This is NFC on existing usage but should fix any remaining bugs with null
constants.
@gkdn gkdn mentioned this pull request Aug 31, 2024
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