Skip to content

Clean up JIT flags #87588

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 16 commits into from
Jun 16, 2023
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
485 changes: 214 additions & 271 deletions src/coreclr/inc/corinfo.h

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions src/coreclr/inc/corjit.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ class ICorJitCompiler
// * For the 64 bit jit this is implemented by code:PreJit.compileMethod
// Note: setTargetOS must be called before this api is used.
virtual CorJitResult compileMethod (
ICorJitInfo *comp, /* IN */
struct CORINFO_METHOD_INFO *info, /* IN */
unsigned /* code:CorJitFlag */ flags, /* IN */
uint8_t **nativeEntry, /* OUT */
uint32_t *nativeSizeOfCode /* OUT */
ICorJitInfo* comp, /* IN */
struct CORINFO_METHOD_INFO* info, /* IN */
unsigned /* code:CorJitFlag */ flags, /* IN */
uint8_t** nativeEntry, /* OUT */
uint32_t* nativeSizeOfCode /* OUT */
) = 0;

// Do any appropriate work at process shutdown. Default impl is to do nothing.
Expand Down Expand Up @@ -251,7 +251,7 @@ class ICorJitInfo : public ICorDynamicInfo
virtual void reserveUnwindInfo (
bool isFunclet, /* IN */
bool isColdCode, /* IN */
uint32_t unwindSize /* IN */
uint32_t unwindSize /* IN */
) = 0;

// Allocate and initialize the .rdata and .pdata for this method or
Expand All @@ -272,19 +272,18 @@ class ICorJitInfo : public ICorDynamicInfo
// funcKind type of funclet (main method code, handler, filter)
//
virtual void allocUnwindInfo (
uint8_t * pHotCode, /* IN */
uint8_t * pColdCode, /* IN */
uint32_t startOffset, /* IN */
uint32_t endOffset, /* IN */
uint32_t unwindSize, /* IN */
uint8_t * pUnwindBlock, /* IN */
CorJitFuncKind funcKind /* IN */
uint8_t * pHotCode, /* IN */
uint8_t * pColdCode, /* IN */
uint32_t startOffset, /* IN */
uint32_t endOffset, /* IN */
uint32_t unwindSize, /* IN */
uint8_t * pUnwindBlock, /* IN */
CorJitFuncKind funcKind /* IN */
) = 0;

// Get a block of memory needed for the code manager information,
// (the info for enumerating the GC pointers while crawling the
// stack frame).
// Note that allocMem must be called first
// Get a block of memory needed for the code manager information,
// (the info for enumerating the GC pointers while crawling the
// stack frame). Note that allocMem must be called first.
virtual void * allocGCInfo (
size_t size /* IN */
) = 0;
Expand All @@ -293,7 +292,7 @@ class ICorJitInfo : public ICorDynamicInfo
// This is guaranteed to be called before any 'setEHinfo' call.
// Note that allocMem must be called before this method can be called.
virtual void setEHcount (
unsigned cEH /* IN */
unsigned cEH /* IN */
) = 0;

// Set the values for one particular exception handler block.
Expand All @@ -303,7 +302,7 @@ class ICorJitInfo : public ICorDynamicInfo
// determine if a "finally" clause is executing.
virtual void setEHinfo (
unsigned EHnumber, /* IN */
const CORINFO_EH_CLAUSE *clause /* IN */
const CORINFO_EH_CLAUSE* clause /* IN */
) = 0;

// Level -> fatalError, Level 2 -> Error, Level 3 -> Warning
Expand Down Expand Up @@ -463,20 +462,19 @@ class ICorJitInfo : public ICorDynamicInfo
// the call site has no signature information (e.g. a helper call) or has no method handle
// (e.g. a CALLI P/Invoke), then null should be passed instead.
virtual void recordCallSite(
uint32_t instrOffset, /* IN */
CORINFO_SIG_INFO * callSig, /* IN */
CORINFO_METHOD_HANDLE methodHandle /* IN */
uint32_t instrOffset, /* IN */
CORINFO_SIG_INFO * callSig, /* IN */
CORINFO_METHOD_HANDLE methodHandle /* IN */
) = 0;

