Skip to content

Delete unused bits of some headers #97761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2024
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
39 changes: 0 additions & 39 deletions src/coreclr/nativeaot/Runtime/inc/MethodTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
class MethodTable;
class TypeManager;
struct TypeManagerHandle;
struct EETypeRef;

#if !defined(USE_PORTABLE_HELPERS)
#define SUPPORTS_WRITABLE_DATA 1
#endif

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

bool IsGenericTypeDefinition()
{ return (GetKind() == GenericTypeDefEEType); }

bool IsCanonical()
{ return GetKind() == CanonicalEEType; }

bool IsInterface()
{ return GetElementType() == ElementType_Interface; }

MethodTable * GetRelatedParameterType();

// A parameterized type shape less than SZARRAY_BASE_SIZE indicates that this is not
// an array but some other parameterized type (see: ParameterizedTypeShapeConstants)
// For arrays, this number uniquely captures both Sz/Md array flavor and rank.
uint32_t GetParameterizedTypeShape() { return m_uBaseSize; }

bool IsValueType()
{ return GetElementType() < ElementType_Class; }

Expand Down Expand Up @@ -257,11 +241,6 @@ class MethodTable
return (m_uFlags & HasPointersFlag) != 0;
}

bool HasOptionalFields()
{
return (m_uFlags & OptionalFieldsFlag) != 0;
}

// How many vtable slots are there?
uint16_t GetNumVtableSlots()
{ return m_usNumVtableSlots; }
Expand All @@ -270,13 +249,6 @@ class MethodTable
uint16_t GetNumInterfaces()
{ return m_usNumInterfaces; }

// Does this class (or its base classes) implement any interfaces?
bool HasInterfaces()
{ return GetNumInterfaces() != 0; }

bool IsGeneric()
{ return (m_uFlags & IsGenericFlag) != 0; }

TypeManagerHandle* GetTypeManagerPtr();

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

#ifdef DACCESS_COMPILE
bool DacVerify();
static bool DacVerifyWorker(MethodTable* pThis);
#endif // DACCESS_COMPILE

// Mark or determine that a type is generic and one or more of it's type parameters is co- or
// contra-variant. This only applies to interface and delegate types.
bool HasGenericVariance()
Expand All @@ -298,16 +265,10 @@ class MethodTable
EETypeElementType GetElementType()
{ return (EETypeElementType)((m_uFlags & ElementTypeMask) >> ElementTypeShift); }

// Determine whether a type is an instantiation of Nullable<T>.
bool IsNullable()
{ return GetElementType() == ElementType_Nullable; }

// Determine whether a type was created by dynamic type loader
bool IsDynamicType()
{ return (m_uFlags & IsDynamicTypeFlag) != 0; }

uint32_t GetHashCode();

// Helper methods that deal with MethodTable topology (size and field layout). These are useful since as we
// optimize for pay-for-play we increasingly want to customize exactly what goes into an MethodTable on a
// per-type basis. The rules that govern this can be both complex and volatile and we risk sprinkling
Expand Down
90 changes: 1 addition & 89 deletions src/coreclr/nativeaot/Runtime/inc/MethodTable.inl
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,6 @@
#ifndef __eetype_inl__
#define __eetype_inl__
//-----------------------------------------------------------------------------------------------------------
inline uint32_t MethodTable::GetHashCode()
{
return m_uHashCode;
}

