Skip to content

Enable GC stress for ReadyToRun code - #135794

Draft
VSadov with Copilot wants to merge 2 commits into
mainfrom
copilot/implement-gc-stress-for-r2r-code
Draft

VSadov with Copilot wants to merge 2 commits into
mainfrom
copilot/implement-gc-stress-for-r2r-code

Conversation

Copilot AI commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Instruction-level GC stress currently instruments JIT-compiled code but skips ReadyToRun methods.

  • Instrumentation: Call SetupGcCoverage before publishing R2R entry points, including async resumption stubs. Serialize setup and use canonical method identity/default code versions for shared generic code.
  • Patching: Support image-backed writes throughout instrumentation and instruction restoration, retaining executable-allocator mappings for JIT code.
  • Regression coverage: Verify collections and live-reference preservation in ordinary and shared-generic R2R methods.
  • Platform scope: Exclude Apple platforms and document the image-patching limitation.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI linked an issue Oct 14, 2026 that may be closed by this pull request
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @anicka-net, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Comment thread src/coreclr/vm/gccover.cpp Outdated
{
ClrVirtualProtect((BYTE*)methodRegion.coldStartAddress, methodRegion.coldSize, PAGE_EXECUTE_READWRITE, &oldProtect);
if (!ClrVirtualProtect((BYTE*)methodRegion.coldStartAddress, methodRegion.coldSize, PAGE_EXECUTE_READWRITE, &oldProtect))
ThrowLastError();

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.

Should we fail fast instead of throwing an exception that would leak into the managed code and be possibly swallowed or change the flow?

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.

I think this should ether be ignored or be a failfast.

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.

@copilot make failure to change protection for the purpose of GC stress a failfast.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 8909fd0. All three GC-stress protection-failure paths now use the fatal-error policy instead of throwing. The R2R regression passes; forcing a protection failure in LLDB produced the fatal diagnostic and SIGABRT.

@VSadov

VSadov commented Oct 16, 2026

Copy link
Copy Markdown
Member

/azp run runtime-coreclr gcstress-extra, runtime-coreclr gcstress0x3-gcstress0xc

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

Copilot AI and others added 2 commits October 17, 2026 10:31
Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
@VSadov
VSadov force-pushed the copilot/implement-gc-stress-for-r2r-code branch from 8909fd0 to c9bf9db Compare October 17, 2026 17:31
@VSadov

VSadov commented Oct 17, 2026

Copy link
Copy Markdown
Member

/azp run runtime-coreclr gcstress-extra, runtime-coreclr gcstress0x3-gcstress0xc

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@VSadov

VSadov commented Oct 17, 2026

Copy link
Copy Markdown
Member

/azp run runtime-coreclr gcstress-extra, runtime-coreclr gcstress0x3-gcstress0xc

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement GC stress for R2R code.

3 participants