Skip to content

[cDAC] GcScanner stack-ref scanning gaps vs native DAC #127765

@max-charlamb

Description

@max-charlamb

Gaps vs native DAC

1. Embedded GC refs in large value types passed by value

  • Native: MetaSig::GcScanRoots ELEMENT_TYPE_VALUETYPE case
    (src/coreclr/vm/siginfo.cpp:5437-5457) -> ReportPointersFromValueTypeArg -> walks the
    type's CGCDesc series and reports each embedded GC ref.
  • cDAC today: GcTypeKind.Other parameters are silently skipped
    (src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/GC/GcScanner.cs).
  • Where to implement: new helper in GcScanner.cs (or sibling ValueTypeGcWalker.cs)
    consuming a new IRuntimeTypeSystem.GetGCDescSeries(typeHandle) accessor. Requires
    GcSignatureTypeProvider / decoder consumers to surface the TypeHandle alongside
    GcTypeKind.Other so the walker has the type to enumerate. The ArgIterator port already
    provides IsArgPassedByRef, which is the first branch native takes here.

2. String..ctor this-slot handling

  • Native: src/coreclr/vm/frames.cpp:1523-1525:
    if (msig.HasThis() && pFunction->GetMethodTable() == g_pStringClass && pFunction->IsCtor())
        msig.ClearHasThis();
    The caller does not pass this for String..ctor; the runtime allocates and overwrites it.
  • cDAC today: no special case; the slot is treated as a tracked ref.
  • Where to implement: GcScanner.PromoteCallerStack (around the existing hasThis
    capture). Needs IRuntimeTypeSystem accessors for the well-known String MethodTable
    and an IsCtor predicate on MethodDesc.

3. SuppressParamTypeArg

  • Native: src/coreclr/vm/frames.cpp:1527-1528:
    if (pFunction->RequiresInstArg() && !SuppressParamTypeArg())
        msig.SetHasParamTypeArg();
    Per-Frame-subclass virtual; some frame kinds suppress the inst-arg slot.
  • cDAC today: RequiresInstArg is honored unconditionally in GcScanner.PromoteCallerStack.
  • Where to implement: extend the frame-kind table in the StackWalk contract with a
    SuppressParamTypeArg bool per FrameKind, then in GcScanner.PromoteCallerStack:
    requiresInstArg = rts.RequiresInstArg(mdh) && !frameSuppressesParamTypeArg;.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions