Repository navigation
Conversation
PR description draft: <!-- --> When morph replaces an array-store helper with a direct store, evaluate effectful operands in array/index/value order before introducing the array null and bounds checks. Enforce this at the conversion itself: importer spills can be undone by forward substitution while the operation is still a helper call. Include ordering-only effects such as volatile reads, both in the conversion and in the existing inline array-store importer spill. Add a single-file regression covering value-expression exceptions and index-before-value exception ordering. Fixes dotnet#133860 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ae8155d6-f240-4542-a1da-c721ba933c91
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The equivalent multidimensional-array store path remains unfixed, and ordering-only behavior lacks regression coverage.
2 open findings
What changed in this PR
Fixes JIT evaluation ordering when expanding reference-array stores.
Changes:
- Preserves array/index/value evaluation order during morphing.
- Includes ordering-only effects such as volatile reads.
- Adds exception-order regression coverage.
| File | Description |
|---|---|
src/coreclr/jit/morph.cpp |
Sequences operands before array checks. |
src/coreclr/jit/importer.cpp |
Recognizes observable ordering effects. |
src/tests/JIT/Regression_ro_2/Runtime_133860.cs |
Tests exception precedence. |
🧠 Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d844e008-f7ad-4958-ad42-de4c706fcb00
EgorBo
marked this pull request as ready for review
October 9, 2026 10:05
Member
Author
|
PTAL @dotnet/jit-contrib |
JulieLeeMSFT
approved these changes
Oct 9, 2026
JulieLeeMSFT
left a comment
Member
There was a problem hiding this comment.
LGTM. The new flag GTF_OBS_EFFECT (observable effect) appears to combine both exception-contributing effects (GTF_EXCEPT) and ordering-only effect (GTF_ORDER_SIDEEFF), closing a gap where ordering-only effects weren't being spilled.
Old (helper call): New (direct store, optimized):
push array eval array ----+
push index eval index ----|--> temps (preserve order)
push value (may throw/order-dep) eval value ----+
call ARRADDR_ST (does checks nullcheck/boundscheck (introduced here)
array,index,value in order) store
Finalize the new spill stores without reapplying assertions to operands already morphed by fgMorphArgs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e8778de6-8ade-4f24-91f4-9060e1eb4744
This was referenced Oct 10, 2026
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.


When morph replaces an array-store helper with a direct store, evaluate effectful operands in array/index/value order before introducing the array null and bounds checks. Enforce this at the conversion itself: importer spills can be undone by forward substitution while the operation is still a helper call.
Include ordering-only effects such as volatile reads, both in the conversion and in the existing inline array-store importer spill.
Fixes #133860
Almost no diffs