[cDAC] Implement IsDiagnosticsHiddenOrLCGMethod for cDAC#127035
[cDAC] Implement IsDiagnosticsHiddenOrLCGMethod for cDAC#127035
Conversation
Add IsDiagnosticsHidden to IRuntimeTypeSystem interface and implement it in RuntimeTypeSystem_1 using IsILStub and IsWrapperStub checks. Replace the legacy-delegation stub in DacDbiImpl.cs with a full cDAC implementation including #if DEBUG validation against the legacy path. Add unit tests covering all three DynamicMethodType return values: kNone (normal IL), kDiagnosticHidden (IL stub, unboxing stub, instantiating stub), and kLCGMethod (LCG/DynamicMethod). Update RuntimeTypeSystem.md with IsDiagnosticsHidden API documentation and implementation pseudocode. Note: IsAsyncThunkMethod is not yet implemented because the AsyncMethodData.flags field is not exposed in the data descriptor. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/ce6cb8ca-467a-4278-bf83-9285186e297d Co-authored-by: barosiak <76071368+barosiak@users.noreply.github.com>
Co-locate IsILStub with IsWrapperStub and IsInstantiatingStub for consistency and discoverability. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/ce6cb8ca-467a-4278-bf83-9285186e297d Co-authored-by: barosiak <76071368+barosiak@users.noreply.github.com>
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
Implements IsDiagnosticsHiddenOrLCGMethod in the managed cDAC DBI layer by adding an IRuntimeTypeSystem.IsDiagnosticsHidden contract API and the supporting async-method metadata plumbing, plus tests to validate behavior across architectures.
Changes:
- Add
IRuntimeTypeSystem.IsDiagnosticsHiddenand implement it inRuntimeTypeSystem_1using IL-stub, wrapper-stub, and async-thunk checks. - Expose/read
AsyncMethodData.Flagsvia data descriptors and a new managed data reader, and add optional-slot addressing for async method data. - Add unit tests covering diagnostics-hidden behavior and LCG/IL-stub distinctions.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/MethodDescTests.cs | Adds tests for IsDiagnosticsHidden/IsDynamicMethod and wires AsyncMethodData.Flags into mock type info. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements IsDiagnosticsHiddenOrLCGMethod using cDAC RuntimeTypeSystem contract (with DEBUG parity check vs legacy DAC). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/RuntimeTypeSystemHelpers/MethodDescOptionalSlots.cs | Adds HasAsyncMethodData and address calculation for async method data optional slot. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/RuntimeTypeSystemHelpers/MethodDescFlags_1.cs | Adds AsyncMethodFlags (used to detect thunk methods). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/AsyncMethodData.cs | New data reader for AsyncMethodData (reads Flags). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs | Implements IsDiagnosticsHidden and async-thunk detection via AsyncMethodData.Flags. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeTypeSystem.cs | Adds the IsDiagnosticsHidden API to the contract interface. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Exposes AsyncMethodData.Flags in the runtime data descriptor. |
| src/coreclr/debug/inc/dacdbiinterface.h | Documents that cDAC depends on the DynamicMethodType enum values. |
| docs/design/datacontracts/RuntimeTypeSystem.md | Updates the design doc to include IsDiagnosticsHidden. |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com> Co-authored-by: Rachel <rachel.jarvi@gmail.com>
|
|
||
| [Theory] | ||
| [ClassData(typeof(MockTarget.StdArch))] | ||
| public void IsDiagnosticsHidden_ReturnsCorrectValues(MockTarget.Architecture arch) |
There was a problem hiding this comment.
The test name IsDiagnosticsHidden_ReturnsCorrectValues is misleading: the assertions validate IsILStub / IsAsyncThunkMethod / IsWrapperStub / IsDynamicMethod, but don't directly assert a single “diagnostics hidden” decision (e.g., the IsDiagnosticsHiddenOrLCGMethod behavior). Consider renaming the test to reflect what it actually asserts, or add assertions that validate the combined hidden/LCG classification outcome.
| public void IsDiagnosticsHidden_ReturnsCorrectValues(MockTarget.Architecture arch) | |
| public void MethodClassificationFlags_ReturnCorrectValues(MockTarget.Architecture arch) |
|
Note This review was generated by Copilot (Claude Opus 4.6), with additional input from gpt-5.3-codex and goldeneye. 🤖 Copilot Code Review — PR #127035Holistic AssessmentMotivation: This PR addresses maintainer feedback from Approach: The decomposition into Summary: ✅ LGTM. This is a clean refactoring that correctly decomposes a policy method into reusable primitives per maintainer direction. The behavior is preserved, the implementation matches the native VM, tests are thorough, and all review feedback from Detailed Findings✅ Correctness — Behavioral equivalence verifiedThe native VM's ✅ API Design — Good decomposition of policy vs. primitivesRemoving ✅ Enum relocation — Consistent with reviewer feedback
✅ Test coverage — Thorough primitive testingTests in 💡 Test method name — Minor discrepancy (non-blocking)The test method at (Flagged by all three models: Claude Opus 4.6, gpt-5.3-codex, goldeneye) 💡 DacDbiImpl integration test — Optional follow-upThe tests validate each contract primitive but don't directly test the composed logic in (Flagged by gpt-5.3-codex and goldeneye)
|
Summary
Implement IsDiagnosticsHiddenOrLCGMethod on DacDbiImpl in the cDAC, including the previously missing IsAsyncThunkMethod check for full parity with the native VM.
Changes