Skip to content

Conversation

@davidwrighton
Copy link
Member

The interpreter calling convention can result in double reporting of arguments passed to callee's. This works today as all of the arguments will be conservatively reported, but it also adds the problem of excess conservative reporting. This change fixes that most of that problem by only dropping reporting of conservative pointers when they point into a callee's stack space.

Note that this does not fix is the scenario where an object reference is held on the IL stack across a call. In those cases the value shall still be reported conservatively. This PR also tweaks the Collect0 test to disable it under the interpreter as the C# compiler generates that particular problematic pattern for this test case.

The interpreter calling convention can result in double reporting of arguments passed to callee's. This works today as all of the arguments will be conservatively reported, but it also adds the problem of excess conservative reporting. This change fixes that most of that problem by only dropping reporting of conservative pointers when they point into a callee's stack space.

Note that this does not fix is the scenario where an object reference is held on the IL stack across a call. In those cases the value shall still be reported conservatively. This PR also tweaks the Collect0 test to disable it under the interpreter as the C# compiler generates that particular problematic pattern for this test case.
Copilot AI review requested due to automatic review settings December 17, 2025 21:28
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 17, 2025
Copy link
Contributor

Copilot AI left a comment

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 GC reporting issues in the CoreCLR interpreter by reducing excess conservative reporting of arguments. The main change optimizes GC stack slot reporting by detecting when a stack slot belongs to a callee's frame rather than the caller's frame, avoiding double reporting. Additionally, a test is disabled under the interpreter due to a known issue with object references held on the IL stack across calls.

Key Changes

  • Modified GC stack slot reporting to skip conservatively reported slots when they point into a callee's stack space
  • Added logic to detect callee frame boundaries using InterpMethodContextFrame
  • Disabled Collect0 test under the interpreter due to incompatible C# compiler output patterns

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/tests/GC/API/GC/Collect0.cs Adds ActiveIssue attribute to disable test under CoreCLR interpreter
src/coreclr/vm/gcinfodecoder.cpp Implements GC reporting optimization for interpreter frames by detecting and skipping slots in callee frames

@jkotas jkotas added area-CodeGen-Interpreter-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 17, 2025
@dotnet-policy-service
Copy link
Contributor

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

@davidwrighton davidwrighton merged commit 6b4ee34 into dotnet:main Jan 5, 2026
104 checks passed
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.

3 participants