Skip to content

Refactor FieldData accumulators in DI to CallbackAccumulator<FieldData>#128829

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/create-plan-for-dacdbi-apis
Draft

Refactor FieldData accumulators in DI to CallbackAccumulator<FieldData>#128829
Copilot wants to merge 3 commits into
mainfrom
copilot/create-plan-for-dacdbi-apis

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

No description provided.

…h/alloc, full DEBUG validation)

Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Copilot AI self-assigned this Jun 1, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 02:15
Copilot AI review requested due to automatic review settings June 1, 2026 02:15
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Copilot AI review requested due to automatic review settings June 1, 2026 02:18
Copy link
Copy Markdown
Contributor

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

The PR description frames this as a small follow-up cleanup ("refactor two file-local FieldDataAccumulator helpers to use the existing generic CallbackAccumulator<FieldData> and revert an unnecessary DAC/DBI protocol counter bump"), but the actual diff is a much larger change that also lands the DacDbi FieldData callback-based protocol, the new cDAC IEditAndContinue contract, and supporting data descriptors.

Changes:

  • Replace IDacDbiInterface::GetClassInfo / GetInstantiationFieldInfo with callback-based EnumerateClassFields / EnumerateInstantiationFields (managed + native) and refactor rsclass.cpp / rstype.cpp to drive them via CallbackAccumulator<FieldData>; widen FieldData::m_fldInstanceOffset to ULONG64 and m_pFldStaticAddress to CORDB_ADDRESS.
  • Add a new cDAC IEditAndContinue contract (EnumerateAddedFieldDescs), new EnCEEClassData / EnCAddedFieldElement / UnorderedArrayBase Data classes + descriptors, Module.EnCClassList (optional FieldAddress), and supporting source-generator changes for nullable FieldAddress.
  • Expose GetNumInstanceFieldBytes / IsFieldDescRVA / IsFieldDescEnCNew on IRuntimeTypeSystem, add EEClass.BaseSizePadding, extract CUnorderedArrayBase so cDAC can read it, and add mocks + xUnit tests for the new EnC contract.
Show a summary per file
File Description
src/coreclr/inc/dacdbi.idl Replace GetClassInfo/GetInstantiationFieldInfo with Enumerate* callback-based variants; drop DacDbiArrayList_FieldData/ClassInfo decls.
src/coreclr/debug/inc/dacdbiinterface.h New FP_FIELDDATA_CALLBACK typedef and EnumerateClassFields / EnumerateInstantiationFields virtuals; updated docs.
src/coreclr/debug/inc/dacdbistructures.h Widen m_fldInstanceOffset to ULONG64 and m_pFldStaticAddress to CORDB_ADDRESS; update setter signatures.
src/coreclr/debug/inc/dacdbistructures.inl Adjust FieldData inline accessors to match new CORDB_ADDRESS/ULONG64 types.
src/coreclr/debug/daccess/dacdbiimpl.h Replace GetClassInfo/GetInstantiationFieldInfo decls; change CollectFields to callback form; drop GetTotalFieldCount/InitClassData.
src/coreclr/debug/daccess/dacdbiimpl.cpp Implement callback-based Enumerate*; update ComputeFieldData to use CORDB_ADDRESS; remove preallocation/count logic.
src/coreclr/debug/di/rsclass.cpp Drive EnumerateClassFields via CallbackAccumulator<FieldData> and Init the field list from acc.items.
src/coreclr/debug/di/rstype.cpp Same refactor for EnumerateInstantiationFields.
src/coreclr/inc/utilcode.h Extract CUnorderedArrayBase (count + TADDR table) from CUnorderedArrayWithAllocator and add cdac_data shim.
src/coreclr/vm/encee.h Add cdac_data for EnCEEClassData and EnCAddedFieldElement.
src/coreclr/vm/ceeload.h Add cdac_data<Module>::EnCClassList under FEATURE_METADATA_UPDATER.
src/coreclr/vm/class.h Add cdac_data<EEClass>::BaseSizePadding.
src/coreclr/vm/datadescriptor/datadescriptor.inc Add UnorderedArrayBase, EnCEEClassData, EnCAddedFieldElement descriptors; EEClass.BaseSizePadding; FieldOffsetNewEnc global; EditAndContinue contract entry.
.../Abstractions/Contracts/IEditAndContinue.cs New contract interface (EnumerateAddedFieldDescs) and empty struct.
.../Abstractions/Contracts/IRuntimeTypeSystem.cs Add GetNumInstanceFieldBytes, IsFieldDescRVA, IsFieldDescEnCNew; make fieldDef nullable on GetFieldDescOffset.
.../Abstractions/ContractRegistry.cs Expose EditAndContinue accessor.
.../Contracts/CoreCLRContracts.cs Register EditAndContinue v1.
.../Contracts/Contracts/EditAndContinue_1.cs New v1 implementation enumerating EnC-added FieldDescs.
.../Contracts/Contracts/RuntimeTypeSystem_1.cs Implement GetNumInstanceFieldBytes/IsFieldDescEnCNew; promote IsFieldDescRVA to interface; null-handle big-RVA fieldDef.
.../Contracts/Data/{Module,EEClass,EnCEEClassData,EnCAddedFieldElement,UnorderedArrayBase}.cs New Data classes / fields backing the EnC descriptors.
.../Contracts/DataType.cs / Constants.cs New DataType values and FieldOffsetNewEnc global.
.../DataGenerator/Parser.cs, Emitter.cs Source-gen support for optional/nullable [FieldAddress] properties.
.../Legacy/Dbi/{IDacDbiInterface.cs,DacDbiImpl.cs} Define FieldData struct; implement new managed Enumerate* with optional debug-only legacy validation.
src/native/managed/cdac/tests/... New mock infrastructure (MockDescriptors.EditAndContinue.cs), EnC contract xUnit tests, and TestOptionalFieldAddr data-generator tests.
docs/design/datacontracts/{EditAndContinue,RuntimeTypeSystem}.md Document the new contract and the new IRuntimeTypeSystem APIs/globals.

Copilot's findings

  • Files reviewed: 36/36 changed files
  • Comments generated: 1

Comment thread src/coreclr/debug/inc/dacdbistructures.h
Copilot stopped work on behalf of rcj1 due to an error June 1, 2026 02:54
Copilot AI requested a review from rcj1 June 1, 2026 02:54
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.

3 participants