Skip to content

Commit

Permalink
JIT/EE interface cleanup (#85975)
Browse files Browse the repository at this point in the history
* JIT/EE interface cleanup
- Delete methods, fields and flags related to verification that is no longer supported
- Delete flags for old x86 models that are no longer needed given SSE2
  is our baseline

* Assert hardware minbar
  • Loading branch information
jkotas authored May 10, 2023
1 parent d7c2594 commit 6971065
Show file tree
Hide file tree
Showing 41 changed files with 266 additions and 1,532 deletions.
61 changes: 3 additions & 58 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1495,8 +1495,8 @@ enum CORINFO_CALLINFO_FLAGS
CORINFO_CALLINFO_NONE = 0x0000,
CORINFO_CALLINFO_ALLOWINSTPARAM = 0x0001, // Can the compiler generate code to pass an instantiation parameters? Simple compilers should not use this flag
CORINFO_CALLINFO_CALLVIRT = 0x0002, // Is it a virtual call?
CORINFO_CALLINFO_KINDONLY = 0x0004, // This is set to only query the kind of call to perform, without getting any other information
CORINFO_CALLINFO_VERIFICATION = 0x0008, // Gets extra verification information.
// UNUSED = 0x0004,
// UNUSED = 0x0008,
CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks.
CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN
// UNUSED = 0x0040,
Expand Down Expand Up @@ -1583,12 +1583,6 @@ struct CORINFO_CALL_INFO

CORINFO_SIG_INFO sig;

//Verification information
unsigned verMethodFlags; // flags for CORINFO_RESOLVED_TOKEN::hMethod
CORINFO_SIG_INFO verSig;
//All of the regular method data is the same... hMethod might not be the same as CORINFO_RESOLVED_TOKEN::hMethod


//If set to:
// - CORINFO_ACCESS_ALLOWED - The access is allowed.
// - CORINFO_ACCESS_ILLEGAL - This access cannot be allowed (i.e. it is public calling private). The
Expand Down Expand Up @@ -1763,13 +1757,6 @@ enum CORINFO_OS
CORINFO_MACOS,
};

struct CORINFO_CPU
{
uint32_t dwCPUType;
uint32_t dwFeatures;
uint32_t dwExtendedFeatures;
};

enum CORINFO_RUNTIME_ABI
{
CORINFO_DESKTOP_ABI = 0x100,
Expand Down Expand Up @@ -2055,8 +2042,6 @@ class ICorStaticInfo
// INLINE_PASS.
//
// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls)
//
// The inlined method need not be verified

virtual CorInfoInline canInline (
CORINFO_METHOD_HANDLE callerHnd, /* IN */
Expand Down Expand Up @@ -2477,10 +2462,7 @@ class ICorStaticInfo
CORINFO_CLASS_HANDLE clsHnd
) = 0;

// This is not pretty. Boxing nullable<T> actually returns
// a boxed<T> not a boxed Nullable<T>. This call allows the verifier
// to call back to the EE on the 'box' instruction and get the transformed
// type to use for verification.
// Boxing nullable<T> actually returns a boxed<T> not a boxed Nullable<T>.
virtual CORINFO_CLASS_HANDLE getTypeForBox(
CORINFO_CLASS_HANDLE cls
) = 0;
Expand Down Expand Up @@ -2901,43 +2883,6 @@ class ICorStaticInfo
CORINFO_CLASS_HANDLE hClass
) = 0;

/*****************************************************************************
* ICorErrorInfo contains methods to deal with SEH exceptions being thrown
* from the corinfo interface. These methods may be called when an exception
* with code EXCEPTION_COMPLUS is caught.
*****************************************************************************/

// Returns the HRESULT of the current exception
virtual JITINTERFACE_HRESULT GetErrorHRESULT(
struct _EXCEPTION_POINTERS *pExceptionPointers
) = 0;

// Fetches the message of the current exception
// Returns the size of the message (including terminating null). This can be
// greater than bufferLength if the buffer is insufficient.
virtual uint32_t GetErrorMessage(
_Inout_updates_(bufferLength) char16_t *buffer,
uint32_t bufferLength
) = 0;

