-
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: Account for mixed-enregistered locals when zeroing without block-init #104593
Conversation
…-init Locals that are in registers at the beginning of a function do not need to have their stack home zeroed. `genFnProlog` already skips these locals when computing the range of bytes to zero; however, `genZeroInitFrame` was not doing the same in the non-block init case, which does not make use of the range computed by `genFnProlog`. This could cause an unbounded amount of (unnecessary) codegen during zero-initing, which is not legal to have in the prolog. Fix dotnet#104570
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress |
Azure Pipelines successfully started running 2 pipeline(s). |
continue; | ||
} | ||
|
||
noway_assert(varDsc->lvOnFrame); |
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.
In genCheckUseBlockInit
it looks like the main loop only increases initStkLclCnt
when varDsc->lvIsOnFrame
.
So couldn't we use that as an early out detection mechanism? Basically:
if (!varDsc->lvMustInit || !varDsc->lvOnFrame)
{
continue;
}
There's then a secondary handler that increments for spill temps containing pointers, but that looks to be independent of this main loop in genZeroInitFrame
and is handled in its own subsequent loop.
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.
genCheckUseBlockInit
will set lvMustInit
, so I don't think we need more checks here... the logic is that if genCheckUseBlockInit
left lvMustInit
as 1 and it isn't in a register, then it must be on frame as otherwise we wouldn't need to init it.
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. It's somewhat hard to correlate the logic done in genCheckUseBlockInit
in contrast to the logic done in genZeroInitFrame
, I think long term it'd be ideal if these could be more explicit between the two to make it very clear that we're handling the right things.
Yeah... @AndyAyersMS has had musings about creating an actual object model of the stack frame, which would also make this stuff harder to get wrong. |
…ut block-init (dotnet#104593)" This reverts commit d586986.
Locals that are in registers at the beginning of a function do not need to have their stack home zeroed.
genFnProlog
already skips these locals when computing the range of bytes to zero; however,genZeroInitFrame
was not doing the same in the non-block init case (which ignores the range computed bygenFnProlog
). This could cause an unbounded amount of (unnecessary) codegen during zero-initing, which is not legal to have in the prolog.Fix #104570