-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix callKillSet for CORINFO_HELP_ASSIGN_BYREF on x64. #19780
Conversation
PTAL @dotnet/jit-contrib I am trying to modify the repro from @jkotas to expose this issue in ci, if I success I will add it 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.
LGTM except comment suggestions
src/jit/codegencommon.cpp
Outdated
// This helper only trashes ECX. | ||
return RBM_ECX; | ||
#elif defined(_TARGET_AMD64_) | ||
// This uses and defs rdi and rci. |
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.
Typo: rci -> rsi
Also, you may want to just be quite explicit that "This uses and defines rdi and rsi, so they remain as live GC refs or byrefs, and are not killed." or something like that.
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.
Thank you, fixed.
src/vm/amd64/jithelpers_fast.S
Outdated
// the CORINFO_HELP_ASSIGN_BYREF helper (i.e. JIT_ByRefWriteBarrier). | ||
// The precise set is defined by RBM_CALLEE_TRASH. | ||
// the CORINFO_HELP_ASSIGN_BYREF helper (i.e. JIT_ByRefWriteBarrier) | ||
// except RDI and RCI that are incoming and outgoing registers. |
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.
Same typo (RCI -> RSI)
Hm, win_x64 corefx test failed, lets try to rerun. Doesn't look like infra. |
Any idea why gc stress didn't catch this? |
Have not succeed in adding a repro. I will merge the fix only for now.
The issue only marks struct fields as dead and we usually have other parts of the class alive (like Thank for your help with repro. |
* Fix callKillSet for CORINFO_HELP_ASSIGN_BYREF. on x64. * Fix typos.
…otnet#19803) * Fix callKillSet for CORINFO_HELP_ASSIGN_BYREF. on x64.
Our emitter doesn't check liveness information consistency, so when we generate a LIR node that expands to a several machine instructions there is no way to check that nobody corrupts the data.
In this case
STORE_OBJ
generatedwhere
byrefRegs
after call did not includersi, rdi
, because we trashedRBM_CALLEE_TRASH_NOGC
that on Linux x64 incudesrsi, rdi
.coreclr/src/jit/emitxarch.cpp
Lines 6880 to 6884 in 1c47703
Fixes #19361.