Skip to content

Commit f37d389

Browse files
Delete unused bits of some headers (#97761)
1 parent ba4c0be commit f37d389

File tree

4 files changed

+1
-263
lines changed

4 files changed

+1
-263
lines changed

src/coreclr/nativeaot/Runtime/inc/MethodTable.h

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
class MethodTable;
1212
class TypeManager;
1313
struct TypeManagerHandle;
14-
struct EETypeRef;
15-
16-
#if !defined(USE_PORTABLE_HELPERS)
17-
#define SUPPORTS_WRITABLE_DATA 1
18-
#endif
1914

2015
//-------------------------------------------------------------------------------------------------
2116
// The subset of TypeFlags that Redhawk knows about at runtime
@@ -195,22 +190,11 @@ class MethodTable
195190
bool IsParameterizedType()
196191
{ return (GetKind() == ParameterizedEEType); }
197192

198-
bool IsGenericTypeDefinition()
199-
{ return (GetKind() == GenericTypeDefEEType); }
200-
201-
bool IsCanonical()
202-
{ return GetKind() == CanonicalEEType; }
203-
204193
bool IsInterface()
205194
{ return GetElementType() == ElementType_Interface; }
206195

207196
MethodTable * GetRelatedParameterType();
208197

209-
// A parameterized type shape less than SZARRAY_BASE_SIZE indicates that this is not
210-
// an array but some other parameterized type (see: ParameterizedTypeShapeConstants)
211-
// For arrays, this number uniquely captures both Sz/Md array flavor and rank.
212-
uint32_t GetParameterizedTypeShape() { return m_uBaseSize; }
213-
214198
bool IsValueType()
215199
{ return GetElementType() < ElementType_Class; }
216200

@@ -257,11 +241,6 @@ class MethodTable
257241
return (m_uFlags & HasPointersFlag) != 0;
258242
}
259243

260-
bool HasOptionalFields()
261-
{
262-
return (m_uFlags & OptionalFieldsFlag) != 0;
263-
}
264-
265244
// How many vtable slots are there?
266245
uint16_t GetNumVtableSlots()
267246
{ return m_usNumVtableSlots; }
@@ -270,13 +249,6 @@ class MethodTable
270249
uint16_t GetNumInterfaces()
271250
{ return m_usNumInterfaces; }
272251

273-
// Does this class (or its base classes) implement any interfaces?
274-
bool HasInterfaces()
275-
{ return GetNumInterfaces() != 0; }
276-
277-
bool IsGeneric()
278-
{ return (m_uFlags & IsGenericFlag) != 0; }
279-
280252
TypeManagerHandle* GetTypeManagerPtr();
281253

282254
// Used only by GC initialization, this initializes the MethodTable used to mark free entries in the GC heap.
@@ -285,11 +257,6 @@ class MethodTable
285257
// not query them and the rest of the runtime will never hold a reference to free object.
286258
inline void InitializeAsGcFreeType();
287259

288-
#ifdef DACCESS_COMPILE
289-
bool DacVerify();
290-
static bool DacVerifyWorker(MethodTable* pThis);
291-
#endif // DACCESS_COMPILE
292-
293260
// Mark or determine that a type is generic and one or more of it's type parameters is co- or
294261
// contra-variant. This only applies to interface and delegate types.
295262
bool HasGenericVariance()
@@ -298,16 +265,10 @@ class MethodTable
298265
EETypeElementType GetElementType()
299266
{ return (EETypeElementType)((m_uFlags & ElementTypeMask) >> ElementTypeShift); }
300267

301-
// Determine whether a type is an instantiation of Nullable<T>.
302-
bool IsNullable()
303-
{ return GetElementType() == ElementType_Nullable; }
304-
305268
// Determine whether a type was created by dynamic type loader
306269
bool IsDynamicType()
307270
{ return (m_uFlags & IsDynamicTypeFlag) != 0; }
308271

309-
uint32_t GetHashCode();
310-
311272
// Helper methods that deal with MethodTable topology (size and field layout). These are useful since as we
312273
// optimize for pay-for-play we increasingly want to customize exactly what goes into an MethodTable on a
313274
// per-type basis. The rules that govern this can be both complex and volatile and we risk sprinkling