// returns EXCEPTION_EXECUTE_HANDLER if it is OK for the compile to handle the
// exception, abort some work (like the inlining) and continue compilation
// returns EXCEPTION_CONTINUE_SEARCH if exception must always be handled by the EE
// things like ThreadStoppedException ...
// returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE
// Only used as a contract between the Zapper and the VM.
virtual int FilterException(
struct _EXCEPTION_POINTERS *pExceptionPointers
) = 0;


virtual void ThrowExceptionForJitResult(
JITINTERFACE_HRESULT result) = 0;

//Throws an exception defined by the given throw helper.
virtual void ThrowExceptionForHelper(
const CORINFO_HELPER_DESC * throwHelper) = 0;

// Runs the given function under an error trap. This allows the JIT to make calls
// to interface functions that may throw exceptions without needing to be aware of
// the EH ABI, exception types, etc. Returns true if the given function completed
Expand Down
16 changes: 5 additions & 11 deletions src/coreclr/inc/corjitflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,16 @@ class CORJIT_FLAGS
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
CORJIT_FLAG_TARGET_P4 = 9,
CORJIT_FLAG_USE_FCOMI = 10, // Generated code may use fcomi(p) instruction
CORJIT_FLAG_USE_CMOV = 11, // Generated code may use cmov instruction

#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,

#endif // !defined(TARGET_X86)

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

