Skip to content

Commit b10ea03

Browse files
authored
Replace CORCOMPILE_FIXUP_BLOB_KIND with ReadyToRunFixupKind (#115854)
Removes the redundant CORCOMPILE_FIXUP_BLOB_KIND enum and replaces all its uses with the equivalent ReadyToRunFixupKind enum. CORCOMPILE_FIXUP_BLOB_KIND was a left-over from fragile NGen. Fixes #115853
1 parent 97d1fc2 commit b10ea03

File tree

7 files changed

+142
-339
lines changed

7 files changed

+142
-339
lines changed

src/coreclr/inc/corcompile.h

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -99,82 +99,6 @@ enum CORCOMPILE_GCREFMAP_TOKENS
9999
GCREFMAP_VASIG_COOKIE = 5,
100100
};
101101

102-
// Tags for fixup blobs
103-
enum CORCOMPILE_FIXUP_BLOB_KIND
104-
{
105-
ENCODE_NONE = 0,
106-
107-
ENCODE_MODULE_OVERRIDE = 0x80, /* When the high bit is set, override of the module immediately follows */
108-
109-
ENCODE_DICTIONARY_LOOKUP_THISOBJ = 0x07,
110-
ENCODE_DICTIONARY_LOOKUP_TYPE = 0x08,
111-
ENCODE_DICTIONARY_LOOKUP_METHOD = 0x09,
112-
113-
ENCODE_TYPE_HANDLE = 0x10, /* Type handle */
114-
ENCODE_METHOD_HANDLE, /* Method handle */
115-
ENCODE_FIELD_HANDLE, /* Field handle */
116-
117-
ENCODE_METHOD_ENTRY, /* For calling a method entry point */
118-
ENCODE_METHOD_ENTRY_DEF_TOKEN, /* Smaller version of ENCODE_METHOD_ENTRY - method is def token */
119-
ENCODE_METHOD_ENTRY_REF_TOKEN, /* Smaller version of ENCODE_METHOD_ENTRY - method is ref token */
120-
121-
ENCODE_VIRTUAL_ENTRY, /* For invoking a virtual method */
122-
ENCODE_VIRTUAL_ENTRY_DEF_TOKEN, /* Smaller version of ENCODE_VIRTUAL_ENTRY - method is def token */
123-
ENCODE_VIRTUAL_ENTRY_REF_TOKEN, /* Smaller version of ENCODE_VIRTUAL_ENTRY - method is ref token */
124-
ENCODE_VIRTUAL_ENTRY_SLOT, /* Smaller version of ENCODE_VIRTUAL_ENTRY - type & slot */
125-
126-
ENCODE_READYTORUN_HELPER, /* ReadyToRun helper */
127-
ENCODE_STRING_HANDLE, /* String token */
128-
129-
ENCODE_NEW_HELPER, /* Dynamically created new helpers */
130-
ENCODE_NEW_ARRAY_HELPER,
131-
132-
ENCODE_ISINSTANCEOF_HELPER, /* Dynamically created casting helper */
133-
ENCODE_CHKCAST_HELPER,
134-
135-
ENCODE_FIELD_ADDRESS, /* For accessing a cross-module static fields */
136-
ENCODE_CCTOR_TRIGGER, /* Static constructor trigger */
137-
138-
ENCODE_STATIC_BASE_NONGC_HELPER, /* Dynamically created static base helpers */
139-
ENCODE_STATIC_BASE_GC_HELPER,
140-
ENCODE_THREAD_STATIC_BASE_NONGC_HELPER,
141-
ENCODE_THREAD_STATIC_BASE_GC_HELPER,
142-
143-
ENCODE_FIELD_BASE_OFFSET, /* Field base */
144-
ENCODE_FIELD_OFFSET,
145-
146-
ENCODE_TYPE_DICTIONARY,
147-
ENCODE_METHOD_DICTIONARY,
148-
149-
ENCODE_CHECK_TYPE_LAYOUT,
150-
ENCODE_CHECK_FIELD_OFFSET,
151-
152-
ENCODE_DELEGATE_CTOR,
153-
154-
ENCODE_DECLARINGTYPE_HANDLE,
155-
156-
ENCODE_INDIRECT_PINVOKE_TARGET, /* For calling a pinvoke method ptr indirectly */
157-
ENCODE_PINVOKE_TARGET, /* For calling a pinvoke method ptr */
158-
159-
ENCODE_CHECK_INSTRUCTION_SET_SUPPORT, /* Define the set of instruction sets that must be supported/unsupported to use the fixup */
160-
161-
ENCODE_VERIFY_FIELD_OFFSET, /* Used for the R2R compiler can generate a check against the real field offset used at runtime */
162-
ENCODE_VERIFY_TYPE_LAYOUT, /* Used for the R2R compiler can generate a check against the real type layout used at runtime */
163-
164-
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 */
165-
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. */
166-
167-
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. */
168-
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. */
169-
170-
ENCODE_MODULE_HANDLE = 0x50, /* Module token */
171-
ENCODE_SYNC_LOCK, /* For synchronizing access to a type */
172-
ENCODE_PROFILING_HANDLE, /* For the method's profiling counter */
173-
ENCODE_VARARGS_METHODDEF, /* For calling a varargs method */
174-
ENCODE_VARARGS_METHODREF,
175-
ENCODE_VARARGS_SIG,
176-
};
177-
178102
enum EncodeMethodSigFlags
179103
{
180104
ENCODE_METHOD_SIG_UnboxingStub = 0x01,
@@ -194,11 +118,6 @@ enum EncodeFieldSigFlags
194118
ENCODE_FIELD_SIG_OwnerType = 0x40,
195119
};
196120

197-
class SBuffer;
198-
class SigBuilder;
199-
class PEDecoder;
200-
class GCRefMapBuilder;
201-
202121
//REVIEW: include for ee exception info
203122
#include "eexcp.h"
204123

@@ -233,17 +152,4 @@ struct CORCOMPILE_EXCEPTION_CLAUSE
233152
};
234153
};
235154

236-
/*********************************************************************************/
237-
// When NGEN install /Profile is run, the ZapProfilingHandleImport fixup table contains
238-
// these 5 values per MethodDesc
239-
enum
240-
{
241-
kZapProfilingHandleImportValueIndexFixup = 0,
242-
kZapProfilingHandleImportValueIndexEnterAddr = 1,
243-
kZapProfilingHandleImportValueIndexLeaveAddr = 2,
244-
kZapProfilingHandleImportValueIndexTailcallAddr = 3,
245-
kZapProfilingHandleImportValueIndexClientData = 4,
246-
247-
kZapProfilingHandleImportValueIndexCount
248-
};
249155
#endif /* COR_COMPILE_H_ */

src/coreclr/inc/readytorun.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ enum ReadyToRunFixupKind
293293

294294
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. */
295295
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. */
296+
297+
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 */
298+
/* 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). */
296299
};
297300

298301
//

src/coreclr/vm/frames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,6 +3072,8 @@ class InterpreterFrame : public FramedMethodFrame
30723072

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

3075+
class GCRefMapBuilder;
3076+
30753077
void ComputeCallRefMap(MethodDesc* pMD,
30763078
GCRefMapBuilder * pBuilder,
30773079
bool isDispatchCell);

