Skip to content

Commit c44a09f

Browse files
committed
[cdac][.NET9] Data descriptor changes for GetMethodDescData
Extracted from dotnet#106413
1 parent cef3898 commit c44a09f

File tree

11 files changed

+335
-17
lines changed

11 files changed

+335
-17
lines changed

src/coreclr/debug/runtimeinfo/contracts.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"EcmaMetadata" : 1,
1414
"Exception": 1,
1515
"Loader": 1,
16+
"NativeCodePointers": 1,
1617
"Object": 1,
1718
"RuntimeTypeSystem": 1,
1819
"Thread": 1

src/coreclr/debug/runtimeinfo/datadescriptor.h

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,16 @@ CDAC_TYPE_END(Module)
233233

234234
CDAC_TYPE_BEGIN(ModuleLookupMap)
235235
CDAC_TYPE_FIELD(ModuleLookupMap, /*pointer*/, TableData, offsetof(LookupMapBase, pTable))
236+
CDAC_TYPE_FIELD(ModuleLookupMap, /*pointer*/, Next, offsetof(LookupMapBase, pNext))
237+
CDAC_TYPE_FIELD(ModuleLookupMap, /*uint32*/, Count, offsetof(LookupMapBase, dwCount))
238+
CDAC_TYPE_FIELD(ModuleLookupMap, /*nuint*/, SupportedFlagsMask, offsetof(LookupMapBase, supportedFlags))
236239
CDAC_TYPE_END(ModuleLookupMap)
237240

241+
CDAC_TYPE_BEGIN(LoaderAllocator)
242+
CDAC_TYPE_INDETERMINATE(LoaderAllocator)
243+
CDAC_TYPE_FIELD(LoaderAllocator, /*uint8*/, IsCollectible, cdac_data<LoaderAllocator>::IsCollectible)
244+
CDAC_TYPE_END(LoaderAllocator)
245+
238246
// RuntimeTypeSystem
239247

