Refactor FieldData accumulators in DI to CallbackAccumulator<FieldData>#128829
Draft
Copilot wants to merge 3 commits into
Draft
Refactor FieldData accumulators in DI to CallbackAccumulator<FieldData>#128829Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
…h/alloc, full DEBUG validation) Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
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/GetInstantiationFieldInfowith callback-basedEnumerateClassFields/EnumerateInstantiationFields(managed + native) and refactorrsclass.cpp/rstype.cppto drive them viaCallbackAccumulator<FieldData>; widenFieldData::m_fldInstanceOffsettoULONG64andm_pFldStaticAddresstoCORDB_ADDRESS. - Add a new cDAC
IEditAndContinuecontract (EnumerateAddedFieldDescs), newEnCEEClassData/EnCAddedFieldElement/UnorderedArrayBaseData classes + descriptors,Module.EnCClassList(optionalFieldAddress), and supporting source-generator changes for nullableFieldAddress. - Expose
GetNumInstanceFieldBytes/IsFieldDescRVA/IsFieldDescEnCNewonIRuntimeTypeSystem, addEEClass.BaseSizePadding, extractCUnorderedArrayBaseso 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
This was referenced Jun 1, 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.
No description provided.