Skip to content

JIT: Keep continuation alive until generic context is loaded - #121951

Merged
jakobbotsch merged 2 commits into
dotnet:mainfrom
jakobbotsch:fix-117265
Nov 26, 2025
Merged

jakobbotsch merged 2 commits into
dotnet:mainfrom
jakobbotsch:fix-117265

Conversation

@jakobbotsch

Copy link
Copy Markdown
Member

There is a theoretical problem where JIT reports the continuation as dead before having restored the generic context local that the EE side is using to keep a LoaderAllocator alive.

Insert an explicit GT_KEEPALIVE node after the state restore.

Fix #117265

Copilot AI review requested due to automatic review settings November 25, 2025 13:08
@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 Nov 25, 2025
@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 addresses a theoretical issue where the JIT might report the continuation object as dead before the generic context local is fully restored during async method resumption. The fix adds an explicit GT_KEEPALIVE node after restoring all locals from the continuation object's data.

Key Changes

  • Inserts a GT_KEEPALIVE node after restoring locals in RestoreFromDataOnResumption to ensure the continuation object remains alive
  • Only adds the keepalive when KeepAliveOffset != UINT_MAX, indicating a keep-alive field is needed for the generic context or collectible method

@jakobbotsch

Copy link
Copy Markdown
Member Author

/ba-g macos brownout

@jakobbotsch
jakobbotsch merged commit 56cb23a into dotnet:main Nov 26, 2025
@jakobbotsch
jakobbotsch deleted the fix-117265 branch November 26, 2025 12:48
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: Ensure continuation stays live until generic context is loaded when resuming

3 participants