240248
CDAC_TYPE_BEGIN(MethodTable)
@@ -299,11 +307,13 @@ CDAC_TYPE_FIELD(DynamicMetadata, /*inline byte array*/, Data, cdac_data<DynamicM
299307
CDAC_TYPE_END(DynamicMetadata)
300308

301309
CDAC_TYPE_BEGIN(MethodDesc)
302-
CDAC_TYPE_INDETERMINATE(MethodDesc)
310+
CDAC_TYPE_SIZE(sizeof(MethodDesc))
303311
CDAC_TYPE_FIELD(MethodDesc, /*uint8*/, ChunkIndex, cdac_data<MethodDesc>::ChunkIndex)
304312
CDAC_TYPE_FIELD(MethodDesc, /*uint16*/, Slot, cdac_data<MethodDesc>::Slot)
305313
CDAC_TYPE_FIELD(MethodDesc, /*uint16*/, Flags, cdac_data<MethodDesc>::Flags)
306314
CDAC_TYPE_FIELD(MethodDesc, /*uint16*/, Flags3AndTokenRemainder, cdac_data<MethodDesc>::Flags3AndTokenRemainder)
315+
CDAC_TYPE_FIELD(MethodDesc, /*uint8*/, EntryPointFlags, cdac_data<MethodDesc>::EntryPointFlags)
316+
CDAC_TYPE_FIELD(MethodDesc, /*pointer*/, CodeData, cdac_data<MethodDesc>::CodeData)
307317
CDAC_TYPE_END(MethodDesc)
308318

309319
CDAC_TYPE_BEGIN(MethodDescChunk)
@@ -334,6 +344,105 @@ CDAC_TYPE_INDETERMINATE(DynamicMethodDesc)
334344
CDAC_TYPE_FIELD(DynamicMethodDesc, /*pointer*/, MethodName, cdac_data<DynamicMethodDesc>::MethodName)
335345
CDAC_TYPE_END(DynamicMethodDesc)
336346

347+
CDAC_TYPE_BEGIN(CodePointer)
348+
CDAC_TYPE_SIZE(sizeof(PCODE))
349+
CDAC_TYPE_END(CodePointer)
350+
351+
CDAC_TYPE_BEGIN(MethodDescCodeData)
352+
CDAC_TYPE_INDETERMINATE(MethodDescCodeData)
353+
CDAC_TYPE_FIELD(MethodDescCodeData, /*CodePointer*/, TemporaryEntryPoint, offsetof(MethodDescCodeData,TemporaryEntryPoint))
354+
CDAC_TYPE_FIELD(MethodDescCodeData, /*pointer*/, VersioningState, offsetof(MethodDescCodeData,VersioningState))
355+
CDAC_TYPE_END(MethodDescCodeData)
356+
357+
CDAC_TYPE_BEGIN(MethodDescVersioningState)
358+
CDAC_TYPE_INDETERMINATE(MethodDescVersioningState)
359+
CDAC_TYPE_FIELD(MethodDescVersioningState, /*pointer*/, NativeCodeVersionNode, cdac_data<MethodDescVersioningState>::NativeCodeVersionNode)
360+
CDAC_TYPE_FIELD(MethodDescVersioningState, /*uint8*/, Flags, cdac_data<MethodDescVersioningState>::Flags)
361+
CDAC_TYPE_END(MethodDescVersioningState)
362+
363+
CDAC_TYPE_BEGIN(PrecodeMachineDescriptor)
364+
CDAC_TYPE_INDETERMINATE(PrecodeMachineDescriptor)
365+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uintptr*/, CodePointerToInstrPointerMask, offsetof(PrecodeMachineDescriptor, CodePointerToInstrPointerMask))
366+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, ReadWidthOfPrecodeType, offsetof(PrecodeMachineDescriptor, ReadWidthOfPrecodeType))
367+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, ShiftOfPrecodeType, offsetof(PrecodeMachineDescriptor, ShiftOfPrecodeType))
368+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, OffsetOfPrecodeType, offsetof(PrecodeMachineDescriptor, OffsetOfPrecodeType))
369+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, InvalidPrecodeType, offsetof(PrecodeMachineDescriptor, InvalidPrecodeType))
370+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, StubPrecodeType, offsetof(PrecodeMachineDescriptor, StubPrecodeType))
371+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, HasNDirectImportPrecode, offsetof(PrecodeMachineDescriptor, HasNDirectImportPrecode))
372+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, NDirectImportPrecodeType, offsetof(PrecodeMachineDescriptor, NDirectImportPrecodeType))
373+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, HasFixupPrecode, offsetof(PrecodeMachineDescriptor, HasFixupPrecode))
374+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint8*/, FixupPrecodeType, offsetof(PrecodeMachineDescriptor, FixupPrecodeType))
375+
CDAC_TYPE_FIELD(PrecodeMachineDescriptor, /*uint32*/, StubCodePageSize, offsetof(PrecodeMachineDescriptor, StubCodePageSize))
376+
CDAC_TYPE_END(PrecodeMachineDescriptor)
377+
378+
CDAC_TYPE_BEGIN(StubPrecodeData)
379+
CDAC_TYPE_INDETERMINATE(StubPrecodeData)
380+
CDAC_TYPE_FIELD(StubPrecodeData, /*pointer*/, MethodDesc, offsetof(StubPrecodeData, MethodDesc))
381+
CDAC_TYPE_FIELD(StubPrecodeData, /*uint8*/, Type, offsetof(StubPrecodeData, Type))
382+
CDAC_TYPE_END(StubPrecodeData)
383+
384+
CDAC_TYPE_BEGIN(FixupPrecodeData)
385+
CDAC_TYPE_INDETERMINATE(FixupPrecodeData)
386+
CDAC_TYPE_FIELD(FixupPrecodeData, /*pointer*/, MethodDesc, offsetof(FixupPrecodeData, MethodDesc))
387+
CDAC_TYPE_END(FixupPrecodeData)
388+
389+
CDAC_TYPE_BEGIN(RangeSectionMap)
390+
CDAC_TYPE_INDETERMINATE(RangeSectionMap)
391+
CDAC_TYPE_FIELD(RangeSectionMap, /*pointer*/, TopLevelData, cdac_data<RangeSectionMap>::TopLevelData)
392+
CDAC_TYPE_END(RangeSectionMap)
393+
394+
CDAC_TYPE_BEGIN(RangeSectionFragment)
395+
CDAC_TYPE_INDETERMINATE(RangeSectionFragment)
396+
CDAC_TYPE_FIELD(RangeSectionFragment, /*pointer*/, RangeBegin, cdac_data<RangeSectionMap>::RangeSectionFragment::RangeBegin)
397+
CDAC_TYPE_FIELD(RangeSectionFragment, /*pointer*/, RangeEndOpen, cdac_data<RangeSectionMap>::RangeSectionFragment::RangeEndOpen)
398+
CDAC_TYPE_FIELD(RangeSectionFragment, /*pointer*/, RangeSection, cdac_data<RangeSectionMap>::RangeSectionFragment::RangeSection)
399+
CDAC_TYPE_FIELD(RangeSectionFragment, /*pointer*/, Next, cdac_data<RangeSectionMap>::RangeSectionFragment::Next)
400+
CDAC_TYPE_END(RangeSectionFragment)
401+
402+
CDAC_TYPE_BEGIN(RangeSection)
403+
CDAC_TYPE_INDETERMINATE(RangeSection)
404+
CDAC_TYPE_FIELD(RangeSection, /*pointer*/, RangeBegin, cdac_data<RangeSection>::RangeBegin)
405+
CDAC_TYPE_FIELD(RangeSection, /*pointer*/, RangeEndOpen, cdac_data<RangeSection>::RangeEndOpen)
406+
CDAC_TYPE_FIELD(RangeSection, /*pointer*/, NextForDelete, cdac_data<RangeSection>::NextForDelete)
407+
CDAC_TYPE_FIELD(RangeSection, /*pointer*/, JitManager, cdac_data<RangeSection>::JitManager)
408+
CDAC_TYPE_FIELD(RangeSection, /*int32_t*/, Flags, cdac_data<RangeSection>::Flags)
409+
CDAC_TYPE_FIELD(RangeSection, /*pointer*/, HeapList, cdac_data<RangeSection>::HeapList)
410+
CDAC_TYPE_FIELD(RangeSection, /*pointer*/, R2RModule, cdac_data<RangeSection>::R2RModule)
411+
CDAC_TYPE_END(RangeSection)
412+
413+
CDAC_TYPE_BEGIN(RealCodeHeader)
414+
CDAC_TYPE_INDETERMINATE(RealCodeHeader)
415+
CDAC_TYPE_FIELD(RealCodeHeader, /*pointer*/, MethodDesc, offsetof(RealCodeHeader, phdrMDesc))
416+
CDAC_TYPE_END(RealCodeHeader)
417+
418+
CDAC_TYPE_BEGIN(HeapList)
419+
CDAC_TYPE_FIELD(HeapList, /*pointer*/, Next, offsetof(HeapList, hpNext))
420+
CDAC_TYPE_FIELD(HeapList, /*pointer*/, StartAddress, offsetof(HeapList, startAddress))
421+
CDAC_TYPE_FIELD(HeapList, /*pointer*/, EndAddress, offsetof(HeapList, endAddress))
422+
CDAC_TYPE_FIELD(HeapList, /*pointer*/, MapBase, offsetof(HeapList, mapBase))
423+
CDAC_TYPE_FIELD(HeapList, /*pointer*/, HeaderMap, offsetof(HeapList, pHdrMap))
424+
CDAC_TYPE_END(HeapList)
425+
426+
CDAC_TYPE_BEGIN(ILCodeVersioningState)
427+
CDAC_TYPE_INDETERMINATE(ILCodeVersioningState)
428+
CDAC_TYPE_FIELD(ILCodeVersioningState, /*pointer*/, Node, cdac_data<ILCodeVersioningState>::Node)
429+
CDAC_TYPE_FIELD(ILCodeVersioningState, /*uint32*/, ActiveVersionKind, cdac_data<ILCodeVersioningState>::ActiveVersionKind)
430+
CDAC_TYPE_FIELD(ILCodeVersioningState, /*pointer*/, ActiveVersionNode, cdac_data<ILCodeVersioningState>::ActiveVersionNode)
431+
CDAC_TYPE_FIELD(ILCodeVersioningState, /*pointer*/, ActiveVersionModule, cdac_data<ILCodeVersioningState>::ActiveVersionModule)
432+
CDAC_TYPE_FIELD(ILCodeVersioningState, /*uint32*/, ActiveVersionMethodDef, cdac_data<ILCodeVersioningState>::ActiveVersionMethodDef)
433+
CDAC_TYPE_END(ILCodeVersioningState)
434+
435+
CDAC_TYPE_BEGIN(NativeCodeVersionNode)
436+
CDAC_TYPE_INDETERMINATE(NativeCodeVersionNode)
437+
CDAC_TYPE_FIELD(NativeCodeVersionNode, /*pointer*/, Next, cdac_data<NativeCodeVersionNode>::Next)
438+
CDAC_TYPE_FIELD(NativeCodeVersionNode, /*pointer*/, MethodDesc, cdac_data<NativeCodeVersionNode>::MethodDesc)
439+
CDAC_TYPE_FIELD(NativeCodeVersionNode, /*pointer*/, NativeCode, cdac_data<NativeCodeVersionNode>::NativeCode)
440+
CDAC_TYPE_END(NativeCodeVersionNode)
441+
442+
CDAC_TYPE_BEGIN(ProfControlBlock)
443+
CDAC_TYPE_FIELD(ProfControlBlock, /*uint64*/, GlobalEventMask, offsetof(ProfControlBlock, globalEventMask))
444+
CDAC_TYPE_END(ProfControlBlock)
445+
337446
CDAC_TYPES_END()
338447