// A relocation is recorded if we are pre-jitting.
// A jump thunk may be inserted if we are jitting
virtual void recordRelocation(
void * location, /* IN */
void * locationRW, /* IN */
void * target, /* IN */
uint16_t fRelocType, /* IN */
uint16_t slotNum = 0, /* IN */
int32_t addlDelta = 0 /* IN */
void * location, /* IN */
void * locationRW, /* IN */
void * target, /* IN */
uint16_t fRelocType, /* IN */
int32_t addlDelta = 0 /* IN */
) = 0;

virtual uint16_t getRelocTypeHint(void * target) = 0;
Expand All @@ -491,9 +489,9 @@ class ICorJitInfo : public ICorDynamicInfo
// Fetches extended flags for a particular compilation instance. Returns
// the number of bytes written to the provided buffer.
virtual uint32_t getJitFlags(
CORJIT_FLAGS* flags, /* IN: Points to a buffer that will hold the extended flags. */
uint32_t sizeInBytes /* IN: The size of the buffer. Note that this is effectively a
version number for the CORJIT_FLAGS value. */
CORJIT_FLAGS* flags, /* IN: Points to a buffer that will hold the extended flags. */
uint32_t sizeInBytes /* IN: The size of the buffer. Note that this is effectively a
version number for the CORJIT_FLAGS value. */
) = 0;
};