#ifdef DACCESS_COMPILE
inline bool MethodTable::DacVerify()
{
// Use a separate static worker because the worker validates
// the whole chain of EETypes and we don't want to accidentally
// answer questions from 'this' that should have come from the
// 'current' MethodTable.
return DacVerifyWorker(this);
}
// static
inline bool MethodTable::DacVerifyWorker(MethodTable* pThis)
{
//*********************************************************************
//**** ASSUMES MAX TYPE HIERARCHY DEPTH OF 1024 TYPES ****
//*********************************************************************
const int MAX_SANE_RELATED_TYPES = 1024;
//*********************************************************************
//**** ASSUMES MAX OF 200 INTERFACES IMPLEMENTED ON ANY GIVEN TYPE ****
//*********************************************************************
const int MAX_SANE_NUM_INSTANCES = 200;


PTR_EEType pCurrentType = dac_cast<PTR_EEType>(pThis);
for (int i = 0; i < MAX_SANE_RELATED_TYPES; i++)
{
// Verify interface map
if (pCurrentType->GetNumInterfaces() > MAX_SANE_NUM_INSTANCES)
return false;

// Validate the current type
if (!pCurrentType->Validate(false))
return false;

//
// Now on to the next type in the hierarchy.
//

pCurrentType = dac_cast<PTR_EEType>(reinterpret_cast<TADDR>(pCurrentType->m_RelatedType.m_pBaseType));

if (pCurrentType == NULL)
break;
}

if (pCurrentType != NULL)
return false; // assume we found an infinite loop

return true;
}
#endif

#if !defined(DACCESS_COMPILE)
inline PTR_UInt8 FollowRelativePointer(const int32_t* pDist)
{
Expand Down Expand Up @@ -107,40 +52,7 @@ __forceinline uint32_t MethodTable::GetFieldOffset(EETypeField eField)
{
return cbOffset;
}
cbOffset += relativeOrFullPointerOffset;

#if SUPPORTS_WRITABLE_DATA
// Followed by writable data.
if (eField == ETF_WritableData)
{
return cbOffset;
}
cbOffset += relativeOrFullPointerOffset;
#endif

// Followed by the pointer to the finalizer method.
if (eField == ETF_Finalizer)
{
ASSERT(HasFinalizer());
return cbOffset;
}
if (HasFinalizer())
cbOffset += relativeOrFullPointerOffset;

// Followed by the pointer to the optional fields.
if (eField == ETF_OptionalFieldsPtr)
{
ASSERT(HasOptionalFields());
return cbOffset;
}
if (HasOptionalFields())
cbOffset += relativeOrFullPointerOffset;

// Followed by the pointer to the sealed virtual slots
if (eField == ETF_SealedVirtualSlots)
return cbOffset;

ASSERT(!"Decoding the rest requires rare flags");
ASSERT(!"NYI");

return 0;
}
Expand Down
61 changes: 0 additions & 61 deletions src/coreclr/nativeaot/Runtime/inc/rhbinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,27 +448,6 @@ struct PInvokeTransitionFrame
typedef DPTR(MethodTable) PTR_EEType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to rename this file to something more meaningful (separate PR)

typedef DPTR(PTR_EEType) PTR_PTR_EEType;

struct EETypeRef
{
union
{
MethodTable * pEEType;
MethodTable ** ppEEType;
uint8_t * rawPtr;
UIntTarget rawTargetPtr; // x86_amd64: keeps union big enough for target-platform pointer
};

static const size_t DOUBLE_INDIR_FLAG = 1;

PTR_EEType GetValue()
{
if (dac_cast<TADDR>(rawTargetPtr) & DOUBLE_INDIR_FLAG)
return *dac_cast<PTR_PTR_EEType>(rawTargetPtr - DOUBLE_INDIR_FLAG);
else
return dac_cast<PTR_EEType>(rawTargetPtr);
}
};

// Blobs are opaque data passed from the compiler, through the binder and into the native image. At runtime we
// provide a simple API to retrieve these blobs (they're keyed by a simple integer ID). Blobs are passed to
// the binder from the compiler and stored in native images by the binder in a sequential stream, each blob
Expand All @@ -481,15 +460,6 @@ struct BlobHeader
uint32_t m_size; // Size of the individual blob excluding this header (DWORD aligned)
};

#ifdef FEATURE_CUSTOM_IMPORTS
struct CustomImportDescriptor
{
uint32_t RvaEATAddr; // RVA of the indirection cell of the address of the EAT for that module
uint32_t RvaIAT; // RVA of IAT array for that module
uint32_t CountIAT; // Count of entries in the above array
};
#endif // FEATURE_CUSTOM_IMPORTS

enum RhEHClauseKind
{
RH_EH_CLAUSE_TYPED = 0,
Expand All @@ -500,34 +470,3 @@ enum RhEHClauseKind

#define RH_EH_CLAUSE_TYPED_INDIRECT RH_EH_CLAUSE_UNUSED

// mapping of cold code blocks to the corresponding hot entry point RVA
// format is a as follows:
// -------------------
// | subSectionCount | # of subsections, where each subsection has a run of hot bodies
// ------------------- followed by a run of cold bodies
// | hotMethodCount | # of hot bodies in subsection
// | coldMethodCount | # of cold bodies in subsection
// -------------------
// ... possibly repeated on ARM
// -------------------
// | hotRVA #1 | RVA of the hot entry point corresponding to the 1st cold body
// | hotRVA #2 | RVA of the hot entry point corresponding to the 2nd cold body
// ... one entry for each cold body containing the corresponding hot entry point

// number of hot and cold bodies in a subsection of code
// in x86 and x64 there's only one subsection, on ARM there may be several
// for large modules with > 16 MB of code
struct SubSectionDesc
{
uint32_t hotMethodCount;
uint32_t coldMethodCount;
};

// this is the structure describing the cold to hot mapping info
struct ColdToHotMapping
{
uint32_t subSectionCount;
SubSectionDesc subSection[/*subSectionCount*/1];
// UINT32 hotRVAofColdMethod[/*coldMethodCount*/];
};

74 changes: 0 additions & 74 deletions src/coreclr/nativeaot/Runtime/inc/varint.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,80 +16,6 @@ class VarInt
return result;
}

//
// WARNING: This method returns the negative of the length of the value that it just skipped!
//
// This was helpful in the GC info scan loop because it allowed us to always skip past unsigned values in
// the body of the loop. At the end of loop, we use this negative sign to distinguish between two cases
// and that allows us to decode the unsigned value that we need outside of the loop. Note that we encode
// the negatives in the s_negLengthTable to avoid any additional operations in the body of the GC scan
// loop.
//
static intptr_t SkipUnsigned(PTR_UInt8 & pbEncoding)
{
uintptr_t lengthBits = *pbEncoding & 0x0F;
size_t negLength = s_negLengthTab[lengthBits];
pbEncoding -= negLength;
return negLength;
}

static uintptr_t WriteUnsigned(PTR_UInt8 pbDest, uint32_t value)
{
if (pbDest == NULL)
{
if (value < 128)
return 1;

if (value < 128*128)
return 2;

if (value < 128*128*128)
return 3;

if (value < 128*128*128*128)
return 4;

return 5;
}

if (value < 128)
{
*pbDest++ = (uint8_t)(value*2 + 0);
return 1;
}

if (value < 128*128)
{
*pbDest++ = (uint8_t)(value*4 + 1);
*pbDest++ = (uint8_t)(value >> 6);
return 2;
}

if (value < 128*128*128)
{
*pbDest++ = (uint8_t)(value*8 + 3);
*pbDest++ = (uint8_t)(value >> 5);
*pbDest++ = (uint8_t)(value >> 13);
return 3;
}

if (value < 128*128*128*128)
{
*pbDest++ = (uint8_t)(value*16 + 7);
*pbDest++ = (uint8_t)(value >> 4);
*pbDest++ = (uint8_t)(value >> 12);
*pbDest++ = (uint8_t)(value >> 20);
return 4;
}

*pbDest++ = 15;
*pbDest++ = (uint8_t)value;
*pbDest++ = (uint8_t)(value >> 8);
*pbDest++ = (uint8_t)(value >> 16);
*pbDest++ = (uint8_t)(value >> 24);
return 5;
}

private:
static int8_t s_negLengthTab[16];
static uint8_t s_shiftTab[16];
Expand Down