339448
CDAC_GLOBALS_BEGIN()
@@ -363,6 +472,7 @@ CDAC_GLOBAL(DirectorySeparator, uint8, (uint8_t)DIRECTORY_SEPARATOR_CHAR_A)
363472
CDAC_GLOBAL(MethodDescAlignment, uint64, MethodDesc::ALIGNMENT)
364473
CDAC_GLOBAL(ObjectHeaderSize, uint64, OBJHEADER_SIZE)
365474
CDAC_GLOBAL(SyncBlockValueToObjectOffset, uint16, OBJHEADER_SIZE - cdac_data<ObjHeader>::SyncBlockValue)
475+
CDAC_GLOBAL(StubCodeBlockLast, uint8, STUB_CODE_BLOCK_LAST)
366476
CDAC_GLOBAL_POINTER(ArrayBoundsZero, cdac_data<ArrayBase>::ArrayBoundsZero)
367477
CDAC_GLOBAL_POINTER(ExceptionMethodTable, &::g_pExceptionClass)
368478
CDAC_GLOBAL_POINTER(FreeObjectMethodTable, &::g_pFreeObjectMethodTable)
@@ -372,6 +482,9 @@ CDAC_GLOBAL_POINTER(StringMethodTable, &::g_pStringClass)
372482
CDAC_GLOBAL_POINTER(SyncTableEntries, &::g_pSyncTable)
373483
CDAC_GLOBAL_POINTER(MiniMetaDataBuffAddress, &::g_MiniMetaDataBuffAddress)
374484
CDAC_GLOBAL_POINTER(MiniMetaDataBuffMaxSize, &::g_MiniMetaDataBuffMaxSize)
485+
CDAC_GLOBAL_POINTER(PrecodeMachineDescriptor, &::g_PrecodeMachineDescriptor)
486+
CDAC_GLOBAL_POINTER(ExecutionManagerCodeRangeMapAddress, cdac_data<ExecutionManager>::CodeRangeMapAddress)
487+
CDAC_GLOBAL_POINTER(ProfilerControlBlock, &::g_profControlBlock)
375488
CDAC_GLOBALS_END()
376489

