Skip to content

[cDAC] Expose interpreter JIT manager code heaps - #134072

Merged
max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:dev/max-charlamb/cdac-interpreter-code-heaps
Sep 23, 2026
Merged

max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:dev/max-charlamb/cdac-interpreter-code-heaps

Conversation

@max-charlamb

Copy link
Copy Markdown
Member

Summary

  • export the optional InterpreterJitManagerAddress through the CoreCLR data descriptor
  • add JitManagerKind-based ExecutionManager APIs for discovering EE and interpreter managers and enumerating their code heaps independently
  • bump the advisory CoreCLR cDAC reader version to 2 and document the reader-version history
  • add unit coverage and a dump test using the interpreter-enabled InterpreterStack debuggee

Motivation

Interpreter-generated code is owned by InterpreterJitManager, whose code heaps were not discoverable through the managed cDAC ExecutionManager contract. Dump collectors using the contract could therefore omit metadata stored alongside interpreted code.

The new descriptor global is optional. Readers tolerate runtimes where it is absent, and older readers ignore it. Existing ISOSDacInterface behavior remains EE-only.

Validation

  • build.cmd clr+libs+tools.cdac+tools.cdactests -rc Release -lc Release /p:UseSharedCompilation=false
  • all 3,154 cDAC unit tests passed
  • cDAC dump-test project built with 0 warnings and 0 errors
  • InterpreterStackDumpTests.ExecutionManager_EnumeratesInterpreterCodeHeaps: 1 passed (local/jit), 1 expected skip (local/r2r, debuggee is JIT-only)
  • generated data-contract documentation check passed

Note

This pull request description was generated with GitHub Copilot.

Expose the optional interpreter JIT manager through the ExecutionManager data contract and allow callers to enumerate code heaps by manager kind. Document reader version 2 and cover the behavior with unit and dump tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b507532c-3857-4e61-86a9-69fe22ec157b
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 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: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@max-charlamb
max-charlamb marked this pull request as ready for review September 16, 2026 19:52
Copilot AI lite review requested due to automatic review settings September 16, 2026 19:52
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 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 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.

🟡 Changes recommended

A critical API compatibility issue and a moderate reader-version test gap remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This pull request exposes interpreter JIT manager code heaps through cDAC and updates related contracts, descriptors, tests, and documentation.

Changes:

  • Adds optional interpreter manager discovery and heap enumeration APIs.
  • Updates native descriptors and test coverage.
  • Bumps the advisory reader version to 2 and documents the change.
File summaries
File Summary
src/native/managed/cdac/tests/UnitTests/MockDescriptors/MockDescriptors.ExecutionManager.cs Adds interpreter manager test descriptors.
src/native/managed/cdac/tests/UnitTests/ExecutionManager/ExecutionManagerTests.cs Tests manager selection and heap enumeration.
src/native/managed/cdac/tests/DumpTests/InterpreterStackDumpTests.cs Adds interpreter heap dump coverage.
src/native/managed/cdac/tests/DumpTests/CodeHeapListDumpTests.cs Updates EE heap queries.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs Preserves EE-only legacy behavior.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeInfo_1.cs Reports reader version 2. Moderate finding (1 vote): add a unit assertion for GetCurrentReaderVersion().
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/ExecutionManager/ExecutionManagerCore.cs Implements manager discovery and enumeration.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/ExecutionManager/ExecutionManager_1.cs Exposes the new manager APIs.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Constants.cs Adds the interpreter global name.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IExecutionManager.cs Adds manager-kind APIs. Critical finding (2 votes): retain existing EE-only members as EE-forwarding wrappers.
src/coreclr/vm/datadescriptor/datadescriptor.inc Publishes the optional native global.
src/coreclr/vm/codeman.h Exposes the interpreter manager address.
docs/design/datacontracts/RuntimeInfo.md Links reader-version history.
docs/design/datacontracts/reader-version-history.md Documents reader versions 1 and 2.
docs/design/datacontracts/ExecutionManager.md Documents the updated contract.
docs/design/datacontracts/data-descriptor-meanings.json Updates descriptor meanings.
Review details

Suppressed comments (1)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeInfo_1.cs:44

  • Please add a unit assertion for GetCurrentReaderVersion() returning 2. This value was just changed and controls the reader capability advertised to callers, but RuntimeInfoTests does not exercise it, so a future mismatch could silently break the reader-version advisory behavior.
    uint IRuntimeInfo.GetCurrentReaderVersion() => 2;
  • Files reviewed: 16/16 changed files
  • Comments generated: 1
  • Review effort level: Lite

max-charlamb added a commit that referenced this pull request Sep 18, 2026
Expose `ExecutionManager::m_pInterpreterJitManager` as the optional
`InterpreterJitManagerAddress` cDAC data-descriptor global when CoreCLR
is built with `FEATURE_INTERPRETER`.

Will be used by #134072 for cDAC dump enumeration.

Co-authored-by: Max Charlamb <maxcharlamb@microsoft.com>
Copilot-Session: b507532c-3857-4e61-86a9-69fe22ec157b
@max-charlamb
max-charlamb merged commit cc0aa5a into dotnet:main Sep 23, 2026
136 of 140 checks passed
@max-charlamb
max-charlamb deleted the dev/max-charlamb/cdac-interpreter-code-heaps branch September 23, 2026 21:13
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 24, 2026
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