-
Notifications
You must be signed in to change notification settings - Fork 792
Implement bottom heap types #5115
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ab096d5
Implement bottom heap types
tlively b5b453a
nullopt
tlively d6c1a62
binaryen.js tests
tlively 05ecd5f
Address feedback
tlively 09d42f1
simplify some code
tlively 328a068
Add tests
tlively ddfebfa
Changelog
tlively 5b556ca
Replace ref.nulls with locals to avoid unreachable replacements in tests
tlively 63e853e
update gufa test
tlively 6c33c30
fix remove-unused-module-elements-refs test
tlively be4a1ff
remove stale optimize-instructions-tnh test
tlively f8c987b
fix merge-blocks test
tlively d4fd05c
fix dae-gc-refine-params.wast
tlively 2310c41
Remove unfinished, stale comment
tlively 93d3d7d
fix test/heap-types.wast
tlively d6a1fda
fix test/lit/passes/cfp.wast
tlively 0d68f7d
Fix possible-contents handling of nulls
tlively 6c4933e
restore and fix ArrayCopy effects test
tlively File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary - we already set
implicitTrap
below. That could be reordered to the top, and then the early return would avoid other stuff if we need to avoid that.I guess this does add more information in a sense, but optimizations should do this anyhow, I think?
Another concern I have here is how this interacts with trapsNeverHappen. We never set
.trap
directly so that we can gate on that flag.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you thinking that we should be setting
implicitTrap
when the target is null rather than settingtrap
? I think it's more consistent to settrap
, just likevisitUnreachable
does. In particular, theCallRef
will be emitted as(unreachable)
in this case, so it would be strange if its effects were different fromUnreachable
's effects.You're probably right that optimizations would take care of this anyway, but the code seems more correct to me as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we can set
implicitTrap
when the target is nullable, which would include null. You're right that the current code is more precise in a way, but I don't think we gain from the extra verbosity.I guess it's fine, though, if we make sure that it doesn't limit us. Specifically, with trapsNeverHappen and the new code then a callRef of a null would no longer be removed by vacuum (like it doesn't remove an unreachable). We should have a test that optimize-instructions turns the callRef into an unreachable (which dce would then remove). (There might already be a test, sorry if so - I haven't gotten to those yet.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems odd that
trapsNeverHappen
doesn't remove anunreachable
, but I guess that's a separate topic.Will make sure I add specific tests for the OptimizeInstructions changes.