Skip to content

Conversation

rcj1
Copy link
Contributor

@rcj1 rcj1 commented Aug 1, 2025

No description provided.

Copy link
Contributor

@Copilot 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 adds a new cDAC API called GetStaticBaseAddress which provides access to static field base addresses for types. The implementation extracts GC and non-GC static base pointers from the DynamicStaticsInfo structure associated with method tables.

Key changes:

  • Implements the GetStaticBaseAddress method in the cDAC interface to replace the legacy implementation fallback
  • Adds new runtime type system methods for accessing GC and non-GC static base pointers
  • Introduces DynamicStaticsInfo data structure and associated global constants for static field access

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
SOSDacImpl.cs Implements GetStaticBaseAddress method with validation, contract calls, and debug verification
DynamicStaticsInfo.cs New data structure for reading GC and non-GC static pointers with masking
RuntimeTypeSystem_1.cs Adds GetGCStaticsBasePointer and GetNonGCStaticsBasePointer methods to access static fields
Constants.cs Adds global constants for StaticsPointerMask and DynamicStaticsInfoSize
DataType.cs Registers DynamicStaticsInfo as a new data type
IRuntimeTypeSystem.cs Adds interface definitions for the new static base pointer methods
datadescriptor.inc Defines CDAC type and global mappings for DynamicStaticsInfo
RuntimeTypeSystem.md Documents the new API methods and data structures
Comments suppressed due to low confidence (3)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs:36

  • The field name DynamicStaticsInfoSize suggests it contains a size value, but it's declared as TargetPointer which typically represents an address. Consider renaming to clarify its purpose or change the type to nuint if it represents a size.
        internal TargetPointer DynamicStaticsInfoSize { get; }

docs/design/datacontracts/RuntimeTypeSystem.md:478

  • The variable target is used but should be _target to match the class field naming convention used elsewhere in the codebase.
        nuint mask = target.ReadGlobal<nuint>(Constants.Globals.StaticsPointerMask);

docs/design/datacontracts/RuntimeTypeSystem.md:493

  • The variable target is used but should be _target to match the class field naming convention used elsewhere in the codebase.
        nuint mask = target.ReadGlobal<nuint>(Constants.Globals.StaticsPointerMask);

Copy link
Contributor

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

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.

2 participants