Skip to content

Replace CORCOMPILE_FIXUP_BLOB_KIND with ReadyToRunFixupKind #115854

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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
94 changes: 0 additions & 94 deletions src/coreclr/inc/corcompile.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,82 +99,6 @@ enum CORCOMPILE_GCREFMAP_TOKENS
GCREFMAP_VASIG_COOKIE = 5,
};

// Tags for fixup blobs
enum CORCOMPILE_FIXUP_BLOB_KIND
{
ENCODE_NONE = 0,

ENCODE_MODULE_OVERRIDE = 0x80, /* When the high bit is set, override of the module immediately follows */

ENCODE_DICTIONARY_LOOKUP_THISOBJ = 0x07,
ENCODE_DICTIONARY_LOOKUP_TYPE = 0x08,
ENCODE_DICTIONARY_LOOKUP_METHOD = 0x09,

ENCODE_TYPE_HANDLE = 0x10, /* Type handle */
ENCODE_METHOD_HANDLE, /* Method handle */
ENCODE_FIELD_HANDLE, /* Field handle */

ENCODE_METHOD_ENTRY, /* For calling a method entry point */
ENCODE_METHOD_ENTRY_DEF_TOKEN, /* Smaller version of ENCODE_METHOD_ENTRY - method is def token */
ENCODE_METHOD_ENTRY_REF_TOKEN, /* Smaller version of ENCODE_METHOD_ENTRY - method is ref token */

ENCODE_VIRTUAL_ENTRY, /* For invoking a virtual method */
ENCODE_VIRTUAL_ENTRY_DEF_TOKEN, /* Smaller version of ENCODE_VIRTUAL_ENTRY - method is def token */
ENCODE_VIRTUAL_ENTRY_REF_TOKEN, /* Smaller version of ENCODE_VIRTUAL_ENTRY - method is ref token */
ENCODE_VIRTUAL_ENTRY_SLOT, /* Smaller version of ENCODE_VIRTUAL_ENTRY - type & slot */

ENCODE_READYTORUN_HELPER, /* ReadyToRun helper */
ENCODE_STRING_HANDLE, /* String token */

ENCODE_NEW_HELPER, /* Dynamically created new helpers */
ENCODE_NEW_ARRAY_HELPER,

ENCODE_ISINSTANCEOF_HELPER, /* Dynamically created casting helper */
ENCODE_CHKCAST_HELPER,

ENCODE_FIELD_ADDRESS, /* For accessing a cross-module static fields */
ENCODE_CCTOR_TRIGGER, /* Static constructor trigger */

ENCODE_STATIC_BASE_NONGC_HELPER, /* Dynamically created static base helpers */
ENCODE_STATIC_BASE_GC_HELPER,
ENCODE_THREAD_STATIC_BASE_NONGC_HELPER,
ENCODE_THREAD_STATIC_BASE_GC_HELPER,

ENCODE_FIELD_BASE_OFFSET, /* Field base */
ENCODE_FIELD_OFFSET,

ENCODE_TYPE_DICTIONARY,
ENCODE_METHOD_DICTIONARY,

ENCODE_CHECK_TYPE_LAYOUT,
ENCODE_CHECK_FIELD_OFFSET,

ENCODE_DELEGATE_CTOR,

ENCODE_DECLARINGTYPE_HANDLE,

ENCODE_INDIRECT_PINVOKE_TARGET, /* For calling a pinvoke method ptr indirectly */
ENCODE_PINVOKE_TARGET, /* For calling a pinvoke method ptr */

ENCODE_CHECK_INSTRUCTION_SET_SUPPORT, /* Define the set of instruction sets that must be supported/unsupported to use the fixup */

ENCODE_VERIFY_FIELD_OFFSET, /* Used for the R2R compiler can generate a check against the real field offset used at runtime */
ENCODE_VERIFY_TYPE_LAYOUT, /* Used for the R2R compiler can generate a check against the real type layout used at runtime */

ENCODE_CHECK_VIRTUAL_FUNCTION_OVERRIDE, /* Generate a runtime check to ensure that virtual function resolution has equivalent behavior at runtime as at compile time. If not equivalent, code will not be used */
ENCODE_VERIFY_VIRTUAL_FUNCTION_OVERRIDE, /* Generate a runtime check to ensure that virtual function resolution has equivalent behavior at runtime as at compile time. If not equivalent, generate runtime failure. */

ENCODE_CHECK_IL_BODY, /* Check to see if an IL method is defined the same at runtime as at compile time. A failed match will cause code not to be used. */
ENCODE_VERIFY_IL_BODY, /* Verify an IL body is defined the same at compile time and runtime. A failed match will cause a hard runtime failure. */

ENCODE_MODULE_HANDLE = 0x50, /* Module token */
ENCODE_SYNC_LOCK, /* For synchronizing access to a type */
ENCODE_PROFILING_HANDLE, /* For the method's profiling counter */
ENCODE_VARARGS_METHODDEF, /* For calling a varargs method */
ENCODE_VARARGS_METHODREF,
ENCODE_VARARGS_SIG,
};

enum EncodeMethodSigFlags
{
ENCODE_METHOD_SIG_UnboxingStub = 0x01,
Expand All @@ -194,11 +118,6 @@ enum EncodeFieldSigFlags
ENCODE_FIELD_SIG_OwnerType = 0x40,
};

class SBuffer;
class SigBuilder;
class PEDecoder;
class GCRefMapBuilder;

//REVIEW: include for ee exception info
#include "eexcp.h"

Expand Down Expand Up @@ -233,17 +152,4 @@ struct CORCOMPILE_EXCEPTION_CLAUSE
};
};

