Skip to content

Use the interpreter GC decoder when inspecting interpreted frames - #136553

Merged
davidwrighton merged 2 commits into
dotnet:mainfrom
davidwrighton:fix/interpreter-gc-decoder
Nov 3, 2026
Merged

davidwrighton merged 2 commits into
dotnet:mainfrom
davidwrighton:fix/interpreter-gc-decoder

Conversation

@davidwrighton

Copy link
Copy Markdown
Member

Summary

Use InterpreterGcInfoDecoder rather than the target-native GcInfoDecoder when inspecting an interpreted frame in:

  • SfiNextWorker, for reverse-P/Invoke detection during exception propagation.
  • SafeToReportGenericParamContext, for the generic-context prolog length.
  • FindFirstInterruptiblePoint, for the GC-reporting location when unwinding between funclets.

Interpreter GC metadata has different encoding parameters and normalization from native metadata. Select the decoder using the frame's code manager, guarded by FEATURE_INTERPRETER, and preserve the existing decoder for native frames.

Found while investigating #135821. This PR is independently based on main and contains no Wasm metadata-format or code-generation changes. The decoder mismatch predates that work; an observable release-mode iOS failure has not been demonstrated.

Validation

  • ./build.sh clr.runtime -rc Checked on this standalone branch: passed, zero warnings and errors.
  • Session-local caught-exception, generic-GC, and uncaught reverse-P/Invoke probes on this standalone branch: passed with normal execution and with DOTNET_Interpreter='*' DOTNET_ReadyToRun=0. The uncaught probe terminated as expected and retained MessageFromMyException.
  • On the Wasm metadata branch, the reverse-P/Invoke probe reproduced the missing-message/assertion failure before this fix and preserved the exception message afterward; the checked browser runtime build also passed. This is supplementary evidence, not a standalone-branch browser test.
  • git diff upstream/main...HEAD --check: passed.
  • No new checked-in regression test; existing WasmBuildAppTest.ExceptionFromMain caught the EH regression.
  • iOS execution and the full test suites were not run.

Note

This pull request description and code changes were generated with GitHub Copilot.

Select InterpreterGcInfoDecoder for reverse-P/Invoke detection, generic-context prolog checks, and interruptible-range enumeration on interpreter frames. Keep native frame decoding unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 798665fd-8e9d-46c8-b56c-843764cdb3d1
@azure-pipelines

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

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli
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.

🔵 Needs a closer look

Runtime-maintainer validation is needed for interpreter GC-root reporting in active/interrupted generic frames and GC during funclet-to-funclet unwinds, since the reported smoke probes do not establish coverage of these paths.

No open issues 🎉

What changed in this PR

This PR updates CoreCLR frame inspection to use InterpreterGcInfoDecoder for interpreted frames, matching their GC metadata encoding while preserving native-frame decoding.

Changes:

  • Selects the interpreter decoder for reverse-P/Invoke detection during exception propagation.
  • Uses it for generic-context prolog lengths and interruptible-range lookup during funclet unwinding.
  • Guards interpreter-specific paths with FEATURE_INTERPRETER.
File Description
src/​coreclr/​vm/​gcenv.ee.common.cpp Selects the frame-appropriate decoder for prolog lengths and interruptible ranges.
src/​coreclr/​vm/​exceptionhandling.cpp Selects the frame-appropriate decoder for reverse-P/Invoke detection.

Review effort: Balanced

@BrzVlad

BrzVlad commented Oct 28, 2026

Copy link
Copy Markdown
Member

Wondering if it makes sense to have a shared GcInfoDecoder which is implemented by InterpreterGcInfoDecoder and a JITGcInfoDecoder, to avoid some code duplication.

@davidwrighton

Copy link
Copy Markdown
Member Author

/ba-g the failures are known issues.

@davidwrighton

Copy link
Copy Markdown
Member Author

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@davidwrighton backporting to release/11.0 was not run because the source pull request has not been merged. Please merge this pull request before requesting a backport.

@davidwrighton
davidwrighton merged commit 1f07b26 into dotnet:main Nov 3, 2026
102 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Nov 3, 2026
@davidwrighton

Copy link
Copy Markdown
Member Author

/backport to release/11.0

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants