Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/inc/slist.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class SList
PTR_SLink m_pHead;
PTR_SLink m_pTail;

// as a generic data structure, friend to all specializations of cdac_data
template<typename U> friend struct ::cdac_data;

// get the list node within the object
Expand Down
21 changes: 14 additions & 7 deletions src/coreclr/vm/cdacdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@
// See datadescriptor.h
//
// This struct enables exposing information that is private to a class to the cDAC. For example,
// if class C has private information that must be provided, declare cdac_data<T> as a friend:
// if class C has private information that must be provided, declare cdac_data<D> as a friend of C
// where D is the specialization of cdac_data that will expose the information. Then provide a
// specialization cdac_data<D> with constexpr members exposing the information.
//
// template<typename T> friend struct ::cdac_data;
// Note: in the common case, type D will be type C.
//
// and provide a specialization cdac_data<C> with constexpr members exposing the information.
// For example, if the offset of field F is required:
// For example, if the offset of field F in class C is required:
//
// class C {
// private:
// int F;
// friend struct ::cdac_data<C>;
// };
// template<> struct cdac_data<C> {
// static constexpr size_t F_Offset = offsetof(C, F);
// };
//
// template<> struct cdac_data<C> {
// static constexpr size_t F_Offset = offsetof(C, F);
// };
template<typename T>
struct cdac_data
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/ceeload.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct DynamicMetadata
{
uint32_t Size;
BYTE Data[0];
template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<DynamicMetadata>;
};

template<>
Expand Down Expand Up @@ -1634,7 +1634,7 @@ class Module : public ModuleBase
uint32_t GetNativeMetadataAssemblyCount();
#endif // !defined(DACCESS_COMPILE)

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<Module>;
};

template<>
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ class EEClass // DO NOT CREATE A NEW EEClass USING NEW!
}
#endif // !DACCESS_COMPILE

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<EEClass>;
};

template<> struct cdac_data<EEClass>
Expand Down Expand Up @@ -1974,7 +1974,7 @@ class ArrayClass : public EEClass
BOOL fForStubAsIL
);

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<ArrayClass>;
};

template<> struct cdac_data<ArrayClass>
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/exstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ThreadExceptionState
// ExceptionTracker or the ExInfo as appropriate for the platform
friend class ProfToEEInterfaceImpl;

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<Thread>;

#ifdef FEATURE_EH_FUNCLETS
friend class ExceptionTracker;
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/vm/method.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ class MethodDesc
static void Init();
#endif

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<MethodDesc>;
};

template<> struct cdac_data<MethodDesc>
Expand Down Expand Up @@ -2349,7 +2349,7 @@ class MethodDescChunk

// Followed by array of method descs...

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<MethodDescChunk>;
};

template<>
Expand Down Expand Up @@ -2436,7 +2436,7 @@ class StoredSigMethodDesc : public MethodDesc
#ifdef DACCESS_COMPILE
void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
#endif
template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<StoredSigMethodDesc>;
};

template<>
Expand Down Expand Up @@ -2694,7 +2694,7 @@ class DynamicMethodDesc : public StoredSigMethodDesc
// following implementations defined in DynamicMethod.cpp
//
void Destroy();
template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<DynamicMethodDesc>;
};

template<>
Expand Down Expand Up @@ -3453,7 +3453,7 @@ class InstantiatedMethodDesc final : public MethodDesc
MethodDesc* pSharedMDescForStub,
Instantiation methodInst,
BOOL getSharedNotStub);
template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<InstantiatedMethodDesc>;
};

template<> struct cdac_data<InstantiatedMethodDesc>
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/methodtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -3980,7 +3980,7 @@ public :

static void GetStaticsOffsets(StaticsOffsetType staticsOffsetType, bool fGenericsStatics, uint32_t *dwGCOffset, uint32_t *dwNonGCOffset);

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<MethodTable>;
}; // class MethodTable

template<> struct cdac_data<MethodTable>
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/vm/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class Object
private:
VOID ValidateInner(BOOL bDeep, BOOL bVerifyNextHeader, BOOL bVerifySyncBlock);

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<Object>;
};

template<>
Expand Down Expand Up @@ -638,7 +638,7 @@ class ArrayBase : public Object
inline static unsigned GetBoundsOffset(MethodTable* pMT);
inline static unsigned GetLowerBoundsOffset(MethodTable* pMT);

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<ArrayBase>;
};

#ifndef DACCESS_COMPILE
Expand Down Expand Up @@ -950,7 +950,7 @@ class StringObject : public Object
static STRINGREF* EmptyStringRefPtr;
static bool EmptyStringIsFrozen;

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<StringObject>;
};

template<>
Expand Down Expand Up @@ -2437,7 +2437,7 @@ class ExceptionObject : public Object
INT32 _xcode;
INT32 _HResult;

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<ExceptionObject>;
};

template<>
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/vm/syncblk.h
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ class InteropSyncBlockInfo
BYTE m_taggedAlloc[2 * sizeof(void*)];
#endif // FEATURE_OBJCMARSHAL

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<InteropSyncBlockInfo>;
};

template<>
Expand Down Expand Up @@ -1286,7 +1286,7 @@ class SyncBlock
}
#endif // defined(ENABLE_CONTRACTS_IMPL)

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<SyncBlock>;
};

template<>
Expand Down Expand Up @@ -1674,7 +1674,7 @@ class ObjHeader

BOOL Validate (BOOL bVerifySyncBlkIndex = TRUE);

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<ObjHeader>;
};

template<>
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -3965,7 +3965,7 @@ class Thread
private:
bool m_hasPendingActivation;

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<Thread>;
};

template<>
Expand Down Expand Up @@ -4247,7 +4247,7 @@ class ThreadStore
bool ShouldTriggerGCForDeadThreads();
void TriggerGCForDeadThreadsIfNecessary();

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<ThreadStore>;
};

template<>
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/vm/typedesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class TypeDesc

// internal RuntimeType object handle
RUNTIMETYPEHANDLE m_hExposedClassObject;
template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<TypeDesc>;
};

template<>
Expand Down Expand Up @@ -269,7 +269,7 @@ class ParamTypeDesc : public TypeDesc {

// The type that is being modified
TypeHandle m_Arg;
template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<ParamTypeDesc>;
};

template<>
Expand Down Expand Up @@ -395,7 +395,7 @@ class TypeVarTypeDesc : public TypeDesc
// index within declaring type or method, numbered from zero
unsigned int m_index;

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<TypeVarTypeDesc>;
};

template<>
Expand Down Expand Up @@ -495,7 +495,7 @@ class FnPtrTypeDesc : public TypeDesc
// Return type first, then argument types
TypeHandle m_RetAndArgTypes[1];

template<typename T> friend struct ::cdac_data;
friend struct ::cdac_data<FnPtrTypeDesc>;
}; // class FnPtrTypeDesc

template<>
Expand Down