[cDAC] Change pointer data to be compile-time constant#118543
Merged
max-charlamb merged 3 commits intodotnet:mainfrom Aug 8, 2025
Merged
[cDAC] Change pointer data to be compile-time constant#118543max-charlamb merged 3 commits intodotnet:mainfrom
max-charlamb merged 3 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR changes pointer data arrays in the cDAC (Contract Data Access) system from runtime values to compile-time constants by making them constexpr. The key motivation is to enable compile-time evaluation of these data structures, which requires special handling for MSVC compiler compatibility.
Key changes:
- Convert pointer data arrays to
constexprwith MSVC-specific compiler flag - Refactor StressLog module table access to use field offsets instead of global pointers
- Update data contracts to support both legacy and new access patterns
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/clrdatadescriptors.cmake | Adds MSVC compiler flag /Zc:externConstexpr to enable external linkage on constexpr variables |
| src/coreclr/debug/datadescriptor-shared/contractpointerdata.cpp | Changes pointer data array from uintptr_t to constexpr void* array |
| src/coreclr/debug/datadescriptor-shared/contractdescriptorstub.c | Updates pointer data types from uintptr_t* to void** |
| src/coreclr/debug/datadescriptor-shared/contract-descriptor.c.in | Updates pointer data types from uintptr_t* to void** |
| src/coreclr/inc/stresslog.h | Changes cdac_offsets template members from const to constexpr |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Removes global StressLogModuleTable pointer, adds Modules field to StressLog type |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/StressLog.cs | Adds optional Modules property to support new field-based access |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StressLog.cs | Implements fallback logic to access module table via StressLog field when global pointer unavailable |
| src/tools/StressLogAnalyzer/src/Program.cs | Adds Modules field definition for StressLogAnalyzer compatibility |
| docs/design/datacontracts/StressLog.md | Updates documentation to reflect removal of global StressLogModuleTable and addition of Modules field |
Contributor
|
Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag |
davidwrighton
approved these changes
Aug 8, 2025
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.
constexpr. On MSVC, this requires enabling a flag to allow external linkage on aconstexprvariable.&g_pStressLog->modules). I updated the contract to reference this field as an offset when theStressLogis available. When it is not available it uses the old pointer (StressLogAnalyzer.cs scenario).