JIT: Replace fgMorphTree with fgMorphArgs for calls introduced after rationalization#127507
Draft
JIT: Replace fgMorphTree with fgMorphArgs for calls introduced after rationalization#127507
Conversation
…nalization Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/676423b6-a547-47ac-96ec-4cc74af33ac3 Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jakobbotsch
April 28, 2026 13:21
View session
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
This was referenced Apr 28, 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.
Post-rationalization phases (lowering, async transformation, GS cookie checks) were calling
fgMorphTreeon freshly createdGenTreeCall*nodes.fgMorphTreeroutes throughfgMorphCall, which performs tail-call analysis, inlining marking, and GC safe-point flagging — all irrelevant or already completed before rationalization. The correct operation for these sites isfgMorphArgs, which handles only ABI info and argument processing.Description
Changed files:
lower.cpp,async.cpp,gschecks.cpp,compiler.hlower.cpp— ReplacefgMorphTreewithfgMorphArgsat four call sites:LowerVirtualVtableCall(interface lookup resolution call)LowerCFGCall(CFG validate-indirect call)InsertPInvokeCallProlog/InsertPInvokeCallEpilog(pinvoke helper calls)InsertPInvokeMethodProlog, the originalfgMorphTree(store)(wherestorewraps the call) is replaced withfgMorphArgs(call)directly — the store wrapper needs no morphing in LIR mode, and the original was discarding the return value offgMorphTreeanywayfgMorphArgssites to reflect the actual intentasync.cpp— ReplacefgMorphTreewithfgMorphArgsfor all seven call nodes created during async state-machine transformation (continuation allocation, context capture/restore, finish, rethrow)gschecks.cpp— ReplacefgMorphTreewithfgMorphArgsfor the special-copy-helper call inserted for unsafe buffer GS checkscompiler.h— MovefgMorphArgsdeclaration fromprivatetopublicalongsidefgMorphTree;AsyncTransformationis not afriendofCompilerso it requires public access