JIT: Account for mixed-enregistered locals when zeroing without block-init#104593
JIT: Account for mixed-enregistered locals when zeroing without block-init#104593jakobbotsch merged 4 commits intodotnet:mainfrom
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.
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.
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.
tannergooding
left a comment
There was a problem hiding this comment.
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.
genFnPrologalready skips these locals when computing the range of bytes to zero; however,genZeroInitFramewas 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