Skip to content

Conversation

@max-charlamb
Copy link
Member

@max-charlamb max-charlamb commented Jul 28, 2025

Why

As we move to completely implement the API's used by SOS in the cDAC, we need to access data structures and global values defined in the GC. These are special because the GC can either be internal to coreclr.dll or an external clrgc.dll. Given this option, it is impossible to completely define GC data structures at coreclr.dll compile time and store them in the data-descriptor like we do for VM structures.

Proposed Solution

Add support for a data-descriptor to have sub-descriptors. Data-descriptors will have a new optional sub-descriptor section which can contain pointers to sub-descriptors. Each sub-descriptor has the same spec as the main (existing) descriptor. The pointers act the same as the well-known symbol name for the main descriptor.

Memory Layout

The sub-descriptors will be an additional (optional) section of the data-descriptor identical in spec to the existing globals with the exception that the value's type must be a pointer.

Parsing

When parsing a data-descriptor, each sub-descriptor pointer is checked if it is non-null. If it is non-null, then the sub-descriptor should be parsed in the same way as the main descriptor.

  • The header of a sub-descriptor must match the parent descriptor. If the header of a sub-descriptor does not match (different pointer size/endianness) this is an error and undefined behavior.
  • The sub-descriptor and parent descriptor must not have conflicting descriptors. If any conflicting descriptors exist, this is an error and undefined behavior.

Types, globals, and contract versions are merged between the sub-descriptor and the parent descriptor.

Implemented in: #118050

Copilot AI review requested due to automatic review settings July 28, 2025 13:45
@max-charlamb max-charlamb marked this pull request as draft July 28, 2025 13:45
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 28, 2025
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 introduces support for multi data-descriptor functionality to the Contract Data Access (cDAC) system. The primary purpose is to enable deferred data definition resolution through sub-descriptors when certain data definitions are not known at compile time but may be provided by external components.

Key changes:

  • Adds support for string-type global values alongside existing primitive integer constants and pointers
  • Introduces sub-descriptor pointers as a new optional component of data descriptors
  • Updates the JSON format to include a "sub-descriptors" field with pointer-based references to external data descriptors

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
datacontracts_design.md Updates global values to support strings and adds sub-descriptor concept documentation
data_descriptor.md Adds comprehensive specification for sub-descriptor descriptors, JSON format updates, and example usage
contract-descriptor.md Adds sub-descriptors field to example JSON and clarifies contract symbol discovery language
Comments suppressed due to low confidence (1)

docs/design/datacontracts/data_descriptor.md:300

  • The link reference uses 'contract-descriptor.md' which is inconsistent with the actual filename 'contract-descriptor.md' shown in the diff. However, this appears to be a correction from 'contract_descriptor.md' to match the actual hyphenated filename, so this is likely fixing an existing inconsistency.
descriptor](./contract-descriptor.md#Contract_descriptor).

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@max-charlamb max-charlamb mentioned this pull request Aug 7, 2025
1 task
@max-charlamb max-charlamb added documentation Documentation bug or enhancement, does not impact product or test code area-Diagnostics-coreclr labels Aug 26, 2025
@max-charlamb max-charlamb marked this pull request as ready for review August 26, 2025 14:02
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@max-charlamb max-charlamb removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 26, 2025
@max-charlamb
Copy link
Member Author

/ba-g docs only change

@max-charlamb
Copy link
Member Author

/ba-g failures unrelated to docs only change

@max-charlamb max-charlamb merged commit 0df3870 into dotnet:main Oct 24, 2025
15 of 16 checks passed
@max-charlamb max-charlamb deleted the cdac-contract-proposal branch October 24, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Diagnostics-coreclr documentation Documentation bug or enhancement, does not impact product or test code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants