WIP: cDAC shared calling-convention port + ByRefLike walker + Win-x64 CallSiteLayout dump tests [NO-REVIEW]#128487
Closed
max-charlamb wants to merge 3 commits into
Closed
Conversation
Recovered from a dangling git stash that was previously lost. Includes: - Per-arch ArgIterator port under src/native/managed/cdac/.../Contracts/CallingConvention/ (X86, AMD64-Unix, AMD64-Windows, Arm32, Arm64, RiscV64+LoongArch64) atop ArgIteratorBase / ArgIteratorData / ArgIteratorFactory / TransitionBlockLayout. - New ICallingConvention contract and CallingConvention_1 implementation that drives the iterators from a decoded signature. - New data descriptor entries for TransitionBlock + ArgumentRegisters (src/coreclr/vm/datadescriptor/datadescriptor.inc, src/coreclr/vm/class.h). - GcScanner refactored to consume CallSiteLayout for caller-stack promotion; CallingConvention contract fetched lazily so stack-walk tests that do not register it still work. - Test suite under src/native/managed/cdac/tests/CallingConvention/ covering 214 per-arch cases, plus MockDescriptors.CallingConvention support and RuntimeTypeSystemGetVectorSizeTests. Post-recovery cleanup applied on top of the original stash: - Files relocated from Contracts/StackWalk/CallingConvention/ to Contracts/CallingConvention/; helper namespace renamed to Contracts.CallingConventionHelpers (matches Contracts/GCInfo/ pattern). - Collapsed the abstract AMD64UnixArgIterator + CdacAMD64UnixArgIterator pair into a single concrete AMD64UnixArgIterator. - Dropped vestigial extraObjectFirstArg / extraFunctionPointerArg ctor parameters that were never set to true in any caller. - Fixed API drift vs. current origin/main (GenericContextLoc-based check, non-generic ArgIterator types, Target.FieldInfo.TypeName). Builds cdac.slnx clean (0 errors, 0 warnings). Test result: 2469 passed, 0 failed, 16 skipped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add IRuntimeTypeSystem.EnumerateInstanceFieldDescs and LookupApproxFieldTypeHandle primitives - Implement GcRefEnumeration.EnumerateByRefLikeRoots walker (recursive field scan) - Update CallingConvention_1.ComputeValueTypeHandle to populate handle for ByRefLike args - GcScanner.ReportArgument dispatches to ByRefLike walker via rts.IsByRefLike - Consolidate duplicate LookupApproxFieldTypeHandle/ResolveFieldTypeHandle helpers - Add unit tests for ByRefLike dispatch in GcScannerReportArgumentTests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rebuild the CallSiteLayout debuggee as a 54-frame deep chain that
exercises every interesting AMD64 calling-convention shape (categories
A-H: empty/int/double argbanks, mixed reg banks, managed ref args,
small/large value types, ByRefLike + Span<T>, instance/retbuf/generic/
vararg specials, Vector64/128/256/512, composite kitchen-sink frames).
All 54 frames stay live to Environment.FailFast so a single dump
captures the whole matrix on the FailFast thread.
Replace CallSiteLayoutDumpTests with:
- CallSiteLayoutDumpTestsBase: shared DumpTestBase subclass providing
CollectChainMethods / LayoutFor / AssertSingle{ByRef,ByValueVT,
ManagedRef} helpers.
- CallSiteLayoutDumpTests_WinX64: 46 [ConditionalTheory] tests gated
by [SkipOnOS=windows], [SkipOnArch=x64], [SkipOnVersion=net10.0]
asserting the explicit Win-x64 layout (IsPassedByRef, slot offsets,
ValueTypeHandle populated/null) for every frame.
The tests are expectation-snapshots derived from the AMD64 Windows ABI.
They pin cDAC ICallingConvention.ComputeCallSiteLayout output to the
hand-derived spec. Independent ground-truth validation via SOS
!clrstack -gc + transition frames is a tracked follow-up; the current
SOS path exercises ComputeCallSiteLayout only on InlinedCallFrames.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Member
Author
|
Superseded by #128488 (AMD64-only slim). Closing in favor of that surface. |
This was referenced May 22, 2026
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.
Note
This PR was prepared with assistance from GitHub Copilot.
Status: WIP / not for review (
NO-REVIEW).This branch is a long-running working branch for porting the native
ArgIteratorand calling-convention machinery into the cDAC, plusfollow-on infrastructure (ByRefLike GC ref enumeration walker,
CallSiteLayoutdump tests).The branch carries three commits today:
ArgIteratorport (X86, AMD64-Unix, AMD64-Windows, Arm32, Arm64,RiscV64 + LoongArch64) atop
ArgIteratorBase/ArgIteratorData/ArgIteratorFactory/TransitionBlockLayout. NewICallingConventioncontract +CallingConvention_1impl drivingthe iterators from a decoded signature. New data-descriptor entries
for
TransitionBlock+ArgumentRegisters.GcScannerrefactoredto consume
CallSiteLayoutfor caller-stack promotion. Unit-testsuite under
tests/CallingConvention/covering 214 per-arch cases.IRuntimeTypeSystem.EnumerateInstanceFieldDescsandLookupApproxFieldTypeHandle; implementsGcRefEnumeration.EnumerateByRefLikeRoots(recursive field scan);wires up
GcScanner.ReportArgumentto dispatch to the BRL walkervia
rts.IsByRefLike.rebuilds the
CallSiteLayoutdebuggee as a 54-frame deep chaincovering categories A-H of AMD64 calling-convention shapes, and
adds 46 Win-x64
[ConditionalTheory]tests asserting the explicitexpected layout for each frame.
Validation so far
CallSiteLayoutDumpTests_WinX64: 46/46 pass onlocaldump;net10.0 dump skipped via
[SkipOnVersion](pre-existingCodeVersionsdescriptor shape mismatch on net10.0 dumps).!clrstack -gclegacy DACvscDACdiff onCallSiteLayout.dmp: byte-identical except for one SOS header line.Confirms the GCInfo-based managed-frame stack walk matches; a
follow-up debuggee using P/Invoke bouncers is planned to extend SOS
parity coverage to
ComputeCallSiteLayoutitself (which is onlyexercised by
GcScanner.PromoteCallerStackon transition frames).CI ask
Looking to get a
CdacDumps_linux_x64.tar.gzartifact from CI so theCallSiteLayoutdebuggee can be used to author a siblingCallSiteLayoutDumpTests_SysVX64class in a follow-up commit.Not for review
This PR is marked
NO-REVIEW. Please do not invest review cycles —it exists to capture CI artifacts and as a working branch.