CORJIT_FLAG_ALT_JIT = 14, // JIT should consider itself an ALT_JIT
Expand All @@ -64,18 +58,18 @@ class CORJIT_FLAGS
CORJIT_FLAG_PROF_ENTERLEAVE = 20, // Instrument prologues/epilogues
CORJIT_FLAG_UNUSED11 = 21,
CORJIT_FLAG_PROF_NO_PINVOKE_INLINE = 22, // Disables PInvoke inlining
CORJIT_FLAG_SKIP_VERIFICATION = 23, // (lazy) skip verification - determined without doing a full resolve. See comment below
CORJIT_FLAG_UNUSED12 = 23,
CORJIT_FLAG_PREJIT = 24, // jit or prejit is the execution engine.
CORJIT_FLAG_RELOC = 25, // Generate relocatable code
CORJIT_FLAG_IMPORT_ONLY = 26, // Only import the function
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_UNUSED13 = 34,
CORJIT_FLAG_UNUSED14 = 34,
CORJIT_FLAG_SAMPLING_JIT_BACKGROUND = 35, // JIT is being invoked as a result of stack sampling for hot methods in the background
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
Expand Down
16 changes: 0 additions & 16 deletions src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,22 +476,6 @@ CORINFO_CLASS_HANDLE getArgClass(
CorInfoHFAElemType getHFAType(
CORINFO_CLASS_HANDLE hClass) override;

JITINTERFACE_HRESULT GetErrorHRESULT(
struct _EXCEPTION_POINTERS* pExceptionPointers) override;

uint32_t GetErrorMessage(
char16_t* buffer,
uint32_t bufferLength) override;

int FilterException(
struct _EXCEPTION_POINTERS* pExceptionPointers) override;

void ThrowExceptionForJitResult(
JITINTERFACE_HRESULT result) override;

void ThrowExceptionForHelper(
const CORINFO_HELPER_DESC* throwHelper) override;

bool runWithErrorTrap(
ICorJitInfo::errorTrapFunction function,
void* parameter) override;
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 = { /* 4e6355a0-3844-45e2-8cef-082c18217e14 */
0x4e6355a0,
0x3844,
0x45e2,
{0x8c, 0xef, 0x8, 0x2c, 0x18, 0x21, 0x7e, 0x14}
constexpr GUID JITEEVersionIdentifier = { /* 50246073-be42-4227-b9e1-edc585672820 */
0x50246073,
0xbe42,
0x4227,
{0xb9, 0xe1, 0xed, 0xc5, 0x85, 0x67, 0x28, 0x20}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/jit/ICorJitInfo_names_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ DEF_CLR_API(getArgType)
DEF_CLR_API(getExactClasses)
DEF_CLR_API(getArgClass)
DEF_CLR_API(getHFAType)
DEF_CLR_API(GetErrorHRESULT)
DEF_CLR_API(GetErrorMessage)
DEF_CLR_API(FilterException)
DEF_CLR_API(ThrowExceptionForJitResult)
DEF_CLR_API(ThrowExceptionForHelper)
DEF_CLR_API(runWithErrorTrap)
DEF_CLR_API(runWithSPMIErrorTrap)
DEF_CLR_API(getEEInfo)
Expand Down
44 changes: 0 additions & 44 deletions src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1126,50 +1126,6 @@ CorInfoHFAElemType WrapICorJitInfo::getHFAType(
return temp;
}

JITINTERFACE_HRESULT WrapICorJitInfo::GetErrorHRESULT(
struct _EXCEPTION_POINTERS* pExceptionPointers)
{
API_ENTER(GetErrorHRESULT);
JITINTERFACE_HRESULT temp = wrapHnd->GetErrorHRESULT(pExceptionPointers);
API_LEAVE(GetErrorHRESULT);
return temp;
}

uint32_t WrapICorJitInfo::GetErrorMessage(
char16_t* buffer,
uint32_t bufferLength)
{
API_ENTER(GetErrorMessage);
uint32_t temp = wrapHnd->GetErrorMessage(buffer, bufferLength);
API_LEAVE(GetErrorMessage);
return temp;
}

int WrapICorJitInfo::FilterException(
struct _EXCEPTION_POINTERS* pExceptionPointers)
{
API_ENTER(FilterException);
int temp = wrapHnd->FilterException(pExceptionPointers);
API_LEAVE(FilterException);
return temp;
}

void WrapICorJitInfo::ThrowExceptionForJitResult(
JITINTERFACE_HRESULT result)
{
API_ENTER(ThrowExceptionForJitResult);
wrapHnd->ThrowExceptionForJitResult(result);
API_LEAVE(ThrowExceptionForJitResult);
}

void WrapICorJitInfo::ThrowExceptionForHelper(
const CORINFO_HELPER_DESC* throwHelper)
{
API_ENTER(ThrowExceptionForHelper);
wrapHnd->ThrowExceptionForHelper(throwHelper);
API_LEAVE(ThrowExceptionForHelper);
}

bool WrapICorJitInfo::runWithErrorTrap(
ICorJitInfo::errorTrapFunction function,
void* parameter)
Expand Down
57 changes: 22 additions & 35 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1733,55 +1733,42 @@ void CodeGen::genGenerateMachineCode()
printf(" for ");

#if defined(TARGET_X86)
if (compiler->info.genCPU == CPU_X86)
if (compiler->canUseEvexEncoding())
{
printf("generic X86 CPU");
printf("X86 with AVX512");
}
else if (compiler->info.genCPU == CPU_X86_PENTIUM_4)
else if (compiler->canUseVexEncoding())
{
printf("Pentium 4");
printf("X86 with AVX");
}
#elif defined(TARGET_AMD64)
if (compiler->info.genCPU == CPU_X64)
else
{
if (compiler->canUseEvexEncoding())
{
printf("X64 CPU with AVX512");
}
else if (compiler->canUseVexEncoding())
{
printf("X64 CPU with AVX");
}
else
{
printf("X64 CPU with SSE2");
}
printf("generic X86");
}
#elif defined(TARGET_ARM)
if (compiler->info.genCPU == CPU_ARM)
#elif defined(TARGET_AMD64)
if (compiler->canUseEvexEncoding())
{
printf("generic ARM CPU");
printf("X64 with AVX512");
}
#elif defined(TARGET_ARM64)
if (compiler->info.genCPU == CPU_ARM64)
else if (compiler->canUseVexEncoding())
{
printf("generic ARM64 CPU");
printf("X64 with AVX");
}
#elif defined(TARGET_LOONGARCH64)
if (compiler->info.genCPU == CPU_LOONGARCH64)
else
{
printf("generic LOONGARCH64 CPU");
printf("generic X64");
}
#elif defined(TARGET_ARM)
printf("generic ARM");
#elif defined(TARGET_ARM64)
printf("generic ARM64");
#elif defined(TARGET_LOONGARCH64)
printf("generic LOONGARCH64");
#elif defined(TARGET_RISCV64)
if (compiler->info.genCPU == CPU_RISCV64)
{
printf("generic RISCV64 CPU");
}
printf("generic RISCV64");
#else
printf("unknown architecture");
#endif
else
{
printf("unknown architecture");
}

if (TargetOS::IsWindows)
{
Expand Down
Loading

0 comments on commit 6971065

Please sign in to comment.