Skip to content

Use impInlineRoot()->compIsAsync() in fgGetStaticsCCtorHelper#130536

Open
jakobbotsch with Copilot wants to merge 1 commit into
mainfrom
copilot/add-impinlineroot-to-compisasync-check
Open

Use impInlineRoot()->compIsAsync() in fgGetStaticsCCtorHelper#130536
jakobbotsch with Copilot wants to merge 1 commit into
mainfrom
copilot/add-impinlineroot-to-compisasync-check

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

fgGetStaticsCCtorHelper types the pinned statics base helpers as TYP_BYREF in async methods so they get "killed across suspensions" behavior and byref-typed derived addresses. The async predicate used compIsAsync(), which reflects the current Compiler rather than the root being compiled — so an inlinee imported into an async root (the inlinee is not itself async) could be mistyped as TYP_I_IMPL.

  • src/coreclr/jit/flowgraph.cpp: route the async check through the inline root:
type = impInlineRoot()->compIsAsync() ? TYP_BYREF : TYP_I_IMPL;

Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 10, 2026 23:42
Copilot AI requested a review from jakobbotsch July 10, 2026 23:42
Copilot AI temporarily deployed to copilot-pat-pool July 10, 2026 23:43 Inactive
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 10, 2026
Copilot AI temporarily deployed to copilot-pat-pool July 10, 2026 23:43 Inactive
@jakobbotsch

Copy link
Copy Markdown
Member

/azp run runtime-coreclr jitstress

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch jakobbotsch marked this pull request as ready for review July 10, 2026 23:43
Copilot AI review requested due to automatic review settings July 10, 2026 23:43
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an inlining-context bug in the JIT’s fgGetStaticsCCtorHelper helper typing logic by ensuring the “is async” predicate is evaluated on the inline root compiler, not the current (possibly-inlinee) compiler.

Changes:

  • Switch the pinned statics base helper return type decision from compIsAsync() to impInlineRoot()->compIsAsync() so inlinees imported into async roots get the intended TYP_BYREF typing.

@jakobbotsch

Copy link
Copy Markdown
Member

My guess as to why #130212 still fails. Haven't actually verified, let's see the pipeline run.
I think I forgot to verify the original PR on the issue, I only verified another fix I decided to switch away from at the last minute.

Fix #130212

cc @JulieLeeMSFT

@jakobbotsch

Copy link
Copy Markdown
Member

/azp run runtime-coreclr jitstress

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

// ensuring derived addresses are byref typed and are treated
// similarly.
type = compIsAsync() ? TYP_BYREF : TYP_I_IMPL;
type = impInlineRoot()->compIsAsync() ? TYP_BYREF : TYP_I_IMPL;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to do this inside compIsAsync; I do this sort of thing elsewhere in the JIT, for things like this that might be called in early phases.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Often we don't actually want this to be true inside the inlinee unless the inlinee is itself async. But this case is an exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants