-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Use destType for size instead of srcType when writing a variable from a register to the stack. #46176
Conversation
cc @dotnet/jit-contrib |
The P/Invoke stub diffs are due to introducing a P/Invoke Frame instead of omitting it. As a result, I am fully confident that this is a complete fix for the random crashes. Base
Updated with this PR
|
I'm not sure what the codegen diffs above are supposed to show. |
The diffs above are the diffs from the IL stubs between 35fbeaf and this PR. I was posting them as they're the only diffs and I believe that they're benign and not the cause of any of the failures we were seeing. |
… a register to the stack.
f4f1a3b
to
380d7a2
Compare
Would be nice to see a method where there are diffs, but the change looks reasonable. |
Hello @jkoritzinsky! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
@@ -11855,7 +11855,7 @@ void CodeGen::genMultiRegStoreToLocal(GenTreeLclVar* lclNode) | |||
{ | |||
if (!lclNode->AsLclVar()->IsLastUse(i)) | |||
{ | |||
GetEmitter()->emitIns_S_R(ins_Store(srcType), emitTypeSize(srcType), reg, fieldLclNum, 0); | |||
GetEmitter()->emitIns_S_R(ins_Store(srcType), emitTypeSize(destType), reg, fieldLclNum, 0); |
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 not it strange that ins_Store
and emitTypeSize
have different arguments here?
Also, ins_Store
is usually taking destType, not source, it does not matter on x64 but I expect arm.
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, that’s how I got confused and did the wrong thing earlier.
in this case, ins_Store needs to take srcType because we might have a float variable in an int register. For example we hit this case on x86 when calling an unmanaged method that returns a struct of floats and we want to store the floats on the stack, which is what prompted my fix in the first place.
I mean my PR + this change has no diffs barring the one I posted (which looks to be related to SuppressGCTransition) |
Ok, so on which platforms did you see the asm changes? How can I repro them? |
I saw the failures (that this pr fixed) on Linux x64, arm, and ARM64 IIRC. |
If we use srcType, we'll in some cases do a 64-bit store instead of a 32-bit store or vice versa. This is causing random failures as described in #46172.
Alternative fix to #46172
I've validated that this PR has no diffs outside of P/Invoke stubs from the JIT in 35fbaef (the commit before #45625).
cc: @safern