镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Enable GC stress for ReadyToRun code - #135794

Merged
VSadov merged 12 commits into
mainfrom
copilot/implement-gc-stress-for-r2r-code
Nov 10, 2026
Merged

VSadov merged 12 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

azure-pipelines Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 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 Resolved
@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

@VSadov

VSadov commented Nov 4, 2026

Copy link
Copy Markdown
Member

@copilot - we do not want to add tests with this PR since. This is a test infrastructure change. There are plenty of tests that it runs already. Please remove all added tests.

Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>

Copilot AI commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@copilot - we do not want to add tests with this PR since. This is a test infrastructure change. There are plenty of tests that it runs already. Please remove all added tests.

Removed all four GC stress test source/project files added by this PR in commit 8b4e…. The runtime implementation and documentation changes remain.

This comment was marked as outdated.

@VSadov

VSadov commented Nov 5, 2026

Copy link
Copy Markdown
Member

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

@VSadov

VSadov commented Nov 5, 2026

Copy link
Copy Markdown
Member

/azp run runtime-coreclr r2r-extra

@azure-pipelines

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

@azure-pipelines

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

@VSadov

VSadov commented Nov 5, 2026

Copy link
Copy Markdown
Member

The PR matches the baseline, with essentially identical failures. This time both PRs were run together, so the comparison is same-day. The PR head is 9dbdd81 and the baseline head is 447af12. Both pipelines started at about 00:33Z on Nov 5.

Scenarios: no difference. Both ran the same 51 jobs, and the same 6 top-level jobs failed (3 pipelines plus their Helix monitors).

PR #135794 Baseline #136001
Build Analysis test failures 141 142
gcstress-extra, not displayed 68 68
gcstress0x3-0xc, not displayed 36 36
r2r-extra, not displayed 32 33

Caveats:

  • About 136 failures per run are hidden by the Build Analysis display limit. "Same failures" rests on matching totals and the visible entries.
  • AzDO and Helix were unreachable, so I couldn't get raw test-result counts or console logs.

I haven't checked which PR commit fixed the x86 crashes. They were already gone at the previous check.

@VSadov
VSadov requested review from jkotas and a balanced review from Copilot November 5, 2026 20:54

This comment was marked as resolved.

This comment was marked as resolved.

@jkotas jkotas left a comment

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.

LGTM!

@VSadov

VSadov commented Nov 10, 2026

Copy link
Copy Markdown
Member

/ba-g test failures unrelated/known. stress failures are the same as in a no-op run.

@VSadov
VSadov merged commit 5c03d3b into main Nov 10, 2026
152 of 158 checks passed
@VSadov
VSadov deleted the copilot/implement-gc-stress-for-r2r-code branch November 10, 2026 19:11
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 11, 2026
VSadov added a commit that referenced this pull request Nov 11, 2026
Thanks for asking me to work on this. I will get started on it and keep
this PR's description up to date as I form a plan and make progress.

> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Assert failure: !th.IsNull()</issue_title>
> <issue_description>## Build Information
> Build:
https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1654712
> Build error leg or test failing:
OutOfProcessTest.JIT/Regression_3/DevDiv_461649/DevDiv_461649/DevDiv_461649.cmd
> <!-- Error message template  -->
> ## Error Message
> 
> Fill the error message using [step by step known issues
guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Build%20Analysis/KnownIssueJsonStepByStep.md).
> 
> <!-- Use ErrorMessage for String.Contains matches. Use ErrorPattern
for regex matches (single line/no backtracking). Set BuildRetry to
`true` to retry builds with this error. Set ExcludeConsoleLog to `true`
to skip helix logs analysis. -->
> 
> ```json
> {
> "ErrorMessage": "Failed test:
OutOfProcessTest.JIT/Regression_3/DevDiv_461649/DevDiv_461649/DevDiv_461649.cmd",
>   "BuildRetry": false,
>   "ExcludeConsoleLog": false
> }
> ```
> 
> <!-- Known issue validation start -->
>  ### Known issue validation
> **Build: 🔎**
https://dev.azure.com/dnceng-public/public/_build/results?buildId=1654712
> **Error message validated:** `[Failed test:
OutOfProcessTest.JIT/Regression_3/DevDiv_461649/DevDiv_461649/DevDiv_461649.cmd`]
> **Result validation:** ❌ Known issue did not match with the provided
build.
> **Validation performed at:** 10/30/2026 1:07:04 AM UTC
> <!-- Known issue validation end -->
> <!--Known issue error report start -->
> 
> ### Report
> #### Summary
> |24-Hour Hit Count|7-Day Hit Count|1-Month Count|
> |---|---|---|
> |0|0|0|
> <!--Known issue error report end --></issue_description>
> - Closes #136674
> 
> <agent_instructions>Re: also fails in
#135794
> 
> **What fails**
> 
> On x86 (non-Unix), `ResolveWorker` builds a resolve stub for a virtual
or interface call. The stub needs the number of stack bytes the callee
pops, so it calls `pMD->SizeOfArgStack()` on the method from the
dispatch token. That call walks the method signature. For a value-type
parameter or return it needs the type layout already loaded, because it
runs under `ENABLE_FORBID_GC_LOADER_USE`. Otherwise `!th.IsNull()`
asserts.
> 
> **Why it started**
> 
> Before #135805, the R2R caller's fixups loaded those types. Now
`ExternalMethodFixupWorker` calls
`PrepareForUseAsAVirtualCallTargetOfANativeImage(pGCRefMap)`. For a
plain instance method with an import map, it only stores the map via
`SetGCRefMap` and returns. So the method has a map but its value types
may be unloaded.
> 
> **The fix**
> 
> The x86 GCRefMap already encodes the stack-pop size. The runtime
already trusts it for the same purpose in `UpdateRegDisplay_Impl` (via
`CbStackPopUsingGCRefMap`). For non-vararg methods, `CbStackPop()`
equals `SizeOfArgStack()`.
> 
> ```cpp
> PTR_BYTE pGCRefMap = pMD->FindGCRefMap(objectType, true /* isDispatch
*/);
> if (pGCRefMap != NULL)
> {
>     GCRefMapDecoder decoder(pGCRefMap);
>     stackArgumentsSize = decoder.ReadStackPop() * sizeof(TADDR);
> }
> else
> {
>     ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE();
> stackArgumentsSize = pMD->SizeOfArgStack(); // unchanged fallback
> }
> ```
> 
> - It uses the same lookup `StubDispatchFrame` uses for GC scanning.
> - Nothing is loaded and the scope isn't relaxed. It also adds
`#include "gcrefmap.h"`, and it stays inside the existing x86 `#if`.
> - The fallback should be safe. As far as I can tell from reading,
preparation skips the load only when it stores a shareable map. Generic
methods and methods that need a hidden generic argument are fully
prepared. I haven't confirmed that.
> 
> </agent_instructions>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> <comment_new><author>@jkotas</author><body>
> Regression likely caused by
#135806 cc @davidwrighton
</body></comment_new>
> </comments>
- Fixes #136674

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
Co-authored-by: David Wrighton <davidwr@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6e1d3f7f-a06c-4561-8189-bdf699656b46
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.

5 participants