diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 93f67680284498..50c0d348bd0f3c 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -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, @@ -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 @@ -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, @@ -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 */ @@ -2477,10 +2462,7 @@ class ICorStaticInfo CORINFO_CLASS_HANDLE clsHnd ) = 0; - // This is not pretty. Boxing nullable actually returns - // a boxed not a boxed Nullable. 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 actually returns a boxed not a boxed Nullable. virtual CORINFO_CLASS_HANDLE getTypeForBox( CORINFO_CLASS_HANDLE cls ) = 0; @@ -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 diff --git a/src/coreclr/inc/corjitflags.h b/src/coreclr/inc/corjitflags.h index 4d511aa6f74705..bd96908acf2a59 100644 --- a/src/coreclr/inc/corjitflags.h +++ b/src/coreclr/inc/corjitflags.h @@ -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 @@ -64,10 +58,10 @@ 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 @@ -75,7 +69,7 @@ class CORJIT_FLAGS 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 diff --git a/src/coreclr/inc/icorjitinfoimpl_generated.h b/src/coreclr/inc/icorjitinfoimpl_generated.h index cf4c94498c33a1..ad73b66da09662 100644 --- a/src/coreclr/inc/icorjitinfoimpl_generated.h +++ b/src/coreclr/inc/icorjitinfoimpl_generated.h @@ -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; diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index d539e04c6b168d..6e5df744de35ac 100644 --- a/src/coreclr/inc/jiteeversionguid.h +++ b/src/coreclr/inc/jiteeversionguid.h @@ -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} }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/coreclr/jit/ICorJitInfo_names_generated.h b/src/coreclr/jit/ICorJitInfo_names_generated.h index cb5db87194525c..b93f42dfba8ffe 100644 --- a/src/coreclr/jit/ICorJitInfo_names_generated.h +++ b/src/coreclr/jit/ICorJitInfo_names_generated.h @@ -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) diff --git a/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp b/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp index b819fc12fbce13..990d8cabce1a23 100644 --- a/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp +++ b/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp @@ -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) diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index c0aa4c78f726bf..c05ef1655c9399 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -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) { diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index bc1b7b0d0dbb46..f7848fababeb13 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -2251,39 +2251,11 @@ void Compiler::compSetProcessor() const JitFlags& jitFlags = *opts.jitFlags; -#if defined(TARGET_ARM) - info.genCPU = CPU_ARM; -#elif defined(TARGET_ARM64) - info.genCPU = CPU_ARM64; -#elif defined(TARGET_AMD64) - info.genCPU = CPU_X64; -#elif defined(TARGET_X86) - if (jitFlags.IsSet(JitFlags::JIT_FLAG_TARGET_P4)) - info.genCPU = CPU_X86_PENTIUM_4; - else - info.genCPU = CPU_X86; -#elif defined(TARGET_LOONGARCH64) - info.genCPU = CPU_LOONGARCH64; -#elif defined(TARGET_RISCV64) - info.genCPU = CPU_RISCV64; -#endif - // // Processor specific optimizations // CLANG_FORMAT_COMMENT_ANCHOR; -#ifdef TARGET_AMD64 - opts.compUseCMOV = true; -#elif defined(TARGET_X86) - opts.compUseCMOV = jitFlags.IsSet(JitFlags::JIT_FLAG_USE_CMOV); -#ifdef DEBUG - if (opts.compUseCMOV) - opts.compUseCMOV = !compStressCompile(STRESS_USE_CMOV, 50); -#endif // DEBUG - -#endif // TARGET_X86 - CORINFO_InstructionSetFlags instructionSetFlags = jitFlags.GetInstructionSetFlags(); opts.compSupportsISA.Reset(); opts.compSupportsISAReported.Reset(); @@ -2690,19 +2662,6 @@ void Compiler::compInitOptions(JitFlags* jitFlags) bool altJitConfig = !pfAltJit->isEmpty(); - // If we have a non-empty AltJit config then we change all of these other - // config values to refer only to the AltJit. Otherwise, a lot of DOTNET_* variables - // would apply to both the altjit and the normal JIT, but we only care about - // debugging the altjit if the DOTNET_AltJit configuration is set. - // - if (compIsForImportOnly() && (!altJitConfig || opts.altJit)) - { - if (JitConfig.JitImportBreak().contains(info.compMethodHnd, info.compClassHnd, &info.compMethodInfo->args)) - { - assert(!"JitImportBreak reached"); - } - } - bool verboseDump = false; if (!altJitConfig || opts.altJit) @@ -2760,11 +2719,6 @@ void Compiler::compInitOptions(JitFlags* jitFlags) lvaEnregEHVars = (compEnregLocals() && JitConfig.EnableEHWriteThru()); lvaEnregMultiRegVars = (compEnregLocals() && JitConfig.EnableMultiRegLocals()); - if (compIsForImportOnly()) - { - return; - } - #if FEATURE_TAILCALL_OPT // By default opportunistic tail call optimization is enabled. // Recognition is done in the importer so this must be set for @@ -4408,8 +4362,7 @@ void Compiler::compFunctionTraceEnd(void* methodCodePtr, ULONG methodCodeSize, b /* { editor brace-matching workaround for following printf */ printf("} Jitted Method %4d at" FMT_ADDR "method %s size %08x%s%s\n", methodNumber, DBG_ADDR(methodCodePtr), - info.compFullName, methodCodeSize, isNYI ? " NYI" : (compIsForImportOnly() ? " import only" : ""), - opts.altJit ? " altjit" : ""); + info.compFullName, methodCodeSize, isNYI ? " NYI" : "", opts.altJit ? " altjit" : ""); } #endif // DEBUG } @@ -4588,13 +4541,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl // get this far if we are jitting the root method. noway_assert(!compIsForInlining()); - // Maybe the caller was not interested in generating code - if (compIsForImportOnly()) - { - compFunctionTraceEnd(nullptr, 0, false); - return; - } - // Prepare for the morph phases // DoPhase(this, PHASE_MORPH_INIT, &Compiler::fgMorphInit); @@ -6205,10 +6151,6 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr, #endif // DEBUG - // Set this before the first 'BADCODE' - // Skip verification where possible - assert(compileFlags->IsSet(JitFlags::JIT_FLAG_SKIP_VERIFICATION)); - /* Setup an error trap */ struct Param diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 91d4350e0afda1..2331ab4a32d55c 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -66,10 +66,6 @@ inline var_types genActualType(T value); #include "simd.h" #include "simdashwintrinsic.h" -// This is only used locally in the JIT to indicate that -// a verification block should be inserted -#define SEH_VERIFICATION_EXCEPTION 0xe0564552 // VER - /***************************************************************************** * Forward declarations */ @@ -9274,8 +9270,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX codeOptimize compCodeOpt; // what type of code optimizations - bool compUseCMOV; - // optimize maximally and/or favor speed over size? #define DEFAULT_MIN_OPTS_CODE_SIZE 60000 @@ -9922,22 +9916,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX unsigned compStmtOffsetsCount; ICorDebugInfo::BoundaryTypes compStmtOffsetsImplicit; -#define CPU_X86 0x0100 // The generic X86 CPU -#define CPU_X86_PENTIUM_4 0x0110 - -#define CPU_X64 0x0200 // The generic x64 CPU -#define CPU_AMD_X64 0x0210 // AMD x64 CPU -#define CPU_INTEL_X64 0x0240 // Intel x64 CPU - -#define CPU_ARM 0x0300 // The generic ARM CPU -#define CPU_ARM64 0x0400 // The generic ARM64 CPU - -#define CPU_LOONGARCH64 0x0800 // The generic LOONGARCH64 CPU - -#define CPU_RISCV64 0x1000 // The generic RISCV64 CPU - - unsigned genCPU; // What CPU are we running on - // Number of class profile probes in this method unsigned compHandleHistogramProbeCount; @@ -10301,7 +10279,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX static EnregisterStats s_enregisterStats; #endif // TRACK_ENREG_STATS - bool compIsForImportOnly(); bool compIsForInlining() const; bool compDonotInline(); @@ -10495,10 +10472,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX typeInfo verParseArgSigToTypeInfo(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args); bool verIsByRefLike(const typeInfo& ti); - void DECLSPEC_NORETURN verRaiseVerifyException(INDEBUG(const char* reason) DEBUGARG(const char* file) - DEBUGARG(unsigned line)); - void verRaiseVerifyExceptionIfNeeded(INDEBUG(const char* reason) DEBUGARG(const char* file) - DEBUGARG(unsigned line)); bool verCheckTailCallConstraint(OPCODE opcode, CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken); diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index 2156a13e3aaaaf..96a579cd51b4dc 100644 --- a/src/coreclr/jit/compiler.hpp +++ b/src/coreclr/jit/compiler.hpp @@ -3620,16 +3620,6 @@ inline bool Compiler::impIsThis(GenTree* obj) } } -/***************************************************************************** - * - * Returns true if the compiler instance is created for import only (verification). - */ - -inline bool Compiler::compIsForImportOnly() -{ - return opts.jitFlags->IsSet(JitFlags::JIT_FLAG_IMPORT_ONLY); -} - /***************************************************************************** * * Returns true if the compiler instance is created for inlining. diff --git a/src/coreclr/jit/fginline.cpp b/src/coreclr/jit/fginline.cpp index 856432f00ea836..08be749cc8d970 100644 --- a/src/coreclr/jit/fginline.cpp +++ b/src/coreclr/jit/fginline.cpp @@ -1129,8 +1129,6 @@ void Compiler::fgInvokeInlineeCompiler(GenTreeCall* call, InlineResult* inlineRe compileFlagsForInlinee.Clear(JitFlags::JIT_FLAG_REVERSE_PINVOKE); compileFlagsForInlinee.Clear(JitFlags::JIT_FLAG_TRACK_TRANSITIONS); - compileFlagsForInlinee.Set(JitFlags::JIT_FLAG_SKIP_VERIFICATION); - #ifdef DEBUG if (pParam->pThis->verbose) { diff --git a/src/coreclr/jit/fgprofile.cpp b/src/coreclr/jit/fgprofile.cpp index 33f922344cffcd..2008534d3b5bfa 100644 --- a/src/coreclr/jit/fgprofile.cpp +++ b/src/coreclr/jit/fgprofile.cpp @@ -41,11 +41,6 @@ // bool Compiler::fgHaveProfileData() { - if (compIsForImportOnly()) - { - return false; - } - return (fgPgoSchema != nullptr); } diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 676f6fa0c83873..f43ced9d1b4834 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -18161,14 +18161,6 @@ CORINFO_CLASS_HANDLE Compiler::gtGetClassHandle(GenTree* tree, bool* pIsExact, b *pIsExact = false; CORINFO_CLASS_HANDLE objClass = nullptr; - // Bail out if we're just importing and not generating code, since - // the jit uses TYP_REF for CORINFO_TYPE_VAR locals and args, but - // these may not be ref types. - if (compIsForImportOnly()) - { - return objClass; - } - // Bail out if the tree is not a ref type. var_types treeType = tree->TypeGet(); if (treeType != TYP_REF) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index e6b3bb4d03c973..aafe4572e9d57c 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -19,15 +19,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #include "corexcep.h" -#define Verify(cond, msg) \ - do \ - { \ - if (!(cond)) \ - { \ - verRaiseVerifyExceptionIfNeeded(INDEBUG(msg) DEBUGARG(__FILE__) DEBUGARG(__LINE__)); \ - } \ - } while (0) - /*****************************************************************************/ void Compiler::impInit() @@ -81,54 +72,6 @@ void Compiler::impPushNullObjRefOnStack() impPushOnStack(gtNewIconNode(0, TYP_REF), typeInfo(TI_NULL)); } -// This method gets called when we run into unverifiable code -// (and we are verifying the method) - -void Compiler::verRaiseVerifyExceptionIfNeeded(INDEBUG(const char* msg) DEBUGARG(const char* file) - DEBUGARG(unsigned line)) -{ -#ifdef DEBUG - const char* tail = strrchr(file, DIRECTORY_SEPARATOR_CHAR_A); - if (tail) - { - file = tail + 1; - } - - if (JitConfig.JitBreakOnUnsafeCode()) - { - assert(!"Unsafe code detected"); - } -#endif - - JITLOG((LL_INFO10000, "Detected unsafe code: %s:%d : %s, while compiling %s opcode %s, IL offset %x\n", file, line, - msg, info.compFullName, impCurOpcName, impCurOpcOffs)); - - if (compIsForImportOnly()) - { - JITLOG((LL_ERROR, "Verification failure: %s:%d : %s, while compiling %s opcode %s, IL offset %x\n", file, line, - msg, info.compFullName, impCurOpcName, impCurOpcOffs)); - verRaiseVerifyException(INDEBUG(msg) DEBUGARG(file) DEBUGARG(line)); - } -} - -void DECLSPEC_NORETURN Compiler::verRaiseVerifyException(INDEBUG(const char* msg) DEBUGARG(const char* file) - DEBUGARG(unsigned line)) -{ - JITLOG((LL_ERROR, "Verification failure: %s:%d : %s, while compiling %s opcode %s, IL offset %x\n", file, line, - msg, info.compFullName, impCurOpcName, impCurOpcOffs)); - -#ifdef DEBUG - // BreakIfDebuggerPresent(); - if (getBreakOnBadCode()) - { - assert(!"Typechecking error"); - } -#endif - - RaiseException(SEH_VERIFICATION_EXCEPTION, EXCEPTION_NONCONTINUABLE, 0, nullptr); - UNREACHABLE(); -} - // helper function that will tell us if the IL instruction at the addr passed // by param consumes an address at the top of the stack. We use it to save // us lvAddrTaken @@ -4213,16 +4156,7 @@ void Compiler::impHandleAccessAllowedInternal(CorInfoIsAccessAllowedResult resul case CORINFO_ACCESS_ALLOWED: break; case CORINFO_ACCESS_ILLEGAL: - // if we're verifying, then we need to reject the illegal access to ensure that we don't think the - // method is verifiable. Otherwise, delay the exception to runtime. - if (compIsForImportOnly()) - { - info.compCompHnd->ThrowExceptionForHelper(helperCall); - } - else - { - impInsertHelperCall(helperCall); - } + impInsertHelperCall(helperCall); break; } } @@ -6802,7 +6736,11 @@ void Compiler::impImportBlockCode(BasicBlock* block) lclNum = getU1LittleEndian(codeAddr); LDARGA: JITDUMP(" %u", lclNum); - Verify(lclNum < info.compILargsCount, "bad arg num"); + + if (lclNum >= info.compILargsCount) + { + BADCODE("Bad IL"); + } if (compIsForInlining()) { @@ -6922,8 +6860,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) op1 = gtNewOperNode(GT_RETFILT, op1->TypeGet(), op1); if (verCurrentState.esStackDepth != 0) { - verRaiseVerifyException(INDEBUG("stack must be 1 on end of filter") DEBUGARG(__FILE__) - DEBUGARG(__LINE__)); + BADCODE("stack must be 1 on end of filter"); } goto APPEND; @@ -7561,7 +7498,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) /* Try to fold the really simple cases like 'iconst *, ifne/ifeq'*/ /* Don't make any blocks unreachable in import only mode */ - if ((op1->gtOper == GT_CNS_INT) && !compIsForImportOnly()) + if (op1->gtOper == GT_CNS_INT) { /* gtFoldExpr() should prevent this as we don't want to make any blocks unreachable under compDbgCode */ @@ -7816,7 +7753,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) assertImp(genActualTypeIsIntOrI(op1->TypeGet())); // Fold Switch for GT_CNS_INT - if (opts.OptimizationEnabled() && (op1->gtOper == GT_CNS_INT) && !compIsForImportOnly()) + if (opts.OptimizationEnabled() && (op1->gtOper == GT_CNS_INT)) { // Find the jump target size_t switchVal = (size_t)op1->AsIntCon()->gtIconVal; @@ -8424,7 +8361,6 @@ void Compiler::impImportBlockCode(BasicBlock* block) BADCODE("Alignment unaligned. must be 1, 2, or 4"); } - Verify(!(prefixFlags & PREFIX_UNALIGNED), "Multiple unaligned. prefixes"); prefixFlags |= PREFIX_UNALIGNED; impValidateMemoryAccessOpcode(codeAddr, codeEndp, false); @@ -8437,7 +8373,6 @@ void Compiler::impImportBlockCode(BasicBlock* block) case CEE_VOLATILE: - Verify(!(prefixFlags & PREFIX_VOLATILE), "Multiple volatile. prefixes"); prefixFlags |= PREFIX_VOLATILE; impValidateMemoryAccessOpcode(codeAddr, codeEndp, true); @@ -8569,7 +8504,6 @@ void Compiler::impImportBlockCode(BasicBlock* block) codeAddr += sizeof(unsigned); // prefix instructions must increment codeAddr manually JITDUMP(" (%08X) ", constrainedResolvedToken.token); - Verify(!(prefixFlags & PREFIX_CONSTRAINED), "Multiple constrained. prefixes"); prefixFlags |= PREFIX_CONSTRAINED; { @@ -8585,7 +8519,6 @@ void Compiler::impImportBlockCode(BasicBlock* block) case CEE_READONLY: JITDUMP(" readonly."); - Verify(!(prefixFlags & PREFIX_READONLY), "Multiple readonly. prefixes"); prefixFlags |= PREFIX_READONLY; { @@ -8602,7 +8535,6 @@ void Compiler::impImportBlockCode(BasicBlock* block) case CEE_TAILCALL: JITDUMP(" tail."); - Verify(!(prefixFlags & PREFIX_TAILCALL_EXPLICIT), "Multiple tailcall. prefixes"); prefixFlags |= PREFIX_TAILCALL_EXPLICIT; { @@ -10768,8 +10700,6 @@ void Compiler::impLoadVar(unsigned lclNum, IL_OFFSET offset) // It will be mapped to the correct lvaTable index void Compiler::impLoadArg(unsigned ilArgNum, IL_OFFSET offset) { - Verify(ilArgNum < info.compILargsCount, "bad arg num"); - if (compIsForInlining()) { if (ilArgNum >= info.compArgsCount) @@ -11343,16 +11273,6 @@ void Compiler::impReimportMarkSuccessors(BasicBlock* block) * from it). */ -LONG FilterVerificationExceptions(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam) -{ - if (pExceptionPointers->ExceptionRecord->ExceptionCode == SEH_VERIFICATION_EXCEPTION) - { - return EXCEPTION_EXECUTE_HANDLER; - } - - return EXCEPTION_CONTINUE_SEARCH; -} - void Compiler::impVerifyEHBlock(BasicBlock* block, bool isTryStart) { assert(block->hasTryIndex()); @@ -11509,17 +11429,6 @@ void Compiler::impImportBlock(BasicBlock* block) /* Now walk the code and import the IL into GenTrees */ - struct FilterVerificationExceptionsParam - { - Compiler* pThis; - BasicBlock* block; - }; - FilterVerificationExceptionsParam param; - - param.pThis = this; - param.block = block; - - PAL_TRY(FilterVerificationExceptionsParam*, pParam, ¶m) { /* @VERIFICATION : For now, the only state propagation from try to it's handler is "thisInit" state (stack is empty at start of try). @@ -11547,26 +11456,21 @@ void Compiler::impImportBlock(BasicBlock* block) // merge the start state of the try begin // - if (pParam->block->bbFlags & BBF_TRY_BEG) + if (block->bbFlags & BBF_TRY_BEG) { - pParam->pThis->impVerifyEHBlock(pParam->block, true); + impVerifyEHBlock(block, true); } - pParam->pThis->impImportBlockCode(pParam->block); + impImportBlockCode(block); // As discussed above: // merge the post-state of each block that is part of this try region // - if (pParam->block->hasTryIndex()) + if (block->hasTryIndex()) { - pParam->pThis->impVerifyEHBlock(pParam->block, false); + impVerifyEHBlock(block, false); } } - PAL_EXCEPT_FILTER(FilterVerificationExceptions) - { - verHandleVerificationFailure(block DEBUGARG(false)); - } - PAL_ENDTRY if (compDonotInline()) { @@ -12516,10 +12420,6 @@ void Compiler::impImport() { return; } - if (compIsForImportOnly()) - { - return; - } } } diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index ce7d2f286db33e..2b8842d255bd88 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -3,15 +3,6 @@ #include "jitpch.h" -#define Verify(cond, msg) \ - do \ - { \ - if (!(cond)) \ - { \ - verRaiseVerifyExceptionIfNeeded(INDEBUG(msg) DEBUGARG(__FILE__) DEBUGARG(__LINE__)); \ - } \ - } while (0) - //------------------------------------------------------------------------ // impImportCall: import a call-inspiring opcode // @@ -1101,13 +1092,7 @@ var_types Compiler::impImportCall(OPCODE opcode, // Stack empty check for implicit tail calls. if (canTailCall && isImplicitTailCall && (verCurrentState.esStackDepth != 0)) { -#ifdef TARGET_AMD64 - // JIT64 Compatibility: Opportunistic tail call stack mismatch throws a VerificationException - // in JIT64, not an InvalidProgramException. - Verify(false, "Stack should be empty after tailcall"); -#else // TARGET_64BIT BADCODE("Stack should be empty after tailcall"); -#endif //! TARGET_64BIT } // assert(compCurBB is not a catch, finally or filter block); @@ -6123,14 +6108,6 @@ void Compiler::impMarkInlineCandidateHelper(GenTreeCall* call, return; } - if (compIsForImportOnly()) - { - // Don't bother creating the inline candidate during verification. - // Otherwise the call to info.compCompHnd->canInline will trigger a recursive verification - // that leads to the creation of multiple instances of Compiler. - return; - } - InlineResult inlineResult(this, call, nullptr, "impMarkInlineCandidate"); // Don't inline if not optimizing root method diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index 578edeb50ccb51..add816cdd9d894 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -38,7 +38,6 @@ CONFIG_INTEGER(JitBreakEmitOutputInstr, W("JitBreakEmitOutputInstr"), -1) CONFIG_INTEGER(JitBreakMorphTree, W("JitBreakMorphTree"), 0xffffffff) CONFIG_INTEGER(JitBreakOnBadCode, W("JitBreakOnBadCode"), 0) CONFIG_INTEGER(JitBreakOnMinOpts, W("JITBreakOnMinOpts"), 0) // Halt if jit switches to MinOpts -CONFIG_INTEGER(JitBreakOnUnsafeCode, W("JitBreakOnUnsafeCode"), 0) CONFIG_INTEGER(JitCloneLoops, W("JitCloneLoops"), 1) // If 0, don't clone. Otherwise clone loops for optimizations. CONFIG_INTEGER(JitCloneLoopsWithGdvTests, W("JitCloneLoopsWithGdvTests"), 1) // If 0, don't clone loops based on // invariant type/method address tests @@ -204,7 +203,6 @@ CONFIG_METHODSET(JitForceProcedureSplitting, W("JitForceProcedureSplitting")) CONFIG_METHODSET(JitGCDump, W("JitGCDump")) CONFIG_METHODSET(JitDebugDump, W("JitDebugDump")) CONFIG_METHODSET(JitHalt, W("JitHalt")) // Emits break instruction into jitted code -CONFIG_METHODSET(JitImportBreak, W("JitImportBreak")) CONFIG_METHODSET(JitInclude, W("JitInclude")) CONFIG_METHODSET(JitLateDisasm, W("JitLateDisasm")) CONFIG_METHODSET(JitMinOptsName, W("JITMinOptsName")) // Forces MinOpts for a named function diff --git a/src/coreclr/jit/jitee.h b/src/coreclr/jit/jitee.h index b55719f56e8250..aa74b2c9c10473 100644 --- a/src/coreclr/jit/jitee.h +++ b/src/coreclr/jit/jitee.h @@ -21,22 +21,16 @@ class JitFlags JIT_FLAG_MCJIT_BACKGROUND = 7, // Calling from multicore JIT background thread, do not call JitComplete #if defined(TARGET_X86) - JIT_FLAG_PINVOKE_RESTORE_ESP = 8, // Restore ESP after returning from inlined PInvoke - JIT_FLAG_TARGET_P4 = 9, - JIT_FLAG_USE_FCOMI = 10, // Generated code may use fcomi(p) instruction - JIT_FLAG_USE_CMOV = 11, // Generated code may use cmov instruction - #else // !defined(TARGET_X86) - JIT_FLAG_UNUSED2 = 8, + #endif // !defined(TARGET_X86) + JIT_FLAG_UNUSED3 = 9, JIT_FLAG_UNUSED4 = 10, JIT_FLAG_UNUSED5 = 11, JIT_FLAG_UNUSED6 = 12, - #endif // !defined(TARGET_X86) - JIT_FLAG_OSR = 13, // Generate alternate version for On Stack Replacement JIT_FLAG_ALT_JIT = 14, // JIT should consider itself an ALT_JIT @@ -54,7 +48,7 @@ class JitFlags JIT_FLAG_PROF_ENTERLEAVE = 20, // Instrument prologues/epilogues JIT_FLAG_UNUSED11 = 21, JIT_FLAG_PROF_NO_PINVOKE_INLINE = 22, // Disables PInvoke inlining - JIT_FLAG_SKIP_VERIFICATION = 23, // (lazy) skip verification - determined without doing a full resolve. See comment below + JIT_FLAG_UNUSED12 = 23, JIT_FLAG_PREJIT = 24, // jit or prejit is the execution engine. JIT_FLAG_RELOC = 25, // Generate relocatable code JIT_FLAG_IMPORT_ONLY = 26, // Only import the function @@ -178,12 +172,7 @@ class JitFlags FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND, JIT_FLAG_MCJIT_BACKGROUND); #if defined(TARGET_X86) - FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PINVOKE_RESTORE_ESP, JIT_FLAG_PINVOKE_RESTORE_ESP); - FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_TARGET_P4, JIT_FLAG_TARGET_P4); - FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_USE_FCOMI, JIT_FLAG_USE_FCOMI); - FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_USE_CMOV, JIT_FLAG_USE_CMOV); - #endif FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_ALT_JIT, JIT_FLAG_ALT_JIT); @@ -192,10 +181,8 @@ class JitFlags FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_READYTORUN, JIT_FLAG_READYTORUN); FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PROF_ENTERLEAVE, JIT_FLAG_PROF_ENTERLEAVE); FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PROF_NO_PINVOKE_INLINE, JIT_FLAG_PROF_NO_PINVOKE_INLINE); - FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_SKIP_VERIFICATION, JIT_FLAG_SKIP_VERIFICATION); FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PREJIT, JIT_FLAG_PREJIT); FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_RELOC, JIT_FLAG_RELOC); - FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY, JIT_FLAG_IMPORT_ONLY); FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB, JIT_FLAG_IL_STUB); FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PROCSPLIT, JIT_FLAG_PROCSPLIT); FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR, JIT_FLAG_BBINSTR); @@ -210,17 +197,13 @@ class JitFlags FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_TIER1, JIT_FLAG_TIER1); #if defined(TARGET_ARM) - FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_RELATIVE_CODE_RELOCS, JIT_FLAG_RELATIVE_CODE_RELOCS); - #endif // TARGET_ARM FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_NO_INLINING, JIT_FLAG_NO_INLINING); #if defined(TARGET_ARM) - FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_SOFTFP_ABI, JIT_FLAG_SOFTFP_ABI); - #endif // TARGET_ARM #undef FLAGS_EQUAL diff --git a/src/coreclr/jit/lclvars.cpp b/src/coreclr/jit/lclvars.cpp index 60dc1828c1a4cd..4f9121ecfe4d99 100644 --- a/src/coreclr/jit/lclvars.cpp +++ b/src/coreclr/jit/lclvars.cpp @@ -3103,13 +3103,6 @@ void Compiler::lvaSetClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool is { noway_assert(varNum < lvaCount); - // If we are just importing, we cannot reliably track local ref types, - // since the jit maps CORINFO_TYPE_VAR to TYP_REF. - if (compIsForImportOnly()) - { - return; - } - if (clsHnd != NO_CLASS_HANDLE && !isExact && JitConfig.JitEnableExactDevirtualization()) { CORINFO_CLASS_HANDLE exactClass; @@ -3198,13 +3191,6 @@ void Compiler::lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool { assert(varNum < lvaCount); - // If we are just importing, we cannot reliably track local ref types, - // since the jit maps CORINFO_TYPE_VAR to TYP_REF. - if (compIsForImportOnly()) - { - return; - } - // Else we should have a class handle to consider assert(clsHnd != nullptr); diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index 6d3806f2987682..5c90ea273df430 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -3043,21 +3043,6 @@ private CorInfoHFAElemType getHFAType(CORINFO_CLASS_STRUCT_* hClass) }; } - private HRESULT GetErrorHRESULT(_EXCEPTION_POINTERS* pExceptionPointers) - { throw new NotImplementedException("GetErrorHRESULT"); } - private uint GetErrorMessage(char* buffer, uint bufferLength) - { throw new NotImplementedException("GetErrorMessage"); } - -#pragma warning disable CA1822 // Mark members as static - private int FilterException(_EXCEPTION_POINTERS* pExceptionPointers) -#pragma warning restore CA1822 // Mark members as static - { - // This method is completely handled by the C++ wrapper to the JIT-EE interface, - // and should never reach the managed implementation. - Debug.Fail("CorInfoImpl.FilterException should not be called"); - throw new NotSupportedException("FilterException"); - } - #pragma warning disable CA1822 // Mark members as static private bool runWithErrorTrap(void* function, void* parameter) #pragma warning restore CA1822 // Mark members as static @@ -3078,11 +3063,6 @@ private bool runWithSPMIErrorTrap(void* function, void* parameter) throw new NotSupportedException("runWithSPMIErrorTrap"); } - private void ThrowExceptionForJitResult(HRESULT result) - { throw new NotImplementedException("ThrowExceptionForJitResult"); } - private void ThrowExceptionForHelper(ref CORINFO_HELPER_DESC throwHelper) - { throw new NotImplementedException("ThrowExceptionForHelper"); } - public static CORINFO_OS TargetToOs(TargetDetails target) { return target.IsWindows ? CORINFO_OS.CORINFO_WINNT : @@ -3910,7 +3890,6 @@ private uint getJitFlags(ref CORJIT_FLAGS flags, uint sizeInBytes) flags.InstructionSetFlags.Add(_compilation.InstructionSetSupport.OptimisticFlags); // Set the rest of the flags that don't make sense to expose publicly. - flags.Set(CorJitFlag.CORJIT_FLAG_SKIP_VERIFICATION); flags.Set(CorJitFlag.CORJIT_FLAG_READYTORUN); flags.Set(CorJitFlag.CORJIT_FLAG_RELOC); flags.Set(CorJitFlag.CORJIT_FLAG_PREJIT); diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs index 3c7f632ef8e7b0..ccfdf88b8797ee 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs @@ -1697,79 +1697,6 @@ private static CorInfoHFAElemType _getHFAType(IntPtr thisHandle, IntPtr* ppExcep } } - [UnmanagedCallersOnly] - private static HRESULT _GetErrorHRESULT(IntPtr thisHandle, IntPtr* ppException, _EXCEPTION_POINTERS* pExceptionPointers) - { - var _this = GetThis(thisHandle); - try - { - return _this.GetErrorHRESULT(pExceptionPointers); - } - catch (Exception ex) - { - *ppException = _this.AllocException(ex); - return default; - } - } - - [UnmanagedCallersOnly] - private static uint _GetErrorMessage(IntPtr thisHandle, IntPtr* ppException, char* buffer, uint bufferLength) - { - var _this = GetThis(thisHandle); - try - { - return _this.GetErrorMessage(buffer, bufferLength); - } - catch (Exception ex) - { - *ppException = _this.AllocException(ex); - return default; - } - } - - [UnmanagedCallersOnly] - private static int _FilterException(IntPtr thisHandle, IntPtr* ppException, _EXCEPTION_POINTERS* pExceptionPointers) - { - var _this = GetThis(thisHandle); - try - { - return _this.FilterException(pExceptionPointers); - } - catch (Exception ex) - { - *ppException = _this.AllocException(ex); - return default; - } - } - - [UnmanagedCallersOnly] - private static void _ThrowExceptionForJitResult(IntPtr thisHandle, IntPtr* ppException, HRESULT result) - { - var _this = GetThis(thisHandle); - try - { - _this.ThrowExceptionForJitResult(result); - } - catch (Exception ex) - { - *ppException = _this.AllocException(ex); - } - } - - [UnmanagedCallersOnly] - private static void _ThrowExceptionForHelper(IntPtr thisHandle, IntPtr* ppException, CORINFO_HELPER_DESC* throwHelper) - { - var _this = GetThis(thisHandle); - try - { - _this.ThrowExceptionForHelper(ref *throwHelper); - } - catch (Exception ex) - { - *ppException = _this.AllocException(ex); - } - } - [UnmanagedCallersOnly] private static byte _runWithErrorTrap(IntPtr thisHandle, IntPtr* ppException, void* function, void* parameter) { @@ -2730,7 +2657,7 @@ private static uint _getJitFlags(IntPtr thisHandle, IntPtr* ppException, CORJIT_ private static IntPtr GetUnmanagedCallbacks() { - void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 184); + void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 179); callbacks[0] = (delegate* unmanaged)&_isIntrinsic; callbacks[1] = (delegate* unmanaged)&_getMethodAttribs; @@ -2846,76 +2773,71 @@ private static IntPtr GetUnmanagedCallbacks() callbacks[111] = (delegate* unmanaged)&_getExactClasses; callbacks[112] = (delegate* unmanaged)&_getArgClass; callbacks[113] = (delegate* unmanaged)&_getHFAType; - callbacks[114] = (delegate* unmanaged)&_GetErrorHRESULT; - callbacks[115] = (delegate* unmanaged)&_GetErrorMessage; - callbacks[116] = (delegate* unmanaged)&_FilterException; - callbacks[117] = (delegate* unmanaged)&_ThrowExceptionForJitResult; - callbacks[118] = (delegate* unmanaged)&_ThrowExceptionForHelper; - callbacks[119] = (delegate* unmanaged)&_runWithErrorTrap; - callbacks[120] = (delegate* unmanaged)&_runWithSPMIErrorTrap; - callbacks[121] = (delegate* unmanaged)&_getEEInfo; - callbacks[122] = (delegate* unmanaged)&_getJitTimeLogFilename; - callbacks[123] = (delegate* unmanaged)&_getMethodDefFromMethod; - callbacks[124] = (delegate* unmanaged)&_printMethodName; - callbacks[125] = (delegate* unmanaged)&_getMethodNameFromMetadata; - callbacks[126] = (delegate* unmanaged)&_getMethodHash; - callbacks[127] = (delegate* unmanaged)&_findNameOfToken; - callbacks[128] = (delegate* unmanaged)&_getSystemVAmd64PassStructInRegisterDescriptor; - callbacks[129] = (delegate* unmanaged)&_getLoongArch64PassStructInRegisterFlags; - callbacks[130] = (delegate* unmanaged)&_getRISCV64PassStructInRegisterFlags; - callbacks[131] = (delegate* unmanaged)&_getThreadTLSIndex; - callbacks[132] = (delegate* unmanaged)&_getInlinedCallFrameVptr; - callbacks[133] = (delegate* unmanaged)&_getAddrOfCaptureThreadGlobal; - callbacks[134] = (delegate* unmanaged)&_getHelperFtn; - callbacks[135] = (delegate* unmanaged)&_getFunctionEntryPoint; - callbacks[136] = (delegate* unmanaged)&_getFunctionFixedEntryPoint; - callbacks[137] = (delegate* unmanaged)&_getMethodSync; - callbacks[138] = (delegate* unmanaged)&_getLazyStringLiteralHelper; - callbacks[139] = (delegate* unmanaged)&_embedModuleHandle; - callbacks[140] = (delegate* unmanaged)&_embedClassHandle; - callbacks[141] = (delegate* unmanaged)&_embedMethodHandle; - callbacks[142] = (delegate* unmanaged)&_embedFieldHandle; - callbacks[143] = (delegate* unmanaged)&_embedGenericHandle; - callbacks[144] = (delegate* unmanaged)&_getLocationOfThisType; - callbacks[145] = (delegate* unmanaged)&_getAddressOfPInvokeTarget; - callbacks[146] = (delegate* unmanaged)&_GetCookieForPInvokeCalliSig; - callbacks[147] = (delegate* unmanaged)&_canGetCookieForPInvokeCalliSig; - callbacks[148] = (delegate* unmanaged)&_getJustMyCodeHandle; - callbacks[149] = (delegate* unmanaged)&_GetProfilingHandle; - callbacks[150] = (delegate* unmanaged)&_getCallInfo; - callbacks[151] = (delegate* unmanaged)&_canAccessFamily; - callbacks[152] = (delegate* unmanaged)&_isRIDClassDomainID; - callbacks[153] = (delegate* unmanaged)&_getClassDomainID; - callbacks[154] = (delegate* unmanaged)&_getStaticFieldContent; - callbacks[155] = (delegate* unmanaged)&_getObjectContent; - callbacks[156] = (delegate* unmanaged)&_getStaticFieldCurrentClass; - callbacks[157] = (delegate* unmanaged)&_getVarArgsHandle; - callbacks[158] = (delegate* unmanaged)&_canGetVarArgsHandle; - callbacks[159] = (delegate* unmanaged)&_constructStringLiteral; - callbacks[160] = (delegate* unmanaged)&_emptyStringLiteral; - callbacks[161] = (delegate* unmanaged)&_getFieldThreadLocalStoreID; - callbacks[162] = (delegate* unmanaged)&_GetDelegateCtor; - callbacks[163] = (delegate* unmanaged)&_MethodCompileComplete; - callbacks[164] = (delegate* unmanaged)&_getTailCallHelpers; - callbacks[165] = (delegate* unmanaged)&_convertPInvokeCalliToCall; - callbacks[166] = (delegate* unmanaged)&_notifyInstructionSetUsage; - callbacks[167] = (delegate* unmanaged)&_updateEntryPointForTailCall; - callbacks[168] = (delegate* unmanaged)&_allocMem; - callbacks[169] = (delegate* unmanaged)&_reserveUnwindInfo; - callbacks[170] = (delegate* unmanaged)&_allocUnwindInfo; - callbacks[171] = (delegate* unmanaged)&_allocGCInfo; - callbacks[172] = (delegate* unmanaged)&_setEHcount; - callbacks[173] = (delegate* unmanaged)&_setEHinfo; - callbacks[174] = (delegate* unmanaged)&_logMsg; - callbacks[175] = (delegate* unmanaged)&_doAssert; - callbacks[176] = (delegate* unmanaged)&_reportFatalError; - callbacks[177] = (delegate* unmanaged)&_getPgoInstrumentationResults; - callbacks[178] = (delegate* unmanaged)&_allocPgoInstrumentationBySchema; - callbacks[179] = (delegate* unmanaged)&_recordCallSite; - callbacks[180] = (delegate* unmanaged)&_recordRelocation; - callbacks[181] = (delegate* unmanaged)&_getRelocTypeHint; - callbacks[182] = (delegate* unmanaged)&_getExpectedTargetArchitecture; - callbacks[183] = (delegate* unmanaged)&_getJitFlags; + callbacks[114] = (delegate* unmanaged)&_runWithErrorTrap; + callbacks[115] = (delegate* unmanaged)&_runWithSPMIErrorTrap; + callbacks[116] = (delegate* unmanaged)&_getEEInfo; + callbacks[117] = (delegate* unmanaged)&_getJitTimeLogFilename; + callbacks[118] = (delegate* unmanaged)&_getMethodDefFromMethod; + callbacks[119] = (delegate* unmanaged)&_printMethodName; + callbacks[120] = (delegate* unmanaged)&_getMethodNameFromMetadata; + callbacks[121] = (delegate* unmanaged)&_getMethodHash; + callbacks[122] = (delegate* unmanaged)&_findNameOfToken; + callbacks[123] = (delegate* unmanaged)&_getSystemVAmd64PassStructInRegisterDescriptor; + callbacks[124] = (delegate* unmanaged)&_getLoongArch64PassStructInRegisterFlags; + callbacks[125] = (delegate* unmanaged)&_getRISCV64PassStructInRegisterFlags; + callbacks[126] = (delegate* unmanaged)&_getThreadTLSIndex; + callbacks[127] = (delegate* unmanaged)&_getInlinedCallFrameVptr; + callbacks[128] = (delegate* unmanaged)&_getAddrOfCaptureThreadGlobal; + callbacks[129] = (delegate* unmanaged)&_getHelperFtn; + callbacks[130] = (delegate* unmanaged)&_getFunctionEntryPoint; + callbacks[131] = (delegate* unmanaged)&_getFunctionFixedEntryPoint; + callbacks[132] = (delegate* unmanaged)&_getMethodSync; + callbacks[133] = (delegate* unmanaged)&_getLazyStringLiteralHelper; + callbacks[134] = (delegate* unmanaged)&_embedModuleHandle; + callbacks[135] = (delegate* unmanaged)&_embedClassHandle; + callbacks[136] = (delegate* unmanaged)&_embedMethodHandle; + callbacks[137] = (delegate* unmanaged)&_embedFieldHandle; + callbacks[138] = (delegate* unmanaged)&_embedGenericHandle; + callbacks[139] = (delegate* unmanaged)&_getLocationOfThisType; + callbacks[140] = (delegate* unmanaged)&_getAddressOfPInvokeTarget; + callbacks[141] = (delegate* unmanaged)&_GetCookieForPInvokeCalliSig; + callbacks[142] = (delegate* unmanaged)&_canGetCookieForPInvokeCalliSig; + callbacks[143] = (delegate* unmanaged)&_getJustMyCodeHandle; + callbacks[144] = (delegate* unmanaged)&_GetProfilingHandle; + callbacks[145] = (delegate* unmanaged)&_getCallInfo; + callbacks[146] = (delegate* unmanaged)&_canAccessFamily; + callbacks[147] = (delegate* unmanaged)&_isRIDClassDomainID; + callbacks[148] = (delegate* unmanaged)&_getClassDomainID; + callbacks[149] = (delegate* unmanaged)&_getStaticFieldContent; + callbacks[150] = (delegate* unmanaged)&_getObjectContent; + callbacks[151] = (delegate* unmanaged)&_getStaticFieldCurrentClass; + callbacks[152] = (delegate* unmanaged)&_getVarArgsHandle; + callbacks[153] = (delegate* unmanaged)&_canGetVarArgsHandle; + callbacks[154] = (delegate* unmanaged)&_constructStringLiteral; + callbacks[155] = (delegate* unmanaged)&_emptyStringLiteral; + callbacks[156] = (delegate* unmanaged)&_getFieldThreadLocalStoreID; + callbacks[157] = (delegate* unmanaged)&_GetDelegateCtor; + callbacks[158] = (delegate* unmanaged)&_MethodCompileComplete; + callbacks[159] = (delegate* unmanaged)&_getTailCallHelpers; + callbacks[160] = (delegate* unmanaged)&_convertPInvokeCalliToCall; + callbacks[161] = (delegate* unmanaged)&_notifyInstructionSetUsage; + callbacks[162] = (delegate* unmanaged)&_updateEntryPointForTailCall; + callbacks[163] = (delegate* unmanaged)&_allocMem; + callbacks[164] = (delegate* unmanaged)&_reserveUnwindInfo; + callbacks[165] = (delegate* unmanaged)&_allocUnwindInfo; + callbacks[166] = (delegate* unmanaged)&_allocGCInfo; + callbacks[167] = (delegate* unmanaged)&_setEHcount; + callbacks[168] = (delegate* unmanaged)&_setEHinfo; + callbacks[169] = (delegate* unmanaged)&_logMsg; + callbacks[170] = (delegate* unmanaged)&_doAssert; + callbacks[171] = (delegate* unmanaged)&_reportFatalError; + callbacks[172] = (delegate* unmanaged)&_getPgoInstrumentationResults; + callbacks[173] = (delegate* unmanaged)&_allocPgoInstrumentationBySchema; + callbacks[174] = (delegate* unmanaged)&_recordCallSite; + callbacks[175] = (delegate* unmanaged)&_recordRelocation; + callbacks[176] = (delegate* unmanaged)&_getRelocTypeHint; + callbacks[177] = (delegate* unmanaged)&_getExpectedTargetArchitecture; + callbacks[178] = (delegate* unmanaged)&_getJitFlags; return (IntPtr)callbacks; } diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs index cedbbda36b7046..18c24222c4fdf4 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs @@ -400,8 +400,8 @@ public 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, @@ -1008,12 +1008,6 @@ public unsafe struct CORINFO_CALL_INFO public CORINFO_SIG_INFO sig; - //Verification information - public uint verMethodFlags; // flags for CORINFO_RESOLVED_TOKEN::hMethod - public 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 @@ -1418,7 +1412,7 @@ public enum CorJitFlag : uint CORJIT_FLAG_PROF_ENTERLEAVE = 20, // Instrument prologues/epilogues CORJIT_FLAG_UNUSED7 = 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_UNUSED8 = 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 diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt index b9f8aa66f259eb..327255bd7eb58a 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -273,11 +273,6 @@ FUNCTIONS int getExactClasses(CORINFO_CLASS_HANDLE baseType, int maxExactClasses, CORINFO_CLASS_HANDLE* exactClsRet); CORINFO_CLASS_HANDLE getArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args); CorInfoHFAElemType getHFAType(CORINFO_CLASS_HANDLE hClass); - JITINTERFACE_HRESULT GetErrorHRESULT(struct _EXCEPTION_POINTERS *pExceptionPointers); - uint32_t GetErrorMessage(char16_t * buffer, uint32_t bufferLength); - [ManualNativeWrapper] int FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers); - void ThrowExceptionForJitResult(JITINTERFACE_HRESULT result); - void ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper); [ManualNativeWrapper] bool runWithErrorTrap(ICorJitInfo::errorTrapFunction function, void* parameter); [ManualNativeWrapper] bool runWithSPMIErrorTrap(ICorJitInfo::errorTrapFunction function, void* parameter); void getEEInfo(CORINFO_EE_INFO* pEEInfoOut); diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs index cdbf7fe492e273..b222bd738c418b 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs @@ -1648,20 +1648,6 @@ private void getCallInfo(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_RESO pResult->sig.flags |= CorInfoSigInfoFlags.CORINFO_SIGFLAG_FAT_CALL; } - if ((flags & CORINFO_CALLINFO_FLAGS.CORINFO_CALLINFO_VERIFICATION) != 0) - { - if (pResult->hMethod != pResolvedToken.hMethod) - { - pResult->verMethodFlags = getMethodAttribsInternal(targetMethod); - Get_CORINFO_SIG_INFO(targetMethod, &pResult->verSig, scope: null); - } - else - { - pResult->verMethodFlags = pResult->methodFlags; - pResult->verSig = pResult->sig; - } - } - pResult->_wrapperDelegateInvoke = 0; } diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface.cpp b/src/coreclr/tools/aot/jitinterface/jitinterface.cpp index bbd4f812e2eae6..35743d089bcb4b 100644 --- a/src/coreclr/tools/aot/jitinterface/jitinterface.cpp +++ b/src/coreclr/tools/aot/jitinterface/jitinterface.cpp @@ -13,12 +13,6 @@ static void NotImplemented() abort(); } -int JitInterfaceWrapper::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - NotImplemented(); - return 1; // EXCEPTION_EXECUTE_HANDLER -} - bool JitInterfaceWrapper::runWithErrorTrap(ICorJitInfo::errorTrapFunction function, void* parameter) { try diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h b/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h index 62db21d2232e23..ec15c56b293aa3 100644 --- a/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h +++ b/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h @@ -125,11 +125,6 @@ struct JitInterfaceCallbacks int (* getExactClasses)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE baseType, int maxExactClasses, CORINFO_CLASS_HANDLE* exactClsRet); CORINFO_CLASS_HANDLE (* getArgClass)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args); CorInfoHFAElemType (* getHFAType)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE hClass); - JITINTERFACE_HRESULT (* GetErrorHRESULT)(void * thisHandle, CorInfoExceptionClass** ppException, struct _EXCEPTION_POINTERS* pExceptionPointers); - uint32_t (* GetErrorMessage)(void * thisHandle, CorInfoExceptionClass** ppException, char16_t* buffer, uint32_t bufferLength); - int (* FilterException)(void * thisHandle, CorInfoExceptionClass** ppException, struct _EXCEPTION_POINTERS* pExceptionPointers); - void (* ThrowExceptionForJitResult)(void * thisHandle, CorInfoExceptionClass** ppException, JITINTERFACE_HRESULT result); - void (* ThrowExceptionForHelper)(void * thisHandle, CorInfoExceptionClass** ppException, const CORINFO_HELPER_DESC* throwHelper); bool (* runWithErrorTrap)(void * thisHandle, CorInfoExceptionClass** ppException, ICorJitInfo::errorTrapFunction function, void* parameter); bool (* runWithSPMIErrorTrap)(void * thisHandle, CorInfoExceptionClass** ppException, ICorJitInfo::errorTrapFunction function, void* parameter); void (* getEEInfo)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_EE_INFO* pEEInfoOut); @@ -1324,44 +1319,6 @@ class JitInterfaceWrapper : public ICorJitInfo return temp; } - virtual JITINTERFACE_HRESULT GetErrorHRESULT( - struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - CorInfoExceptionClass* pException = nullptr; - JITINTERFACE_HRESULT temp = _callbacks->GetErrorHRESULT(_thisHandle, &pException, pExceptionPointers); - if (pException != nullptr) throw pException; - return temp; -} - - virtual uint32_t GetErrorMessage( - char16_t* buffer, - uint32_t bufferLength) -{ - CorInfoExceptionClass* pException = nullptr; - uint32_t temp = _callbacks->GetErrorMessage(_thisHandle, &pException, buffer, bufferLength); - if (pException != nullptr) throw pException; - return temp; -} - - virtual int FilterException( - struct _EXCEPTION_POINTERS* pExceptionPointers); - - virtual void ThrowExceptionForJitResult( - JITINTERFACE_HRESULT result) -{ - CorInfoExceptionClass* pException = nullptr; - _callbacks->ThrowExceptionForJitResult(_thisHandle, &pException, result); - if (pException != nullptr) throw pException; -} - - virtual void ThrowExceptionForHelper( - const CORINFO_HELPER_DESC* throwHelper) -{ - CorInfoExceptionClass* pException = nullptr; - _callbacks->ThrowExceptionForHelper(_thisHandle, &pException, throwHelper); - if (pException != nullptr) throw pException; -} - virtual bool runWithErrorTrap( ICorJitInfo::errorTrapFunction function, void* parameter); diff --git a/src/coreclr/tools/superpmi/superpmi-shared/agnostic.h b/src/coreclr/tools/superpmi/superpmi-shared/agnostic.h index 61f81c83e0d51f..c717ea0631c8de 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/agnostic.h +++ b/src/coreclr/tools/superpmi/superpmi-shared/agnostic.h @@ -318,8 +318,6 @@ struct Agnostic_CORINFO_CALL_INFO DWORD methodFlags; DWORD classFlags; Agnostic_CORINFO_SIG_INFO sig; - DWORD verMethodFlags; - Agnostic_CORINFO_SIG_INFO verSig; DWORD accessAllowed; Agnostic_CORINFO_HELPER_DESC callsiteCalloutHelper; DWORD thisTransform; diff --git a/src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h b/src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h index 19a0600b3f582b..615072268280b0 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h +++ b/src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h @@ -42,7 +42,6 @@ LWM(GetThreadLocalFieldInfo, DWORDLONG, DWORD) LWM(GetThreadLocalStaticBlocksInfo, DWORD, Agnostic_GetThreadLocalStaticBlocksInfo) DENSELWM(EmptyStringLiteral, DLD) DENSELWM(ErrorList, DWORD) -LWM(FilterException, DWORD, DWORD) LWM(FindCallSiteSig, Agnostic_FindCallSiteSig, Agnostic_CORINFO_SIG_INFO) LWM(FindNameOfToken, DLD, DLD) LWM(FindSig, Agnostic_FindSig, Agnostic_CORINFO_SIG_INFO) diff --git a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp index 469ff6f6d56d9e..a40ecd64947185 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp @@ -1185,16 +1185,8 @@ const char* CorJitFlagToString(CORJIT_FLAGS::CorJitFlag flag) return "CORJIT_FLAG_MCJIT_BACKGROUND"; #if defined(TARGET_X86) - case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_PINVOKE_RESTORE_ESP: return "CORJIT_FLAG_PINVOKE_RESTORE_ESP"; - case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_TARGET_P4: - return "CORJIT_FLAG_TARGET_P4"; - case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_USE_FCOMI: - return "CORJIT_FLAG_USE_FCOMI"; - case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_USE_CMOV: - return "CORJIT_FLAG_USE_CMOV"; - #endif // defined(TARGET_X86) case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_OSR: @@ -1211,14 +1203,10 @@ const char* CorJitFlagToString(CORJIT_FLAGS::CorJitFlag flag) return "CORJIT_FLAG_PROF_ENTERLEAVE"; case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_PROF_NO_PINVOKE_INLINE: return "CORJIT_FLAG_PROF_NO_PINVOKE_INLINE"; - case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_SKIP_VERIFICATION: - return "CORJIT_FLAG_SKIP_VERIFICATION"; case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_PREJIT: return "CORJIT_FLAG_PREJIT"; case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_RELOC: return "CORJIT_FLAG_RELOC"; - case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_IMPORT_ONLY: - return "CORJIT_FLAG_IMPORT_ONLY"; case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_IL_STUB: return "CORJIT_FLAG_IL_STUB"; case CORJIT_FLAGS::CorJitFlag::CORJIT_FLAG_PROCSPLIT: @@ -1506,7 +1494,7 @@ void MethodContext::recGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, key.flags = (DWORD)flags; Agnostic_CORINFO_CALL_INFO value; - ZeroMemory(&value, sizeof(Agnostic_CORINFO_CALL_INFO)); // init verSig with 0. + ZeroMemory(&value, sizeof(Agnostic_CORINFO_CALL_INFO)); if (exceptionCode == 0) { @@ -1514,11 +1502,6 @@ void MethodContext::recGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, value.methodFlags = (DWORD)pResult->methodFlags; value.classFlags = (DWORD)pResult->classFlags; value.sig = SpmiRecordsHelper::StoreAgnostic_CORINFO_SIG_INFO(pResult->sig, GetCallInfo, SigInstHandleMap); - if (flags & CORINFO_CALLINFO_VERIFICATION) - { - value.verMethodFlags = (DWORD)pResult->verMethodFlags; - value.verSig = SpmiRecordsHelper::StoreAgnostic_CORINFO_SIG_INFO(pResult->verSig, GetCallInfo, SigInstHandleMap); - } value.accessAllowed = (DWORD)pResult->accessAllowed; value.callsiteCalloutHelper.helperNum = (DWORD)pResult->callsiteCalloutHelper.helperNum; @@ -1553,8 +1536,6 @@ void MethodContext::dmpGetCallInfo(const Agnostic_GetCallInfo& key, const Agnost printf("GetCallInfo key rt{%s} crt{%s} ch-%016" PRIX64 " flg-%08X" ", value mth-%016" PRIX64 ", mf-%08X (%s) cf-%08X (%s)" " sig-%s" - " vmf-%08X (%s)" - " vsig-%s" " aa-%u" " cch{hn-%u na-%u (TODO: dump callsiteCalloutHelper.args)}" " tt-%u" @@ -1578,9 +1559,6 @@ void MethodContext::dmpGetCallInfo(const Agnostic_GetCallInfo& key, const Agnost value.classFlags, SpmiDumpHelper::DumpCorInfoFlag((CorInfoFlag)value.classFlags).c_str(), SpmiDumpHelper::DumpAgnostic_CORINFO_SIG_INFO(value.sig, GetCallInfo, SigInstHandleMap).c_str(), - value.verMethodFlags, - SpmiDumpHelper::DumpCorInfoFlag((CorInfoFlag)value.verMethodFlags).c_str(), - SpmiDumpHelper::DumpAgnostic_CORINFO_SIG_INFO(value.verSig, GetCallInfo, SigInstHandleMap).c_str(), value.accessAllowed, value.callsiteCalloutHelper.helperNum, value.callsiteCalloutHelper.numArgs, @@ -1634,11 +1612,6 @@ void MethodContext::repGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, pResult->methodFlags = (unsigned)value.methodFlags; pResult->classFlags = (unsigned)value.classFlags; pResult->sig = SpmiRecordsHelper::Restore_CORINFO_SIG_INFO(value.sig, GetCallInfo, SigInstHandleMap); - if (flags & CORINFO_CALLINFO_VERIFICATION) - { - pResult->verMethodFlags = (unsigned)value.verMethodFlags; - pResult->verSig = SpmiRecordsHelper::Restore_CORINFO_SIG_INFO(value.verSig, GetCallInfo, SigInstHandleMap); - } pResult->accessAllowed = (CorInfoIsAccessAllowedResult)value.accessAllowed; pResult->callsiteCalloutHelper.helperNum = (CorInfoHelpFunc)value.callsiteCalloutHelper.helperNum; pResult->callsiteCalloutHelper.numArgs = (unsigned)value.callsiteCalloutHelper.numArgs; @@ -5156,36 +5129,6 @@ void* MethodContext::repGetArrayInitializationData(CORINFO_FIELD_HANDLE field, D return result; } -void MethodContext::recFilterException(struct _EXCEPTION_POINTERS* pExceptionPointers, int result) -{ - if (FilterException == nullptr) - FilterException = new LightWeightMap(); - - DWORD key = (DWORD)pExceptionPointers->ExceptionRecord->ExceptionCode; - DWORD value = (DWORD)result; - FilterException->Add(key, value); - DEBUG_REC(dmpFilterException(key, value)); -} -void MethodContext::dmpFilterException(DWORD key, DWORD value) -{ - printf("FilterException key %u, value %u", key, value); -} -int MethodContext::repFilterException(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - if (FilterException == nullptr) - return EXCEPTION_CONTINUE_SEARCH; - if (FilterException->GetIndex((DWORD)pExceptionPointers->ExceptionRecord->ExceptionCode) < 0) - return EXCEPTION_CONTINUE_SEARCH; - else - { - DWORD key = (DWORD)pExceptionPointers->ExceptionRecord->ExceptionCode; - DWORD value = FilterException->Get(key); - DEBUG_REP(dmpFilterException(key, value)); - int result = (int)value; - return result; - } -} - void MethodContext::recGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup) { if (GetAddressOfPInvokeTarget == nullptr) diff --git a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h index 53b3b02f745eaa..23f77fed338254 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h @@ -663,10 +663,6 @@ class MethodContext void dmpGetArrayInitializationData(DLD key, DWORDLONG value); void* repGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size); - void recFilterException(struct _EXCEPTION_POINTERS* pExceptionPointers, int result); - void dmpFilterException(DWORD key, DWORD value); - int repFilterException(struct _EXCEPTION_POINTERS* pExceptionPointers); - void recGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup); void dmpGetAddressOfPInvokeTarget(DWORDLONG key, DLD value); void repGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup); @@ -1111,7 +1107,7 @@ enum mcPackets //Packet_AllocMethodBlockCounts = 131, PacketCR_AllocUnwindInfo = 132, PacketCR_ReserveUnwindInfo = 133, - Packet_FilterException = 134, + //Packet_FilterException = 134, //Packet_HandleException = 135, //Retired9 = 136, Packet_IsFieldStatic = 137, diff --git a/src/coreclr/tools/superpmi/superpmi-shared/spmidumphelper.cpp b/src/coreclr/tools/superpmi/superpmi-shared/spmidumphelper.cpp index 77cf5a77564618..d4dde380b7e236 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/spmidumphelper.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shared/spmidumphelper.cpp @@ -239,9 +239,6 @@ std::string SpmiDumpHelper::DumpJitFlags(unsigned long long flags) // x86 only // AddFlagNumeric(PINVOKE_RESTORE_ESP, 8); - AddFlagNumeric(TARGET_P4, 9); - AddFlagNumeric(USE_FCOMI, 10); - AddFlagNumeric(USE_CMOV, 11); AddFlag(OSR); AddFlag(ALT_JIT); @@ -252,10 +249,8 @@ std::string SpmiDumpHelper::DumpJitFlags(unsigned long long flags) AddFlag(PROF_ENTERLEAVE); AddFlag(PROF_NO_PINVOKE_INLINE); - AddFlag(SKIP_VERIFICATION); AddFlag(PREJIT); AddFlag(RELOC); - AddFlag(IMPORT_ONLY); AddFlag(IL_STUB); AddFlag(PROCSPLIT); AddFlag(BBINSTR); diff --git a/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp index 96249dde36c0da..132cb3b3556ab3 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -1331,53 +1331,6 @@ CorInfoHFAElemType interceptor_ICJI::getHFAType(CORINFO_CLASS_HANDLE hClass) return temp; } -/***************************************************************************** -* 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 -HRESULT interceptor_ICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - mc->cr->AddCall("GetErrorHRESULT"); - return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers); -} - -// 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. -uint32_t interceptor_ICJI::GetErrorMessage(_Inout_updates_(bufferLength) char16_t *buffer, uint32_t bufferLength) -{ - mc->cr->AddCall("GetErrorMessage"); - return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength); -} - -// 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 -int interceptor_ICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - mc->cr->AddCall("FilterException"); - int temp = original_ICorJitInfo->FilterException(pExceptionPointers); - mc->recFilterException(pExceptionPointers, temp); - return temp; -} - -void interceptor_ICJI::ThrowExceptionForJitResult(HRESULT result) -{ - mc->cr->AddCall("ThrowExceptionForJitResult"); - original_ICorJitInfo->ThrowExceptionForJitResult(result); -} - -// Throws an exception defined by the given throw helper. -void interceptor_ICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper) -{ - mc->cr->AddCall("ThrowExceptionForHelper"); - original_ICorJitInfo->ThrowExceptionForHelper(throwHelper); -} - /***************************************************************************** * ICorStaticInfo contains EE interface methods which return values that are * constant from invocation to invocation. Thus they may be embedded in diff --git a/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp index 58dc80abec8e1b..33746daa479e43 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp @@ -923,42 +923,6 @@ CorInfoHFAElemType interceptor_ICJI::getHFAType( return original_ICorJitInfo->getHFAType(hClass); } -JITINTERFACE_HRESULT interceptor_ICJI::GetErrorHRESULT( - struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - mcs->AddCall("GetErrorHRESULT"); - return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers); -} - -uint32_t interceptor_ICJI::GetErrorMessage( - char16_t* buffer, - uint32_t bufferLength) -{ - mcs->AddCall("GetErrorMessage"); - return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength); -} - -int interceptor_ICJI::FilterException( - struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - mcs->AddCall("FilterException"); - return original_ICorJitInfo->FilterException(pExceptionPointers); -} - -void interceptor_ICJI::ThrowExceptionForJitResult( - JITINTERFACE_HRESULT result) -{ - mcs->AddCall("ThrowExceptionForJitResult"); - original_ICorJitInfo->ThrowExceptionForJitResult(result); -} - -void interceptor_ICJI::ThrowExceptionForHelper( - const CORINFO_HELPER_DESC* throwHelper) -{ - mcs->AddCall("ThrowExceptionForHelper"); - original_ICorJitInfo->ThrowExceptionForHelper(throwHelper); -} - bool interceptor_ICJI::runWithErrorTrap( ICorJitInfo::errorTrapFunction function, void* parameter) diff --git a/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp index a9dced511ddce6..78179769f31d4a 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp @@ -809,37 +809,6 @@ CorInfoHFAElemType interceptor_ICJI::getHFAType( return original_ICorJitInfo->getHFAType(hClass); } -JITINTERFACE_HRESULT interceptor_ICJI::GetErrorHRESULT( - struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers); -} - -uint32_t interceptor_ICJI::GetErrorMessage( - char16_t* buffer, - uint32_t bufferLength) -{ - return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength); -} - -int interceptor_ICJI::FilterException( - struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - return original_ICorJitInfo->FilterException(pExceptionPointers); -} - -void interceptor_ICJI::ThrowExceptionForJitResult( - JITINTERFACE_HRESULT result) -{ - original_ICorJitInfo->ThrowExceptionForJitResult(result); -} - -void interceptor_ICJI::ThrowExceptionForHelper( - const CORINFO_HELPER_DESC* throwHelper) -{ - original_ICorJitInfo->ThrowExceptionForHelper(throwHelper); -} - bool interceptor_ICJI::runWithErrorTrap( ICorJitInfo::errorTrapFunction function, void* parameter) diff --git a/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp index 9915b4699eeebc..3fdd37cb879ed5 100644 --- a/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp @@ -1141,60 +1141,6 @@ CorInfoHFAElemType MyICJI::getHFAType(CORINFO_CLASS_HANDLE hClass) return value; } -/***************************************************************************** -* 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 -HRESULT MyICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - jitInstance->mc->cr->AddCall("GetErrorHRESULT"); - LogError("Hit unimplemented GetErrorHRESULT"); - DebugBreakorAV(76); - return 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. -uint32_t MyICJI::GetErrorMessage(_Inout_updates_(bufferLength) char16_t* buffer, uint32_t bufferLength) -{ - jitInstance->mc->cr->AddCall("GetErrorMessage"); - LogError("Hit unimplemented GetErrorMessage"); - DebugBreakorAV(77); - return 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 - -int MyICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - jitInstance->mc->cr->AddCall("FilterException"); - int result = jitInstance->mc->repFilterException(pExceptionPointers); - return result; -} - -void MyICJI::ThrowExceptionForJitResult(HRESULT result) -{ - jitInstance->mc->cr->AddCall("ThrowExceptionForJitResult"); - LogError("Hit unimplemented ThrowExceptionForJitResult"); - DebugBreakorAV(80); -} - -// Throws an exception defined by the given throw helper. -void MyICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper) -{ - jitInstance->mc->cr->AddCall("ThrowExceptionForHelper"); - LogError("Hit unimplemented ThrowExceptionForHelper"); - DebugBreakorAV(81); -} - /***************************************************************************** * ICorStaticInfo contains EE interface methods which return values that are * constant from invocation to invocation. Thus they may be embedded in diff --git a/src/coreclr/vm/cgensys.h b/src/coreclr/vm/cgensys.h index b7cc4c715a51b0..12f3a31778065a 100644 --- a/src/coreclr/vm/cgensys.h +++ b/src/coreclr/vm/cgensys.h @@ -75,23 +75,6 @@ extern "C" void STDCALL DelayLoad_Helper_Obj(); extern "C" void STDCALL DelayLoad_Helper_ObjObj(); #endif -// Returns information about the CPU processor. -// Note that this information may be the least-common-denominator in the -// case of a multi-proc machine. - -#ifdef TARGET_X86 -void GetSpecificCpuInfo(CORINFO_CPU * cpuInfo); -#else -inline void GetSpecificCpuInfo(CORINFO_CPU * cpuInfo) -{ - LIMITED_METHOD_CONTRACT; - cpuInfo->dwCPUType = 0; - cpuInfo->dwFeatures = 0; - cpuInfo->dwExtendedFeatures = 0; -} - -#endif // !TARGET_X86 - #if (defined(TARGET_X86) || defined(TARGET_AMD64)) extern "C" DWORD xmmYmmStateSupport(); extern "C" DWORD avx512StateSupport(); diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 5be7e91f7e0622..280ff93194b7af 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1336,27 +1336,6 @@ void EEJitManager::SetCpuInfo() CORJIT_FLAGS CPUCompileFlags; -#if defined(TARGET_X86) - CORINFO_CPU cpuInfo; - GetSpecificCpuInfo(&cpuInfo); - - switch (CPU_X86_FAMILY(cpuInfo.dwCPUType)) - { - case CPU_X86_PENTIUM_4: - CPUCompileFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_TARGET_P4); - break; - - default: - break; - } - - if (CPU_X86_USE_CMOV(cpuInfo.dwFeatures)) - { - CPUCompileFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_USE_CMOV); - CPUCompileFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_USE_FCOMI); - } -#endif // TARGET_X86 - #if defined(TARGET_X86) || defined(TARGET_AMD64) CPUCompileFlags.Set(InstructionSet_X86Base); @@ -1453,161 +1432,173 @@ void EEJitManager::SetCpuInfo() __cpuid(cpuidInfo, 0x00000000); uint32_t maxCpuId = static_cast(cpuidInfo[CPUID_EAX]); + _ASSERTE(maxCpuId >= 1); - if (maxCpuId >= 1) + __cpuid(cpuidInfo, 0x00000001); + + _ASSERTE((cpuidInfo[CPUID_EDX] & (1 << 15)) != 0); // CMOV + +#if defined(TARGET_X86) && !defined(TARGET_WINDOWS) + // Linux may still support no SSE/SSE2 for 32-bit + if ((cpuidInfo[CPUID_EDX] & (1 << 25)) != 0) + { + EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("SSE is not supported on the processor.")); + } + if ((cpuidInfo[CPUID_EDX] & (1 << 26)) != 0) { - __cpuid(cpuidInfo, 0x00000001); + EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("SSE2 is not supported on the processor.")); + } +#else + _ASSERTE((cpuidInfo[CPUID_EDX] & (1 << 25)) != 0); // SSE + _ASSERTE((cpuidInfo[CPUID_EDX] & (1 << 26)) != 0); // SSE2 +#endif - if (((cpuidInfo[CPUID_EDX] & (1 << 25)) != 0) && ((cpuidInfo[CPUID_EDX] & (1 << 26)) != 0)) // SSE & SSE2 - { - CPUCompileFlags.Set(InstructionSet_SSE); - CPUCompileFlags.Set(InstructionSet_SSE2); + CPUCompileFlags.Set(InstructionSet_SSE); + CPUCompileFlags.Set(InstructionSet_SSE2); - if ((cpuidInfo[CPUID_ECX] & (1 << 25)) != 0) // AESNI - { - CPUCompileFlags.Set(InstructionSet_AES); - } + if ((cpuidInfo[CPUID_ECX] & (1 << 25)) != 0) // AESNI + { + CPUCompileFlags.Set(InstructionSet_AES); + } - if ((cpuidInfo[CPUID_ECX] & (1 << 1)) != 0) // PCLMULQDQ - { - CPUCompileFlags.Set(InstructionSet_PCLMULQDQ); - } + if ((cpuidInfo[CPUID_ECX] & (1 << 1)) != 0) // PCLMULQDQ + { + CPUCompileFlags.Set(InstructionSet_PCLMULQDQ); + } + + if ((cpuidInfo[CPUID_ECX] & (1 << 0)) != 0) // SSE3 + { + CPUCompileFlags.Set(InstructionSet_SSE3); + + if ((cpuidInfo[CPUID_ECX] & (1 << 9)) != 0) // SSSE3 + { + CPUCompileFlags.Set(InstructionSet_SSSE3); - if ((cpuidInfo[CPUID_ECX] & (1 << 0)) != 0) // SSE3 + if ((cpuidInfo[CPUID_ECX] & (1 << 19)) != 0) // SSE4.1 { - CPUCompileFlags.Set(InstructionSet_SSE3); + CPUCompileFlags.Set(InstructionSet_SSE41); - if ((cpuidInfo[CPUID_ECX] & (1 << 9)) != 0) // SSSE3 + if ((cpuidInfo[CPUID_ECX] & (1 << 20)) != 0) // SSE4.2 { - CPUCompileFlags.Set(InstructionSet_SSSE3); + CPUCompileFlags.Set(InstructionSet_SSE42); - if ((cpuidInfo[CPUID_ECX] & (1 << 19)) != 0) // SSE4.1 + if ((cpuidInfo[CPUID_ECX] & (1 << 22)) != 0) // MOVBE { - CPUCompileFlags.Set(InstructionSet_SSE41); + CPUCompileFlags.Set(InstructionSet_MOVBE); + } + + if ((cpuidInfo[CPUID_ECX] & (1 << 23)) != 0) // POPCNT + { + CPUCompileFlags.Set(InstructionSet_POPCNT); + } - if ((cpuidInfo[CPUID_ECX] & (1 << 20)) != 0) // SSE4.2 + if (((cpuidInfo[CPUID_ECX] & (1 << 27)) != 0) && ((cpuidInfo[CPUID_ECX] & (1 << 28)) != 0)) // OSXSAVE & AVX + { + if(DoesOSSupportAVX() && (xmmYmmStateSupport() == 1)) // XGETBV == 11 { - CPUCompileFlags.Set(InstructionSet_SSE42); + CPUCompileFlags.Set(InstructionSet_AVX); - if ((cpuidInfo[CPUID_ECX] & (1 << 22)) != 0) // MOVBE + if ((cpuidInfo[CPUID_ECX] & (1 << 12)) != 0) // FMA { - CPUCompileFlags.Set(InstructionSet_MOVBE); + CPUCompileFlags.Set(InstructionSet_FMA); } - if ((cpuidInfo[CPUID_ECX] & (1 << 23)) != 0) // POPCNT + if (maxCpuId >= 0x07) { - CPUCompileFlags.Set(InstructionSet_POPCNT); - } + __cpuidex(cpuidInfo, 0x00000007, 0x00000000); - if (((cpuidInfo[CPUID_ECX] & (1 << 27)) != 0) && ((cpuidInfo[CPUID_ECX] & (1 << 28)) != 0)) // OSXSAVE & AVX - { - if(DoesOSSupportAVX() && (xmmYmmStateSupport() == 1)) // XGETBV == 11 + if ((cpuidInfo[CPUID_EBX] & (1 << 5)) != 0) // AVX2 { - CPUCompileFlags.Set(InstructionSet_AVX); + CPUCompileFlags.Set(InstructionSet_AVX2); - if ((cpuidInfo[CPUID_ECX] & (1 << 12)) != 0) // FMA + if (DoesOSSupportAVX512() && (avx512StateSupport() == 1)) // XGETBV XRC0[7:5] == 111 { - CPUCompileFlags.Set(InstructionSet_FMA); - } + if ((cpuidInfo[CPUID_EBX] & (1 << 16)) != 0) // AVX512F + { + CPUCompileFlags.Set(InstructionSet_AVX512F); - if (maxCpuId >= 0x07) - { - __cpuidex(cpuidInfo, 0x00000007, 0x00000000); + bool isAVX512_VLSupported = false; + if ((cpuidInfo[CPUID_EBX] & (1 << 31)) != 0) // AVX512VL + { + CPUCompileFlags.Set(InstructionSet_AVX512F_VL); + isAVX512_VLSupported = true; + } - if ((cpuidInfo[CPUID_EBX] & (1 << 5)) != 0) // AVX2 - { - CPUCompileFlags.Set(InstructionSet_AVX2); + if ((cpuidInfo[CPUID_EBX] & (1 << 30)) != 0) // AVX512BW + { + CPUCompileFlags.Set(InstructionSet_AVX512BW); + if (isAVX512_VLSupported) // AVX512BW_VL + { + CPUCompileFlags.Set(InstructionSet_AVX512BW_VL); + } + } - if (DoesOSSupportAVX512() && (avx512StateSupport() == 1)) // XGETBV XRC0[7:5] == 111 + if ((cpuidInfo[CPUID_EBX] & (1 << 28)) != 0) // AVX512CD { - if ((cpuidInfo[CPUID_EBX] & (1 << 16)) != 0) // AVX512F + CPUCompileFlags.Set(InstructionSet_AVX512CD); + if (isAVX512_VLSupported) // AVX512CD_VL { - CPUCompileFlags.Set(InstructionSet_AVX512F); - - bool isAVX512_VLSupported = false; - if ((cpuidInfo[CPUID_EBX] & (1 << 31)) != 0) // AVX512VL - { - CPUCompileFlags.Set(InstructionSet_AVX512F_VL); - isAVX512_VLSupported = true; - } - - if ((cpuidInfo[CPUID_EBX] & (1 << 30)) != 0) // AVX512BW - { - CPUCompileFlags.Set(InstructionSet_AVX512BW); - if (isAVX512_VLSupported) // AVX512BW_VL - { - CPUCompileFlags.Set(InstructionSet_AVX512BW_VL); - } - } - - if ((cpuidInfo[CPUID_EBX] & (1 << 28)) != 0) // AVX512CD - { - CPUCompileFlags.Set(InstructionSet_AVX512CD); - if (isAVX512_VLSupported) // AVX512CD_VL - { - CPUCompileFlags.Set(InstructionSet_AVX512CD_VL); - } - } - - if ((cpuidInfo[CPUID_EBX] & (1 << 17)) != 0) // AVX512DQ - { - CPUCompileFlags.Set(InstructionSet_AVX512DQ); - if (isAVX512_VLSupported) // AVX512DQ_VL - { - CPUCompileFlags.Set(InstructionSet_AVX512DQ_VL); - } - } - - if ((cpuidInfo[CPUID_ECX] & (1 << 1)) != 0) // AVX512VBMI - { - CPUCompileFlags.Set(InstructionSet_AVX512VBMI); - if (isAVX512_VLSupported) // AVX512VBMI_VL - { - CPUCompileFlags.Set(InstructionSet_AVX512VBMI_VL); - } - } + CPUCompileFlags.Set(InstructionSet_AVX512CD_VL); } } - __cpuidex(cpuidInfo, 0x00000007, 0x00000001); + if ((cpuidInfo[CPUID_EBX] & (1 << 17)) != 0) // AVX512DQ + { + CPUCompileFlags.Set(InstructionSet_AVX512DQ); + if (isAVX512_VLSupported) // AVX512DQ_VL + { + CPUCompileFlags.Set(InstructionSet_AVX512DQ_VL); + } + } - if ((cpuidInfo[CPUID_EAX] & (1 << 4)) != 0) // AVX-VNNI + if ((cpuidInfo[CPUID_ECX] & (1 << 1)) != 0) // AVX512VBMI { - CPUCompileFlags.Set(InstructionSet_AVXVNNI); + CPUCompileFlags.Set(InstructionSet_AVX512VBMI); + if (isAVX512_VLSupported) // AVX512VBMI_VL + { + CPUCompileFlags.Set(InstructionSet_AVX512VBMI_VL); + } } } } + + __cpuidex(cpuidInfo, 0x00000007, 0x00000001); + + if ((cpuidInfo[CPUID_EAX] & (1 << 4)) != 0) // AVX-VNNI + { + CPUCompileFlags.Set(InstructionSet_AVXVNNI); + } } } } } } } - - if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SIMD16ByteOnly) != 0) - { - CPUCompileFlags.Clear(InstructionSet_AVX2); - } } + } - if (maxCpuId >= 0x07) - { - __cpuidex(cpuidInfo, 0x00000007, 0x00000000); + if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SIMD16ByteOnly) != 0) + { + CPUCompileFlags.Clear(InstructionSet_AVX2); + } - if ((cpuidInfo[CPUID_EBX] & (1 << 3)) != 0) // BMI1 - { - CPUCompileFlags.Set(InstructionSet_BMI1); - } + if (maxCpuId >= 0x07) + { + __cpuidex(cpuidInfo, 0x00000007, 0x00000000); - if ((cpuidInfo[CPUID_EBX] & (1 << 8)) != 0) // BMI2 - { - CPUCompileFlags.Set(InstructionSet_BMI2); - } + if ((cpuidInfo[CPUID_EBX] & (1 << 3)) != 0) // BMI1 + { + CPUCompileFlags.Set(InstructionSet_BMI1); + } - if ((cpuidInfo[CPUID_EDX] & (1 << 14)) != 0) - { - CPUCompileFlags.Set(InstructionSet_X86Serialize); // SERIALIZE - } + if ((cpuidInfo[CPUID_EBX] & (1 << 8)) != 0) // BMI2 + { + CPUCompileFlags.Set(InstructionSet_BMI2); + } + + if ((cpuidInfo[CPUID_EDX] & (1 << 14)) != 0) + { + CPUCompileFlags.Set(InstructionSet_X86Serialize); // SERIALIZE } } @@ -1623,15 +1614,6 @@ void EEJitManager::SetCpuInfo() CPUCompileFlags.Set(InstructionSet_LZCNT); } } - - if (!CPUCompileFlags.IsSet(InstructionSet_SSE)) - { - EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("SSE is not supported on the processor.")); - } - if (!CPUCompileFlags.IsSet(InstructionSet_SSE2)) - { - EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("SSE2 is not supported on the processor.")); - } #endif // defined(TARGET_X86) || defined(TARGET_AMD64) #if defined(TARGET_ARM64) diff --git a/src/coreclr/vm/i386/asmhelpers.S b/src/coreclr/vm/i386/asmhelpers.S index c0b5919e75aeb4..e0b87813592ddd 100644 --- a/src/coreclr/vm/i386/asmhelpers.S +++ b/src/coreclr/vm/i386/asmhelpers.S @@ -126,93 +126,6 @@ LEAF_ENTRY RestoreFPUContext, _TEXT ret 4 LEAF_END RestoreFPUContext, _TEXT - -LEAF_ENTRY GetSpecificCpuTypeAsm, _TEXT - push ebx // ebx is trashed by the cpuid calls - - // See if the chip supports CPUID - pushfd - pop ecx // Get the EFLAGS - mov eax, ecx // Save for later testing - xor ecx, 0x200000 // Invert the ID bit - push ecx - popfd // Save the updated flags - pushfd - pop ecx // Retrieve the updated flags - xor ecx, eax // Test if it actually changed (bit set means yes) - push eax - popfd // Restore the flags - - test ecx, 0x200000 - jz LOCAL_LABEL(Assume486) - - xor eax, eax - cpuid - - test eax, eax - jz LOCAL_LABEL(Assume486) // brif CPUID1 not allowed - - mov eax, 1 - cpuid - - // filter out everything except family and model - // Note that some multi-procs have different stepping number for each proc - and eax, 0x0ff0 - - jmp LOCAL_LABEL(CpuTypeDone) - -LOCAL_LABEL(Assume486): - mov eax, 0x0400 // report 486 - -LOCAL_LABEL(CpuTypeDone): - pop ebx - ret -LEAF_END GetSpecificCpuTypeAsm, _TEXT - -// uint32_t __stdcall GetSpecificCpuFeaturesAsm(uint32_t *pInfo); -LEAF_ENTRY GetSpecificCpuFeaturesAsm, _TEXT - push ebx // ebx is trashed by the cpuid calls - - // See if the chip supports CPUID - pushfd - pop ecx // Get the EFLAGS - mov eax, ecx // Save for later testing - xor ecx, 0x200000// Invert the ID bit. - push ecx - popfd // Save the updated flags. - pushfd - pop ecx // Retrieve the updated flags - xor ecx, eax // Test if it actually changed (bit set means yes) - push eax - popfd // Restore the flags - - test ecx, 0x200000 - jz LOCAL_LABEL(CpuFeaturesFail) - - xor eax, eax - cpuid - - test eax, eax - jz LOCAL_LABEL(CpuFeaturesDone) // br if CPUID1 not allowed - - mov eax, 1 - cpuid - mov eax, edx // return all feature flags - mov edx, [esp + 8] - test edx, edx - jz LOCAL_LABEL(CpuFeaturesDone) - mov [edx],ebx // return additional useful information - jmp LOCAL_LABEL(CpuFeaturesDone) - -LOCAL_LABEL(CpuFeaturesFail): - xor eax, eax // Nothing to report - -LOCAL_LABEL(CpuFeaturesDone): - pop ebx - ret 4 -LEAF_END GetSpecificCpuFeaturesAsm, _TEXT - - // ----------------------------------------------------------------------- // The out-of-line portion of the code to enable preemptive GC. // After the work is done, the code jumps back to the "pRejoinPoint" diff --git a/src/coreclr/vm/i386/asmhelpers.asm b/src/coreclr/vm/i386/asmhelpers.asm index 1e7d47a2046d61..de45300b9241de 100644 --- a/src/coreclr/vm/i386/asmhelpers.asm +++ b/src/coreclr/vm/i386/asmhelpers.asm @@ -377,91 +377,6 @@ endif retn 8 _CallJitEHFinallyHelper@8 ENDP - -_GetSpecificCpuTypeAsm@0 PROC public - push ebx ; ebx is trashed by the cpuid calls - - ; See if the chip supports CPUID - pushfd - pop ecx ; Get the EFLAGS - mov eax, ecx ; Save for later testing - xor ecx, 200000h ; Invert the ID bit. - push ecx - popfd ; Save the updated flags. - pushfd - pop ecx ; Retrieve the updated flags - xor ecx, eax ; Test if it actually changed (bit set means yes) - push eax - popfd ; Restore the flags - - test ecx, 200000h - jz Assume486 - - xor eax, eax - cpuid - - test eax, eax - jz Assume486 ; brif CPUID1 not allowed - - mov eax, 1 - cpuid - - ; filter out everything except family and model - ; Note that some multi-procs have different stepping number for each proc - and eax, 0ff0h - - jmp CpuTypeDone - -Assume486: - mov eax, 0400h ; report 486 -CpuTypeDone: - pop ebx - retn -_GetSpecificCpuTypeAsm@0 ENDP - -; uint32_t __stdcall GetSpecificCpuFeaturesAsm(uint32_t *pInfo); -_GetSpecificCpuFeaturesAsm@4 PROC public - push ebx ; ebx is trashed by the cpuid calls - - ; See if the chip supports CPUID - pushfd - pop ecx ; Get the EFLAGS - mov eax, ecx ; Save for later testing - xor ecx, 200000h ; Invert the ID bit. - push ecx - popfd ; Save the updated flags. - pushfd - pop ecx ; Retrieve the updated flags - xor ecx, eax ; Test if it actually changed (bit set means yes) - push eax - popfd ; Restore the flags - - test ecx, 200000h - jz CpuFeaturesFail - - xor eax, eax - cpuid - - test eax, eax - jz CpuFeaturesDone ; br if CPUID1 not allowed - - mov eax, 1 - cpuid - mov eax, edx ; return all feature flags - mov edx, [esp+8] - test edx, edx - jz CpuFeaturesDone - mov [edx],ebx ; return additional useful information - jmp CpuFeaturesDone - -CpuFeaturesFail: - xor eax, eax ; Nothing to report -CpuFeaturesDone: - pop ebx - retn 4 -_GetSpecificCpuFeaturesAsm@4 ENDP - - ;----------------------------------------------------------------------- ; The out-of-line portion of the code to enable preemptive GC. ; After the work is done, the code jumps back to the "pRejoinPoint" diff --git a/src/coreclr/vm/i386/cgencpu.h b/src/coreclr/vm/i386/cgencpu.h index 9e6024c0cb980b..8c58ff5669b426 100644 --- a/src/coreclr/vm/i386/cgencpu.h +++ b/src/coreclr/vm/i386/cgencpu.h @@ -40,26 +40,6 @@ EXTERN_C void SinglecastDelegateInvokeStub(); #define GetEEFuncEntryPoint(pfn) GFN_TADDR(pfn) -//********************************************************************** -// To be used with GetSpecificCpuInfo() - -#define CPU_X86_FAMILY(cpuType) (((cpuType) & 0x0F00) >> 8) -#define CPU_X86_MODEL(cpuType) (((cpuType) & 0x00F0) >> 4) -// Stepping is masked out by GetSpecificCpuInfo() -// #define CPU_X86_STEPPING(cpuType) (((cpuType) & 0x000F) ) - -#define CPU_X86_USE_CMOV(cpuFeat) ((cpuFeat & 0x00008001) == 0x00008001) -#define CPU_X86_USE_SSE2(cpuFeat) ((cpuFeat & 0x04000000) == 0x04000000) - -// Values for CPU_X86_FAMILY(cpuType) -#define CPU_X86_486 4 -#define CPU_X86_PENTIUM 5 -#define CPU_X86_PENTIUM_PRO 6 -#define CPU_X86_PENTIUM_4 0xF - -// Values for CPU_X86_MODEL(cpuType) for CPU_X86_PENTIUM_PRO -#define CPU_X86_MODEL_PENTIUM_PRO_BANIAS 9 // Pentium M (Mobile PPro with P4 feautres) - #define COMMETHOD_PREPAD 8 // # extra bytes to allocate in addition to sizeof(ComCallMethodDesc) #ifdef FEATURE_COMINTEROP #define COMMETHOD_CALL_PRESTUB_SIZE 5 // x86: CALL(E8) xx xx xx xx diff --git a/src/coreclr/vm/i386/cgenx86.cpp b/src/coreclr/vm/i386/cgenx86.cpp index 8d17ace05de965..48d943697ee367 100644 --- a/src/coreclr/vm/i386/cgenx86.cpp +++ b/src/coreclr/vm/i386/cgenx86.cpp @@ -39,9 +39,6 @@ #include "stublink.inl" -extern "C" DWORD STDCALL GetSpecificCpuTypeAsm(void); -extern "C" uint32_t STDCALL GetSpecificCpuFeaturesAsm(uint32_t *pInfo); - // NOTE on Frame Size C_ASSERT usage in this file // if the frame size changes then the stubs have to be revisited for correctness // kindly revist the logic and then update the constants so that the C_ASSERT will again fire @@ -76,64 +73,6 @@ void ClearRegDisplayArgumentAndScratchRegisters(REGDISPLAY * pRD) } #endif // FEATURE_EH_FUNCLETS -#ifndef DACCESS_COMPILE - -//--------------------------------------------------------------- -// Returns the type of CPU (the value of x of x86) -// (Please note, that it returns 6 for P5-II) -//--------------------------------------------------------------- -void GetSpecificCpuInfo(CORINFO_CPU * cpuInfo) -{ - LIMITED_METHOD_CONTRACT; - - static CORINFO_CPU val = { 0, 0, 0 }; - - if (val.dwCPUType) - { - *cpuInfo = val; - return; - } - - CORINFO_CPU tempVal; - tempVal.dwCPUType = GetSpecificCpuTypeAsm(); // written in ASM & doesn't participate in contracts - _ASSERTE(tempVal.dwCPUType); - -#ifdef _DEBUG - /* Set Family+Model+Stepping string (eg., x690 for Banias, or xF30 for P4 Prescott) - * instead of Family only - */ - - const DWORD cpuDefault = 0xFFFFFFFF; - static ConfigDWORD cpuFamily; - DWORD configCpuFamily = cpuFamily.val(CLRConfig::INTERNAL_CPUFamily); - if (configCpuFamily != cpuDefault) - { - assert((configCpuFamily & 0xFFF) == configCpuFamily); - tempVal.dwCPUType = (tempVal.dwCPUType & 0xFFFF0000) | configCpuFamily; - } -#endif - - tempVal.dwFeatures = GetSpecificCpuFeaturesAsm(&tempVal.dwExtendedFeatures); // written in ASM & doesn't participate in contracts - -#ifdef _DEBUG - /* Set the 32-bit feature mask - */ - - const DWORD cpuFeaturesDefault = 0xFFFFFFFF; - static ConfigDWORD cpuFeatures; - DWORD configCpuFeatures = cpuFeatures.val(CLRConfig::INTERNAL_CPUFeatures); - if (configCpuFeatures != cpuFeaturesDefault) - { - tempVal.dwFeatures = configCpuFeatures; - } -#endif - - val = *cpuInfo = tempVal; -} - -#endif // #ifndef DACCESS_COMPILE - - #ifndef FEATURE_EH_FUNCLETS //--------------------------------------------------------------------------------------- // diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 785a313d4d5de0..1c4d2091691167 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -5280,32 +5280,29 @@ void CEEInfo::getCallInfo( { BYTE * indcell = NULL; - if (!(flags & CORINFO_CALLINFO_KINDONLY)) - { - // We shouldn't be using GetLoaderAllocator here because for LCG, we need to get the - // VirtualCallStubManager from where the stub will be used. - // For normal methods there is no difference. - LoaderAllocator *pLoaderAllocator = m_pMethodBeingCompiled->GetLoaderAllocator(); - VirtualCallStubManager *pMgr = pLoaderAllocator->GetVirtualCallStubManager(); + // We shouldn't be using GetLoaderAllocator here because for LCG, we need to get the + // VirtualCallStubManager from where the stub will be used. + // For normal methods there is no difference. + LoaderAllocator *pLoaderAllocator = m_pMethodBeingCompiled->GetLoaderAllocator(); + VirtualCallStubManager *pMgr = pLoaderAllocator->GetVirtualCallStubManager(); - PCODE addr = pMgr->GetCallStub(exactType, pTargetMD); + PCODE addr = pMgr->GetCallStub(exactType, pTargetMD); - // Now we want to indirect through a cell so that updates can take place atomically. - if (m_pMethodBeingCompiled->IsLCGMethod()) - { - // LCG methods should use recycled indcells to prevent leaks. - indcell = pMgr->GenerateStubIndirection(addr, TRUE); + // Now we want to indirect through a cell so that updates can take place atomically. + if (m_pMethodBeingCompiled->IsLCGMethod()) + { + // LCG methods should use recycled indcells to prevent leaks. + indcell = pMgr->GenerateStubIndirection(addr, TRUE); - // Add it to the per DM list so that we can recycle them when the resolver is finalized - LCGMethodResolver *pResolver = m_pMethodBeingCompiled->AsDynamicMethodDesc()->GetLCGMethodResolver(); - pResolver->AddToUsedIndCellList(indcell); - } - else - { - // Normal methods should avoid recycled cells to preserve the locality of all indcells - // used by one method. - indcell = pMgr->GenerateStubIndirection(addr, FALSE); - } + // Add it to the per DM list so that we can recycle them when the resolver is finalized + LCGMethodResolver *pResolver = m_pMethodBeingCompiled->AsDynamicMethodDesc()->GetLCGMethodResolver(); + pResolver->AddToUsedIndCellList(indcell); + } + else + { + // Normal methods should avoid recycled cells to preserve the locality of all indcells + // used by one method. + indcell = pMgr->GenerateStubIndirection(addr, FALSE); } // We use an indirect call @@ -5521,20 +5518,6 @@ void CEEInfo::getCallInfo( } } - if (flags & CORINFO_CALLINFO_VERIFICATION) - { - if (pResult->hMethod != pResolvedToken->hMethod) - { - pResult->verMethodFlags = getMethodAttribsInternal(pResolvedToken->hMethod); - getMethodSigInternal(pResolvedToken->hMethod, &pResult->verSig, pResolvedToken->hClass); - } - else - { - pResult->verMethodFlags = pResult->methodFlags; - pResult->verSig = pResult->sig; - } - } - pResult->wrapperDelegateInvoke = FALSE; if (m_pMethodBeingCompiled->IsDynamicMethod()) @@ -5595,49 +5578,6 @@ bool CEEInfo::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, EE_TO_JIT_TRANSITION(); return ret; } -void CEEInfo::ThrowExceptionForHelper(const CORINFO_HELPER_DESC * throwHelper) -{ - CONTRACTL { - THROWS; - GC_TRIGGERS; - MODE_PREEMPTIVE; - } CONTRACTL_END; - - JIT_TO_EE_TRANSITION(); - - _ASSERTE(throwHelper->args[0].argType == CORINFO_HELPER_ARG_TYPE_Method); - MethodDesc *pCallerMD = GetMethod(throwHelper->args[0].methodHandle); - - AccessCheckContext accessContext(pCallerMD); - - switch (throwHelper->helperNum) - { - case CORINFO_HELP_METHOD_ACCESS_EXCEPTION: - { - _ASSERTE(throwHelper->args[1].argType == CORINFO_HELPER_ARG_TYPE_Method); - ThrowMethodAccessException(&accessContext, GetMethod(throwHelper->args[1].methodHandle)); - } - break; - case CORINFO_HELP_FIELD_ACCESS_EXCEPTION: - { - _ASSERTE(throwHelper->args[1].argType == CORINFO_HELPER_ARG_TYPE_Field); - ThrowFieldAccessException(&accessContext, reinterpret_cast(throwHelper->args[1].fieldHandle)); - } - break; - case CORINFO_HELP_CLASS_ACCESS_EXCEPTION: - { - _ASSERTE(throwHelper->args[1].argType == CORINFO_HELPER_ARG_TYPE_Class); - TypeHandle typeHnd(throwHelper->args[1].classHandle); - ThrowTypeAccessException(&accessContext, typeHnd.GetMethodTable()); - } - break; - - default: - _ASSERTE(!"Unknown access exception type"); - } - EE_TO_JIT_TRANSITION(); -} - bool CEEInfo::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls) { @@ -10284,70 +10224,6 @@ int32_t * CEEInfo::getAddrOfCaptureThreadGlobal(void **ppIndirection) } - -HRESULT CEEInfo::GetErrorHRESULT(struct _EXCEPTION_POINTERS *pExceptionPointers) -{ - CONTRACTL { - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - } CONTRACTL_END; - - HRESULT hr = S_OK; - - //This function is called from the JIT64 exception filter during PEVerify. Because it is a filter, it - //can be "called" from a NOTHROW region in the case of StackOverflow. Security::MapToHR throws - //internally, but it catches all exceptions. Therefore, none of the children can cause an exception to - //percolate out of this function (except for Stack Overflow). Obviously I can't explain most of this to - //the Contracts system, and I can't add this CONTRACT_VIOLATION to the filter in Jit64. - CONTRACT_VIOLATION(ThrowsViolation); - - JIT_TO_EE_TRANSITION(); - - GCX_COOP(); - - OBJECTREF throwable = GetThread()->LastThrownObject(); - hr = GetExceptionHResult(throwable); - - EE_TO_JIT_TRANSITION(); - - return hr; -} - - -uint32_t CEEInfo::GetErrorMessage(_Inout_updates_(bufferLength) char16_t* buffer, uint32_t bufferLength) -{ - CONTRACTL { - THROWS; - GC_TRIGGERS; - MODE_PREEMPTIVE; - } CONTRACTL_END; - - uint32_t result = 0; - - JIT_TO_EE_TRANSITION(); - - GCX_COOP(); - - OBJECTREF throwable = GetThread()->LastThrownObject(); - - if (throwable != NULL) - { - EX_TRY - { - result = GetExceptionMessage(throwable, (LPWSTR)buffer, bufferLength); - } - EX_CATCH - { - } - EX_END_CATCH(SwallowAllExceptions) - } - - EE_TO_JIT_TRANSITION(); - - return result; -} - // This method is called from CEEInfo::FilterException which // is run as part of the SEH filter clause for the JIT. // It is fatal to throw an exception while running a SEH filter clause @@ -10431,12 +10307,6 @@ LONG EEFilterException(struct _EXCEPTION_POINTERS *pExceptionPointers, void *unu return result; } -int CEEInfo::FilterException(struct _EXCEPTION_POINTERS *pExceptionPointers) -{ - WRAPPER_NO_CONTRACT; - return EEFilterException(pExceptionPointers, nullptr); -} - // This code is called if FilterException chose to handle the exception. void CEEInfo::HandleException(struct _EXCEPTION_POINTERS *pExceptionPointers) { @@ -10514,26 +10384,6 @@ void CEEInfo::HandleException(struct _EXCEPTION_POINTERS *pExceptionPointers) EE_TO_JIT_TRANSITION_LEAF(); } -void ThrowExceptionForJit(HRESULT res); - -void CEEInfo::ThrowExceptionForJitResult( - HRESULT result) -{ - CONTRACTL { - THROWS; - GC_TRIGGERS; - MODE_PREEMPTIVE; - } CONTRACTL_END; - - JIT_TO_EE_TRANSITION(); - - if (!SUCCEEDED(result)) - ThrowExceptionForJit(result); - - EE_TO_JIT_TRANSITION(); -} - - CORINFO_MODULE_HANDLE CEEInfo::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void **ppIndirection) { @@ -10659,7 +10509,7 @@ static LONG RunWithErrorTrapFilter(struct _EXCEPTION_POINTERS* exceptionPointers auto* param = reinterpret_cast(theParam); param->m_exceptionPointers = *exceptionPointers; - return param->m_corInfo->FilterException(exceptionPointers); + return EEFilterException(exceptionPointers, nullptr); } #endif // !defined(TARGET_UNIX) @@ -12894,8 +12744,6 @@ CORJIT_FLAGS GetCompileFlags(MethodDesc * ftn, CORJIT_FLAGS flags, CORINFO_METHO } } - flags.Set(CORJIT_FLAGS::CORJIT_FLAG_SKIP_VERIFICATION); - if (ftn->IsILStub() && !g_pConfig->GetTrackDynamicMethodDebugInfo()) { // no debug info available for IL stubs @@ -13062,17 +12910,6 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config, flags = GetCompileFlags(ftn, flags, &methodInfo); -#ifdef _DEBUG - if (!flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_SKIP_VERIFICATION)) - { - SString methodString; - if (LoggingOn(LF_VERIFIER, LL_INFO100)) - TypeString::AppendMethodDebug(methodString, ftn); - - LOG((LF_VERIFIER, LL_INFO100, "{ Will verify method (%p) %s %s\n", ftn, methodString.GetUTF8(), ftn->m_pszDebugMethodSignature)); - } -#endif //_DEBUG - #if defined(TARGET_AMD64) || defined(TARGET_ARM64) BOOL fForceJumpStubOverflow = FALSE;