-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix GC hole with multi-reg local var stores #65916
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
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT Issue Detailsnull
|
Change dotnet#64857 exposed an existing problem where when generating code for a multi-reg GT_STORE_LCL_VAR, if the first register slot was not enregistered, but the second or subsequent slots was, and those non-first slots contained GC pointers, we wouldn't properly add those GC pointers to the GC tracking sets. This led to cases where the register lifetimes would be killed in the GC info before the actual lifetime was complete. The primary fix is to make `gtHasReg()` handle the `IsMultiRegLclVar()` case. As a side-effect, this fixes some LSRA dumps that weren't displaying multiple registers properly. There are about 50 SPMI asm diffs on win-arm64 where register lifetimes get extended, fixing GC holes. I also made `GetMultiRegCount()` handle the `IsMultiRegLclVar()` case. I made a number of cleanup changes along the way: 1. Fixed two cases of calling `gcInfo.gcMarkRegSetNpt` with regNumber, not regMaskTP 2. Marked some functions `const` 3. Improved some comments 4. Changed "ith" to "i'th" in comments which still doesn't read great, but at least I'm not left trying to parse "ith" as an English word. 5. Use `OperIsScalarLocal()` more broadly 6. Renamed `gtDispRegCount` to `gtDispMultiRegCount` to make it clear it only applies to the multi-reg case. Fixes dotnet#65476.
4ada190 to
f7fea2f
Compare
|
I will take a look on Monday. |
|
/azp run runtime-coreclr superpmi-replay |
|
Azure Pipelines successfully started running 1 pipeline(s). |
kunalspathak
left a comment
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.
Added a minor nit. I have kicked of superpmi replay to make sure we at least run the jitstressregs.
There are about 50 SPMI asm diffs on win-arm64 where register lifetimes
get extended, fixing GC holes.
Yes, so there are no code size or perfscore diffs, but just the register lifetimes differences? Wonder why asmdiffs (coredistools) is even thinking that there is code difference?
kunalspathak
left a comment
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.
superpmi-replay is clean.
| // having a reg if regs are allocated for all its | ||
| // In case of multi-reg call nodes, it is considered having a reg if regs are allocated for ALL its | ||
| // return values. | ||
| // REVIEW: why is this ALL and the other cases are ANY? Explain. |
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.
Do you intend to keep this comment?
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.
Yes, because I don't know the answer :-)
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, okay
Co-authored-by: Kunal Pathak <[email protected]>
Change #64857 exposed an existing problem where when generating code
for a multi-reg GT_STORE_LCL_VAR, if the first register slot was not
enregistered, but the second or subsequent slots was, and those non-first
slots contained GC pointers, we wouldn't properly add those GC pointers
to the GC tracking sets. This led to cases where the register lifetimes
would be killed in the GC info before the actual lifetime was complete.
The primary fix is to make
gtHasReg()handle theIsMultiRegLclVar()case. As a side-effect, this fixes some LSRA dumps that weren't displaying
multiple registers properly.
There are about 50 SPMI asm diffs on win-arm64 where register lifetimes
get extended, fixing GC holes.
I also made
GetMultiRegCount()handle theIsMultiRegLclVar()case.I made a number of cleanup changes along the way:
gcInfo.gcMarkRegSetNptwith regNumber, not regMaskTPconstbut at least I'm not left trying to parse "ith" as an English word.
OperIsScalarLocal()more broadlygtDispRegCounttogtDispMultiRegCountto make it clearit only applies to the multi-reg case.
Fixes #65476.