377490
#undef CDAC_BASELINE

src/coreclr/vm/appdomain.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
#include "codeversion.h"
3737

38+
#include "cdacdata.h"
39+
3840
class BaseDomain;
3941
class SystemDomain;
4042
class AppDomain;

src/coreclr/vm/ceemain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ void EEStartupHelper()
625625

626626
// We cache the SystemInfo for anyone to use throughout the life of the EE.
627627
GetSystemInfo(&g_SystemInfo);
628+
PrecodeMachineDescriptor::Init();
628629

629630
// Set callbacks so that LoadStringRC knows which language our
630631
// threads are in so that it can return the proper localized string.

src/coreclr/vm/codeman.h

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,8 @@ class Range
555555
{
556556
return end;
557557
}
558+
559+
template<typename T> friend struct ::cdac_data;
558560
};
559561

560562
struct RangeSection
@@ -626,6 +628,19 @@ struct RangeSection
626628

627629

628630
RangeSection* _pRangeSectionNextForDelete = NULL; // Used for adding to the cleanup list
631+
632+
template<typename T> friend struct ::cdac_data;
633+
};
634+
635+
template<> struct cdac_data<RangeSection>
636+
{
637+
static constexpr size_t RangeBegin = offsetof(RangeSection, _range.begin);
638+
static constexpr size_t RangeEndOpen = offsetof(RangeSection, _range.end);
639+
static constexpr size_t NextForDelete = offsetof(RangeSection, _pRangeSectionNextForDelete);
640+
static constexpr size_t JitManager = offsetof(RangeSection, _pjit);
641+
static constexpr size_t Flags = offsetof(RangeSection, _flags);
642+
static constexpr size_t HeapList = offsetof(RangeSection, _pHeapList);
643+
static constexpr size_t R2RModule = offsetof(RangeSection, _pR2RModule);
629644
};
630645

