Skip to content

Commit 7a08e67

Browse files
Collect all MethodDesc fields in one place (#101565)
* Collect all MethodDesc fields in one place * Change enum name. * Remove irrelevant macro - METHOD_MAX_RVA.
1 parent a08ed38 commit 7a08e67

File tree

6 files changed

+80
-110
lines changed

6 files changed

+80
-110
lines changed

src/coreclr/vm/amd64/asmconstants.h

-3
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,6 @@ ASMCONSTANTS_C_ASSERT(OFFSETOF__LazyMachState__m_CaptureRip
278278
ASMCONSTANTS_C_ASSERT(OFFSETOF__LazyMachState__m_CaptureRsp
279279
== offsetof(LazyMachState, m_CaptureRsp));
280280

281-
#define OFFSETOF__MethodDesc__m_wFlags DBG_FRE(0x2E, 0x06)
282-
ASMCONSTANTS_C_ASSERT(OFFSETOF__MethodDesc__m_wFlags == offsetof(MethodDesc, m_wFlags));
283-
284281
#define OFFSETOF__VASigCookie__pNDirectILStub 0x8
285282
ASMCONSTANTS_C_ASSERT(OFFSETOF__VASigCookie__pNDirectILStub
286283
== offsetof(VASigCookie, pNDirectILStub));

src/coreclr/vm/arm/asmconstants.h

-7
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,6 @@ ASMCONSTANTS_C_ASSERT(SIZEOF__FloatArgumentRegisters == sizeof(FloatArgumentRegi
114114
#define ASM_ENREGISTERED_RETURNTYPE_MAXSIZE 0x20
115115
ASMCONSTANTS_C_ASSERT(ASM_ENREGISTERED_RETURNTYPE_MAXSIZE == ENREGISTERED_RETURNTYPE_MAXSIZE)
116116

117-
118-
#define MethodDesc__m_wFlags DBG_FRE(0x1A, 0x06)
119-
ASMCONSTANTS_C_ASSERT(MethodDesc__m_wFlags == offsetof(MethodDesc, m_wFlags))
120-
121-
#define MethodDesc__mdcClassification 0x7
122-
ASMCONSTANTS_C_ASSERT(MethodDesc__mdcClassification == mdcClassification)
123-
124117
#ifdef FEATURE_COMINTEROP
125118

126119
#define Stub__m_pCode DBG_FRE(0x10, 0x0c)

src/coreclr/vm/classcompat.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ VOID MethodTableBuilder::BuildInteropVTable_PlaceMembers(
869869
bmtMethod->ppMethodDescList[i] = pNewMD;
870870

871871
// Make sure that fcalls have a 0 rva. This is assumed by the prejit fixup logic
872-
_ASSERTE(((Classification & ~mdcMethodImpl) != mcFCall) || dwDescrOffset == 0);
872+
_ASSERTE(((Classification & ~mdfMethodImpl) != mcFCall) || dwDescrOffset == 0);
873873

874874
// Non-virtual method
875875
if (IsMdStatic(dwMemberAttrs) ||
@@ -938,7 +938,7 @@ VOID MethodTableBuilder::BuildInteropVTable_PlaceMembers(
938938
}
939939
}
940940

941-
if (Classification & mdcMethodImpl)
941+
if (Classification & mdfMethodImpl)
942942
{ // If this method serves as the BODY of a MethodImpl specification, then
943943
// we should iterate all the MethodImpl's for this class and see just how many
944944
// of them this method participates in as the BODY.
@@ -2797,7 +2797,7 @@ VOID MethodTableBuilder::EnumerateClassMethods()
27972797
}
27982798

27992799
// Generic methods should always be mcInstantiated
2800-
if (!((numGenericMethodArgs == 0) || ((Classification & mdcClassification) == mcInstantiated)))
2800+
if (!((numGenericMethodArgs == 0) || ((Classification & mdfClassification) == mcInstantiated)))
28012801
{
28022802
BuildMethodTableThrowException(BFA_GENERIC_METHODS_INST);
28032803
}
@@ -2806,7 +2806,7 @@ VOID MethodTableBuilder::EnumerateClassMethods()
28062806
// from the overrides.
28072807
for(DWORD impls = 0; impls < bmtMethodImpl->dwNumberMethodImpls; impls++) {
28082808
if ((bmtMethodImpl->rgMethodImplTokens[impls].methodBody == tok) && !IsMdStatic(dwMemberAttrs)) {
2809-
Classification |= mdcMethodImpl;
2809+
Classification |= mdfMethodImpl;
28102810
break;
28112811
}
28122812
}
@@ -2830,7 +2830,7 @@ VOID MethodTableBuilder::EnumerateClassMethods()
28302830

28312831
// Set the index into the storage locations
28322832
BYTE impl;
2833-
if (Classification & mdcMethodImpl)
2833+
if (Classification & mdfMethodImpl)
28342834
{
28352835
impl = METHOD_IMPL;
28362836
}
@@ -2840,25 +2840,25 @@ VOID MethodTableBuilder::EnumerateClassMethods()
28402840
}
28412841

28422842
BYTE type;
2843-
if ((Classification & mdcClassification) == mcNDirect)
2843+
if ((Classification & mdfClassification) == mcNDirect)
28442844
{
28452845
type = METHOD_TYPE_NDIRECT;
28462846
}
2847-
else if ((Classification & mdcClassification) == mcFCall)
2847+
else if ((Classification & mdfClassification) == mcFCall)
28482848
{
28492849
type = METHOD_TYPE_FCALL;
28502850
}
2851-
else if ((Classification & mdcClassification) == mcEEImpl)
2851+
else if ((Classification & mdfClassification) == mcEEImpl)
28522852
{
28532853
type = METHOD_TYPE_EEIMPL;
28542854
}
28552855
#ifdef FEATURE_COMINTEROP
2856-
else if ((Classification & mdcClassification) == mcComInterop)
2856+
else if ((Classification & mdfClassification) == mcComInterop)
28572857
{
28582858
type = METHOD_TYPE_INTEROP;
28592859
}
28602860
#endif // FEATURE_COMINTEROP
2861-
else if ((Classification & mdcClassification) == mcInstantiated)
2861+
else if ((Classification & mdfClassification) == mcInstantiated)
28622862
{
28632863
type = METHOD_TYPE_INSTANTIATED;
28642864
}

src/coreclr/vm/i386/asmconstants.h

-7
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,6 @@ ASMCONSTANTS_C_ASSERT(OFFSETOF__FrameHandlerExRecord__m_pEntryFrame == offsetof(
233233

234234
#endif
235235

236-
237-
#define MethodDesc_m_wFlags DBG_FRE(0x1a, 0x06)
238-
ASMCONSTANTS_C_ASSERT(MethodDesc_m_wFlags == offsetof(MethodDesc, m_wFlags))
239-
240-
#define MethodDesc_mdcClassification 7
241-
ASMCONSTANTS_C_ASSERT(MethodDesc_mdcClassification == mdcClassification)
242-
243236
#define ComPlusCallMethodDesc__m_pComPlusCallInfo DBG_FRE(0x1C, 0x8)
244237
ASMCONSTANTS_C_ASSERT(ComPlusCallMethodDesc__m_pComPlusCallInfo == offsetof(ComPlusCallMethodDesc, m_pComPlusCallInfo))
245238

src/coreclr/vm/method.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ SIZE_T MethodDesc::SizeOf()
120120
LIMITED_METHOD_DAC_CONTRACT;
121121

122122
SIZE_T size = s_ClassificationSizeTable[m_wFlags &
123-
(mdcClassification
124-
| mdcHasNonVtableSlot
125-
| mdcMethodImpl
126-
| mdcHasNativeCodeSlot)];
123+
(mdfClassification
124+
| mdfHasNonVtableSlot
125+
| mdfMethodImpl
126+
| mdfHasNativeCodeSlot)];
127127

128128
return size;
129129
}
@@ -946,7 +946,7 @@ PTR_PCODE MethodDesc::GetAddrOfNativeCodeSlot()
946946

947947
_ASSERTE(HasNativeCodeSlot());
948948

949-
SIZE_T size = s_ClassificationSizeTable[m_wFlags & (mdcClassification | mdcHasNonVtableSlot | mdcMethodImpl)];
949+
SIZE_T size = s_ClassificationSizeTable[m_wFlags & (mdfClassification | mdfHasNonVtableSlot | mdfMethodImpl)];
950950

951951
return (PTR_PCODE)(dac_cast<TADDR>(this) + size);
952952
}
@@ -2252,7 +2252,7 @@ MethodImpl *MethodDesc::GetMethodImpl()
22522252
}
22532253
CONTRACTL_END
22542254

2255-
SIZE_T size = s_ClassificationSizeTable[m_wFlags & (mdcClassification | mdcHasNonVtableSlot)];
2255+
SIZE_T size = s_ClassificationSizeTable[m_wFlags & (mdfClassification | mdfHasNonVtableSlot)];
22562256

22572257
return PTR_MethodImpl(dac_cast<TADDR>(this) + size);
22582258
}

0 commit comments

Comments
 (0)