src/coreclr/nativeaot/Runtime/inc/MethodTable.inl

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,6 @@
44
#ifndef __eetype_inl__
55
#define __eetype_inl__
66
//-----------------------------------------------------------------------------------------------------------
7-
inline uint32_t MethodTable::GetHashCode()
8-
{
9-
return m_uHashCode;
10-
}
11-
12-
#ifdef DACCESS_COMPILE
13-
inline bool MethodTable::DacVerify()
14-
{
15-
// Use a separate static worker because the worker validates
16-
// the whole chain of EETypes and we don't want to accidentally
17-
// answer questions from 'this' that should have come from the
18-
// 'current' MethodTable.
19-
return DacVerifyWorker(this);
20-
}
21-
// static
22-
inline bool MethodTable::DacVerifyWorker(MethodTable* pThis)
23-
{
24-
//*********************************************************************
25-
//**** ASSUMES MAX TYPE HIERARCHY DEPTH OF 1024 TYPES ****
26-
//*********************************************************************
27-
const int MAX_SANE_RELATED_TYPES = 1024;
28-
//*********************************************************************
29-
//**** ASSUMES MAX OF 200 INTERFACES IMPLEMENTED ON ANY GIVEN TYPE ****
30-
//*********************************************************************
31-
const int MAX_SANE_NUM_INSTANCES = 200;
32-
33-
34-
PTR_EEType pCurrentType = dac_cast<PTR_EEType>(pThis);
35-
for (int i = 0; i < MAX_SANE_RELATED_TYPES; i++)
36-
{
37-
// Verify interface map
38-
if (pCurrentType->GetNumInterfaces() > MAX_SANE_NUM_INSTANCES)
39-
return false;
40-
41-
// Validate the current type
42-
if (!pCurrentType->Validate(false))
43-
return false;
44-
45-
//
46-
// Now on to the next type in the hierarchy.
47-
//
48-
49-
pCurrentType = dac_cast<PTR_EEType>(reinterpret_cast<TADDR>(pCurrentType->m_RelatedType.m_pBaseType));
50-
51-
if (pCurrentType == NULL)
52-
break;
53-
}
54-
55-
if (pCurrentType != NULL)
56-
return false; // assume we found an infinite loop
57-
58-
return true;
59-
}
60-
#endif
61-
627
#if !defined(DACCESS_COMPILE)
638
inline PTR_UInt8 FollowRelativePointer(const int32_t* pDist)
649
{
@@ -107,40 +52,7 @@ __forceinline uint32_t MethodTable::GetFieldOffset(EETypeField eField)
10752
{
10853
return cbOffset;
10954
}
110-
cbOffset += relativeOrFullPointerOffset;
111-
112-
#if SUPPORTS_WRITABLE_DATA
113-
// Followed by writable data.
114-
if (eField == ETF_WritableData)
115-
{
116-
return cbOffset;
117-
}
118-
cbOffset += relativeOrFullPointerOffset;
119-
#endif
120-
121-
// Followed by the pointer to the finalizer method.
122-
if (eField == ETF_Finalizer)
123-
{
124-
ASSERT(HasFinalizer());
125-
return cbOffset;
126-
}
127-
if (HasFinalizer())
128-
cbOffset += relativeOrFullPointerOffset;
129-
130-
// Followed by the pointer to the optional fields.
131-
if (eField == ETF_OptionalFieldsPtr)
132-
{
133-
ASSERT(HasOptionalFields());
134-
return cbOffset;
135-
}
136-
if (HasOptionalFields())
137-
cbOffset += relativeOrFullPointerOffset;
138-
139-
// Followed by the pointer to the sealed virtual slots
140-
if (eField == ETF_SealedVirtualSlots)
141-
return cbOffset;
142-
143-
ASSERT(!"Decoding the rest requires rare flags");
55+
ASSERT(!"NYI");
14456

14557
return 0;
14658
}

src/coreclr/nativeaot/Runtime/inc/rhbinder.h

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -448,27 +448,6 @@ struct PInvokeTransitionFrame
448448
typedef DPTR(MethodTable) PTR_EEType;
449449
typedef DPTR(PTR_EEType) PTR_PTR_EEType;
450450

451-
struct EETypeRef
452-
{
453-
union
454-
{
455-
MethodTable * pEEType;
456-
MethodTable ** ppEEType;
457-
uint8_t * rawPtr;
458-
UIntTarget rawTargetPtr; // x86_amd64: keeps union big enough for target-platform pointer
459-
};
460-
461-
static const size_t DOUBLE_INDIR_FLAG = 1;
462-
463-
PTR_EEType GetValue()
464-
{
465-
if (dac_cast<TADDR>(rawTargetPtr) & DOUBLE_INDIR_FLAG)
466-
return *dac_cast<PTR_PTR_EEType>(rawTargetPtr - DOUBLE_INDIR_FLAG);
467-
else
468-
return dac_cast<PTR_EEType>(rawTargetPtr);
469-
}
470-
};
471-
472451
// Blobs are opaque data passed from the compiler, through the binder and into the native image. At runtime we
473452
// provide a simple API to retrieve these blobs (they're keyed by a simple integer ID). Blobs are passed to
474453
// the binder from the compiler and stored in native images by the binder in a sequential stream, each blob
@@ -481,15 +460,6 @@ struct BlobHeader
481460
uint32_t m_size; // Size of the individual blob excluding this header (DWORD aligned)
482461
};
483462

