Repository navigation
[cDAC] Remove GetClassPointer from the public IRuntimeTypeSystem surface - #130625
Merged
max-charlamb merged 2 commits intoJul 13, 2026
Merged
max-charlamb merged 2 commits into
max-charlamb merged 2 commits into
Conversation
GetClassPointer returned a raw EEClass* -- a runtime-internal detail -- on the public contract interface. Its two consumers outside RuntimeTypeSystem_1 used it only indirectly: - DacDbiImpl.IsValidObject re-implemented the MethodTable -> EEClass -> MethodTable validation (a port of MethodTable::ValidateWithPossibleAV) that GetTypeHandle already performs; it now relies on GetTypeHandle succeeding. - CdacTypeHandle (CallingConvention) read the EEClass optional fields for the SystemV AMD64 eightbyte register classification; this is now exposed via a semantic, cDAC-owned TryGetSystemVAmd64EightByteClassification API (layered SystemVAmd64EightByte structs, optional second eightbyte). GetClassPointer is now internal to RuntimeTypeSystem_1. Co-authored-by: Copilot <[email protected]> Copilot-Session: f2aa5dc4-0c99-43f0-af14-734143849c4a
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the cDAC RuntimeTypeSystem contract surface by removing a raw runtime-internal pointer API (GetClassPointer) and replacing one consumer scenario with a more semantic, contract-owned API for SystemV AMD64 eightbyte classification. It also simplifies legacy DBI object validation logic by relying on existing type-handle validation, and updates docs/tests accordingly.
Changes:
- Remove
GetClassPointerfromIRuntimeTypeSystemsurface and keep it as aninternalhelper inRuntimeTypeSystem_1. - Introduce
TryGetSystemVAmd64EightByteClassification(...)onIRuntimeTypeSystemplus cDAC-owned result types, and adaptCdacTypeHandleto consume it via an explicit mapping layer. - Simplify
DacDbiImpl.IsValidObjectto treat successfulGetTypeHandleresolution as validity; update tests andRuntimeTypeSystem.mdAPI/docs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/UnitTests/MethodTableTests.cs | Removes assertions that depended on the now-non-public GetClassPointer. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Simplifies IsValidObject to rely on GetTypeHandle validation behavior. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs | Makes GetClassPointer internal and adds TryGetSystemVAmd64EightByteClassification implementation. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/CallingConvention/CdacTypeHandle.cs | Switches to the new API and explicitly maps cDAC classification to shared SystemVClassificationType. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeTypeSystem.cs | Adds new public contract API + new public result types; removes GetClassPointer from the interface. |
| docs/design/datacontracts/RuntimeTypeSystem.md | Updates contract API listing, descriptor table, and pseudocode for the new API. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
max-charlamb
marked this pull request as ready for review
July 13, 2026 16:03
rcj1
reviewed
Jul 13, 2026
rcj1
reviewed
Jul 13, 2026
rcj1
reviewed
Jul 13, 2026
…g defaults, doc read-at-offset style - Make GetClassPointer private (was internal; no external callers). - Simplify throwing default interface methods to expression body (drop redundant out-param init). - RuntimeTypeSystem.md: use GetClassData for the EEClass read and read-at-offset style for the eightbyte fields instead of naming Data.* types. Co-authored-by: Copilot <[email protected]> Copilot-Session: f2aa5dc4-0c99-43f0-af14-734143849c4a
rcj1
approved these changes
Jul 13, 2026
max-charlamb
enabled auto-merge (squash)
July 13, 2026 18:23
Member
Author
|
/ba-g Build Analysis stuck on message ADO dropped |
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
…ace (#130625) ## Summary `IRuntimeTypeSystem.GetClassPointer` returned a raw `EEClass*` — a CoreCLR-internal structure with no meaning outside the runtime type system — on the public cDAC contract surface. This PR removes it from the interface and makes it `internal` to `RuntimeTypeSystem_1`, in line with the principle that contracts should expose what a diagnostic consumer needs rather than runtime internals. It had only two consumers outside the `RuntimeTypeSystem` implementation, both of which used it indirectly: - **`DacDbiImpl.IsValidObject`** re-implemented the `MethodTable -> EEClass -> MethodTable` self-consistency check (a port of the runtime's `MethodTable::ValidateWithPossibleAV`). `GetTypeHandle` already performs exactly this validation, so `IsValidObject` now simply relies on `GetTypeHandle` succeeding. - **`CdacTypeHandle`** (CallingConvention) read the `EEClass` optional fields to obtain the SystemV AMD64 eightbyte register-passing classification. That is now exposed through a semantic, cDAC-owned API on `IRuntimeTypeSystem`. ## Changes - Remove `GetClassPointer` from `IRuntimeTypeSystem`; keep it as an `internal` helper on `RuntimeTypeSystem_1`. - Add `bool TryGetSystemVAmd64EightByteClassification(TypeHandle, out SystemVAmd64EightByteClassification)` with cDAC-owned result types: - `SystemVAmd64Classification` enum (mirrors the ABI classification; consumers no longer cast raw bytes to the runtime-internal `SystemVClassificationType`). - Layered `SystemVAmd64EightByte { Classification, Size }`, with `SystemVAmd64EightByteClassification { First, Second? }` — the optional second eightbyte replaces a separate count, making invalid states unrepresentable. - Simplify `DacDbiImpl.IsValidObject` to rely on `GetTypeHandle` validation. - Map the cDAC classification enum to the shared JIT `SystemVClassificationType` explicitly at the CallingConvention adapter boundary. - Remove the now-internal `GetClassPointer` assertions from `MethodTableTests` (the surrounding `IsCanonicalMethodTable` coverage remains). - Update `docs/design/datacontracts/RuntimeTypeSystem.md` (API listing, data-descriptor table for `EEClass.OptionalFields` / `EEClassOptionalFields` / `SystemVEightByteRegistersInfo`, and pseudocode). ## Testing - `dotnet build src/native/managed/cdac/cdac.slnx -c Debug` — succeeds, 0 warnings/errors. - cDAC unit tests: 2693 passed, 0 failed, 16 skipped. > [!NOTE] > This PR was generated with the assistance of GitHub Copilot. --------- Co-authored-by: Max Charlamb <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IRuntimeTypeSystem.GetClassPointerreturned a rawEEClass*— a CoreCLR-internal structure with no meaning outside the runtime type system — on the public cDAC contract surface. This PR removes it from the interface and makes itinternaltoRuntimeTypeSystem_1, in line with the principle that contracts should expose what a diagnostic consumer needs rather than runtime internals.It had only two consumers outside the
RuntimeTypeSystemimplementation, both of which used it indirectly:DacDbiImpl.IsValidObjectre-implemented theMethodTable -> EEClass -> MethodTableself-consistency check (a port of the runtime'sMethodTable::ValidateWithPossibleAV).GetTypeHandlealready performs exactly this validation, soIsValidObjectnow simply relies onGetTypeHandlesucceeding.CdacTypeHandle(CallingConvention) read theEEClassoptional fields to obtain the SystemV AMD64 eightbyte register-passing classification. That is now exposed through a semantic, cDAC-owned API onIRuntimeTypeSystem.Changes
GetClassPointerfromIRuntimeTypeSystem; keep it as aninternalhelper onRuntimeTypeSystem_1.bool TryGetSystemVAmd64EightByteClassification(TypeHandle, out SystemVAmd64EightByteClassification)with cDAC-owned result types:SystemVAmd64Classificationenum (mirrors the ABI classification; consumers no longer cast raw bytes to the runtime-internalSystemVClassificationType).SystemVAmd64EightByte { Classification, Size }, withSystemVAmd64EightByteClassification { First, Second? }— the optional second eightbyte replaces a separate count, making invalid states unrepresentable.DacDbiImpl.IsValidObjectto rely onGetTypeHandlevalidation.SystemVClassificationTypeexplicitly at the CallingConvention adapter boundary.GetClassPointerassertions fromMethodTableTests(the surroundingIsCanonicalMethodTablecoverage remains).docs/design/datacontracts/RuntimeTypeSystem.md(API listing, data-descriptor table forEEClass.OptionalFields/EEClassOptionalFields/SystemVEightByteRegistersInfo, and pseudocode).Testing
dotnet build src/native/managed/cdac/cdac.slnx -c Debug— succeeds, 0 warnings/errors.Note
This PR was generated with the assistance of GitHub Copilot.