src/coreclr/vm/genericdict.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -698,26 +698,26 @@ Dictionary::PopulateEntry(
698698
BYTE fixupKind = *pBlob++;
699699

700700
ModuleBase * pInfoModule = pModule;
701-
if (fixupKind & ENCODE_MODULE_OVERRIDE)
701+
if (fixupKind & READYTORUN_FIXUP_ModuleOverride)
702702
{
703703
DWORD moduleIndex = CorSigUncompressData(pBlob);
704704
pInfoModule = pModule->GetModuleFromIndex(moduleIndex);
705-
fixupKind &= ~ENCODE_MODULE_OVERRIDE;
705+
fixupKind &= ~READYTORUN_FIXUP_ModuleOverride;
706706
}
707707

708-
_ASSERTE(fixupKind == ENCODE_DICTIONARY_LOOKUP_THISOBJ ||
709-
fixupKind == ENCODE_DICTIONARY_LOOKUP_TYPE ||
710-
fixupKind == ENCODE_DICTIONARY_LOOKUP_METHOD);
708+
_ASSERTE(fixupKind == READYTORUN_FIXUP_ThisObjDictionaryLookup ||
709+
fixupKind == READYTORUN_FIXUP_TypeDictionaryLookup ||
710+
fixupKind == READYTORUN_FIXUP_MethodDictionaryLookup);
711711

712-
if (fixupKind == ENCODE_DICTIONARY_LOOKUP_THISOBJ)
712+
if (fixupKind == READYTORUN_FIXUP_ThisObjDictionaryLookup)
713713
{
714714
SigPointer p(pBlob);
715715
p.SkipExactlyOne();
716716
pBlob = p.GetPtr();
717717
}
718718

719-
BYTE signatureKind = *pBlob++;
720-
if (signatureKind & ENCODE_MODULE_OVERRIDE)
719+
ReadyToRunFixupKind signatureKind = (ReadyToRunFixupKind)*pBlob++;
720+
if (signatureKind & READYTORUN_FIXUP_ModuleOverride)
721721
{
722722
DWORD moduleIndex = CorSigUncompressData(pBlob);
723723
ModuleBase * pSignatureModule = pModule->GetModuleFromIndex(moduleIndex);
@@ -726,20 +726,20 @@ Dictionary::PopulateEntry(
726726
pInfoModule = pSignatureModule;
727727
}
728728
_ASSERTE(pInfoModule == pSignatureModule);
729-
signatureKind &= ~ENCODE_MODULE_OVERRIDE;
729+
signatureKind = (ReadyToRunFixupKind)(signatureKind & ~READYTORUN_FIXUP_ModuleOverride);
730730
}
731731

732-
switch ((CORCOMPILE_FIXUP_BLOB_KIND) signatureKind)
732+
switch (signatureKind)
733733
{
734-
case ENCODE_DECLARINGTYPE_HANDLE: kind = DeclaringTypeHandleSlot; break;
735-
case ENCODE_TYPE_HANDLE: kind = TypeHandleSlot; break;
736-
case ENCODE_FIELD_HANDLE: kind = FieldDescSlot; break;
737-
case ENCODE_METHOD_HANDLE: kind = MethodDescSlot; break;
738-
case ENCODE_METHOD_ENTRY: kind = MethodEntrySlot; break;
739-
case ENCODE_VIRTUAL_ENTRY: kind = DispatchStubAddrSlot; break;
734+
case READYTORUN_FIXUP_DeclaringTypeHandle: kind = DeclaringTypeHandleSlot; break;
735+
case READYTORUN_FIXUP_TypeHandle: kind = TypeHandleSlot; break;
736+
case READYTORUN_FIXUP_FieldHandle: kind = FieldDescSlot; break;
737+
case READYTORUN_FIXUP_MethodHandle: kind = MethodDescSlot; break;
738+
case READYTORUN_FIXUP_MethodEntry: kind = MethodEntrySlot; break;
739+
case READYTORUN_FIXUP_VirtualEntry: kind = DispatchStubAddrSlot; break;
740740

741741
default:
742-
_ASSERTE(!"Unexpected CORCOMPILE_FIXUP_BLOB_KIND");
742+
_ASSERTE(!"Unexpected ReadyToRunFixupKind");
743743
ThrowHR(COR_E_BADIMAGEFORMAT);
744744
}
745745

0 commit comments

Comments
 (0)