JIT: Add a "default value analysis" for async hoisting#124514
JIT: Add a "default value analysis" for async hoisting#124514jakobbotsch merged 23 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR adds a new "default value analysis" for async hoisting to address issue #124512, where the JIT incorrectly hoists default-valued locals at async suspension points. The issue occurs when the JIT suppresses explicit zeroing of locals (expecting them to be zeroed by the prolog), but then hoists these uninitialized locals into async continuations when their address is taken.
Changes:
- Introduces a two-phase
DefaultValueAnalysisclass that tracks which locals retain their default (zero) values through program execution - Integrates this analysis with the existing
AsyncLivenessclass to skip hoisting locals that are live but still have default values at suspension points - Handles promoted struct fields correctly by checking if all fields have default values
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/coreclr/jit/async.cpp:597
- There's an extra line separator here (line 597). Following the pattern seen elsewhere in the file, function header comments should start with a single line separator, not a double one.
//------------------------------------------------------------------------
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/coreclr/jit/async.cpp:583
- There are duplicate comment separator lines (------------------------------------------------------------------------). The second separator on line 583 should be removed as it's redundant.
//------------------------------------------------------------------------
//------------------------------------------------------------------------
|
cc @dotnet/jit-contrib PTAL @AndyAyersMS Diffs. Throughput wise pretty much a wash. The analysis here was written almost completely autonomously by Copilot with Opus 4.6. I made a few changes:
Still, I was quite impressed by the result. |
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
AndyAyersMS
left a comment
There was a problem hiding this comment.
Just a comment nit you can fix later.
|
/ba-g Failure looks similar to #124370 and not related to async |
This analysis computes the set of locals that still have their default value and uses it to skip hoisting these locals into continuations around async suspension points.
Fix #124512
Example from #124512: