-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[JIT] Fix re-use val zero on GC tracking #84051
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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.
This appears to be the only way to propagate GC info properly.
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.
@BruceForstall you are probably best to look at this.
The main issue is that we have a
null
node and acns_int 0
node re-using the same register, but when that register is being used forcns_int 0
, there are circumstances where the GC info hasn't propagated yet and that register is still seen as GC tracked even if it's for an integer. This happens if both thenull
andcns_int 0
node live within the same IG.Originally I wanted to simply not GC track a reg that is initially
null
but that caused many seg faults. I tried that here: 346b9feIf that worked, then we wouldn't have to worry about GC tracking when registers get re-used.
The only other option, I think, is to propagate the GC info by creating a new label, which creates a new IG; serves as a snapshot of the GC info.
You have any thoughts?
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 would think the right fix is something like
gcInfo.gcMarkRegPtrVal(tree->getRegNum(), tree->TypeGet());
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.
@AndyAyersMS In order for the state of
gcInfo
to be reflected in the actual emitting of instructions, it has to be propagated via instruction groups, which is what the creation of the label is doing. In this case, the state ofgcInfo
has already marked the register as a non-pointer, but that information wasn't propagated.gcMarkRegPtrVal
doesn't propagate the info, it just sets the state.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 does propagate it, but only during codegen. I suspect the emitter GC tracking doesn't handle a case like this where the gcness of a register can change without writing to the register.
In which case, you might consider introducing a fake instruction that just reinterprets the register with its new GC type and acts like a write; that might convey intention of changing GC type more clearly than forcing a label, which seems a bit fragile and obscure.
Or it might gum up other things. Hard to say.
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.
Ah, I see Bruce had similar comments below.
I agree we can take this fix for now, but we should seriously consider something a bit more explicit. Ideally the code generator would not need to be aware of the peculiar aspects of emitter gc tracking.
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 agree that we should introduce a fake instruction, this is what @BruceForstall and I talked about. Seems Bruce beat me to making an issue about it. :)