484-
#ifdef FEATURE_CUSTOM_IMPORTS
485-
struct CustomImportDescriptor
486-
{
487-
uint32_t RvaEATAddr; // RVA of the indirection cell of the address of the EAT for that module
488-
uint32_t RvaIAT; // RVA of IAT array for that module
489-
uint32_t CountIAT; // Count of entries in the above array
490-
};
491-
#endif // FEATURE_CUSTOM_IMPORTS
492-
493463
enum RhEHClauseKind
494464
{
495465
RH_EH_CLAUSE_TYPED = 0,
@@ -500,34 +470,3 @@ enum RhEHClauseKind
500470

501471
#define RH_EH_CLAUSE_TYPED_INDIRECT RH_EH_CLAUSE_UNUSED
502472

503-
// mapping of cold code blocks to the corresponding hot entry point RVA
504-
// format is a as follows:
505-
// -------------------
506-
// | subSectionCount | # of subsections, where each subsection has a run of hot bodies
507-
// ------------------- followed by a run of cold bodies
508-
// | hotMethodCount | # of hot bodies in subsection
509-
// | coldMethodCount | # of cold bodies in subsection
510-
// -------------------
511-
// ... possibly repeated on ARM
512-
// -------------------
513-
// | hotRVA #1 | RVA of the hot entry point corresponding to the 1st cold body
514-
// | hotRVA #2 | RVA of the hot entry point corresponding to the 2nd cold body
515-
// ... one entry for each cold body containing the corresponding hot entry point
516-
517-
// number of hot and cold bodies in a subsection of code
518-
// in x86 and x64 there's only one subsection, on ARM there may be several
519-
// for large modules with > 16 MB of code
520-
struct SubSectionDesc
521-
{
522-
uint32_t hotMethodCount;
523-
uint32_t coldMethodCount;
524-
};
525-
526-
// this is the structure describing the cold to hot mapping info
527-
struct ColdToHotMapping
528-
{
529-
uint32_t subSectionCount;
530-
SubSectionDesc subSection[/*subSectionCount*/1];
531-
// UINT32 hotRVAofColdMethod[/*coldMethodCount*/];
532-
};
533-

src/coreclr/nativeaot/Runtime/inc/varint.h

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -16,80 +16,6 @@ class VarInt
1616
return result;
1717
}
1818

19-
//
20-
// WARNING: This method returns the negative of the length of the value that it just skipped!
21-
//
22-
// This was helpful in the GC info scan loop because it allowed us to always skip past unsigned values in
23-
// the body of the loop. At the end of loop, we use this negative sign to distinguish between two cases
24-
// and that allows us to decode the unsigned value that we need outside of the loop. Note that we encode
25-
// the negatives in the s_negLengthTable to avoid any additional operations in the body of the GC scan
26-
// loop.
27-
//
28-
static intptr_t SkipUnsigned(PTR_UInt8 & pbEncoding)
29-
{
30-
uintptr_t lengthBits = *pbEncoding & 0x0F;
31-
size_t negLength = s_negLengthTab[lengthBits];
32-
pbEncoding -= negLength;
33-
return negLength;
34-
}
35-
36-
static uintptr_t WriteUnsigned(PTR_UInt8 pbDest, uint32_t value)
37-
{
38-
if (pbDest == NULL)
39-
{
40-
if (value < 128)
41-
return 1;
42-
43-
if (value < 128*128)
44-
return 2;
45-
46-
if (value < 128*128*128)
47-
return 3;
48-
49-
if (value < 128*128*128*128)
50-
return 4;
51-
52-
return 5;
53-
}
54-
55-
if (value < 128)
56-
{
57-
*pbDest++ = (uint8_t)(value*2 + 0);
58-
return 1;
59-
}
60-
61-
if (value < 128*128)
62-
{
63-
*pbDest++ = (uint8_t)(value*4 + 1);
64-
*pbDest++ = (uint8_t)(value >> 6);
65-
return 2;
66-
}
67-
68-
if (value < 128*128*128)
69-
{
70-
*pbDest++ = (uint8_t)(value*8 + 3);
71-
*pbDest++ = (uint8_t)(value >> 5);
72-
*pbDest++ = (uint8_t)(value >> 13);
73-
return 3;
74-
}
75-
76-
if (value < 128*128*128*128)
77-
{
78-
*pbDest++ = (uint8_t)(value*16 + 7);
79-
*pbDest++ = (uint8_t)(value >> 4);
80-
*pbDest++ = (uint8_t)(value >> 12);
81-
*pbDest++ = (uint8_t)(value >> 20);
82-
return 4;
83-
}
84-
85-
*pbDest++ = 15;
86-
*pbDest++ = (uint8_t)value;
87-
*pbDest++ = (uint8_t)(value >> 8);
88-
*pbDest++ = (uint8_t)(value >> 16);
89-
*pbDest++ = (uint8_t)(value >> 24);
90-
return 5;
91-
}
92-
9319
private:
9420
static int8_t s_negLengthTab[16];
9521
static uint8_t s_shiftTab[16];

0 commit comments

Comments
 (0)