631646
enum class RangeSectionLockState
@@ -835,7 +850,7 @@ class RangeSectionMap
835850
{
836851
// Upgrade to non-collectible
837852
#ifdef _DEBUG
838-
TADDR initialValue =
853+
TADDR initialValue =
839854
#endif
840855
InterlockedCompareExchangeT(&_ptr, ptr - 1, ptr);
841856
assert(initialValue == ptr || initialValue == (ptr - 1));
@@ -951,7 +966,7 @@ class RangeSectionMap
951966
auto levelNew = static_cast<decltype(&(outerLevel->VolatileLoad(NULL))[0])>(AllocateLevel());
952967
if (levelNew == NULL)
953968
return NULL;
954-
969+
955970
if (!outerLevel->Install(levelNew, collectible))
956971
{
957972
// Handle race where another thread grew the table
@@ -1017,7 +1032,7 @@ class RangeSectionMap
10171032
auto rangeSectionL3 = rangeSectionL3Ptr->VolatileLoadWithoutBarrier(pLockState);
10181033
if (rangeSectionL3 == NULL)
10191034
return NULL;
1020-
1035+
10211036
auto rangeSectionL2Ptr = &((*rangeSectionL3)[EffectiveBitsForLevel(address, 3)]);
10221037
if (level == 2)
10231038
return rangeSectionL2Ptr;
@@ -1071,7 +1086,7 @@ class RangeSectionMap
10711086

10721087
// Account for the range not starting at the beginning of a last level fragment
10731088
rangeSize += pRangeSection->_range.RangeStart() & (bytesAtLastLevel - 1);
1074-
1089+
10751090
uintptr_t fragmentCount = ((rangeSize - 1) / bytesAtLastLevel) + 1;
10761091
return fragmentCount;
10771092
}
@@ -1314,7 +1329,7 @@ class RangeSectionMap
13141329
else
13151330
{
13161331
// Since the fragment linked lists are sorted such that the collectible ones are always after the non-collectible ones, this should never happen.
1317-
assert(!seenCollectibleRangeList);
1332+
assert(!seenCollectibleRangeList);
13181333
}
13191334
#endif
13201335
entryInMapToUpdate = &(entryInMapToUpdate->VolatileLoadWithoutBarrier(pLockState))->pRangeSectionFragmentNext;
@@ -1355,7 +1370,7 @@ class RangeSectionMap
13551370

13561371
if (foundMeaningfulValue)
13571372
break;
1358-
1373+
13591374
// This level is completely empty. Free it, and then null out the pointer to it.
13601375
pointerToLevelData->Uninstall();
13611376
#if defined(__GNUC__)
@@ -1432,6 +1447,21 @@ class RangeSectionMap
14321447
}
14331448
#endif// DACCESS_COMPILE
14341449

1450+
template<typename T> friend struct ::cdac_data;
1451+
};
1452+
1453+
template<>
1454+
struct cdac_data<RangeSectionMap>
1455+
{
1456+
static constexpr size_t TopLevelData = offsetof(RangeSectionMap, _topLevelData);
1457+
1458+
struct RangeSectionFragment
1459+
{
1460+
static constexpr size_t RangeBegin = offsetof(RangeSectionMap::RangeSectionFragment, _range.begin);
1461+
static constexpr size_t RangeEndOpen = offsetof(RangeSectionMap::RangeSectionFragment, _range.end);
1462+
static constexpr size_t RangeSection = offsetof(RangeSectionMap::RangeSectionFragment, pRangeSection);
1463+
static constexpr size_t Next = offsetof(RangeSectionMap::RangeSectionFragment, pRangeSectionFragmentNext);
1464+
};
14351465
};
14361466

14371467
struct RangeSectionMapData
@@ -2246,8 +2276,18 @@ class ExecutionManager
22462276
JumpStubBlockHeader * m_pBlocks;
22472277
JumpStubTable m_Table;
22482278
};
2279+
2280+
template<typename T> friend struct ::cdac_data;
22492281
};
22502282

2283+
#ifndef DACCESS_COMPILE
2284+
template<>
2285+
struct cdac_data<ExecutionManager>
2286+
{
2287+
static constexpr void* const CodeRangeMapAddress = (void*)&ExecutionManager::g_codeRangeMap.Data[0];
2288+
};
2289+
#endif
2290+
22512291
inline CodeHeader * EEJitManager::GetCodeHeader(const METHODTOKEN& MethodToken)
22522292
{
22532293
LIMITED_METHOD_DAC_CONTRACT;
@@ -2552,6 +2592,8 @@ class EECodeInfo
25522592
// Simple helper to return a pointer to the UNWIND_INFO given the offset to the unwind info.
25532593
UNWIND_INFO * GetUnwindInfoHelper(ULONG unwindInfoOffset);
25542594
#endif // TARGET_AMD64
2595+
2596+
template<typename T> friend struct ::cdac_data;
25552597
};
25562598

