Repository navigation
JIT: Read Nullable hasValue before paramName in Tier0 ThrowIfNull - #137644
Merged
Merged
Conversation
|
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. |
At Tier0, `impThrowIfNull` folds `ArgumentNullException.ThrowIfNull(CORINFO_HELP_BOX_NULLABLE(cls, addr), paramName)` into `addr->hasValue != 0 ? NOP : ThrowIfNull(null, paramName)`. It spilled `addr` and `paramName`, but the `hasValue` read (and the implicit null check on `addr`) happened later, in the QMARK condition. So any exception (or write to the source) from evaluating `paramName` was observed before the source was read, while the original box reads the source first. Spill the `hasValue` read itself before `paramName`, matching when the box helper reads the value. Fixes dotnet#137639 Co-authored-by: Copilot <[email protected]> Copilot-Session: 3e6c4fb6-77fd-4a5a-9011-1cf5506af1bb
EgorBo
force-pushed
the
fix-137639-throwifnull-nullable
branch
from
November 16, 2026 17:45
ae64a19 to
99d3004
Compare
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Member
Author
|
PTAL @AndyAyersMS @dotnet/jit-contrib |
AndyAyersMS
approved these changes
Nov 17, 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.
At Tier0,
impThrowIfNullfoldsArgumentNullException.ThrowIfNull(CORINFO_HELP_BOX_NULLABLE(cls, addr), paramName)intoaddr->hasValue != 0 ? NOP : ThrowIfNull(null, paramName). It spilledaddrandparamName, but thehasValueread (and the implicit null check onaddr) happened later, in the QMARK condition. So any exception (or write to the source) from evaluatingparamNamewas observed before the source was read, while the original box reads the source first.Spill the
hasValueread itself beforeparamName, matching when the box helper reads the value.Fixes #137639