Repository navigation
[release/11.0] JIT: expand all stack array allocations in a statement - #138558
Open
DavidObando wants to merge 2 commits into
Open
DavidObando wants to merge 2 commits into
DavidObando wants to merge 2 commits into
Conversation
…dotnet#133531) Backport of dotnet#133531 (ef97eb5) to release/11.0. Fixes dotnet#138487
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
…3531-release-11.0
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Issue #138487
main PR #133531
Description
Backports #133531 (
ef97eb54da2) torelease/11.0.Compiler::fgExpandStackArrayAllocations()previously broke out of its statement loop after expanding the first stack-allocated arrayNEWARRhelper call in a statement. BecausegtSplitTreeonly moves subtrees evaluated before the split point into earlier statements, any remaining stack-allocatedNEWARRhelper calls in the same statement (e.g., merged there by forward substitution) were left unexpanded with a 0-segmentWellKnownArg::StackArrayLocalargument, causing an assert in Checked/Debug builds and an AV/SIGSEGV inLowering::LowerArg/ABIPassingSegment::GetStackOffset()in Release builds.This fix keeps rescanning the statement until all stack-allocated array helper calls in it have been expanded, and includes the
Runtime_133523regression test from themainPR.Customer Impact
Deterministic process crash (SIGSEGV /
0xC0000005) during FullOpts JIT compilation on .NET 11.0.0 whenever forward substitution places two or more stack-allocated array allocations in the same statement (for example,0 == c.x && new int[0] != new int[0]orfirst[second[index]]). The only release workaround is globally disabling object stack allocation (DOTNET_JitObjectStackAllocation=0).Regression
Yes. Regressed in .NET 11.0.0 relative to .NET 10.
Testing
Built the Release JIT on
osx-arm64from this branch:Result:
Build succeeded. 0 Warning(s), 0 Error(s).Verified against a copy of the installed .NET 11.0.0 (
osx-arm64) runtime using a test harness containing both the repro from #138487 (0 == c.x && new int[0] != new int[0]) and theTwoArrays/ThreeArrayscases fromRuntime_133523.cs:libclrjit.dylib:Segmentation fault: 11(exit code 139).release/11.0Releaselibclrjit.dylib:Check=True, TwoArrays=0, ThreeArrays=42(exit code 0).Full
src/testssuite was not run locally (relying on CI matrix).Risk
Very low. Small, localized loop change in
Compiler::fgExpandStackArrayAllocations()that only affects statements containing multiple stack-allocated array helper calls (which previously always asserted/crashed). Clean cherry-pick of #133531, which has been baking inmainsince September 2026 with zero SPMI asm diffs.Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.
Resolves #138487
Note
This pull request was authored and submitted with the assistance of GitHub Copilot.