25572599
#include "codeman.inl"

src/coreclr/vm/codeversion.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ class ILCodeVersion
248248
mdMethodDef m_methodDef;
249249
} m_synthetic;
250250
};
251+
252+
template<typename T> friend struct ::cdac_data;
253+
};
254+
255+
template<>
256+
struct cdac_data<ILCodeVersion>
257+
{
258+
// All fields are accessed via ILCodeVersioningState.m_activeVersion
251259
};
252260

253261

@@ -316,6 +324,16 @@ class NativeCodeVersionNode
316324
IsActiveChildFlag = 1
317325
};
318326
DWORD m_flags;
327+
328+
template<typename T> friend struct ::cdac_data;
329+
};
330+
331+
template<>
332+
struct cdac_data<NativeCodeVersionNode>
333+
{
334+
static constexpr size_t Next = offsetof(NativeCodeVersionNode, m_pNextMethodDescSibling);
335+
static constexpr size_t MethodDesc = offsetof(NativeCodeVersionNode, m_pMethodDesc);
336+
static constexpr size_t NativeCode = offsetof(NativeCodeVersionNode, m_pNativeCode);
319337
};
320338

321339
class NativeCodeVersionCollection
@@ -473,6 +491,15 @@ class MethodDescVersioningState
473491
BYTE m_flags;
474492
NativeCodeVersionId m_nextId;
475493
PTR_NativeCodeVersionNode m_pFirstVersionNode;
494+
495+
template<typename T> friend struct ::cdac_data;
496+
};
497+
498+
template<>
499+
struct cdac_data<MethodDescVersioningState>
500+
{
501+
static constexpr size_t NativeCodeVersionNode = offsetof(MethodDescVersioningState, m_pFirstVersionNode);
502+
static constexpr size_t Flags = offsetof(MethodDescVersioningState, m_flags);
476503
};
477504

478505
class ILCodeVersioningState
@@ -505,6 +532,18 @@ class ILCodeVersioningState
505532
PTR_ILCodeVersionNode m_pFirstVersionNode;
506533
PTR_Module m_pModule;
507534
mdMethodDef m_methodDef;
535+
536+
template<typename T> friend struct ::cdac_data;
537+
};
538+
539+
template<>
540+
struct cdac_data<ILCodeVersioningState>
541+
{
542+
static constexpr size_t Node = offsetof(ILCodeVersioningState, m_pFirstVersionNode);
543+
static constexpr size_t ActiveVersionKind = offsetof(ILCodeVersioningState, m_activeVersion.m_storageKind);
544+
static constexpr size_t ActiveVersionNode = offsetof(ILCodeVersioningState, m_activeVersion.m_pVersionNode);
545+
static constexpr size_t ActiveVersionModule = offsetof(ILCodeVersioningState, m_activeVersion.m_synthetic.m_pModule);
546+
static constexpr size_t ActiveVersionMethodDef = offsetof(ILCodeVersioningState, m_activeVersion.m_synthetic.m_methodDef);
508547
};
509548

510549
class CodeVersionManager

src/coreclr/vm/loaderallocator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
UINT64 LoaderAllocator::cLoaderAllocatorsCreated = 1;
1919

20-
LoaderAllocator::LoaderAllocator(bool collectible) :
20+
LoaderAllocator::LoaderAllocator(bool collectible) :
2121
m_stubPrecodeRangeList(STUB_CODE_BLOCK_STUBPRECODE, collectible),
2222
m_fixupPrecodeRangeList(STUB_CODE_BLOCK_FIXUPPRECODE, collectible)
2323
{
@@ -68,7 +68,7 @@ LoaderAllocator::LoaderAllocator(bool collectible) :
6868
m_pLastUsedCodeHeap = NULL;
6969
m_pLastUsedDynamicCodeHeap = NULL;
7070
m_pJumpStubCache = NULL;
71-
m_IsCollectible = collectible;
71+
m_IsCollectible = collectible ? 1 : 0;
7272

7373
m_pMarshalingData = NULL;
7474

0 commit comments

Comments
 (0)