Skip to content

Commit

Permalink
Rename cdac_offsets to cdac_data (dotnet#105657)
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung authored Jul 30, 2024
1 parent 122d97b commit 18eba09
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 148 deletions.
158 changes: 79 additions & 79 deletions src/coreclr/debug/runtimeinfo/datadescriptor.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/coreclr/inc/slist.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef _H_SLIST_
#define _H_SLIST_

#include "cdacoffsets.h"
#include "cdacdata.h"

//------------------------------------------------------------------
// struct SLink, to use a singly linked list
Expand Down Expand Up @@ -120,7 +120,7 @@ class SList
PTR_SLink m_pHead;
PTR_SLink m_pTail;

template<typename U> friend struct ::cdac_offsets;
template<typename U> friend struct ::cdac_data;

// get the list node within the object
static SLink* GetLink (T* pLink)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ set(VM_HEADERS_WKS
callhelpers.h
callsiteinspect.h
callconvbuilder.hpp
cdacoffsets.h
cdacdata.h
ceemain.h
clrconfignative.h
clrex.h
Expand Down
25 changes: 25 additions & 0 deletions src/coreclr/vm/cdacdata.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#ifndef CDACDATA_H__
#define CDACDATA_H__

// 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:
//
// template<typename T> friend struct ::cdac_data;
//
// and provide a specialization cdac_data<C> with constexpr members exposing the information.
// For example, if the offset of field F is required:
//
// template<> struct cdac_data<C> {
// static constexpr size_t F_Offset = offsetof(C, F);
// };
template<typename T>
struct cdac_data
{
};

#endif// CDACDATA_H__
24 changes: 0 additions & 24 deletions src/coreclr/vm/cdacoffsets.h

This file was deleted.

8 changes: 4 additions & 4 deletions src/coreclr/vm/ceeload.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ struct DynamicMetadata
{
uint32_t Size;
BYTE Data[0];
template<typename T> friend struct ::cdac_offsets;
template<typename T> friend struct ::cdac_data;
};

template<>
struct cdac_offsets<DynamicMetadata>
struct cdac_data<DynamicMetadata>
{
static constexpr size_t Size = offsetof(DynamicMetadata, Size);
static constexpr size_t Data = offsetof(DynamicMetadata, Data);
Expand Down Expand Up @@ -1629,11 +1629,11 @@ class Module : public ModuleBase
uint32_t GetNativeMetadataAssemblyCount();
#endif // !defined(DACCESS_COMPILE)

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

template<>
struct cdac_offsets<Module>
struct cdac_data<Module>
{
static constexpr size_t Assembly = offsetof(Module, m_pAssembly);
static constexpr size_t Base = offsetof(Module, m_baseAddress);
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/vm/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -1798,10 +1798,10 @@ class EEClass // DO NOT CREATE A NEW EEClass USING NEW!
}
#endif // !DACCESS_COMPILE

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

template<> struct cdac_offsets<EEClass>
template<> struct cdac_data<EEClass>
{
static constexpr size_t InternalCorElementType = offsetof(EEClass, m_NormType);
static constexpr size_t MethodTable = offsetof(EEClass, m_pMethodTable);
Expand Down Expand Up @@ -1997,10 +1997,10 @@ class ArrayClass : public EEClass
BOOL fForStubAsIL
);

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

template<> struct cdac_offsets<ArrayClass>
template<> struct cdac_data<ArrayClass>
{
static constexpr size_t Rank = offsetof(ArrayClass, m_rank);
};
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/exstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DebuggerExState;
class EHClauseInfo;

#include "exceptionhandling.h"
#include "cdacoffsets.h"
#include "cdacdata.h"

#if !defined(FEATURE_EH_FUNCLETS)
// ExInfo contains definitions for 32bit
Expand Down 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_offsets;
template<typename T> friend struct ::cdac_data;

#ifdef FEATURE_EH_FUNCLETS
friend class ExceptionTracker;
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/vm/method.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class MethodDesc
pamTracker = NULL;
}

// If EnsureTemporaryEntryPointCore is called, then
// If EnsureTemporaryEntryPointCore is called, then
// both GetTemporaryEntryPointIfExists and GetSlot()
// are guaranteed to return a NON-NULL PCODE.
EnsureTemporaryEntryPointCore(pamTracker);
Expand Down Expand Up @@ -316,7 +316,7 @@ class MethodDesc

Precode* GetOrCreatePrecode();
void MarkPrecodeAsStableEntrypoint();


// Given a code address return back the MethodDesc whenever possible
//
Expand Down Expand Up @@ -1909,10 +1909,10 @@ class MethodDesc
static void Init();
#endif

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

template<> struct cdac_offsets<MethodDesc>
template<> struct cdac_data<MethodDesc>
{
static constexpr size_t ChunkIndex = offsetof(MethodDesc, m_chunkIndex);
static constexpr size_t Slot = offsetof(MethodDesc, m_wSlotNumber);
Expand Down Expand Up @@ -2338,11 +2338,11 @@ class MethodDescChunk

// Followed by array of method descs...

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

template<>
struct cdac_offsets<MethodDescChunk>
struct cdac_data<MethodDescChunk>
{
static constexpr size_t MethodTable = offsetof(MethodDescChunk, m_methodTable);
static constexpr size_t Next = offsetof(MethodDescChunk, m_next);
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/vm/methodtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ struct GenericsDictInfo

// Number of type parameters (NOT including those of superclasses).
WORD m_wNumTyPars;
template<typename T> friend struct ::cdac_offsets;
template<typename T> friend struct ::cdac_data;
}; // struct GenericsDictInfo
typedef DPTR(GenericsDictInfo) PTR_GenericsDictInfo;

template<>
struct cdac_offsets<GenericsDictInfo>
struct cdac_data<GenericsDictInfo>
{
static constexpr size_t NumTypeArgs = offsetof(GenericsDictInfo, m_wNumTyPars);
};
Expand Down Expand Up @@ -4029,10 +4029,10 @@ public :

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

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

template<> struct cdac_offsets<MethodTable>
template<> struct cdac_data<MethodTable>
{
static constexpr size_t MTFlags = offsetof(MethodTable, m_dwFlags);
static constexpr size_t BaseSize = offsetof(MethodTable, m_BaseSize);
Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/vm/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,11 @@ class Object
private:
VOID ValidateInner(BOOL bDeep, BOOL bVerifyNextHeader, BOOL bVerifySyncBlock);

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

template<>
struct cdac_offsets<Object>
struct cdac_data<Object>
{
static constexpr size_t m_pMethTab = offsetof(Object, m_pMethTab);
};
Expand Down Expand Up @@ -639,16 +639,16 @@ class ArrayBase : public Object
inline static unsigned GetBoundsOffset(MethodTable* pMT);
inline static unsigned GetLowerBoundsOffset(MethodTable* pMT);

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

#ifndef DACCESS_COMPILE
template<>
struct cdac_offsets<ArrayBase>
struct cdac_data<ArrayBase>
{
static constexpr size_t m_NumComponents = offsetof(ArrayBase, m_NumComponents);

static constexpr INT32* s_arrayBoundsZero = &ArrayBase::s_arrayBoundsZero;
static constexpr INT32* ArrayBoundsZero = &ArrayBase::s_arrayBoundsZero;
};
#endif

Expand Down Expand Up @@ -951,11 +951,11 @@ class StringObject : public Object
static STRINGREF* EmptyStringRefPtr;
static bool EmptyStringIsFrozen;

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

template<>
struct cdac_offsets<StringObject>
struct cdac_data<StringObject>
{
static constexpr size_t m_FirstChar = offsetof(StringObject, m_FirstChar);
static constexpr size_t m_StringLength = offsetof(StringObject, m_StringLength);
Expand Down Expand Up @@ -2385,11 +2385,11 @@ class ExceptionObject : public Object
INT32 _xcode;
INT32 _HResult;

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

template<>
struct cdac_offsets<ExceptionObject>
struct cdac_data<ExceptionObject>
{
static constexpr size_t _message = offsetof(ExceptionObject, _message);
static constexpr size_t _innerException = offsetof(ExceptionObject, _innerException);
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
#include "gchandleutilities.h"
#include "gcinfotypes.h"
#include <clrhost.h>
#include "cdacoffsets.h"
#include "cdacdata.h"

class Thread;
class ThreadStore;
Expand Down Expand Up @@ -3966,11 +3966,11 @@ class Thread
private:
bool m_hasPendingActivation;

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

template<>
struct cdac_offsets<Thread>
struct cdac_data<Thread>
{
static constexpr size_t Id = offsetof(Thread, m_ThreadId);
static constexpr size_t OSId = offsetof(Thread, m_OSThreadId);
Expand Down Expand Up @@ -4248,11 +4248,11 @@ class ThreadStore
bool ShouldTriggerGCForDeadThreads();
void TriggerGCForDeadThreadsIfNecessary();

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

template<>
struct cdac_offsets<ThreadStore>
struct cdac_data<ThreadStore>
{
static constexpr size_t FirstThreadLink = offsetof(ThreadStore, m_ThreadList) + offsetof(ThreadList, m_link);
static constexpr size_t ThreadCount = offsetof(ThreadStore, m_ThreadCount);
Expand Down
16 changes: 8 additions & 8 deletions src/coreclr/vm/typedesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ class TypeDesc

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

template<>
struct cdac_offsets<TypeDesc>
struct cdac_data<TypeDesc>
{
static constexpr size_t TypeAndFlags = offsetof(TypeDesc, m_typeAndFlags);
};
Expand Down Expand Up @@ -269,11 +269,11 @@ class ParamTypeDesc : public TypeDesc {

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

template<>
struct cdac_offsets<ParamTypeDesc>
struct cdac_data<ParamTypeDesc>
{
static constexpr size_t TypeArg = offsetof(ParamTypeDesc, m_Arg);
};
Expand Down Expand Up @@ -395,11 +395,11 @@ class TypeVarTypeDesc : public TypeDesc
// index within declaring type or method, numbered from zero
unsigned int m_index;

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

template<>
struct cdac_offsets<TypeVarTypeDesc>
struct cdac_data<TypeVarTypeDesc>
{
static constexpr size_t Module = offsetof(TypeVarTypeDesc, m_pModule);
static constexpr size_t Token = offsetof(TypeVarTypeDesc, m_token);
Expand Down Expand Up @@ -490,11 +490,11 @@ class FnPtrTypeDesc : public TypeDesc
// Return type first, then argument types
TypeHandle m_RetAndArgTypes[1];

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

template<>
struct cdac_offsets<FnPtrTypeDesc>
struct cdac_data<FnPtrTypeDesc>
{
static constexpr size_t NumArgs = offsetof(FnPtrTypeDesc, m_NumArgs);
static constexpr size_t RetAndArgTypes = offsetof(FnPtrTypeDesc, m_RetAndArgTypes);
Expand Down

0 comments on commit 18eba09

Please sign in to comment.