-
Notifications
You must be signed in to change notification settings - Fork 46.4k
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
[compiler] Maintain RPO and unique instruction ids when constructing scope terminals #30399
Merged
josephsavona
merged 5 commits into
gh/josephsavona/34/base
from
gh/josephsavona/34/head
Jul 24, 2024
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1af828e
[compiler] Maintain RPO and uniquely instruction ids when constructin…
josephsavona 346eefb
Update on "[compiler] Maintain RPO and uniquely instruction ids when …
josephsavona 4059ee3
Update on "[compiler] Maintain RPO and uniquely instruction ids when …
josephsavona 45e889b
Update on "[compiler] Maintain RPO and unique instruction ids when co…
josephsavona 9983ccf
rebase on "[compiler] Maintain RPO and unique instruction ids when co…
josephsavona 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 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 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
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.
Hmm I don't think the range fixing logic covers all cases here. I wrote some validation in #30409, and we see quite a few cases in which identifiers have an attached mutable range that is neither (1) invalid e.g.
end === start + 1
nor (2) a scope range.There's roughly 3-4 classes:
identifier.mutableRange
to that of the scope.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 think currently, mutable ranges are referenced after this pass (see
ValidateMemoizedEffectDeps
andValidatePreserveExistingManualMemo
for examples).Overall, I admit I'm a bit confused whether we need to ensure that identifier and scope ranges are always equivalent (i.e. pointing to the same object). My understanding is that this is unnecessary and we should instead deep copy when creating scopes in
InferReactiveScopeVariables
. Currently, our aligning and merging logic extends themutableRange
of some but not all identifiers(cc @mvitousek as we were discussing a related topic yesterday)
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.
Yeah I was realizing after writing this that there were some other cases to cover. I think we need to just update all the passes that look at identifier or scope ranges (after this pass) to stop doing that and look at the scope’s effective range.
Alternatively I can do a more thorough tracking of how every scope needs to update its range before/after.
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.
Is this possible to do even before this pass? I.e., is it semantically necessary that identifiers report their own mutable ranges at all? It feels like it would be more consistent to always refer to an identifier's scope's mutable range. As it stands I am uncertain what it even means when they don't align to be honest. (Happy to split this into a separate conversation!)
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.
Well, it's necessary for identifiers to report their ranges so that we can construct scopes. But yeah, after that i don't see why we'd ever need to use identifier ranges.
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.
Addressed in #30428 - happy to squash that into this PR though