Expand Down
113 changes: 34 additions & 79 deletions src/coreclr/inc/corjitflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,97 +22,52 @@ class CORJIT_FLAGS
{
public:

// Note: these flags can be #ifdef'ed, but no number should be re-used between different #ifdef conditions,
// so platform-independent code can know uniquely which number corresponds to which flag.
enum CorJitFlag
{
CORJIT_FLAG_CALL_GETJITFLAGS = 0xffffffff, // Indicates that the JIT should retrieve flags in the form of a
// pointer to a CORJIT_FLAGS value via ICorJitInfo::getJitFlags().
CORJIT_FLAG_SPEED_OPT = 0,
CORJIT_FLAG_SIZE_OPT = 1,

CORJIT_FLAG_SPEED_OPT = 0, // optimize for speed
CORJIT_FLAG_SIZE_OPT = 1, // optimize for code size
CORJIT_FLAG_DEBUG_CODE = 2, // generate "debuggable" code (no code-mangling optimizations)
CORJIT_FLAG_DEBUG_EnC = 3, // We are in Edit-n-Continue mode
CORJIT_FLAG_DEBUG_INFO = 4, // generate line and local-var info
CORJIT_FLAG_MIN_OPT = 5, // disable all jit optimizations (not necessarily debuggable code)
CORJIT_FLAG_ENABLE_CFG = 6, // generate control-flow guard checks
CORJIT_FLAG_MCJIT_BACKGROUND = 7, // Calling from multicore JIT background thread, do not call JitComplete

#if defined(TARGET_X86)
CORJIT_FLAG_PINVOKE_RESTORE_ESP = 8, // Restore ESP after returning from inlined PInvoke
#else // !defined(TARGET_X86)
CORJIT_FLAG_UNUSED2 = 8,
#endif // !defined(TARGET_X86)

CORJIT_FLAG_UNUSED3 = 9,
CORJIT_FLAG_UNUSED4 = 10,
CORJIT_FLAG_UNUSED5 = 11,
CORJIT_FLAG_UNUSED6 = 12,

CORJIT_FLAG_OSR = 13, // Generate alternate method for On Stack Replacement

CORJIT_FLAG_ALT_JIT = 14, // JIT should consider itself an ALT_JIT
CORJIT_FLAG_FROZEN_ALLOC_ALLOWED = 15, // JIT is allowed to use *_MAYBEFROZEN allocators
CORJIT_FLAG_UNUSED9 = 16,
CORJIT_FLAG_UNUSED10 = 17,

CORJIT_FLAG_MAKEFINALCODE = 18, // Use the final code generator, i.e., not the interpreter.
CORJIT_FLAG_READYTORUN = 19, // Use version-resilient code generation
CORJIT_FLAG_PROF_ENTERLEAVE = 20, // Instrument prologues/epilogues
CORJIT_FLAG_UNUSED11 = 21,
CORJIT_FLAG_PROF_NO_PINVOKE_INLINE = 22, // Disables PInvoke inlining
CORJIT_FLAG_UNUSED12 = 23,
CORJIT_FLAG_PREJIT = 24, // jit or prejit is the execution engine.
CORJIT_FLAG_RELOC = 25, // Generate relocatable code
CORJIT_FLAG_UNUSED13 = 26,
CORJIT_FLAG_IL_STUB = 27, // method is an IL stub
CORJIT_FLAG_PROCSPLIT = 28, // JIT should separate code into hot and cold sections
CORJIT_FLAG_BBINSTR = 29, // Collect basic block profile information
CORJIT_FLAG_BBOPT = 30, // Optimize method based on profile information
CORJIT_FLAG_FRAMED = 31, // All methods have an EBP frame
CORJIT_FLAG_BBINSTR_IF_LOOPS = 32, // JIT must instrument current method if it has loops
CORJIT_FLAG_PUBLISH_SECRET_PARAM = 33, // JIT must place stub secret param into local 0. (used by IL stubs)
CORJIT_FLAG_UNUSED14 = 34,
CORJIT_FLAG_UNUSED37 = 35,
CORJIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
CORJIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
CORJIT_FLAG_TRACK_TRANSITIONS = 38, // The JIT should insert the REVERSE_PINVOKE helper variants that track transitions.
CORJIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
CORJIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code
CORJIT_FLAG_ENABLE_CFG = 6, // generate CFG enabled code
CORJIT_FLAG_OSR = 7, // Generate alternate version for On Stack Replacement
CORJIT_FLAG_ALT_JIT = 8, // JIT should consider itself an ALT_JIT
CORJIT_FLAG_FROZEN_ALLOC_ALLOWED = 9, // JIT is allowed to use *_MAYBEFROZEN allocators
CORJIT_FLAG_MAKEFINALCODE = 10, // Use the final code generator, i.e., not the interpreter.
CORJIT_FLAG_READYTORUN = 11, // Use version-resilient code generation
CORJIT_FLAG_PROF_ENTERLEAVE = 12, // Instrument prologues/epilogues
CORJIT_FLAG_PROF_NO_PINVOKE_INLINE = 13, // Disables PInvoke inlining
CORJIT_FLAG_PREJIT = 14, // prejit is the execution engine.
CORJIT_FLAG_RELOC = 15, // Generate relocatable code
CORJIT_FLAG_IL_STUB = 16, // method is an IL stub
CORJIT_FLAG_PROCSPLIT = 17, // JIT should separate code into hot and cold sections
CORJIT_FLAG_BBINSTR = 18, // Collect basic block profile information
CORJIT_FLAG_BBINSTR_IF_LOOPS = 19, // JIT must instrument current method if it has loops
CORJIT_FLAG_BBOPT = 20, // Optimize method based on profile information
CORJIT_FLAG_FRAMED = 21, // All methods have an EBP frame
CORJIT_FLAG_PUBLISH_SECRET_PARAM = 22, // JIT must place stub secret param into local 0. (used by IL stubs)
CORJIT_FLAG_USE_PINVOKE_HELPERS = 23, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
CORJIT_FLAG_REVERSE_PINVOKE = 24, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
CORJIT_FLAG_TRACK_TRANSITIONS = 25, // The JIT should insert the helper variants that track transitions.
CORJIT_FLAG_TIER0 = 26, // This is the initial tier for tiered compilation which should generate code as quickly as possible
CORJIT_FLAG_TIER1 = 27, // This is the final tier (for now) for tiered compilation which should generate high quality code
CORJIT_FLAG_NO_INLINING = 28, // JIT should not inline any called method into this method

#if defined(TARGET_ARM)
CORJIT_FLAG_RELATIVE_CODE_RELOCS = 41, // JIT should generate PC-relative address computations instead of EE relocation records
#else // !defined(TARGET_ARM)
CORJIT_FLAG_UNUSED15 = 41,
#endif // !defined(TARGET_ARM)
CORJIT_FLAG_RELATIVE_CODE_RELOCS = 29, // JIT should generate PC-relative address computations instead of EE relocation records
CORJIT_FLAG_SOFTFP_ABI = 30, // Enable armel calling convention
#endif

CORJIT_FLAG_NO_INLINING = 42, // JIT should not inline any called method into this method
#if defined(TARGET_X86) || defined(TARGET_AMD64)
CORJIT_FLAG_VECTOR512_THROTTLING = 31, // On x86/x64, 512-bit vector usage may incur CPU frequency throttling
#endif

#if defined(TARGET_ARM)
CORJIT_FLAG_SOFTFP_ABI = 43, // On ARM should enable armel calling convention
#elif defined(TARGET_X86) || defined(TARGET_AMD64)
CORJIT_FLAG_VECTOR512_THROTTLING = 43, // On Xarch, 512-bit vector usage may incur CPU frequency throttling
#else
CORJIT_FLAG_UNUSED16 = 43,
#endif // !defined(TARGET_ARM)

CORJIT_FLAG_UNUSED17 = 44,
CORJIT_FLAG_UNUSED18 = 45,
CORJIT_FLAG_UNUSED19 = 46,
CORJIT_FLAG_UNUSED20 = 47,
CORJIT_FLAG_UNUSED21 = 48,
CORJIT_FLAG_UNUSED22 = 49,
CORJIT_FLAG_UNUSED23 = 50,
CORJIT_FLAG_UNUSED24 = 51,
CORJIT_FLAG_UNUSED25 = 52,
CORJIT_FLAG_UNUSED26 = 53,
CORJIT_FLAG_UNUSED27 = 54,
CORJIT_FLAG_UNUSED28 = 55,
CORJIT_FLAG_UNUSED29 = 56,
CORJIT_FLAG_UNUSED30 = 57,
CORJIT_FLAG_UNUSED31 = 58,
CORJIT_FLAG_UNUSED32 = 59,
CORJIT_FLAG_UNUSED33 = 60,
CORJIT_FLAG_UNUSED34 = 61,
CORJIT_FLAG_UNUSED35 = 62,
CORJIT_FLAG_UNUSED36 = 63
};

CORJIT_FLAGS()
Expand Down
45 changes: 0 additions & 45 deletions src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ void getEHinfo(
CORINFO_CLASS_HANDLE getMethodClass(
CORINFO_METHOD_HANDLE method) override;

CORINFO_MODULE_HANDLE getMethodModule(
CORINFO_METHOD_HANDLE method) override;

void getMethodVTableOffset(
CORINFO_METHOD_HANDLE method,
unsigned* offsetOfIndirection,
Expand Down Expand Up @@ -117,13 +114,6 @@ bool satisfiesMethodConstraints(
CORINFO_CLASS_HANDLE parent,
CORINFO_METHOD_HANDLE method) override;

bool isCompatibleDelegate(
CORINFO_CLASS_HANDLE objCls,
CORINFO_CLASS_HANDLE methodParentCls,
CORINFO_METHOD_HANDLE method,
CORINFO_CLASS_HANDLE delegateCls,
bool* pfIsOpenDelegate) override;

void methodMustBeLoadedBeforeCodeIsRun(
CORINFO_METHOD_HANDLE method) override;

Expand All @@ -143,9 +133,6 @@ PatchpointInfo* getOSRInfo(
void resolveToken(
CORINFO_RESOLVED_TOKEN* pResolvedToken) override;

bool tryResolveToken(
CORINFO_RESOLVED_TOKEN* pResolvedToken) override;

void findSig(
CORINFO_MODULE_HANDLE module,
unsigned sigTOK,
Expand All @@ -161,14 +148,6 @@ void findCallSiteSig(
CORINFO_CLASS_HANDLE getTokenTypeAsHandle(
CORINFO_RESOLVED_TOKEN* pResolvedToken) override;

bool isValidToken(
CORINFO_MODULE_HANDLE module,
unsigned metaTOK) override;

bool isValidStringRef(
CORINFO_MODULE_HANDLE module,
unsigned metaTOK) override;

int getStringLiteral(
CORINFO_MODULE_HANDLE module,
unsigned metaTOK,
Expand Down Expand Up @@ -347,10 +326,6 @@ TypeCompareState compareTypesForEquality(
CORINFO_CLASS_HANDLE cls1,
CORINFO_CLASS_HANDLE cls2) override;

CORINFO_CLASS_HANDLE mergeClasses(
CORINFO_CLASS_HANDLE cls1,
CORINFO_CLASS_HANDLE cls2) override;

bool isMoreSpecificType(
CORINFO_CLASS_HANDLE cls1,
CORINFO_CLASS_HANDLE cls2) override;
Expand All @@ -366,9 +341,6 @@ CorInfoType getChildType(
CORINFO_CLASS_HANDLE clsHnd,
CORINFO_CLASS_HANDLE* clsRet) override;

bool satisfiesClassConstraints(
CORINFO_CLASS_HANDLE cls) override;

bool isSDArray(
CORINFO_CLASS_HANDLE cls) override;

Expand Down Expand Up @@ -509,12 +481,6 @@ const char* getMethodNameFromMetadata(
unsigned getMethodHash(
CORINFO_METHOD_HANDLE ftn) override;

size_t findNameOfToken(
CORINFO_MODULE_HANDLE moduleHandle,
mdToken token,
char* szFQName,
size_t FQNameCapacity) override;

bool getSystemVAmd64PassStructInRegisterDescriptor(
CORINFO_CLASS_HANDLE structHnd,
SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr) override;
Expand All @@ -528,9 +494,6 @@ uint32_t getRISCV64PassStructInRegisterFlags(
uint32_t getThreadTLSIndex(
void** ppIndirection) override;

const void* getInlinedCallFrameVptr(
void** ppIndirection) override;

int32_t* getAddrOfCaptureThreadGlobal(
void** ppIndirection) override;

Expand Down Expand Up @@ -607,13 +570,6 @@ void getCallInfo(
CORINFO_CALLINFO_FLAGS flags,
CORINFO_CALL_INFO* pResult) override;

bool canAccessFamily(
CORINFO_METHOD_HANDLE hCaller,
CORINFO_CLASS_HANDLE hInstanceType) override;

bool isRIDClassDomainID(
CORINFO_CLASS_HANDLE cls) override;

unsigned getClassDomainID(
CORINFO_CLASS_HANDLE cls,
void** ppIndirection) override;
Expand Down Expand Up @@ -743,7 +699,6 @@ void recordRelocation(
void* locationRW,
void* target,
uint16_t fRelocType,
uint16_t slotNum,
int32_t addlDelta) override;

uint16_t getRelocTypeHint(
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
#define GUID_DEFINED
#endif // !GUID_DEFINED

constexpr GUID JITEEVersionIdentifier = { /* fda2f9dd-6b3e-4ecd-a7b8-79e5edf1f072 */
0xfda2f9dd,
0x6b3e,
0x4ecd,
{0xa7, 0xb8, 0x79, 0xe5, 0xed, 0xf1, 0xf0, 0x72}
constexpr GUID JITEEVersionIdentifier = { /* 88398e9f-093a-4212-85bc-bebb8c14cd24 */
0x88398e9f,
0x093a,
0x4212,
{0x85, 0xbc, 0xbe, 0xbb, 0x8c, 0x14, 0xcd, 0x24}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading