Repository navigation
JIT: preserve null check dependencies in call arguments - #137276
Merged
Merged
Conversation
Fixes dotnet#134473 Co-authored-by: Copilot <[email protected]>
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
@dotnet/jit-contrib PTAL Relatively simple fix to call argument ordering. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the JIT call-argument ordering change.
No open issues 🎉
What changed in this PR
This PR fixes JIT call-argument reordering that can move a dependent argument ahead of an implicit null check, causing an access violation instead of a NullReferenceException.
Changes:
- Preserve earlier throwing arguments in temporaries when a later argument carries
GTF_ORDER_SIDEEFF. - Keep exception tracking limited to arguments that can throw.
- Add regression cases for non-throwing dependencies, throwing dependencies, and multiple earlier guards.
| File | Description |
|---|---|
src/tests/JIT/Regression_ro_2/Runtime_134473.cs |
Adds three regression cases checking results and null-reference behavior. |
src/coreclr/jit/morph.cpp |
Preserves null-check dependencies before sorting call arguments. |
Review effort: Balanced
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
lewing
approved these changes
Nov 10, 2026
jakobbotsch
approved these changes
Nov 11, 2026
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.
Preserve dependencies between earlier throwing arguments and later arguments with
GTF_ORDER_SIDEEFF. A later argument may rely on an earlier implicit null check, even when it cannot throw itself or throws the same exception.Evaluate the earlier throwing arguments into temps before argument sorting. Add regression cases for non-throwing dependencies, still-throwing dependencies, and multiple earlier guards.
Validation
Windows x64 Release:
.\build.cmd clr+libs -c Releaseand.\build.cmd clr.jit -c Release: passed..\src\tests\build.cmd x64 Release -Priority 1 -Test JIT\Regression_ro_2\Regression_ro_2.csproj: passed.0xC0000005before the fix and pass afterward. The fullRegression_ro_2runner passes all 498 cases.Checked and other platforms were not run.
Codegen and performance
SuperPMI changes 931 contexts, with a net code-size increase of 1,144 bytes (+0.0018%).
Local BenchmarkDotNet results on Windows x64 under Hyper-V, with tiering and ReadyToRun disabled (one launch, five warmups, ten iterations):
Resolves #134473
Note
This fix and PR description were prepared with GitHub Copilot.