Skip to content

[cDAC] Compute MethodDesc size directly to support more heap dump scenarios#124772

Merged
max-charlamb merged 4 commits intodotnet:mainfrom
max-charlamb:cdac-dumptests-heap-fix-2
Feb 24, 2026
Merged

[cDAC] Compute MethodDesc size directly to support more heap dump scenarios#124772
max-charlamb merged 4 commits intodotnet:mainfrom
max-charlamb:cdac-dumptests-heap-fix-2

Conversation

@max-charlamb
Copy link
Member

Modifies how MethodDesc sizes are computed. Instead of using the runtime s_ClassificationSizeTable which is not present in heap dumps, RuntimeTypeSystem now computes the MethodDesc size from datadescriptors.

Modified DumpTests to run on heap dumps for verification.

@dotnet-policy-service
Copy link
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 changed the title [cDAC] Allow more functionality in heap dumps [cDAC] Compute MethodDesc size directly to support more heap dump scenarios Feb 24, 2026
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 modifies how MethodDesc sizes are computed in the cDAC RuntimeTypeSystem contract to support heap dumps. Previously, the code read from the runtime's s_ClassificationSizeTable global, which is not available in heap dumps. The new implementation computes the MethodDesc size directly from data descriptor type sizes, mirroring the runtime's size table logic but using only metadata that's available in heap dumps.

Changes:

  • Replaced runtime table lookup with data-descriptor-based size computation for MethodDesc instances
  • Added AsyncMethodData data type for computing optional slot sizes
  • Changed TypeHierarchy test debuggee to use heap dumps instead of full dumps for verification

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
RuntimeTypeSystem_1.cs Reimplemented ComputeSize method to calculate MethodDesc size from data descriptor sizes instead of reading s_ClassificationSizeTable
Constants.cs Removed MethodDescSizeTable global constant that's no longer needed
DataType.cs Added AsyncMethodData enum value for the async method data slot
datadescriptor.inc Added AsyncMethodData data descriptor and removed MethodDescSizeTable global
MockDescriptors.MethodDescriptors.cs Updated mock tests to remove dummy MethodDescSizeTable and add AsyncMethodData type info
RuntimeTypeSystemDumpTests.cs Removed DumpType override to use default "heap" dumps
TypeHierarchy.csproj Changed dump type from "Full" to "Heap"
RuntimeTypeSystem.md Updated documentation to reflect new size computation approach and removed MethodDescSizeTable global

- Use DataType.CLRToCOMCallMethodDesc for ComInterop classification
- Use DataType.NonVtableSlot instead of target.PointerSize
- Use DataType.NativeCodeSlot instead of target.PointerSize
- Fix error message typo: AsyncMethodDescData -> AsyncMethodData

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@max-charlamb max-charlamb merged commit ae967fe into dotnet:main Feb 24, 2026
110 of 114 checks passed
@max-charlamb max-charlamb deleted the cdac-dumptests-heap-fix-2 branch February 24, 2026 03:19
iremyux pushed a commit to iremyux/dotnet-runtime that referenced this pull request Mar 2, 2026
…narios (dotnet#124772)

Modifies how MethodDesc sizes are computed. Instead of using the runtime
`s_ClassificationSizeTable` which is not present in heap dumps,
RuntimeTypeSystem now computes the MethodDesc size from datadescriptors.

Modified DumpTests to run on heap dumps for verification.
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.

4 participants