/*********************************************************************************/
// When NGEN install /Profile is run, the ZapProfilingHandleImport fixup table contains
// these 5 values per MethodDesc
enum
{
kZapProfilingHandleImportValueIndexFixup = 0,
kZapProfilingHandleImportValueIndexEnterAddr = 1,
kZapProfilingHandleImportValueIndexLeaveAddr = 2,
kZapProfilingHandleImportValueIndexTailcallAddr = 3,
kZapProfilingHandleImportValueIndexClientData = 4,

kZapProfilingHandleImportValueIndexCount
};
#endif /* COR_COMPILE_H_ */
3 changes: 3 additions & 0 deletions src/coreclr/inc/readytorun.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ enum ReadyToRunFixupKind

READYTORUN_FIXUP_Check_IL_Body = 0x35, /* Check to see if an IL method is defined the same at runtime as at compile time. A failed match will cause code not to be used. */
READYTORUN_FIXUP_Verify_IL_Body = 0x36, /* Verify an IL body is defined the same at compile time and runtime. A failed match will cause a hard runtime failure. */

READYTORUN_FIXUP_ModuleOverride = 0x80, /* followed by sig-encoded UInt with assemblyref index into either the assemblyref table of the MSIL metadata of the master context module for the signature or */
/* into the extra assemblyref table in the manifest metadata R2R header table (used in cases inlining brings in references to assemblies not seen in the MSIL). */
};

//
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/frames.h
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,8 @@ class InterpreterFrame : public FramedMethodFrame

#define ASSERT_ADDRESS_IN_STACK(address) _ASSERTE (Thread::IsAddressInCurrentStack (address));

class GCRefMapBuilder;

void ComputeCallRefMap(MethodDesc* pMD,
GCRefMapBuilder * pBuilder,
bool isDispatchCell);
Expand Down
34 changes: 17 additions & 17 deletions src/coreclr/vm/genericdict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,26 +698,26 @@ Dictionary::PopulateEntry(
BYTE fixupKind = *pBlob++;

ModuleBase * pInfoModule = pModule;
if (fixupKind & ENCODE_MODULE_OVERRIDE)
if (fixupKind & READYTORUN_FIXUP_ModuleOverride)
{
DWORD moduleIndex = CorSigUncompressData(pBlob);
pInfoModule = pModule->GetModuleFromIndex(moduleIndex);
fixupKind &= ~ENCODE_MODULE_OVERRIDE;
fixupKind &= ~READYTORUN_FIXUP_ModuleOverride;
}

_ASSERTE(fixupKind == ENCODE_DICTIONARY_LOOKUP_THISOBJ ||
fixupKind == ENCODE_DICTIONARY_LOOKUP_TYPE ||
fixupKind == ENCODE_DICTIONARY_LOOKUP_METHOD);
_ASSERTE(fixupKind == READYTORUN_FIXUP_ThisObjDictionaryLookup ||
fixupKind == READYTORUN_FIXUP_TypeDictionaryLookup ||
fixupKind == READYTORUN_FIXUP_MethodDictionaryLookup);

if (fixupKind == ENCODE_DICTIONARY_LOOKUP_THISOBJ)
if (fixupKind == READYTORUN_FIXUP_ThisObjDictionaryLookup)
{
SigPointer p(pBlob);
p.SkipExactlyOne();
pBlob = p.GetPtr();
}

BYTE signatureKind = *pBlob++;
if (signatureKind & ENCODE_MODULE_OVERRIDE)
ReadyToRunFixupKind signatureKind = (ReadyToRunFixupKind)*pBlob++;
if (signatureKind & READYTORUN_FIXUP_ModuleOverride)
{
DWORD moduleIndex = CorSigUncompressData(pBlob);
ModuleBase * pSignatureModule = pModule->GetModuleFromIndex(moduleIndex);
Expand All @@ -726,20 +726,20 @@ Dictionary::PopulateEntry(
pInfoModule = pSignatureModule;
}
_ASSERTE(pInfoModule == pSignatureModule);
signatureKind &= ~ENCODE_MODULE_OVERRIDE;
signatureKind = (ReadyToRunFixupKind)(signatureKind & ~READYTORUN_FIXUP_ModuleOverride);
}

switch ((CORCOMPILE_FIXUP_BLOB_KIND) signatureKind)
switch (signatureKind)
{
case ENCODE_DECLARINGTYPE_HANDLE: kind = DeclaringTypeHandleSlot; break;
case ENCODE_TYPE_HANDLE: kind = TypeHandleSlot; break;
case ENCODE_FIELD_HANDLE: kind = FieldDescSlot; break;
case ENCODE_METHOD_HANDLE: kind = MethodDescSlot; break;
case ENCODE_METHOD_ENTRY: kind = MethodEntrySlot; break;
case ENCODE_VIRTUAL_ENTRY: kind = DispatchStubAddrSlot; break;
case READYTORUN_FIXUP_DeclaringTypeHandle: kind = DeclaringTypeHandleSlot; break;
case READYTORUN_FIXUP_TypeHandle: kind = TypeHandleSlot; break;
case READYTORUN_FIXUP_FieldHandle: kind = FieldDescSlot; break;
case READYTORUN_FIXUP_MethodHandle: kind = MethodDescSlot; break;
case READYTORUN_FIXUP_MethodEntry: kind = MethodEntrySlot; break;
case READYTORUN_FIXUP_VirtualEntry: kind = DispatchStubAddrSlot; break;

default:
_ASSERTE(!"Unexpected CORCOMPILE_FIXUP_BLOB_KIND");
_ASSERTE(!"Unexpected ReadyToRunFixupKind");
ThrowHR(COR_E_BADIMAGEFORMAT);
}

Expand Down
Loading
Loading