From a098de5da7ad6fef5e39fb0033f4838856ab4b0a Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sat, 26 Jan 2019 09:26:16 -0800 Subject: [PATCH] Cleanup stackoverflow handling leftovers (dotnet/coreclr#22228) Commit migrated from https://github.com/dotnet/coreclr/commit/3038b7484330012fb418dae61cfbdb54542719fd --- src/coreclr/src/inc/corjit.h | 26 ----------- src/coreclr/src/inc/ex.h | 49 ++------------------ src/coreclr/src/inc/predeftlsslot.h | 1 - src/coreclr/src/jit/codegen.h | 7 --- src/coreclr/src/jit/codegenarm.cpp | 7 --- src/coreclr/src/jit/codegenarm64.cpp | 7 --- src/coreclr/src/jit/codegencommon.cpp | 37 --------------- src/coreclr/src/jit/codegenxarch.cpp | 7 --- src/coreclr/src/jit/compiler.cpp | 13 ------ src/coreclr/src/jit/compiler.h | 12 ----- src/coreclr/src/jit/emitxarch.cpp | 86 ----------------------------------- src/coreclr/src/jit/jit.h | 6 --- src/coreclr/src/jit/jitconfigvalues.h | 1 - src/coreclr/src/utilcode/ex.cpp | 7 --- src/coreclr/src/utilcode/hostimpl.cpp | 2 +- src/coreclr/src/vm/clrex.cpp | 5 +- src/coreclr/src/vm/clrex.h | 10 +--- src/coreclr/src/vm/corhost.cpp | 2 +- src/coreclr/src/vm/threads.h | 22 +-------- 19 files changed, 10 insertions(+), 297 deletions(-) diff --git a/src/coreclr/src/inc/corjit.h b/src/coreclr/src/inc/corjit.h index cadfdff..7d818d4 100644 --- a/src/coreclr/src/inc/corjit.h +++ b/src/coreclr/src/inc/corjit.h @@ -34,32 +34,6 @@ #include -#define CORINFO_STACKPROBE_DEPTH 256*sizeof(UINT_PTR) // Guaranteed stack until an fcall/unmanaged - // code can set up a frame. Please make sure - // this is less than a page. This is due to - // 2 reasons: - // - // If we need to probe more than a page - // size, we need one instruction per page - // (7 bytes per instruction) - // - // The JIT wants some safe space so it doesn't - // have to put a probe on every call site. It achieves - // this by probing n bytes more than CORINFO_STACKPROBE_DEPTH - // If it hasn't used more than n for its own stuff, it - // can do a call without doing any other probe - // - // In any case, we do really expect this define to be - // small, as setting up a frame should be only pushing - // a couple of bytes on the stack - // - // There is a compile time assert - // in the x86 jit to protect you from this - // - - - - /*****************************************************************************/ // These are error codes returned by CompileMethod enum CorJitResult diff --git a/src/coreclr/src/inc/ex.h b/src/coreclr/src/inc/ex.h index 8b9ec3b..9cd2adb 100644 --- a/src/coreclr/src/inc/ex.h +++ b/src/coreclr/src/inc/ex.h @@ -121,12 +121,6 @@ void GetCurrentExceptionPointers(PEXCEPTION_POINTERS pExceptionInfo); DWORD GetCurrentExceptionCode(); // --------------------------------------------------------------------------- -// We save current ExceptionPointers using VectoredExceptionHandler. The save data is only valid -// duing exception handling. Return TRUE if the current exception is hard or soft SO. -// --------------------------------------------------------------------------- -bool IsCurrentExceptionSO(); - -// --------------------------------------------------------------------------- // Standard exception hierarchy & infrastructure for library code & EE // --------------------------------------------------------------------------- @@ -151,8 +145,6 @@ Exception | |-> DelegatingException Y | - |-> StackOverflowException Y - | |-> OutOfMemoryException Y | |-> CLRException Y @@ -237,15 +229,12 @@ class Exception HandlerState(); void CleanupTry(); - void SetupCatch(INDEBUG_COMMA(__in_z const char * szFile) int lineNum, bool fVMInitialized = true); + void SetupCatch(INDEBUG_COMMA(__in_z const char * szFile) int lineNum); void SucceedCatch(); BOOL DidCatch() { return (m_dwFlags & Caught); } void SetCaught() { m_dwFlags |= Caught; } - BOOL DidCatchSO() { return (m_dwFlags & CaughtSO); } - void SetCaughtSO() { m_dwFlags |= CaughtSO; } - BOOL DidCatchCxx() { return (m_dwFlags & CaughtCxx); } void SetCaughtCxx() { m_dwFlags |= CaughtCxx; } }; @@ -721,14 +710,6 @@ private: EX_RETHROW; \ } \ -#define RethrowSOExceptions \ - if (__state.DidCatchSO()) \ - { \ - STATIC_CONTRACT_THROWS_TERMINAL; \ - EX_RETHROW; \ - } \ - - // Don't use this - use RethrowCorruptingExceptions (see below) instead. #define SwallowAllExceptions ; @@ -760,10 +741,6 @@ private: // SET_CE_RETHROW_FLAG_FOR_EX_CATCH macros helps evaluate if the CE is to be rethrown or not. This has been redefined in // Clrex.h to add the condition of evaluating the throwable as well (which is not available outside the VM folder). // -// Typically, SET_CE_RETHROW_FLAG_FOR_EX_CATCH would rethrow a Corrupted State Exception. However, SO needs to be dealt -// with specially and this work is done during EX_CATCH, by calling SetupCatch against the handler state, and by EX_ENDTRY -// by calling HANDLE_STACKOVERFLOW_AFTER_CATCH. -// // Passing FALSE as the second argument to IsProcessCorruptedStateException implies that SET_CE_RETHROW_FLAG_FOR_EX_CATCH // will ensure that we dont rethrow SO and allow EX_ENDTRY to SO specific processing. If none is done, then EX_ENDTRY will // rethrow SO. By that time stack has been reclaimed and thus, throwing SO will be safe. @@ -1276,10 +1253,6 @@ Exception *ExThrowWithInnerHelper(Exception *inner); // exception. This will allow the stack to unwind point, and so we won't be jeopardizing a // second stack overflow. //=================================================================================== -#ifndef VM_NO_SO_INFRASTRUCTURE_CODE -#define VM_NO_SO_INFRASTRUCTURE_CODE(x) -#endif - #define EX_HOOK \ EX_CATCH \ { \ @@ -1287,11 +1260,7 @@ Exception *ExThrowWithInnerHelper(Exception *inner); #define EX_END_HOOK \ } \ ANNOTATION_HANDLER_END; \ - if (IsCurrentExceptionSO()) \ - __state.SetCaughtSO(); \ - VM_NO_SO_INFRASTRUCTURE_CODE(_ASSERTE(!__state.DidCatchSO());) \ - if (!__state.DidCatchSO()) \ - EX_RETHROW; \ + EX_RETHROW; \ EX_END_CATCH_FOR_HOOK; \ } @@ -1321,22 +1290,10 @@ inline void Exception::HandlerState::CleanupTry() LIMITED_METHOD_DAC_CONTRACT; } -inline void Exception::HandlerState::SetupCatch(INDEBUG_COMMA(__in_z const char * szFile) int lineNum, bool fVMInitialized /* = true */) +inline void Exception::HandlerState::SetupCatch(INDEBUG_COMMA(__in_z const char * szFile) int lineNum) { WRAPPER_NO_CONTRACT; - if (fVMInitialized) - { - // Calling into IsCurrentExceptionSO will end up using various VM support entities (e.g. TLS slots, accessing CExecutionEngine - // implementation that accesses other VM specific data, etc) that may not be ready/initialized - // until the VM is initialized. - // - // This is particularly important when we have exceptions thrown/triggerred during runtime's initialization - // and accessing such data can result in possible recursive AV's in the runtime. - if (IsCurrentExceptionSO()) - SetCaughtSO(); - } - /* don't embed file names in retail to save space and avoid IP */ /* a findstr /n will allow you to locate it in a pinch */ #ifdef _DEBUG diff --git a/src/coreclr/src/inc/predeftlsslot.h b/src/coreclr/src/inc/predeftlsslot.h index bf2817e..d8b53fd 100644 --- a/src/coreclr/src/inc/predeftlsslot.h +++ b/src/coreclr/src/inc/predeftlsslot.h @@ -20,7 +20,6 @@ enum PredefinedTlsSlots TlsIdx_JitLogEnv, TlsIdx_IceCap, TlsIdx_StressLog, - TlsIdx_StackProbe, TlsIdx_Check, TlsIdx_ForbidGCLoaderUseCount, TlsIdx_ClrDebugState, // Pointer to ClrDebugState* structure diff --git a/src/coreclr/src/jit/codegen.h b/src/coreclr/src/jit/codegen.h index 40042ba..4db09e4 100644 --- a/src/coreclr/src/jit/codegen.h +++ b/src/coreclr/src/jit/codegen.h @@ -160,13 +160,6 @@ private: genStackLevel = newStackLevel; } -#if STACK_PROBES - // Stack Probes - bool genNeedPrologStackProbe; - - void genGenerateStackProbe(); -#endif - //------------------------------------------------------------------------- void genReportEH(); diff --git a/src/coreclr/src/jit/codegenarm.cpp b/src/coreclr/src/jit/codegenarm.cpp index 151704b..06732fb 100644 --- a/src/coreclr/src/jit/codegenarm.cpp +++ b/src/coreclr/src/jit/codegenarm.cpp @@ -477,13 +477,6 @@ BAILOUT: if (endLabel != nullptr) genDefineTempLabel(endLabel); -#if STACK_PROBES - if (compiler->opts.compNeedStackProbes) - { - genGenerateStackProbe(); - } -#endif - genProduceReg(tree); } diff --git a/src/coreclr/src/jit/codegenarm64.cpp b/src/coreclr/src/jit/codegenarm64.cpp index e45f88a..1e71256 100644 --- a/src/coreclr/src/jit/codegenarm64.cpp +++ b/src/coreclr/src/jit/codegenarm64.cpp @@ -2135,13 +2135,6 @@ BAILOUT: if (endLabel != nullptr) genDefineTempLabel(endLabel); -#if STACK_PROBES - if (compiler->opts.compNeedStackProbes) - { - genGenerateStackProbe(); - } -#endif - genProduceReg(tree); } diff --git a/src/coreclr/src/jit/codegencommon.cpp b/src/coreclr/src/jit/codegencommon.cpp index b96054a..789651a 100644 --- a/src/coreclr/src/jit/codegencommon.cpp +++ b/src/coreclr/src/jit/codegencommon.cpp @@ -2039,10 +2039,6 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode) #ifdef DEBUG genInterruptibleUsed = true; -#if STACK_PROBES - genNeedPrologStackProbe = false; -#endif - compiler->fgDebugCheckBBlist(); #endif // DEBUG @@ -7869,21 +7865,6 @@ void CodeGen::genFnProlog() intRegState.rsCalleeRegArgMaskLiveIn &= ~RBM_SECRET_STUB_PARAM; } -#if STACK_PROBES - // We could probably fold this into the loop for the FrameSize >= 0x3000 probing - // when creating the stack frame. Don't think it's worth it, though. - if (genNeedPrologStackProbe) - { - // - // Can't have a call until we have enough padding for rejit - // - genPrologPadForReJit(); - noway_assert(compiler->opts.compNeedStackProbes); - genGenerateStackProbe(); - compiler->compStackProbePrologDone = true; - } -#endif // STACK_PROBES - // // Zero out the frame as needed // @@ -9733,24 +9714,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#if STACK_PROBES -void CodeGen::genGenerateStackProbe() -{ - noway_assert(compiler->opts.compNeedStackProbes); - - // If this assert fires, it means somebody has changed the value - // CORINFO_STACKPROBE_DEPTH. - // Why does the EE need such a deep probe? It should just need a couple - // of bytes, to set up a frame in the unmanaged code.. - - static_assert_no_msg(CORINFO_STACKPROBE_DEPTH + JIT_RESERVED_STACK < compiler->eeGetPageSize()); - - JITDUMP("Emitting stack probe:\n"); - getEmitter()->emitIns_AR_R(INS_TEST, EA_PTRSIZE, REG_EAX, REG_SPBASE, - -(CORINFO_STACKPROBE_DEPTH + JIT_RESERVED_STACK)); -} -#endif // STACK_PROBES - #if defined(_TARGET_XARCH_) // Save compCalleeFPRegsPushed with the smallest register number saved at [RSP+offset], working // down the stack to the largest register number stored at [RSP+offset-(genCountBits(regMask)-1)*XMM_REG_SIZE] diff --git a/src/coreclr/src/jit/codegenxarch.cpp b/src/coreclr/src/jit/codegenxarch.cpp index 2aa9978..6fb8e42 100644 --- a/src/coreclr/src/jit/codegenxarch.cpp +++ b/src/coreclr/src/jit/codegenxarch.cpp @@ -2668,13 +2668,6 @@ BAILOUT: } #endif // JIT32_GCENCODER -#if STACK_PROBES - if (compiler->opts.compNeedStackProbes) - { - genGenerateStackProbe(); - } -#endif - #ifdef DEBUG // Update local variable to reflect the new stack pointer. if (compiler->opts.compStackCheckOnRet) diff --git a/src/coreclr/src/jit/compiler.cpp b/src/coreclr/src/jit/compiler.cpp index 2c24df9..5176d2c 100644 --- a/src/coreclr/src/jit/compiler.cpp +++ b/src/coreclr/src/jit/compiler.cpp @@ -1995,9 +1995,6 @@ void Compiler::compInit(ArenaAllocator* pAlloc, InlineInfo* inlineInfo) compNeedsGSSecurityCookie = false; compGSReorderStackLayout = false; -#if STACK_PROBES - compStackProbePrologDone = false; -#endif compGeneratingProlog = false; compGeneratingEpilog = false; @@ -3601,15 +3598,6 @@ void Compiler::compInitOptions(JitFlags* jitFlags) #endif } - opts.compNeedStackProbes = false; - -#ifdef DEBUG - if (JitConfig.StackProbesOverride() != 0 || compStressCompile(STRESS_GENERIC_VARN, 5)) - { - opts.compNeedStackProbes = true; - } -#endif - #ifdef DEBUG // Now, set compMaxUncheckedOffsetForNullObject for STRESS_NULL_OBJECT_CHECK if (compStressCompile(STRESS_NULL_OBJECT_CHECK, 30)) @@ -3662,7 +3650,6 @@ void Compiler::compInitOptions(JitFlags* jitFlags) { printf("OPTIONS: Jit invoked for ngen\n"); } - printf("OPTIONS: Stack probing is %s\n", opts.compNeedStackProbes ? "ENABLED" : "DISABLED"); } #endif diff --git a/src/coreclr/src/jit/compiler.h b/src/coreclr/src/jit/compiler.h index 6c93434..4bd410a 100644 --- a/src/coreclr/src/jit/compiler.h +++ b/src/coreclr/src/jit/compiler.h @@ -8200,9 +8200,6 @@ public: bool fgLocalVarLivenessDone; // Note that this one is used outside of debug. bool fgLocalVarLivenessChanged; -#if STACK_PROBES - bool compStackProbePrologDone; -#endif bool compLSRADone; bool compRationalIRForm; @@ -8469,15 +8466,6 @@ public: static const bool dspGCtbls = true; #endif - // We need stack probes to guarantee that we won't trigger a stack overflow - // when calling unmanaged code until they get a chance to set up a frame, because - // the EE will have no idea where it is. - // - // We will only be doing this currently for hosted environments. Unfortunately - // we need to take care of stubs, so potentially, we will have to do the probes - // for any call. We have a plan for not needing for stubs though - bool compNeedStackProbes; - #ifdef PROFILING_SUPPORTED // Whether to emit Enter/Leave/TailCall hooks using a dummy stub (DummyProfilerELTStub()). // This option helps make the JIT behave as if it is running under a profiler. diff --git a/src/coreclr/src/jit/emitxarch.cpp b/src/coreclr/src/jit/emitxarch.cpp index bba4c17..e56c4b2 100644 --- a/src/coreclr/src/jit/emitxarch.cpp +++ b/src/coreclr/src/jit/emitxarch.cpp @@ -6866,92 +6866,6 @@ void emitter::emitIns_Call(EmitCallType callType, // a sanity test. assert((unsigned)abs((signed)argSize) <= codeGen->genStackLevel); -#if STACK_PROBES - if (emitComp->opts.compNeedStackProbes) - { - // If we've pushed more than JIT_RESERVED_STACK allows, do an additional stack probe - // Else, just make sure the prolog does a probe for us. Invariant we're trying - // to get is that at any point we go out to unmanaged code, there is at least - // CORINFO_STACKPROBE_DEPTH bytes of stack available. - // - // The reason why we are not doing one probe for the max size at the prolog - // is that when don't have the max depth precomputed (it can depend on codegen), - // and we need it at the time we generate locallocs - // - // Compiler::lvaAssignFrameOffsets sets up compLclFrameSize, which takes in - // account everything except for the arguments of a callee. - // - // - // - if ((TARGET_POINTER_SIZE + // return address for call - emitComp->genStackLevel + - // Current stack level. This gets resetted on every - // localloc and on the prolog (invariant is that - // genStackLevel is 0 on basic block entry and exit and - // after any alloca). genStackLevel will include any arguments - // to the call, so we will insert an additional probe if - // we've consumed more than JIT_RESERVED_STACK bytes - // of stack, which is what the prolog probe covers (in - // addition to the EE requested size) - (emitComp->compHndBBtabCount * TARGET_POINTER_SIZE) - // Hidden slots for calling finallys - ) >= JIT_RESERVED_STACK) - { - // This happens when you have a call with a lot of arguments or a call is done - // when there's a lot of stuff pushed on the stack (for example a call whos returned - // value is an argument of another call that has pushed stuff on the stack) - // This should't be very frequent. - // For different values of JIT_RESERVED_STACK - // - // For mscorlib (109605 calls) - // - // 14190 probes in prologs (56760 bytes of code) - // - // JIT_RESERVED_STACK = 16 : 5452 extra probes - // JIT_RESERVED_STACK = 32 : 1084 extra probes - // JIT_RESERVED_STACK = 64 : 1 extra probes - // JIT_RESERVED_STACK = 96 : 0 extra probes - emitComp->genGenerateStackProbe(); - } - else - { - if (emitComp->compGeneratingProlog || emitComp->compGeneratingEpilog) - { - if (emitComp->compStackProbePrologDone) - { - // We already generated a probe and this call is not happening - // at a depth >= JIT_RESERVED_STACK, so nothing to do here - } - else - { - // 3 possible ways to get here: - // - We are in an epilog and haven't generated a probe in the prolog. - // This shouldn't happen as we don't generate any calls in epilog. - // - We are in the prolog, but doing a call before generating the probe. - // This shouldn't happen at all. - // - We are in the prolog, did not generate a probe but now we need - // to generate a probe because we need a call (eg: profiler). We'll - // need a probe. - // - // In any case, we need a probe - - // Ignore the profiler callback for now. - if (!emitComp->compIsProfilerHookNeeded()) - { - assert(!"We do not expect to get here"); - emitComp->genGenerateStackProbe(); - } - } - } - else - { - // We will need a probe and will generate it in the prolog - emitComp->genNeedPrologStackProbe = true; - } - } - } -#endif // STACK_PROBES - // Trim out any callee-trashed registers from the live set. regMaskTP savedSet = emitGetGCRegsSavedOrModified(methHnd); gcrefRegs &= savedSet; diff --git a/src/coreclr/src/jit/jit.h b/src/coreclr/src/jit/jit.h index bdeccf4..f5f96b4 100644 --- a/src/coreclr/src/jit/jit.h +++ b/src/coreclr/src/jit/jit.h @@ -444,7 +444,6 @@ typedef ptrdiff_t ssize_t; //============================================================================= #define REDUNDANT_LOAD 1 // track locals in regs, suppress loads -#define STACK_PROBES 0 // Support for stack probes #define DUMP_FLOWGRAPHS DEBUG // Support for creating Xml Flowgraph reports in *.fgx files #define HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION 1 // if 1 we must have all handler entry points in the Hot code section @@ -794,11 +793,6 @@ private: #define CLFLG_MINOPT (CLFLG_TREETRANS) -#define JIT_RESERVED_STACK 64 // Reserved for arguments of calls and hidden - // pushes for finallys so that we don't - // probe on every call site. See comment in - // for CORINFO_STACKPROBE_DEPTH in corjit.h - /*****************************************************************************/ extern void dumpILBytes(const BYTE* const codeAddr, unsigned codeSize, unsigned alignSize); diff --git a/src/coreclr/src/jit/jitconfigvalues.h b/src/coreclr/src/jit/jitconfigvalues.h index 649db4e..328ea0c 100644 --- a/src/coreclr/src/jit/jitconfigvalues.h +++ b/src/coreclr/src/jit/jitconfigvalues.h @@ -135,7 +135,6 @@ CONFIG_INTEGER(RunAltJitCode, W("RunAltJitCode"), 1) // If non-zero, and the com // code and fall back to the default compiler. CONFIG_INTEGER(RunComponentUnitTests, W("JitComponentUnitTests"), 0) // Run JIT component unit tests CONFIG_INTEGER(ShouldInjectFault, W("InjectFault"), 0) -CONFIG_INTEGER(StackProbesOverride, W("JitStackProbes"), 0) CONFIG_INTEGER(StressCOMCall, W("StressCOMCall"), 0) CONFIG_INTEGER(TailcallStress, W("TailcallStress"), 0) CONFIG_INTEGER(TreesBeforeAfterMorph, W("JitDumpBeforeAfterMorph"), 0) // If 1, display each tree before/after morphing diff --git a/src/coreclr/src/utilcode/ex.cpp b/src/coreclr/src/utilcode/ex.cpp index 1b5bfa7..5c182d5 100644 --- a/src/coreclr/src/utilcode/ex.cpp +++ b/src/coreclr/src/utilcode/ex.cpp @@ -1273,13 +1273,6 @@ DWORD GetCurrentExceptionCode() return (DWORD)(size_t)ClrFlsGetValue(TlsIdx_EXCEPTION_CODE); } -bool IsCurrentExceptionSO() -{ - WRAPPER_NO_CONTRACT; - return GetCurrentExceptionCode() == STATUS_STACK_OVERFLOW; -} - - //=========================================================================================== // These abstractions hide the difference between legacy desktop CLR's (that don't support // side-by-side-inproc and rely on a fixed SEH code to identify managed exceptions) and diff --git a/src/coreclr/src/utilcode/hostimpl.cpp b/src/coreclr/src/utilcode/hostimpl.cpp index 3a90ab7..5aacc58e 100644 --- a/src/coreclr/src/utilcode/hostimpl.cpp +++ b/src/coreclr/src/utilcode/hostimpl.cpp @@ -82,7 +82,7 @@ static void **CheckThreadState(DWORD slot, BOOL force = TRUE) // If this is for the stack probe, and we failed to allocate memory for it, we won't // put in a guard page. - if (slot == TlsIdx_ClrDebugState || slot == TlsIdx_StackProbe) + if (slot == TlsIdx_ClrDebugState) { return NULL; } diff --git a/src/coreclr/src/vm/clrex.cpp b/src/coreclr/src/vm/clrex.cpp index 5f4354b..d3a1ea5 100644 --- a/src/coreclr/src/vm/clrex.cpp +++ b/src/coreclr/src/vm/clrex.cpp @@ -897,13 +897,12 @@ void CLRException::HandlerState::SetupCatch(INDEBUG_COMMA(__in_z const char * sz STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - bool fVMInitialized = g_fEEStarted?true:false; - Exception::HandlerState::SetupCatch(INDEBUG_COMMA(szFile) lineNum, fVMInitialized); + Exception::HandlerState::SetupCatch(INDEBUG_COMMA(szFile) lineNum); Thread *pThread = NULL; DWORD exceptionCode = 0; - if (fVMInitialized) + if (g_fEEStarted) { pThread = GetThread(); exceptionCode = GetCurrentExceptionCode(); diff --git a/src/coreclr/src/vm/clrex.h b/src/coreclr/src/vm/clrex.h index 87ad5d0..a38f3a3 100644 --- a/src/coreclr/src/vm/clrex.h +++ b/src/coreclr/src/vm/clrex.h @@ -12,11 +12,6 @@ #ifndef _CLREX_H_ #define _CLREX_H_ -// BCL classnativelib includes first -#ifndef VM_NO_SO_INFRASTRUCTURE_CODE -#define VM_NO_SO_INFRASTRUCTURE_CODE(x) x -#endif - #include #include "runtimeexceptionkind.h" @@ -793,7 +788,7 @@ class EEFileLoadException : public EEException #define SET_CE_RETHROW_FLAG_FOR_EX_CATCH(expr) ((expr == TRUE) && \ (g_pConfig->LegacyCorruptedStateExceptionsPolicy() == false) && \ (CEHelper::IsProcessCorruptedStateException(GetCurrentExceptionCode(), FALSE) || \ - ((!__state.DidCatchSO()) && (!__state.DidCatchCxx()) && \ + (!__state.DidCatchCxx() && \ CEHelper::IsLastActiveExceptionCorrupting(TRUE)))) #endif // FEATURE_CORRUPTING_EXCEPTIONS @@ -898,8 +893,7 @@ LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv); // #undef EX_ENDTRY #define EX_ENDTRY \ - PAL_CPP_ENDTRY \ - _ASSERTE(!__state.DidCatchSO()); + PAL_CPP_ENDTRY // CLRException::GetErrorInfo below invokes GetComIPFromObjectRef diff --git a/src/coreclr/src/vm/corhost.cpp b/src/coreclr/src/vm/corhost.cpp index ae73123..4ac57d4 100644 --- a/src/coreclr/src/vm/corhost.cpp +++ b/src/coreclr/src/vm/corhost.cpp @@ -2799,7 +2799,7 @@ LError: } // If this is for the stack probe, and we failed to allocate memory for it, we won't // put in a guard page. - if (slot == TlsIdx_ClrDebugState || slot == TlsIdx_StackProbe) + if (slot == TlsIdx_ClrDebugState) return NULL; ThrowOutOfMemory(); diff --git a/src/coreclr/src/vm/threads.h b/src/coreclr/src/vm/threads.h index e728303..6ec6323 100644 --- a/src/coreclr/src/vm/threads.h +++ b/src/coreclr/src/vm/threads.h @@ -1256,9 +1256,7 @@ public: TSNC_UnbalancedLocks = 0x00200000, // Do not rely on lock accounting for this thread: // we left an app domain with a lock count different from // when we entered it - TSNC_DisableSOCheckInHCALL = 0x00400000, // Some HCALL method may be called directly from VM. - // We can not assert they are called in SOTolerant - // region. + // unused = 0x00400000, TSNC_IgnoreUnhandledExceptions = 0x00800000, // Set for a managed thread born inside an appdomain created with the APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS flag. TSNC_ProcessedUnhandledException = 0x01000000,// Set on a thread on which we have done unhandled exception processing so that // we dont perform it again when OS invokes our UEF. Currently, applicable threads include: @@ -1562,24 +1560,6 @@ public: return (m_State & TS_Detached); } -#ifdef _DEBUG - class DisableSOCheckInHCALL - { - private: - Thread *m_pThread; - public: - DisableSOCheckInHCALL() - { - m_pThread = GetThread(); - m_pThread->SetThreadStateNC(TSNC_DisableSOCheckInHCALL); - } - ~DisableSOCheckInHCALL() - { - LIMITED_METHOD_CONTRACT; - m_pThread->ResetThreadStateNC(TSNC_DisableSOCheckInHCALL); - } - }; -#endif static LONG m_DetachCount; static LONG m_ActiveDetachCount; // Count how many non-background detached -- 2.7.4