Repository navigation
[cDAC] Select one authoritative layout per IData instance - #136851
Merged
max-charlamb merged 2 commits intoNov 5, 2026
Merged
Conversation
Prefer a complete native layout when available and use lazy managed lookup only when no native layout exists. Preserve the CoreLib assembly root explicitly during dump enumeration and cover whole-layout selection with regression tests. Co-authored-by: Copilot <[email protected]> Copilot-Session: de3eab4e-b090-430a-8e30-6b204fb1519a
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
|
We could probably remove LayoutSet now that we only resolve max one layout. |
Represent each generated IData layout with a single TypeLayout helper and update CdacUsageGraph to recognize the renamed generated helper. Co-authored-by: Copilot <[email protected]> Copilot-Session: de3eab4e-b090-430a-8e30-6b204fb1519a
3 tasks
rcj1
approved these changes
Nov 5, 2026
Member
Author
|
/ba-g helix monitor failure |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Select one authoritative layout for each generated
IDatainstance. Try all candidate type names against native descriptors first; only when none exists, resolve a managed layout lazily. Missing fields or size never cause another layout to be consulted. Optional fields remain absent, and required fields or size throw when accessed.This removes unnecessary managed type-name scans for missing optional native fields, such as
MethodTable.InterfaceMap, and replaces the per-instance layout list and array with one layout holder. Static, thread-static, and type-handle resolution remain independent.Explicitly capture the CoreLib assembly root in
MemoryEnumerator.EnumerateStatics(). Managed fallback previously captured this pointer incidentally; later analysis of the resulting dump can still legitimately need it. Keep this read independently best-effort so an unavailable Loader or RuntimeTypeSystem does not prevent the other static reads.Update the IData documentation and add regression coverage for layout priority, required and optional fields, writes, field addresses, offsets, instance size, lazy managed resolution, and dump-root preservation.
Performance
Fresh Windows x64 heap-enumeration measurements, in milliseconds:
These are means of 90 retained measurements per case: three process launches with 30 measurements each, with no outlier removal. Both cDAC providers include the same other optimizations from #136598, #136589, #136600, #136611, #136646, and #136661. This is a combined-optimizations experiment, not an isolated comparison against current main; this PR does not include those other changes.
Measurements ran on a shared Hyper-V host and exclude instance creation, flush/setup, and release. The target dumps lack optional
MethodTable.InterfaceMap; benefits on newer targets can differ. Legitimate metadata reads, including exception type-name resolution, remain unchanged.Validation
After rebasing this change independently onto current main:
The test and publish invocations used the repository-local SDK:
In the combined-optimizations experiment, all 18 dump cases also completed with fail-fast guards forbidding managed layout lookup and full managed type-name search. Six named stack-walk cases matched native DAC exactly, with cold/warm equality. The four architecture-specific dump-root regression cases were verified to fail when the explicit root read was removed.
Note
This PR description and implementation were developed with GitHub Copilot.