From a28b25aacdcd2adb0fdfa70bd869f53ba6565976 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Wed, 23 Jan 2019 22:13:01 +0100 Subject: [PATCH] Remove all traces of FEATURE_STACK_PROBE. (#22149) --- Documentation/botr/mscorlib.md | 2 +- Documentation/botr/profilability.md | 2 - Documentation/coding-guidelines/clr-code-guide.md | 17 +- .../project-docs/clr-configuration-knobs.md | 1 - src/ToolBox/SOS/Strike/metadata.cpp | 1 - src/binder/clrprivbinderassemblyloadcontext.cpp | 1 - src/classlibnative/bcltype/arraynative.cpp | 4 - src/classlibnative/bcltype/arraynative.inl | 3 - src/classlibnative/bcltype/system.cpp | 3 - src/debug/daccess/dacdbiimpl.cpp | 2 - src/debug/ee/controller.cpp | 40 - src/debug/ee/controller.h | 1 - src/debug/ee/debugger.cpp | 80 - src/debug/ee/debuggermodule.cpp | 1 - src/debug/ee/funceval.cpp | 1 - src/debug/ee/functioninfo.cpp | 23 - src/debug/ee/rcthread.cpp | 21 - src/debug/ildbsymlib/pch.h | 1 - src/debug/ildbsymlib/symwrite.cpp | 17 - src/dlls/mscoree/comcallunmarshal.cpp | 24 - src/dlls/mscorpe/iceefilegen.cpp | 2 - src/gc/env/gcenv.base.h | 3 - src/gc/gc.cpp | 2 - src/gc/handletable.cpp | 7 - src/gc/handletable.inl | 2 - src/gc/handletablecache.cpp | 1 - src/gc/handletablescan.cpp | 1 - src/gc/objecthandle.cpp | 2 - src/ildasm/windasm.cpp | 3 - src/inc/arraylist.h | 9 - src/inc/clrconfigvalues.h | 1 - src/inc/clrhost.h | 16 +- src/inc/clrtypes.h | 11 - src/inc/contract.h | 238 +-- src/inc/contract.inl | 108 -- src/inc/corexcep.h | 6 - src/inc/daccess.h | 2 +- src/inc/entrypoints.h | 53 +- src/inc/ex.h | 36 +- src/inc/formattype.cpp | 4 - src/inc/genericstackprobe.h | 610 ------- src/inc/genericstackprobe.inl | 15 - src/inc/holder.h | 20 +- src/inc/metadatatracker.h | 6 - src/inc/ostype.h | 1 - src/inc/palclr.h | 13 +- src/inc/palclr_win.h | 11 +- src/inc/pedecoder.inl | 28 - src/inc/predeftlsslot.h | 2 - src/inc/profilepriv.inl | 40 - src/inc/sarray.inl | 1 - src/inc/sbuffer.inl | 13 - src/inc/sstring.inl | 8 - src/inc/staticcontract.h | 59 +- src/inc/utilcode.h | 2 - src/md/compiler/regmeta_import.cpp | 3 - src/md/compiler/regmeta_vm.cpp | 4 - src/md/enc/mdinternalrw.cpp | 6 - src/md/enc/metamodelrw.cpp | 4 - src/md/runtime/mdinternaldisp.cpp | 4 - src/strongname/api/common.h | 2 - src/utilcode/arraylist.cpp | 1 - src/utilcode/ccomprc.cpp | 1 - src/utilcode/check.cpp | 16 +- src/utilcode/clrconfig.cpp | 2 - src/utilcode/clrhost.cpp | 1 - src/utilcode/clrhost_nodependencies.cpp | 19 - src/utilcode/collections.cpp | 1 - src/utilcode/debug.cpp | 14 - src/utilcode/ex.cpp | 50 +- src/utilcode/genericstackprobe.cpp | 510 ------ src/utilcode/loaderheap.cpp | 1 - src/utilcode/log.cpp | 12 - src/utilcode/longfilepathwrappers.cpp | 83 - src/utilcode/pedecoder.cpp | 29 +- src/utilcode/posterror.cpp | 7 - src/utilcode/regutil.cpp | 6 - src/utilcode/sstring.cpp | 1 - src/utilcode/stresslog.cpp | 7 - src/utilcode/util.cpp | 13 +- src/utilcode/util_nodependencies.cpp | 1 - src/utilcode/utilmessagebox.cpp | 8 +- src/utilcode/winfix.cpp | 1 - src/vm/amd64/cgenamd64.cpp | 11 - src/vm/amd64/cgencpu.h | 4 - src/vm/amd64/excepamd64.cpp | 2 - src/vm/amd64/gmsamd64.cpp | 1 - src/vm/appdomain.cpp | 17 +- src/vm/appdomain.hpp | 5 - src/vm/array.cpp | 1 - src/vm/assembly.cpp | 5 - src/vm/assemblynative.cpp | 1 - src/vm/assemblyspec.cpp | 1 - src/vm/assemblyspec.hpp | 1 - src/vm/binder.cpp | 1 - src/vm/callhelpers.cpp | 9 - src/vm/callhelpers.h | 2 - src/vm/ceeload.cpp | 31 - src/vm/ceeload.h | 1 - src/vm/ceeload.inl | 1 - src/vm/ceemain.cpp | 46 +- src/vm/class.cpp | 4 - src/vm/classcompat.cpp | 1 - src/vm/classcompat.h | 1 - src/vm/classfactory.cpp | 44 - src/vm/classhash.cpp | 1 - src/vm/clrex.cpp | 43 +- src/vm/clrex.h | 17 +- src/vm/clrex.inl | 2 - src/vm/clsload.cpp | 47 +- src/vm/clsload.inl | 1 - src/vm/codeman.cpp | 23 - src/vm/codeman.h | 1 - src/vm/codepitchingmanager.cpp | 1 - src/vm/comcache.cpp | 1 - src/vm/comcallablewrapper.cpp | 12 - src/vm/comcallablewrapper.h | 14 - src/vm/comconnectionpoints.cpp | 25 - src/vm/comdelegate.cpp | 1 - src/vm/commodule.cpp | 1 - src/vm/common.h | 2 - src/vm/compile.cpp | 7 +- src/vm/compile.h | 1 - src/vm/comsynchronizable.cpp | 9 - src/vm/comthreadpool.cpp | 19 +- src/vm/comtoclrcall.cpp | 43 +- src/vm/comtoclrcall.h | 8 - src/vm/comutilnative.cpp | 7 - src/vm/comwaithandle.cpp | 10 +- src/vm/contractimpl.cpp | 3 - src/vm/contractimpl.h | 2 - src/vm/corhost.cpp | 80 +- src/vm/crst.h | 2 - src/vm/customattribute.cpp | 2 - src/vm/custommarshalerinfo.h | 1 - src/vm/dataimage.cpp | 1 - src/vm/debugdebugger.cpp | 1 - src/vm/debughelp.cpp | 2 - src/vm/dispatchinfo.cpp | 6 - src/vm/dllimport.cpp | 1 - src/vm/domainfile.cpp | 6 - src/vm/domainfile.inl | 10 +- src/vm/dwreport.cpp | 2 - src/vm/dynamicmethod.cpp | 2 - src/vm/ecall.cpp | 3 - src/vm/eeconfig.cpp | 8 - src/vm/eeconfig.h | 5 +- src/vm/eecontract.cpp | 1 - src/vm/eecontract.h | 2 - src/vm/eedbginterfaceimpl.cpp | 48 - src/vm/eedbginterfaceimpl.inl | 2 - src/vm/eehash.inl | 5 - src/vm/eepolicy.cpp | 243 +-- src/vm/eetoprofinterfaceimpl.cpp | 112 +- src/vm/eetoprofinterfaceimpl.inl | 1 - src/vm/encee.cpp | 1 - src/vm/eventreporter.cpp | 5 - src/vm/eventtrace.cpp | 8 - src/vm/excep.cpp | 215 +-- src/vm/exceptionhandling.cpp | 97 +- src/vm/exceptmacros.h | 26 +- src/vm/exinfo.cpp | 5 - src/vm/exstate.cpp | 12 +- src/vm/extensibleclassfactory.cpp | 1 - src/vm/fcall.cpp | 3 - src/vm/fcall.h | 11 +- src/vm/field.cpp | 24 +- src/vm/field.h | 3 - src/vm/fieldmarshaler.cpp | 1 - src/vm/fieldmarshaler.h | 1 - src/vm/fptrstubs.cpp | 1 - src/vm/frames.cpp | 14 - src/vm/frames.h | 1 - src/vm/gccover.cpp | 2 - src/vm/gcenv.ee.common.cpp | 1 - src/vm/gchandleutilities.h | 2 - src/vm/gchelpers.cpp | 42 - src/vm/generics.cpp | 11 - src/vm/hash.cpp | 1 - src/vm/hosting.cpp | 41 +- src/vm/i386/cgenx86.cpp | 10 - src/vm/i386/excepx86.cpp | 43 +- src/vm/i386/gmsx86.cpp | 2 - src/vm/i386/jitinterfacex86.cpp | 8 - src/vm/ibclogger.cpp | 39 - src/vm/interoputil.cpp | 36 - src/vm/interoputil.inl | 2 - src/vm/interpreter.cpp | 95 -- src/vm/interpreter.hpp | 4 - src/vm/jithelpers.cpp | 13 - src/vm/jitinterface.cpp | 183 -- src/vm/jitinterface.h | 1 - src/vm/listlock.h | 1 - src/vm/loaderallocator.cpp | 11 - src/vm/managedmdimport.cpp | 58 - src/vm/marshalnative.cpp | 2 - src/vm/mda.h | 2 +- src/vm/mdaassistants.cpp | 98 -- src/vm/memberload.cpp | 1 - src/vm/method.cpp | 31 +- src/vm/method.hpp | 2 - src/vm/method.inl | 3 - src/vm/methodtable.cpp | 47 +- src/vm/methodtable.h | 5 - src/vm/methodtable.inl | 7 - src/vm/methodtablebuilder.cpp | 12 - src/vm/mlinfo.cpp | 1 - src/vm/nativeoverlapped.h | 4 +- src/vm/notifyexternals.cpp | 1 - src/vm/object.cpp | 25 - src/vm/object.h | 6 - src/vm/object.inl | 8 - src/vm/olecontexthelpers.cpp | 2 - src/vm/olevariant.cpp | 3 - src/vm/packedfields.inl | 2 - src/vm/pefile.cpp | 4 - src/vm/pefile.inl | 15 - src/vm/peimage.cpp | 9 +- src/vm/peimage.inl | 2 - src/vm/peimagelayout.inl | 1 - src/vm/precode.cpp | 4 - src/vm/prestub.cpp | 1 - src/vm/profattach.cpp | 2 - src/vm/profattachclient.cpp | 4 - src/vm/profilingenumerators.cpp | 7 - src/vm/profilingenumerators.h | 4 - src/vm/profilinghelper.cpp | 1 - src/vm/profilinghelper.inl | 4 - src/vm/proftoeeinterfaceimpl.cpp | 119 +- src/vm/proftoeeinterfaceimpl.inl | 1 - src/vm/qcall.h | 13 +- src/vm/readytoruninfo.cpp | 7 - src/vm/reflectioninvocation.cpp | 13 +- src/vm/runtimecallablewrapper.cpp | 1 - src/vm/runtimecallablewrapper.h | 2 - src/vm/runtimehandles.cpp | 33 +- src/vm/safehandle.cpp | 1 - src/vm/sha1.cpp | 6 - src/vm/siginfo.cpp | 19 - src/vm/sourceline.cpp | 7 +- src/vm/spinlock.cpp | 4 - src/vm/stackingallocator.cpp | 8 - src/vm/stackingallocator.h | 9 +- src/vm/stackprobe.cpp | 1765 -------------------- src/vm/stackprobe.h | 991 ----------- src/vm/stackprobe.inl | 135 -- src/vm/stacksampler.cpp | 6 - src/vm/stackwalk.cpp | 11 - src/vm/stdinterfaces.cpp | 12 - src/vm/stdinterfaces_wrapper.cpp | 98 +- src/vm/stubhelpers.cpp | 5 +- src/vm/stublink.cpp | 19 - src/vm/stublink.h | 1 - src/vm/stubmgr.cpp | 12 +- src/vm/stubmgr.h | 5 - src/vm/syncblk.cpp | 6 +- src/vm/syncblk.h | 1 - src/vm/syncblk.inl | 7 - src/vm/synch.cpp | 25 +- src/vm/threadpoolrequest.cpp | 4 - src/vm/threads.cpp | 237 +-- src/vm/threads.h | 79 - src/vm/threads.inl | 13 - src/vm/threadstatics.cpp | 5 - src/vm/threadstatics.h | 3 - src/vm/threadsuspend.cpp | 52 +- src/vm/tlbexport.h | 3 +- src/vm/typectxt.cpp | 9 - src/vm/typedesc.cpp | 10 +- src/vm/typedesc.h | 1 - src/vm/typehandle.cpp | 50 +- src/vm/typehandle.h | 1 - src/vm/typehandle.inl | 1 - src/vm/typehash.cpp | 10 - src/vm/typekey.h | 1 - src/vm/typeparse.cpp | 44 +- src/vm/typeparse.h | 2 - src/vm/typestring.cpp | 97 +- src/vm/util.cpp | 33 +- src/vm/util.hpp | 5 +- src/vm/versionresilienthashcode.cpp | 1 - src/vm/virtualcallstub.cpp | 12 - src/vm/vmholder.h | 3 - src/vm/weakreferencenative.cpp | 3 - src/vm/win32threadpool.cpp | 35 - src/vm/wrappers.h | 2 - src/vm/zapsig.cpp | 1 - src/zap/zapimage.cpp | 7 - src/zap/zapinfo.cpp | 4 - src/zap/zapper.cpp | 1 - 290 files changed, 193 insertions(+), 8658 deletions(-) delete mode 100644 src/inc/genericstackprobe.h delete mode 100644 src/inc/genericstackprobe.inl delete mode 100644 src/utilcode/genericstackprobe.cpp delete mode 100644 src/vm/stackprobe.cpp delete mode 100644 src/vm/stackprobe.h delete mode 100644 src/vm/stackprobe.inl diff --git a/Documentation/botr/mscorlib.md b/Documentation/botr/mscorlib.md index d5fc85e..83c3b68 100644 --- a/Documentation/botr/mscorlib.md +++ b/Documentation/botr/mscorlib.md @@ -121,7 +121,7 @@ The QCall entrypoint has to be registered in tables in [vm\ecalllist.h][ecalllis BOOL QCALLTYPE FooNative::Bar(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString) { // All QCalls should have QCALL_CONTRACT. - // It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; SO_TOLERANT. + // It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE. QCALL_CONTRACT; // Optionally, use QCALL_CHECK instead and the expanded form of the contract diff --git a/Documentation/botr/profilability.md b/Documentation/botr/profilability.md index 528c3f1..1001b6a 100644 --- a/Documentation/botr/profilability.md +++ b/Documentation/botr/profilability.md @@ -69,7 +69,6 @@ Each and every callback wrapper must have some common gunk at the top. Here's a // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; CLR_TO_PROFILER_ENTRYPOINT((LF_CORPROF, @@ -167,7 +166,6 @@ Each and every Info function must have some common gunk at the top. Here's an e // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; PROFILER_TO_CLR_ENTRYPOINT_SYNC((LF_CORPROF, diff --git a/Documentation/coding-guidelines/clr-code-guide.md b/Documentation/coding-guidelines/clr-code-guide.md index c1f69b0..e212d1a 100644 --- a/Documentation/coding-guidelines/clr-code-guide.md +++ b/Documentation/coding-guidelines/clr-code-guide.md @@ -76,9 +76,8 @@ Written in 2006, by: * [2.10.1.5 LOADS_TYPE(loadlevel)](#2.10.1.5) * [2.10.1.6 CAN_TAKE_LOCK / CANNOT_TAKE_LOCK](#2.10.1.6) * [2.10.1.7 EE_THREAD_REQUIRED / EE_THREAD_NOT_REQUIRED](#2.10.1.7) - * [2.10.1.8 SO_TOLERANT/SO_INTOLERANT](#2.10.1.8) - * [2.10.1.9 PRECONDITION(expr)](#2.10.1.9) - * [2.10.1.10 POSTCONDITION(expr)](#2.10.1.10) + * [2.10.1.8 PRECONDITION(expr)](#2.10.1.8) + * [2.10.1.9 POSTCONDITION(expr)](#2.10.1.9) * [2.10.2 Is order important?](#2.10.2) * [2.10.3 Using the right form of contract](#2.10.3) * [2.10.4 When is it safe to use a runtime contract?](#2.10.4) @@ -1207,19 +1206,11 @@ You should only use BEGIN/END_GETTHREAD_ALLOWED(_IN_NO_THROW_REGION) if: If the latter is true, it's generally best to push BEGIN/END_GETTHREAD_ALLOWED down the callee chain so all callers benefit. -#### 2.10.1.8 SO_TOLERANT/SO_INTOLERANT - -These are related to stack probes. SO_TOLERANT means the function is written in such a way that it is safe to throw a StackOverflow exception between any two instructions. It doesn't update global state, doesn't modify data structures, and doesn't call out to the operating system. - -If you don't specify SO_TOLERANT, the function is treated as SO_INTOLERANT. - -The CLR asserts if you invoke an SO_INTOLERANT function outside the scope of a stack probe. The probe's purpose is to check in advance if sufficient stack is available and trigger the SO exception before venturing into SO_INTOLERANT code. - -#### 2.10.1.9 PRECONDITION(_expr_) +#### 2.10.1.8 PRECONDITION(_expr_) This is pretty self-explanatory. It is basically an **_ASSERTE.** Both _ASSERTE's and PRECONDITIONS are used widely in the codebase. The expression can evaluate to either a Boolean or a Check. -#### 2.10.1.10 POSTCONDITION(_expr_) +#### 2.10.1.9 POSTCONDITION(_expr_) This is an expression that's tested on a _normal_ function exit. It will not be tested if an exception is thrown out of the function. Postconditions can access the function's locals provided that the locals were declared at the top level scope of the function. C++ objects will not have been destructed yet. diff --git a/Documentation/project-docs/clr-configuration-knobs.md b/Documentation/project-docs/clr-configuration-knobs.md index 4797d75..328fdaa 100644 --- a/Documentation/project-docs/clr-configuration-knobs.md +++ b/Documentation/project-docs/clr-configuration-knobs.md @@ -816,7 +816,6 @@ Name | Description | Type | Class | Default Value | Flags `MscorsnLogging` | Enables strong name logging | `DWORD` | `INTERNAL` | `0` | REGUTIL_default `NativeImageRequire` | | `DWORD` | `EXTERNAL` | `0` | REGUTIL_default `NestedEhOom` | | `DWORD` | `INTERNAL` | `0` | REGUTIL_default -`NO_SO_NOT_MAINLINE` | | `DWORD` | `EXTERNAL` | `0` | REGUTIL_default `NoGuiOnAssert` | | `DWORD` | `INTERNAL` | `INTERNAL_NoGuiOnAssert_Default` | REGUTIL_default `NoProcedureSplitting` | | `DWORD` | `EXTERNAL` | `0` | REGUTIL_default `NoStringInterning` | Disallows string interning. I see no value in it anymore. | `DWORD` | `INTERNAL` | `1` | REGUTIL_default diff --git a/src/ToolBox/SOS/Strike/metadata.cpp b/src/ToolBox/SOS/Strike/metadata.cpp index 073b979..8502aaa 100644 --- a/src/ToolBox/SOS/Strike/metadata.cpp +++ b/src/ToolBox/SOS/Strike/metadata.cpp @@ -9,7 +9,6 @@ // ==--== #include "strike.h" #include "util.h" -#include "genericstackprobe.h" /**********************************************************************\ * Routine Description: * diff --git a/src/binder/clrprivbinderassemblyloadcontext.cpp b/src/binder/clrprivbinderassemblyloadcontext.cpp index 5c6ea42..6f74626 100644 --- a/src/binder/clrprivbinderassemblyloadcontext.cpp +++ b/src/binder/clrprivbinderassemblyloadcontext.cpp @@ -259,7 +259,6 @@ void CLRPrivBinderAssemblyLoadContext::PrepareForLoadContextRelease(INT_PTR ptrM GC_NOTRIGGER; THROWS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/classlibnative/bcltype/arraynative.cpp b/src/classlibnative/bcltype/arraynative.cpp index eb5cfd9..c99cb5c 100644 --- a/src/classlibnative/bcltype/arraynative.cpp +++ b/src/classlibnative/bcltype/arraynative.cpp @@ -165,7 +165,6 @@ void ArrayInitializeWorker(ARRAYBASEREF * arrayRef, MethodTable* pElemMT) { STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_INTOLERANT; // Ensure that the array element type is fully loaded before executing its code pElemMT->EnsureInstanceActive(); @@ -283,7 +282,6 @@ ArrayNative::AssignArrayEnum ArrayNative::CanAssignArrayTypeNoGC(const BASEARRAY NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; PRECONDITION(pSrc != NULL); PRECONDITION(pDest != NULL); } @@ -888,7 +886,6 @@ void memmoveGCRefs(void *dest, const void *src, size_t len) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -916,7 +913,6 @@ void ArrayNative::ArrayCopyNoTypeCheck(BASEARRAYREF pSrc, unsigned int srcIndex, NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; PRECONDITION(pSrc != NULL); PRECONDITION(srcIndex >= 0); PRECONDITION(pDest != NULL); diff --git a/src/classlibnative/bcltype/arraynative.inl b/src/classlibnative/bcltype/arraynative.inl index b29e1a9..492d4fb 100644 --- a/src/classlibnative/bcltype/arraynative.inl +++ b/src/classlibnative/bcltype/arraynative.inl @@ -21,7 +21,6 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -156,7 +155,6 @@ FORCEINLINE void InlinedBackwardGCSafeCopyHelper(void *dest, const void *src, si NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -294,7 +292,6 @@ FORCEINLINE void InlinedMemmoveGCRefsHelper(void *dest, const void *src, size_t NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/classlibnative/bcltype/system.cpp b/src/classlibnative/bcltype/system.cpp index bd1db8f..944cda0 100644 --- a/src/classlibnative/bcltype/system.cpp +++ b/src/classlibnative/bcltype/system.cpp @@ -379,7 +379,6 @@ void SystemNative::GenericFailFast(STRINGREF refMesgString, EXCEPTIONREF refExce THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; }CONTRACTL_END; struct @@ -481,7 +480,6 @@ void SystemNative::GenericFailFast(STRINGREF refMesgString, EXCEPTIONREF refExce // skip this, if required. if (IsWatsonEnabled()) { - BEGIN_SO_INTOLERANT_CODE(pThread); if ((gc.refExceptionForWatsonBucketing == NULL) || !SetupWatsonBucketsForFailFast(gc.refExceptionForWatsonBucketing)) { PTR_EHWatsonBucketTracker pUEWatsonBucketTracker = pThread->GetExceptionState()->GetUEWatsonBucketTracker(); @@ -493,7 +491,6 @@ void SystemNative::GenericFailFast(STRINGREF refMesgString, EXCEPTIONREF refExce pUEWatsonBucketTracker->ClearWatsonBucketDetails(); } } - END_SO_INTOLERANT_CODE; } #endif // !FEATURE_PAL diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp index d8ed188..8ffbe2b 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -1310,7 +1310,6 @@ void DacDbiInterfaceImpl::GetMethodRegionInfo(MethodDesc * pMethodDe { CONTRACTL { - SO_INTOLERANT; GC_NOTRIGGER; PRECONDITION(CheckPointer(pCodeInfo)); } @@ -5758,7 +5757,6 @@ HRESULT DacDbiInterfaceImpl::FastSanityCheckObject(PTR_Object objPtr) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } diff --git a/src/debug/ee/controller.cpp b/src/debug/ee/controller.cpp index 494f66b..7d75a60 100644 --- a/src/debug/ee/controller.cpp +++ b/src/debug/ee/controller.cpp @@ -958,7 +958,6 @@ DebuggerController::DebuggerController(Thread * pThread, AppDomain * pAppDomain) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; CONSTRUCTOR_CHECK; @@ -993,7 +992,6 @@ void DebuggerController::DeleteAllControllers() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1016,7 +1014,6 @@ DebuggerController::~DebuggerController() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; DESTRUCTOR_CHECK; @@ -1051,7 +1048,6 @@ void DebuggerController::Delete() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1108,7 +1104,6 @@ void DebuggerController::DisableAll() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -1185,7 +1180,6 @@ void DebuggerController::Dequeue() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1234,7 +1228,6 @@ bool DebuggerController::BindPatch(DebuggerControllerPatch *patch, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; // from GetJitInfo GC_NOTRIGGER; MODE_ANY; // don't really care what mode we're in. @@ -1662,7 +1655,6 @@ BOOL DebuggerController::CheckGetPatchedOpcode(CORDB_ADDRESS_TYPE *address, { CONTRACTL { - SO_NOT_MAINLINE; // take Controller lock. NOTHROW; GC_NOTRIGGER; } @@ -2022,7 +2014,6 @@ void DebuggerController::AddPatchToStartOfLatestMethod(MethodDesc * fd) { CONTRACTL { - SO_NOT_MAINLINE; THROWS; // from GetJitInfo GC_NOTRIGGER; MODE_ANY; // don't really care what mode we're in. @@ -2050,7 +2041,6 @@ BOOL DebuggerController::AddBindAndActivateNativeManagedPatch(MethodDesc * fd, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; // from GetJitInfo GC_NOTRIGGER; MODE_ANY; // don't really care what mode we're in. @@ -2077,7 +2067,6 @@ BOOL DebuggerController::AddBindAndActivatePatchForMethodDesc(MethodDesc *fd, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; MODE_ANY; // don't really care what mode we're in. @@ -2160,7 +2149,6 @@ void DebuggerController::RemovePatchesFromModule(Module *pModule, AppDomain *pAp { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -2217,7 +2205,6 @@ bool DebuggerController::ModuleHasPatches( Module* pModule ) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -2572,7 +2559,6 @@ DPOSS_ACTION DebuggerController::ScanForTriggers(CORDB_ADDRESS_TYPE *address, { CONTRACTL { - SO_NOT_MAINLINE; // @todo - should this throw or not? NOTHROW; @@ -3112,7 +3098,6 @@ void DebuggerController::EnableSingleStep() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3149,7 +3134,6 @@ BOOL DebuggerController::IsSingleStepEnabled(Thread *pThread) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3172,7 +3156,6 @@ void DebuggerController::EnableSingleStep(Thread *pThread) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3194,7 +3177,6 @@ void DebuggerController::DisableSingleStep() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3296,7 +3278,6 @@ void DebuggerController::EnableExceptionHook() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3313,7 +3294,6 @@ void DebuggerController::DisableExceptionHook() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3340,7 +3320,6 @@ BOOL DebuggerController::DispatchExceptionHook(Thread *thread, // This can only modify controller's internal state. Can't send managed debug events. CONTRACTL { - SO_NOT_MAINLINE; GC_NOTRIGGER; NOTHROW; MODE_ANY; @@ -3405,7 +3384,6 @@ void DebuggerController::EnableUnwind(FramePointer fp) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3464,7 +3442,6 @@ bool DebuggerController::DispatchUnwind(Thread *thread, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; // don't send IPC events MODE_COOPERATIVE; // TriggerUnwind always is coop @@ -3578,7 +3555,6 @@ void DebuggerController::EnableTraceCall(FramePointer maxFrame) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3616,7 +3592,6 @@ VOID DebuggerController::PatchTargetVisitor(TADDR pVirtualTraceCallTarget, VOID* { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3647,7 +3622,6 @@ void DebuggerController::DisableTraceCall() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3834,7 +3808,6 @@ void DebuggerController::EnableMethodEnter() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -3867,7 +3840,6 @@ void DebuggerController::DisableMethodEnter() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -4030,7 +4002,6 @@ bool DebuggerController::SendEvent(Thread *thread, bool fIpChanged) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; SENDEVENT_CONTRACT_ITEMS; } @@ -4092,7 +4063,6 @@ void ThisFunctionMayHaveTriggerAGC() { CONTRACTL { - SO_NOT_MAINLINE; GC_TRIGGERS; NOTHROW; } @@ -4119,7 +4089,6 @@ bool DebuggerController::DispatchNativeException(EXCEPTION_RECORD *pException, { CONTRACTL { - SO_INTOLERANT; NOTHROW; // If this exception is for the debugger, then we may trigger a GC. @@ -4695,7 +4664,6 @@ TP_RESULT DebuggerPatchSkip::TriggerExceptionHook(Thread *thread, CONTEXT * cont { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; // Patch skippers only operate on patches set in managed code. But the infrastructure may have @@ -4996,7 +4964,6 @@ bool DebuggerBreakpoint::SendEvent(Thread *thread, bool fIpChanged) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; SENDEVENT_CONTRACT_ITEMS; } @@ -6648,7 +6615,6 @@ bool DebuggerStepper::SetRangesFromIL(DebuggerJitInfo *dji, COR_DEBUG_STEP_RANGE { CONTRACTL { - SO_NOT_MAINLINE; WRAPPER(THROWS); GC_NOTRIGGER; PRECONDITION(ThisIsHelperThreadWorker()); // Only help initializes a stepper. @@ -7540,7 +7506,6 @@ void DebuggerStepper::TriggerUnwind(Thread *thread, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; // from GetJitInfo GC_NOTRIGGER; // don't send IPC events MODE_COOPERATIVE; // TriggerUnwind always is coop @@ -7679,7 +7644,6 @@ bool DebuggerStepper::SendEvent(Thread *thread, bool fIpChanged) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; SENDEVENT_CONTRACT_ITEMS; } @@ -8307,7 +8271,6 @@ bool DebuggerThreadStarter::SendEvent(Thread *thread, bool fIpChanged) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; SENDEVENT_CONTRACT_ITEMS; } @@ -8519,7 +8482,6 @@ bool DebuggerUserBreakpoint::SendEvent(Thread *thread, bool fIpChanged) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; SENDEVENT_CONTRACT_ITEMS; } @@ -8604,7 +8566,6 @@ bool DebuggerFuncEvalComplete::SendEvent(Thread *thread, bool fIpChanged) { CONTRACTL { - SO_NOT_MAINLINE; THROWS; SENDEVENT_CONTRACT_ITEMS; } @@ -8949,7 +8910,6 @@ bool DebuggerContinuableExceptionBreakpoint::SendEvent(Thread *thread, bool fIpC { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; SENDEVENT_CONTRACT_ITEMS; } diff --git a/src/debug/ee/controller.h b/src/debug/ee/controller.h index 7756a29..7172662 100644 --- a/src/debug/ee/controller.h +++ b/src/debug/ee/controller.h @@ -1797,7 +1797,6 @@ public: { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; SENDEVENT_CONTRACT_ITEMS; } diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index b753d33..46b8b39 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -707,7 +707,6 @@ void Debugger::SendSimpleIPCEventAndBlock() { CONTRACTL { - SO_NOT_MAINLINE; MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; } @@ -801,7 +800,6 @@ HRESULT ValidateGCHandle(OBJECTHANDLE oh) CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -846,7 +844,6 @@ HRESULT ValidateObject(Object *objPtr) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -957,7 +954,6 @@ Debugger::Debugger() { CONTRACTL { - SO_INTOLERANT; WRAPPER(THROWS); WRAPPER(GC_TRIGGERS); CONSTRUCTOR_CHECK; @@ -1000,7 +996,6 @@ Debugger::~Debugger() NOTHROW; GC_NOTRIGGER; DESTRUCTOR_CHECK; - SO_INTOLERANT; } CONTRACTL_END; @@ -1053,7 +1048,6 @@ void Debugger::InitDebugEventCounting() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -1200,7 +1194,6 @@ HRESULT Debugger::CheckInitMethodInfoTable() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -1636,7 +1629,6 @@ DebuggerHeap * Debugger::GetInteropSafeHeap() { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; } @@ -1658,7 +1650,6 @@ DebuggerHeap * Debugger::GetInteropSafeHeap_NoThrow() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -1679,7 +1670,6 @@ DebuggerHeap * Debugger::GetInteropSafeExecutableHeap() { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; } @@ -1701,7 +1691,6 @@ DebuggerHeap * Debugger::GetInteropSafeExecutableHeap_NoThrow() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -1944,7 +1933,6 @@ HRESULT Debugger::Startup(void) { CONTRACTL { - SO_INTOLERANT; THROWS; GC_TRIGGERS; } @@ -2149,7 +2137,6 @@ HRESULT Debugger::StartupPhase2(Thread * pThread) { CONTRACTL { - SO_INTOLERANT; THROWS; GC_TRIGGERS; } @@ -2244,7 +2231,6 @@ void Debugger::InitializeLazyDataIfNecessary() { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_TRIGGERS; } @@ -2269,7 +2255,6 @@ HRESULT Debugger::LazyInitWrapper() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; PRECONDITION(ThisMaybeHelperThread()); @@ -2298,7 +2283,6 @@ void Debugger::LazyInit() { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; PRECONDITION(ThreadHoldsLock()); // ensure we're serialized, requires GC_NOTRIGGER @@ -2346,7 +2330,6 @@ void HelperThreadFavor::Init() { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; PRECONDITION(ThisMaybeHelperThread()); @@ -2385,7 +2368,6 @@ void DebuggerLazyInit::Init() { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; PRECONDITION(ThisMaybeHelperThread()); @@ -2483,7 +2465,6 @@ HRESULT Debugger::RequestFavor(FAVORCALLBACK fp, void * pData) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_TRIGGERS; PRECONDITION(fp != NULL); @@ -2528,7 +2509,6 @@ void Debugger::StopDebugger(void) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -2574,7 +2554,6 @@ DebuggerMethodInfo *Debugger::CreateMethodInfo(Module *module, mdMethodDef md) { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; @@ -2634,7 +2613,6 @@ void Debugger::JITComplete(NativeCodeVersion nativeCodeVersion, TADDR newAddress CONTRACTL { - SO_INTOLERANT; THROWS; PRECONDITION(!HasDebuggerDataLock()); PRECONDITION(newAddress != NULL); @@ -2710,7 +2688,6 @@ SIZE_T Debugger::GetArgCount(MethodDesc *fd,BOOL *fVarArg /* = NULL */) { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; } @@ -2806,7 +2783,6 @@ DebuggerJitInfo *Debugger::GetJitInfo(MethodDesc *fd, const BYTE *pbAddr, Debugg { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; PRECONDITION(!g_pDebugger->HasDebuggerDataLock()); @@ -2952,7 +2928,6 @@ DebuggerMethodInfo *Debugger::GetOrCreateMethodInfo(Module *pModule, mdMethodDef { CONTRACTL { - SO_INTOLERANT; SUPPORTS_DAC; THROWS; GC_NOTRIGGER; @@ -3010,7 +2985,6 @@ HRESULT Debugger::GetILToNativeMapping(PCODE pNativeCodeStartAddress, ULONG32 cM { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_TRIGGERS_FROM_GETJITINFO; } @@ -3130,7 +3104,6 @@ HRESULT Debugger::GetILToNativeMappingIntoArrays( { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; } @@ -3191,7 +3164,6 @@ CodeRegionInfo CodeRegionInfo::GetCodeRegionInfo(DebuggerJitInfo *dji, MethodDes { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; @@ -3389,7 +3361,6 @@ void Debugger::getBoundaries(MethodDesc * md, #ifndef DACCESS_COMPILE CONTRACTL { - SO_INTOLERANT; THROWS; GC_TRIGGERS; } @@ -3485,7 +3456,6 @@ void Debugger::getVars(MethodDesc * md, ULONG32 *cVars, ICorDebugInfo::ILVarInfo #ifndef DACCESS_COMPILE CONTRACTL { - SO_INTOLERANT; THROWS; GC_TRIGGERS_FROM_GETJITINFO; PRECONDITION(!ThisIsHelperThreadWorker()); @@ -3588,7 +3558,6 @@ HRESULT Debugger::SetIP( bool fCanSetIPOnly, Thread *thread,Module *module, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(thread)); @@ -3929,7 +3898,6 @@ HRESULT Debugger::ShuffleVariablesGet(DebuggerJitInfo *dji, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(dji)); @@ -4036,7 +4004,6 @@ HRESULT Debugger::ShuffleVariablesSet(DebuggerJitInfo *dji, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(dji)); @@ -4148,7 +4115,6 @@ GetSetFrameHelper::Init(MethodDesc *pMD) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -4336,7 +4302,6 @@ GetSetFrameHelper::~GetSetFrameHelper() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -4369,7 +4334,6 @@ SIZE_T GetSetFrameHelper::GetSizeOfElement(CorElementType cet) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -4441,7 +4405,6 @@ SIZE_T GetSetFrameHelper::GetValueClassSize(MetaSig* pSig) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pSig)); @@ -4488,7 +4451,6 @@ bool GetSetFrameHelper::GetValueClassSizeOfVar(int varNum, ICorDebugInfo::VarLoc { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -4562,7 +4524,6 @@ HRESULT Debugger::GetVariablesFromOffset(MethodDesc *pMD, // @todo - convert this to throwing w/ holders. It will be cleaner. CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(rgpVCs)); @@ -4743,7 +4704,6 @@ HRESULT Debugger::SetVariablesAtOffset(MethodDesc *pMD, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pCtx)); @@ -4914,7 +4874,6 @@ HRESULT Debugger::MapAndBindFunctionPatches(DebuggerJitInfo *djiNew, CONTRACTL { - SO_NOT_MAINLINE; THROWS; CALLED_IN_DEBUGGERDATALOCK_HOLDER_SCOPE_MAY_GC_TRIGGERS_CONTRACT; PRECONDITION(!djiNew || djiNew->m_nativeCodeVersion.GetMethodDesc() == fd); @@ -5112,7 +5071,6 @@ HRESULT Debugger::MapPatchToDJI( DebuggerControllerPatch *dcp,DebuggerJitInfo *d { CONTRACTL { - SO_NOT_MAINLINE; THROWS; CALLED_IN_DEBUGGERDATALOCK_HOLDER_SCOPE_MAY_GC_TRIGGERS_CONTRACT; PRECONDITION(djiTo != NULL); @@ -5213,7 +5171,6 @@ void Debugger::SendSyncCompleteIPCEvent(bool isEESuspendedForGC) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(ThreadHoldsLock()); @@ -5359,7 +5316,6 @@ DebuggerModule* Debugger::LookupOrCreateModule(Module* pModule, AppDomain *pAppD { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -5462,7 +5418,6 @@ void Debugger::TrapAllRuntimeThreads() { CONTRACTL { - SO_NOT_MAINLINE; MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; @@ -5565,7 +5520,6 @@ void Debugger::ReleaseAllRuntimeThreads(AppDomain *pAppDomain) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; @@ -5601,7 +5555,6 @@ int Debugger::GetMethodEncNumber(MethodDesc * pMethod) { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; } @@ -5621,7 +5574,6 @@ bool Debugger::IsJMCMethod(Module* pModule, mdMethodDef tkMethod) { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; MODE_ANY; @@ -5661,7 +5613,6 @@ bool Debugger::FirstChanceNativeException(EXCEPTION_RECORD *exception, CONTRACTL { - SO_TOLERANT; NOTHROW; // No clear GC_triggers semantics here. See DispatchNativeException. @@ -5807,7 +5758,6 @@ void Debugger::OnMethodEnter(void * pIP) { THROWS; GC_NOTRIGGER; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5835,7 +5785,6 @@ DWORD* Debugger::GetJMCFlagAddr(Module * pModule) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(CheckPointer(pModule)); } CONTRACTL_END; @@ -5926,7 +5875,6 @@ void Debugger::SetModuleDefaultJMCStatus(Module * pRuntimeModule, bool fStatus) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(ThisIsHelperThreadWorker()); @@ -13762,8 +13710,6 @@ VOID Debugger::M2UHandoffHijackWorker(CONTEXT *pContext, STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; // from sending managed event STATIC_CONTRACT_MODE_PREEMPTIVE; // we're in umanaged code. - SO_NOT_MAINLINE_FUNCTION; - LOG((LF_CORDB, LL_INFO1000, "D::M2UHHW: Context=0x%p exception record=0x%p\n", pContext, pExceptionRecord)); @@ -14898,7 +14844,6 @@ HRESULT Debugger::RemoveAppDomainFromIPC (AppDomain *pAppDomain) { MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; - SO_INTOLERANT; } CONTRACTL_END; @@ -14956,7 +14901,6 @@ HRESULT Debugger::UpdateAppDomainEntryInIPC(AppDomain *pAppDomain) { NOTHROW; if (GetThread()) { GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);} - SO_INTOLERANT; } CONTRACTL_END; @@ -15005,7 +14949,6 @@ HRESULT Debugger::CopyModulePdb(Module* pRuntimeModule) { THROWS; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; - SO_NOT_MAINLINE; PRECONDITION(ThisIsHelperThread()); MODE_ANY; @@ -15032,7 +14975,6 @@ HRESULT Debugger::IterateAppDomainsForPdbs() { THROWS; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; - SO_NOT_MAINLINE; PRECONDITION(ThisIsHelperThread()); MODE_ANY; @@ -15099,7 +15041,6 @@ HRESULT Debugger::InitAppDomainIPC(void) { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; PRECONDITION(CheckPointer(m_pAppDomainCB)); } @@ -15216,7 +15157,6 @@ HRESULT Debugger::TerminateAppDomainIPC(void) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; } CONTRACTL_END; @@ -15290,7 +15230,6 @@ HRESULT Debugger::FuncEvalSetup(DebuggerIPCE_FuncEvalInfo *pEvalInfo, { NOTHROW; GC_NOTRIGGER; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -15448,7 +15387,6 @@ HRESULT Debugger::FuncEvalSetupReAbort(Thread *pThread, Thread::ThreadAbortReque { NOTHROW; GC_NOTRIGGER; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -15595,7 +15533,6 @@ Debugger::FuncEvalRudeAbort( { THROWS; GC_NOTRIGGER; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -15810,7 +15747,6 @@ void Debugger::ShutdownBegun(void) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; } CONTRACTL_END; @@ -15850,7 +15786,6 @@ void Debugger::LockDebuggerForShutdown(void) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -15895,7 +15830,6 @@ void Debugger::DisableDebugger(void) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; PRECONDITION(ThisMaybeHelperThread()); } CONTRACTL_END; @@ -15922,7 +15856,6 @@ void Debugger::DoHelperThreadDuty() { CONTRACTL { - SO_NOT_MAINLINE; THROWS; WRAPPER(GC_TRIGGERS); } @@ -16006,7 +15939,6 @@ HRESULT Debugger::NameChangeEvent(AppDomain *pAppDomain, Thread *pThread) { CONTRACTL { - SO_NOT_MAINLINE; MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; } @@ -16092,7 +16024,6 @@ BOOL Debugger::SendCtrlCToDebugger(DWORD dwCtrlType) { CONTRACTL { - SO_NOT_MAINLINE; MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; } @@ -16160,7 +16091,6 @@ void Debugger::SetIDbgThreadControl(IDebuggerThreadControl *pIDbgThreadControl) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -16195,7 +16125,6 @@ BOOL Debugger::IsThreadContextInvalid(Thread *pThread) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -16271,7 +16200,6 @@ void Debugger::CreateConnection(CONNID dwConnectionId, __in_z WCHAR *wzName) { CONTRACTL { - SO_NOT_MAINLINE; MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; } @@ -16319,7 +16247,6 @@ void Debugger::DestroyConnection(CONNID dwConnectionId) { CONTRACTL { - SO_NOT_MAINLINE; MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; } @@ -16354,7 +16281,6 @@ void Debugger::ChangeConnection(CONNID dwConnectionId) { CONTRACTL { - SO_NOT_MAINLINE; MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT; MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT; } @@ -16410,7 +16336,6 @@ bool ThisIsHelperThreadWorker(void) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -16711,7 +16636,6 @@ DebuggerHeap::~DebuggerHeap() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -16751,7 +16675,6 @@ HRESULT DebuggerHeap::Init(BOOL fExecutable) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -16857,7 +16780,6 @@ void *DebuggerHeap::Alloc(DWORD size) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -16921,7 +16843,6 @@ void *DebuggerHeap::Realloc(void *pMem, DWORD newSize, DWORD oldSize) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -16960,7 +16881,6 @@ void DebuggerHeap::Free(void *pMem) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } diff --git a/src/debug/ee/debuggermodule.cpp b/src/debug/ee/debuggermodule.cpp index 57ef616..d4faf0e 100644 --- a/src/debug/ee/debuggermodule.cpp +++ b/src/debug/ee/debuggermodule.cpp @@ -40,7 +40,6 @@ void DebuggerModule::PickPrimaryModule() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } diff --git a/src/debug/ee/funceval.cpp b/src/debug/ee/funceval.cpp index eef8ced..0bcfa93 100644 --- a/src/debug/ee/funceval.cpp +++ b/src/debug/ee/funceval.cpp @@ -3694,7 +3694,6 @@ void * STDCALL FuncEvalHijackWorker(DebuggerEval *pDE) MODE_COOPERATIVE; GC_TRIGGERS; THROWS; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pDE)); } diff --git a/src/debug/ee/functioninfo.cpp b/src/debug/ee/functioninfo.cpp index 56b07c3..1bbcde2 100644 --- a/src/debug/ee/functioninfo.cpp +++ b/src/debug/ee/functioninfo.cpp @@ -130,7 +130,6 @@ void DebuggerJitInfo::InitFuncletAddress() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -372,7 +371,6 @@ DebuggerJitInfo::NativeOffset DebuggerJitInfo::MapILOffsetToNative(DebuggerJitIn { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -544,7 +542,6 @@ SIZE_T DebuggerJitInfo::MapSpecialToNative(CorDebugMappingResult mapping, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(NULL != pfAccurate); @@ -612,7 +609,6 @@ SIZE_T DebuggerJitInfo::MapILOffsetToNativeForSetIP(SIZE_T offsetILTo, int funcl { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -676,7 +672,6 @@ void DebuggerJitInfo::MapILRangeToMapEntryRange(SIZE_T startOffset, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -753,7 +748,6 @@ DWORD DebuggerJitInfo::MapNativeOffsetToIL(SIZE_T nativeOffsetToMap, { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; PRECONDITION(map != NULL); @@ -895,7 +889,6 @@ void DebuggerJitInfo::LazyInitBounds() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; PRECONDITION(ThisMaybeHelperThread()); @@ -1020,7 +1013,6 @@ void DebuggerJitInfo::SetBoundaries(ULONG32 cMap, ICorDebugInfo::OffsetMapping * { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; PRECONDITION(CheckPointer(this)); @@ -1292,7 +1284,6 @@ ICorDebugInfo::SourceTypes DebuggerJitInfo::GetSrcTypeFromILOffset(SIZE_T ilOffs { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1321,7 +1312,6 @@ DebuggerMethodInfo::~DebuggerMethodInfo() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; DESTRUCTOR_CHECK; @@ -1428,7 +1418,6 @@ DebuggerMethodInfo::DebuggerMethodInfo(Module *module, mdMethodDef token) : { CONTRACTL { - SO_INTOLERANT; WRAPPER(THROWS); WRAPPER(GC_TRIGGERS); CONSTRUCTOR_CHECK; @@ -1461,7 +1450,6 @@ DebuggerModule* DebuggerMethodInfo::GetPrimaryModule() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -1526,7 +1514,6 @@ DebuggerJitInfo * DebuggerMethodInfo::FindJitInfo(MethodDesc * pMD, { CONTRACTL { - SO_INTOLERANT; SUPPORTS_DAC; NOTHROW; GC_NOTRIGGER; @@ -1572,7 +1559,6 @@ DebuggerJitInfo *DebuggerMethodInfo::FindOrCreateInitAndAddJitInfo(MethodDesc* f { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; } @@ -1638,7 +1624,6 @@ DebuggerJitInfo *DebuggerMethodInfo::CreateInitAndAddJitInfo(NativeCodeVersion n { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; PRECONDITION(!g_pDebugger->HasDebuggerDataLock()); @@ -1746,7 +1731,6 @@ void DebuggerMethodInfo::DeleteJitInfo(DebuggerJitInfo *dji) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -1801,7 +1785,6 @@ void DebuggerMethodInfo::DeleteJitInfoList(void) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -1931,7 +1914,6 @@ void DebuggerMethodInfo::SetJMCStatus(bool fStatus) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1985,7 +1967,6 @@ void DebuggerMethodInfo::IterateAllDJIs(AppDomain * pAppDomain, Module * pLoader { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; } @@ -2022,7 +2003,6 @@ void DebuggerMethodInfo::CreateDJIsForNativeBlobs(AppDomain * pAppDomain, Module { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; } @@ -2083,7 +2063,6 @@ void DebuggerMethodInfo::CreateDJIsForMethodDesc(MethodDesc * pMethodDesc) { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; } @@ -2346,7 +2325,6 @@ DebuggerJitInfo *DebuggerJitInfo::GetJitInfoByAddress(const BYTE *pbAddr ) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -2388,7 +2366,6 @@ PTR_DebuggerJitInfo DebuggerMethodInfo::GetLatestJitInfo(MethodDesc *mdesc) CONTRACTL { - SO_INTOLERANT; THROWS; CALLED_IN_DEBUGGERDATALOCK_HOLDER_SCOPE_MAY_GC_TRIGGERS_CONTRACT; PRECONDITION(!g_pDebugger->HasDebuggerDataLock()); diff --git a/src/debug/ee/rcthread.cpp b/src/debug/ee/rcthread.cpp index 987c290..bb653e5 100644 --- a/src/debug/ee/rcthread.cpp +++ b/src/debug/ee/rcthread.cpp @@ -20,7 +20,6 @@ #include #include "eemessagebox.h" -#include "genericstackprobe.h" #ifndef SM_REMOTESESSION #define SM_REMOTESESSION 0x1000 @@ -47,7 +46,6 @@ DebuggerRCThread::DebuggerRCThread(Debugger * pDebugger) { CONTRACTL { - SO_INTOLERANT; WRAPPER(THROWS); GC_NOTRIGGER; CONSTRUCTOR_CHECK; @@ -75,7 +73,6 @@ DebuggerRCThread::~DebuggerRCThread() { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; DESTRUCTOR_CHECK; @@ -102,7 +99,6 @@ void DebuggerRCThread::CloseIPCHandles() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -231,7 +227,6 @@ HRESULT DebuggerIPCControlBlock::Init( { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; } @@ -322,7 +317,6 @@ HRESULT DebuggerRCThread::Init(void) { CONTRACTL { - SO_INTOLERANT; THROWS; GC_NOTRIGGER; PRECONDITION(!ThisIsHelperThreadWorker()); // initialized by main thread @@ -490,7 +484,6 @@ HRESULT DebuggerRCThread::VerifySecurityOnRSCreatedEvents( CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -656,7 +649,6 @@ HRESULT DebuggerRCThread::SetupRuntimeOffsets(DebuggerIPCControlBlock * pDebugge { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; @@ -856,7 +848,6 @@ void DebuggerRCThread::ThreadProc(void) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_TRIGGERS; // Debugger::SuspendComplete can trigger GC @@ -1047,7 +1038,6 @@ bool DebuggerRCThread::HandleRSEA() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; if (g_pEEInterface->GetThread() != NULL) { GC_TRIGGERS; } else { GC_NOTRIGGER; } PRECONDITION(ThisIsHelperThreadWorker()); @@ -1115,7 +1105,6 @@ void DebuggerRCThread::MainLoop() CONTRACTL { - SO_INTOLERANT; NOTHROW; PRECONDITION(m_thread != NULL); @@ -1363,7 +1352,6 @@ void DebuggerRCThread::TemporaryHelperThreadMainLoop() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; @@ -1565,8 +1553,6 @@ LExit: // We just wrap the instance method DebuggerRCThread::ThreadProc WRAPPER_NO_CONTRACT; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO(); - ClrFlsSetThreadType(ThreadType_DbgHelper); LOG((LF_CORDB, LL_EVERYTHING, "ThreadProcStatic called\n")); @@ -1578,8 +1564,6 @@ LExit: DebuggerRCThread* t = (DebuggerRCThread*)g_pRCThread; t->ThreadProc(); // this thread is local, go and become the helper - - END_SO_INTOLERANT_CODE; return 0; } @@ -1599,7 +1583,6 @@ HRESULT DebuggerRCThread::Start(void) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -1678,7 +1661,6 @@ HRESULT DebuggerRCThread::AsyncStop(void) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; @@ -1711,7 +1693,6 @@ HRESULT inline DebuggerRCThread::EnsureRuntimeOffsetsInit(IpcTarget ipcTarget) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; @@ -1773,7 +1754,6 @@ HRESULT DebuggerRCThread::SendIPCEvent() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; // duh, we're in preemptive.. @@ -1918,7 +1898,6 @@ void DebuggerRCThread::DoFavor(FAVORCALLBACK fp, void * pData) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_TRIGGERS; diff --git a/src/debug/ildbsymlib/pch.h b/src/debug/ildbsymlib/pch.h index ddd4787..4533035 100644 --- a/src/debug/ildbsymlib/pch.h +++ b/src/debug/ildbsymlib/pch.h @@ -19,7 +19,6 @@ #include "corsym.h" #include "palclr.h" #include "cor.h" -#include "genericstackprobe.h" // I'm not sure why this code uses these macros for memory management (they should at least be // in-line functions). DELETE is a symbol defined in WinNt.h as an access-type. We're probably diff --git a/src/debug/ildbsymlib/symwrite.cpp b/src/debug/ildbsymlib/symwrite.cpp index 7f32761..4d3fb53 100644 --- a/src/debug/ildbsymlib/symwrite.cpp +++ b/src/debug/ildbsymlib/symwrite.cpp @@ -282,9 +282,7 @@ HRESULT SymWriter::CreateDocument(const WCHAR *wcsUrl, // Docu pDocument->SetDocumentWriter(sdw); // stack check needed to call back into utilcode - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO(); hr = m_pStringPool->AddStringW(wcsUrl, (UINT32 *)&UrlEntry); - END_SO_INTOLERANT_CODE; IfFailGo(hr); pDocument->SetUrlEntry(UrlEntry); @@ -739,11 +737,8 @@ COM_METHOD SymWriter::DefineLocalVariable( ULONG32 sigLen; sigLen = cSig; - // stack check needed to call back into utilcode - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO(); // Copy the name. hr = m_pStringPool->AddStringW(name, (UINT32 *)&NameEntry); - END_SO_INTOLERANT_CODE; IfFailGo(hr); var->SetName(NameEntry); @@ -813,11 +808,8 @@ COM_METHOD SymWriter::DefineParameter( var->SetSequence(sequence); - // stack check needed to call back into utilcode - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO(); // Copy the name. hr = m_pStringPool->AddStringW(name, (UINT32 *)&NameEntry); - END_SO_INTOLERANT_CODE; IfFailGo(hr); var->SetName(NameEntry); @@ -905,11 +897,8 @@ COM_METHOD SymWriter::DefineConstant( // the stringpool if (V_VT(&value) == VT_BSTR) { - // stack check needed to call back into utilcode - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO(); // Copy the bstrValue. hr = m_pStringPool->AddStringW(V_BSTR(&value), (UINT32 *)&ValueBstr); - END_SO_INTOLERANT_CODE; IfFailGo(hr); V_BSTR(&value) = NULL; } @@ -919,11 +908,8 @@ COM_METHOD SymWriter::DefineConstant( con->SetValue(value, ValueBstr); - // stack check needed to call back into utilcode - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO(); // Copy the name. hr = m_pStringPool->AddStringW(name, (UINT32 *)&Name); - END_SO_INTOLERANT_CODE; IfFailGo(hr); con->SetName(Name); @@ -1111,11 +1097,8 @@ COM_METHOD SymWriter::UsingNamespace(const WCHAR *fullName) SymUsingNamespace *use; IfNullGo( use = m_MethodInfo.m_usings.next()); - // stack check needed to call back into utilcode - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO(); // Copy the name. hr = m_pStringPool->AddStringW(fullName, (UINT32 *)&Name); - END_SO_INTOLERANT_CODE; IfFailGo(hr); use->SetName(Name); diff --git a/src/dlls/mscoree/comcallunmarshal.cpp b/src/dlls/mscoree/comcallunmarshal.cpp index d0f9b7c..5733897 100644 --- a/src/dlls/mscoree/comcallunmarshal.cpp +++ b/src/dlls/mscoree/comcallunmarshal.cpp @@ -28,7 +28,6 @@ STDMETHODIMP ComCallUnmarshal::QueryInterface(REFIID iid, void **ppv) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(CheckPointer(ppv, NULL_OK)); } CONTRACTL_END; @@ -51,14 +50,12 @@ STDMETHODIMP ComCallUnmarshal::QueryInterface(REFIID iid, void **ppv) STDMETHODIMP_(ULONG) ComCallUnmarshal::AddRef(void) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return 2; } STDMETHODIMP_(ULONG) ComCallUnmarshal::Release(void) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return 1; } @@ -67,7 +64,6 @@ STDMETHODIMP ComCallUnmarshal::GetUnmarshalClass (REFIID riid, void * pv, ULONG LPCLSID pclsid) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // Marshal side only. _ASSERTE(FALSE); return E_NOTIMPL; @@ -78,7 +74,6 @@ STDMETHODIMP ComCallUnmarshal::GetMarshalSizeMax (REFIID riid, void * pv, ULONG ULONG * pSize) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // Marshal side only. _ASSERTE(FALSE); return E_NOTIMPL; @@ -89,7 +84,6 @@ STDMETHODIMP ComCallUnmarshal::MarshalInterface (LPSTREAM pStm, REFIID riid, voi ULONG mshlflags) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // Marshal side only. _ASSERTE(FALSE); return E_NOTIMPL; @@ -100,7 +94,6 @@ STDMETHODIMP ComCallUnmarshal::UnmarshalInterface (LPSTREAM pStm, REFIID riid, v CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT;; STATIC_CONTRACT_MODE_PREEMPTIVE; PRECONDITION(CheckPointer(pStm)); PRECONDITION(CheckPointer(ppvObj)); @@ -110,7 +103,6 @@ STDMETHODIMP ComCallUnmarshal::UnmarshalInterface (LPSTREAM pStm, REFIID riid, v ULONG mshlflags; HRESULT hr = E_FAIL; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); // The marshal code added a reference to the object, but we return a // reference to the object as well, so don't change the ref count on the // success path. Need to release on error paths though (if we manage to @@ -161,8 +153,6 @@ STDMETHODIMP ComCallUnmarshal::UnmarshalInterface (LPSTREAM pStm, REFIID riid, v hr = pOldUnk->QueryInterface(riid, ppvObj); } ErrExit: - ; - END_SO_INTOLERANT_CODE; return hr; } @@ -172,7 +162,6 @@ STDMETHODIMP ComCallUnmarshal::ReleaseMarshalData (LPSTREAM pStm) NOTHROW; GC_NOTRIGGER; STATIC_CONTRACT_MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pStm)); } CONTRACTL_END; @@ -184,8 +173,6 @@ STDMETHODIMP ComCallUnmarshal::ReleaseMarshalData (LPSTREAM pStm) if (!pStm) return E_POINTER; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - // Read the raw IP out of the marshalling stream. Do this first since we // need to update the stream pointer even in case of failures. hr = pStm->Read (&pUnk, sizeof (pUnk), &bytesRead); @@ -214,15 +201,12 @@ STDMETHODIMP ComCallUnmarshal::ReleaseMarshalData (LPSTREAM pStm) pUnk->Release (); ErrExit: - ; - END_SO_INTOLERANT_CODE; return hr; } STDMETHODIMP ComCallUnmarshal::DisconnectObject (ULONG dwReserved) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // Nothing we can (or need to) do here. The client is using a raw IP to // access this server, so the server shouldn't go away until the client @@ -242,7 +226,6 @@ STDMETHODIMP CComCallUnmarshalFactory::QueryInterface(REFIID iid, void **ppv) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(CheckPointer(ppv)); } CONTRACTL_END; @@ -260,16 +243,12 @@ STDMETHODIMP CComCallUnmarshalFactory::QueryInterface(REFIID iid, void **ppv) STDMETHODIMP_(ULONG) CComCallUnmarshalFactory::AddRef(void) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - return 2; } STDMETHODIMP_(ULONG) CComCallUnmarshalFactory::Release(void) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - return 1; } @@ -279,7 +258,6 @@ STDMETHODIMP CComCallUnmarshalFactory::CreateInstance(LPUNKNOWN punkOuter, REFII { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(CheckPointer(ppv)); } CONTRACTL_END; @@ -297,8 +275,6 @@ STDMETHODIMP CComCallUnmarshalFactory::CreateInstance(LPUNKNOWN punkOuter, REFII STDMETHODIMP CComCallUnmarshalFactory::LockServer(BOOL fLock) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - return S_OK; } diff --git a/src/dlls/mscorpe/iceefilegen.cpp b/src/dlls/mscorpe/iceefilegen.cpp index c48ae7e..1214652 100644 --- a/src/dlls/mscorpe/iceefilegen.cpp +++ b/src/dlls/mscorpe/iceefilegen.cpp @@ -446,8 +446,6 @@ HRESULT ICeeFileGen::GetHeaderInfo (HCEEFILE ceeFile, PIMAGE_NT_HEADERS *ppNtHea HRESULT ICeeFileGen::GenerateCeeFile (HCEEFILE ceeFile) { - SO_NOT_MAINLINE_FUNCTION; - TESTANDRETURNPOINTER(ceeFile); CeeFileGenWriter *gen = reinterpret_cast(ceeFile); diff --git a/src/gc/env/gcenv.base.h b/src/gc/env/gcenv.base.h index 187d9ca..d982cae 100644 --- a/src/gc/env/gcenv.base.h +++ b/src/gc/env/gcenv.base.h @@ -406,7 +406,6 @@ typedef struct _PROCESSOR_NUMBER { #define STATIC_CONTRACT_DEBUG_ONLY #define STATIC_CONTRACT_NOTHROW #define STATIC_CONTRACT_CAN_TAKE_LOCK -#define STATIC_CONTRACT_SO_TOLERANT #define STATIC_CONTRACT_GC_NOTRIGGER #define STATIC_CONTRACT_MODE_COOPERATIVE #define CONTRACTL @@ -417,8 +416,6 @@ typedef struct _PROCESSOR_NUMBER { #define INSTANCE_CHECK #define MODE_COOPERATIVE #define MODE_ANY -#define SO_INTOLERANT -#define SO_TOLERANT #define GC_TRIGGERS #define GC_NOTRIGGER #define CAN_TAKE_LOCK diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index 921da85..a748174 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -34149,8 +34149,6 @@ BOOL GCHeap::IsInFrozenSegment (Object * object) // returns TRUE if the pointer is in one of the GC heaps. bool GCHeap::IsHeapPointer (void* vpObject, bool small_heap_only) { - STATIC_CONTRACT_SO_TOLERANT; - // removed STATIC_CONTRACT_CAN_TAKE_LOCK here because find_segment // no longer calls GCEvent::Wait which eventually takes a lock. diff --git a/src/gc/handletable.cpp b/src/gc/handletable.cpp index b2a0e09..2232c45 100644 --- a/src/gc/handletable.cpp +++ b/src/gc/handletable.cpp @@ -297,7 +297,6 @@ OBJECTHANDLE HndCreateHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTREF obje { MODE_ANY; } - SO_INTOLERANT; } CONTRACTL_END; @@ -356,7 +355,6 @@ void ValidateFetchObjrefForHandle(OBJECTREF objref, ADIndex appDomainIndex) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_COOPERATIVE; STATIC_CONTRACT_DEBUG_ONLY; @@ -374,7 +372,6 @@ void ValidateAssignObjrefForHandle(OBJECTREF objref, ADIndex appDomainIndex) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_COOPERATIVE; STATIC_CONTRACT_DEBUG_ONLY; @@ -432,7 +429,6 @@ void HndDestroyHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTHANDLE handle) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; CAN_TAKE_LOCK; // because of TableFreeSingleHandleToCache } CONTRACTL_END; @@ -478,7 +474,6 @@ void HndDestroyHandleOfUnknownType(HHANDLETABLE hTable, OBJECTHANDLE handle) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -590,7 +585,6 @@ void HndLogSetEvent(OBJECTHANDLE handle, _UNCHECKED_OBJECTREF value) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_COOPERATIVE; #if !defined(DACCESS_COMPILE) && defined(FEATURE_EVENT_TRACE) @@ -646,7 +640,6 @@ void HndWriteBarrier(OBJECTHANDLE handle, OBJECTREF objref) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_COOPERATIVE; // unwrap the objectref we were given diff --git a/src/gc/handletable.inl b/src/gc/handletable.inl index 752a7b0..5633302 100644 --- a/src/gc/handletable.inl +++ b/src/gc/handletable.inl @@ -14,7 +14,6 @@ inline void HndAssignHandle(OBJECTHANDLE handle, OBJECTREF objref) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -66,7 +65,6 @@ inline BOOL HndFirstAssignHandle(OBJECTHANDLE handle, OBJECTREF objref) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; diff --git a/src/gc/handletablecache.cpp b/src/gc/handletablecache.cpp index 918cbc9..3771efb 100644 --- a/src/gc/handletablecache.cpp +++ b/src/gc/handletablecache.cpp @@ -772,7 +772,6 @@ void TableFreeSingleHandleToCache(HandleTable *pTable, uint32_t uType, OBJECTHAN NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; CAN_TAKE_LOCK; // because of TableCacheMissOnFree } CONTRACTL_END; diff --git a/src/gc/handletablescan.cpp b/src/gc/handletablescan.cpp index 6a39a00..1c67cb3 100644 --- a/src/gc/handletablescan.cpp +++ b/src/gc/handletablescan.cpp @@ -787,7 +787,6 @@ void BlockResetAgeMapForBlocksWorker(uint32_t *pdwGen, uint32_t dwClumpMask, Sca { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_COOPERATIVE; // fetch the table segment we are working in diff --git a/src/gc/objecthandle.cpp b/src/gc/objecthandle.cpp index 9c459f3..aa1ab57 100644 --- a/src/gc/objecthandle.cpp +++ b/src/gc/objecthandle.cpp @@ -257,7 +257,6 @@ void CALLBACK PinObject(_UNCHECKED_OBJECTREF *pObjRef, uintptr_t *pExtraInfo, ui { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_COOPERATIVE; UNREFERENCED_PARAMETER(pExtraInfo); @@ -856,7 +855,6 @@ void SetDependentHandleSecondary(OBJECTHANDLE handle, OBJECTREF objref) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; diff --git a/src/ildasm/windasm.cpp b/src/ildasm/windasm.cpp index 13b56fc..da0c20e 100644 --- a/src/ildasm/windasm.cpp +++ b/src/ildasm/windasm.cpp @@ -502,9 +502,6 @@ int __cdecl main(int nCmdShow, char* lpCmdLine[]) g_pszExeFile = lpCmdLine[0]; #endif - // ildasm does not need to be SO-robust. - SO_NOT_MAINLINE_FUNCTION; - // SWI has requested that the exact form of the function call below be used. For details see http://swi/SWI%20Docs/Detecting%20Heap%20Corruption.doc (void)HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); diff --git a/src/inc/arraylist.h b/src/inc/arraylist.h index f45085b..b8c149f 100644 --- a/src/inc/arraylist.h +++ b/src/inc/arraylist.h @@ -86,7 +86,6 @@ class ArrayListBase void Set(DWORD index, PTR_VOID element) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; *GetPtr(index) = element; } @@ -102,7 +101,6 @@ class ArrayListBase void Init() { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; m_count = 0; m_firstBlock.m_next = NULL; @@ -112,7 +110,6 @@ class ArrayListBase void Destroy() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; Clear(); } @@ -153,7 +150,6 @@ class ArrayListBase static Iterator Create(ArrayListBlock* block, DWORD remaining) { LIMITED_METHOD_DAC_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; Iterator i; i.m_block = block; i.m_index = (DWORD) -1; @@ -188,15 +184,12 @@ class ArrayListBase Iterator Iterate() { - STATIC_CONTRACT_SO_INTOLERANT; WRAPPER_NO_CONTRACT; return Iterator::Create((ArrayListBlock*)&m_firstBlock, m_count); } ConstIterator Iterate() const { - STATIC_CONTRACT_SO_INTOLERANT; - // Const cast is safe because ConstIterator does not expose any way to modify the block ArrayListBlock *pFirstBlock = const_cast(reinterpret_cast(&m_firstBlock)); return ConstIterator(pFirstBlock, m_count); @@ -277,14 +270,12 @@ public: #ifndef DACCESS_COMPILE ArrayList() { - STATIC_CONTRACT_SO_INTOLERANT; WRAPPER_NO_CONTRACT; Init(); } ~ArrayList() { - STATIC_CONTRACT_SO_INTOLERANT; WRAPPER_NO_CONTRACT; Destroy(); } diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index 843f7e4..0f3b8cb 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -793,7 +793,6 @@ CONFIG_DWORD_INFO(INTERNAL_MessageDebugOut, W("MessageDebugOut"), 0, "") CONFIG_DWORD_INFO_EX(INTERNAL_MscorsnLogging, W("MscorsnLogging"), 0, "Enables strong name logging", CLRConfig::REGUTIL_default) RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NativeImageRequire, W("NativeImageRequire"), 0, "", CLRConfig::REGUTIL_default) CONFIG_DWORD_INFO_EX(INTERNAL_NestedEhOom, W("NestedEhOom"), 0, "", CLRConfig::REGUTIL_default) -RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NO_SO_NOT_MAINLINE, W("NO_SO_NOT_MAINLINE"), 0, "", CLRConfig::REGUTIL_default) #define INTERNAL_NoGuiOnAssert_Default 1 RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_NoGuiOnAssert, W("NoGuiOnAssert"), INTERNAL_NoGuiOnAssert_Default, "", CLRConfig::REGUTIL_default) RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NoProcedureSplitting, W("NoProcedureSplitting"), 0, "", CLRConfig::REGUTIL_default) diff --git a/src/inc/clrhost.h b/src/inc/clrhost.h index beb3ac3..0d90f2c 100644 --- a/src/inc/clrhost.h +++ b/src/inc/clrhost.h @@ -90,7 +90,6 @@ inline void ClrFlsIncrementValue(DWORD slot, int increment) STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(increment != 0); @@ -108,8 +107,6 @@ inline void ClrFlsIncrementValue(DWORD slot, int increment) { BEGIN_PRESERVE_LAST_ERROR; - ANNOTATION_VIOLATION(SOToleranceViolation); - IExecutionEngine * pEngine = GetExecutionEngine(); value = (size_t) pEngine->TLS_GetValue(slot); @@ -127,7 +124,6 @@ inline void * ClrFlsGetValue (DWORD slot) STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; void **block = (*__ClrFlsGetBlock)(); if (block != NULL) @@ -136,8 +132,6 @@ inline void * ClrFlsGetValue (DWORD slot) } else { - ANNOTATION_VIOLATION(SOToleranceViolation); - void * value = GetExecutionEngine()->TLS_GetValue(slot); return value; } @@ -149,7 +143,6 @@ inline BOOL ClrFlsCheckValue(DWORD slot, void ** pValue) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; #ifdef _DEBUG *pValue = ULongToPtr(0xcccccccc); @@ -162,7 +155,6 @@ inline BOOL ClrFlsCheckValue(DWORD slot, void ** pValue) } else { - ANNOTATION_VIOLATION(SOToleranceViolation); BOOL result = GetExecutionEngine()->TLS_CheckValue(slot, pValue); return result; } @@ -174,10 +166,9 @@ inline void ClrFlsSetValue(DWORD slot, void *pData) STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; - void **block = (*__ClrFlsGetBlock)(); - if (block != NULL) + void **block = (*__ClrFlsGetBlock)(); + if (block != NULL) { block[slot] = pData; } @@ -185,7 +176,6 @@ inline void ClrFlsSetValue(DWORD slot, void *pData) { BEGIN_PRESERVE_LAST_ERROR; - ANNOTATION_VIOLATION(SOToleranceViolation); GetExecutionEngine()->TLS_SetValue(slot, pData); END_PRESERVE_LAST_ERROR; @@ -619,6 +609,4 @@ inline bool IsInCantAllocRegion () // for stress log the rule is more restrict, we have to check the global counter too extern BOOL IsInCantAllocStressLogRegion(); -#include "genericstackprobe.inl" - #endif diff --git a/src/inc/clrtypes.h b/src/inc/clrtypes.h index b0b1fc2..15387aa 100644 --- a/src/inc/clrtypes.h +++ b/src/inc/clrtypes.h @@ -295,7 +295,6 @@ template T Min(T v1, T v2) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; return v1 < v2 ? v1 : v2; } @@ -303,7 +302,6 @@ template T Max(T v1, T v2) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; return v1 > v2 ? v1 : v2; } @@ -322,7 +320,6 @@ T Max(T v1, T v2) inline UINT AlignUp(UINT value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return (value+alignment-1)&~(alignment-1); } @@ -331,7 +328,6 @@ inline UINT AlignUp(UINT value, UINT alignment) inline ULONG AlignUp(ULONG value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return (value+alignment-1)&~(alignment-1); } @@ -340,7 +336,6 @@ inline ULONG AlignUp(ULONG value, UINT alignment) inline UINT64 AlignUp(UINT64 value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return (value+alignment-1)&~(UINT64)(alignment-1); } @@ -348,7 +343,6 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment) inline UINT AlignDown(UINT value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return (value&~(alignment-1)); } @@ -357,7 +351,6 @@ inline UINT AlignDown(UINT value, UINT alignment) inline ULONG AlignDown(ULONG value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return (value&~(ULONG)(alignment-1)); } @@ -366,7 +359,6 @@ inline ULONG AlignDown(ULONG value, UINT alignment) inline UINT64 AlignDown(UINT64 value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return (value&~(UINT64)(alignment-1)); } @@ -394,7 +386,6 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment) inline UINT AlignmentTrim(UINT value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return value&(alignment-1); } @@ -405,7 +396,6 @@ inline UINT AlignmentTrim(UINT value, UINT alignment) inline UINT AlignmentTrim(ULONG value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return value&(alignment-1); } @@ -414,7 +404,6 @@ inline UINT AlignmentTrim(ULONG value, UINT alignment) inline UINT AlignmentTrim(UINT64 value, UINT alignment) { STATIC_CONTRACT_LEAF; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return ((UINT)value)&(alignment-1); } diff --git a/src/inc/contract.h b/src/inc/contract.h index e24b2e9..0e3206c 100644 --- a/src/inc/contract.h +++ b/src/inc/contract.h @@ -46,18 +46,6 @@ // // LOADS_TYPE(level) the function promises not to load any types beyond "level" // -// SO_INTOLERANT the function cannot tolerate an SO at any point and must run behind an -// an SO probe via BEGIN_SO_INTOLERANT_XXX. This is the default. We want most -// of our code to run behind an SO probe. The only time you need to explicitly -// mark something as SO_INTOLERANT is if the static analysis tool incorrectly -// flags it as an entry point. -// -or- SO_TOLERANT the function can tolerate an SO. It either does not update any global state -// that needs to be cleaned up should a random SO occur, or it protects those -// updates behind an SO probe. -// -or- SO_NOT_MAINLINE the function is not hardened to SO and should never run on a managed thread -// where we need to be hardened to SO. You can use this for functions that run -// only for ngen or Win9X etc. -// // CAN_TAKE_LOCK the function has a code path that takes a lock // _or_ (CAN_TAKE_LOCK and CANNOT_RETAKE_LOCK) // the function has a code path that takes a lock, but never tries to reenter @@ -144,9 +132,6 @@ // STATIC_CONTRACT_GCNOTRIGGER // STATIC_CONTRACT_FAULT // STATIC_CONTRACT_FORBID_FAULT -// STATIC_CONTRACT_SO_INTOLERANT -// STATIC_CONTRACT_SO_TOLERANT -// STATIC_CONTRACT_SO_NOT_MAINLINE // use to implement statically checkable contracts // when runtime contracts cannot be used. // @@ -171,7 +156,6 @@ // GCViolation // ModeViolation // FaultViolation -// SOToleranceViolation // FaultNotFatal // HostViolation // LoadsTypeViolation @@ -438,10 +422,6 @@ private: UINT m_GCForbidCount; UINT m_maxLoadTypeLevel; // taken from enum ClassLoadLevel BOOL m_allowGetThread; // TRUE if GetThread() is ok in this scope -#ifdef FEATURE_STACK_PROBE //StackMarkerStack required only when SO infrastructure is enabled - /* Used to validate backout stack consumption required for StackOverflow infrastructure */ - StackMarkerStack m_StackMarkerStack; // The stack of stack markers -#endif DbgStateLockState m_LockState; public: @@ -478,10 +458,6 @@ public: m_allowGetThread = TRUE; // By default, GetThread() is perfectly fine to call -#ifdef FEATURE_STACK_PROBE - m_StackMarkerStack.Init(); -#endif - m_LockState.SetStartingValues(); } @@ -582,32 +558,6 @@ public: CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_HOSTCALLS); } -#ifdef FEATURE_STACK_PROBE //SO contract functions only required when SO infrastructure is enabled - //--// - BOOL IsSOTolerant() - { - return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_SOTOLERANT); - } - - void SetSOTolerance() - { - CONTRACT_BITMASK_SET(CONTRACT_BITMASK_SOTOLERANT); - } - - BOOL SetSOTolerance(BOOL tolerance) - { - BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_SOTOLERANT); - CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_SOTOLERANT,tolerance); - return prevState; - } - - void ResetSOTolerance() - { - CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_SOTOLERANT); - } - -#endif - //--// BOOL IsDebugOnly() { @@ -635,31 +585,6 @@ public: CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_DEBUGONLY); } - #ifdef FEATURE_STACK_PROBE - //--// - BOOL IsSONotMainline() - { - return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_SONOTMAINLINE); - } - - void SetSONotMainline() - { - CONTRACT_BITMASK_SET(CONTRACT_BITMASK_SONOTMAINLINE); - } - - BOOL SetSONotMainline(BOOL value) - { - BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_SONOTMAINLINE); - CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_SONOTMAINLINE,value); - return prevState; - } - - void ResetSONotMainline() - { - CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_SONOTMAINLINE); - } -#endif - //--// BOOL IsGetThreadAllowed() { @@ -797,37 +722,6 @@ public: m_LockState.OnEnterCannotRetakeLockFunction(); } -#ifdef FEATURE_STACK_PROBE //SO contract functions only required when SO infrastructure is enabled - BOOL IsSOIntolerant() - { - return !IsSOTolerant(); - } - - BOOL BeginSOTolerant() - { - return SetSOTolerance(TRUE); - } - - BOOL BeginSOIntolerant() - { - return SetSOTolerance(FALSE); - } - - - void CheckIfSOIntolerantOK(const char *szFunction, const char *szFile, int lineNum); - - - - - - //--// - - StackMarkerStack& GetStackMarkerStack() - { - return m_StackMarkerStack; - } -#endif - void CheckOkayToLock(__in_z const char *szFunction, __in_z const char *szFile, int lineNum); // Asserts if its not okay to lock BOOL CheckOkayToLockNoAssert(); // Returns if OK to lock void LockTaken(DbgStateLockType dbgStateLockType, @@ -856,7 +750,6 @@ ClrDebugState *GetClrDebugState(BOOL fAlloc = TRUE); inline ClrDebugState *CheckClrDebugState() { STATIC_CONTRACT_LIMITED_METHOD; - STATIC_CONTRACT_SO_TOLERANT; ClrDebugState *ret = (ClrDebugState*)ClrFlsGetValue(TlsIdx_ClrDebugState); return ret; } @@ -1045,30 +938,6 @@ class BaseContract MODE_Preempt = 0x00000040, MODE_Coop = 0x00000080, - // The following are used to assert the type of global state update being done by the function. - // This is used by the SO infrastructure to detect if we are probing properly. A CLR process will - // run in one of two states: SO-tolerant or SO-intolerant. In SO-tolerant mode, an SO is OK and we - // will not corrupt any global state. However, we cannot allow an SO to occur in SO-intolerant code - // because we might end up with our global state being corrupted. - // - // When we enter the EE from any entry point, we will begin in SO-tolerant mode and must probe for sufficient - // stack before entering SO-intolerant code. We will tell the differnce between SO-tolerant and SO-intolerant code - // by contract annotations on that function: SO_TOLERANT and SO_INTOLERANT. - - // We enter the EE in SO_TOLERANT mode. All entry point functions into the EE must be marked as SO_TOLERANT and - // and must probe before calling an SO-intolerant function. We have a static analsysis tool that ensures that every - // entry point is tagged as SO_TOLERANT and that it probes before calling an SO_TOLERANT function. - - // By default, all unannotated functions in the EE are SO_INTOLERANT which means that they must run behind a probe. - // Our contract checking will verify this at runtime. We only need to annotate a function explicilty as SO_INTOLERANT - // to tell our static analysis tool that they are not entry points (if it can't find a caller for a function, it assumes that the - // function is an entry point and should be marked SO_INTOLERANT.) - - SO_TOLERANCE_Mask = 0x00000300, - SO_TOLERANT_No = 0x00000000, // the default. - SO_TOLERANT_Yes = 0x00000100, - SO_TOLERANCE_Disabled = 0x00000200, - DEBUG_ONLY_Yes = 0x00000400, // code runs under debug only SO_MAINLINE_No = 0x00000800, // code is not part of our mainline SO scenario @@ -1108,7 +977,7 @@ class BaseContract LOADS_TYPE_Disabled = 0x00000000, // the default ALL_Disabled = THROWS_Disabled|GC_Disabled|FAULT_Disabled|MODE_Disabled|LOADS_TYPE_Disabled| - SO_TOLERANCE_Disabled|HOST_Disabled|EE_THREAD_Disabled|CAN_TAKE_LOCK_Disabled|CAN_RETAKE_LOCK_No_Disabled + HOST_Disabled|EE_THREAD_Disabled|CAN_TAKE_LOCK_Disabled|CAN_RETAKE_LOCK_No_Disabled }; @@ -1310,7 +1179,6 @@ enum ContractViolationBits ModeViolation = 0x00000004, // suppress MODE_PREEMP and MODE_COOP tags in this scope FaultViolation = 0x00000008, // suppress INJECT_FAULT assertions in this scope FaultNotFatal = 0x00000010, // suppress INJECT_FAULT but not fault injection by harness - SOToleranceViolation = 0x00000020, // suppress SO_TOLERANCE tags in this scope LoadsTypeViolation = 0x00000040, // suppress LOADS_TYPE tags in this scope TakesLockViolation = 0x00000080, // suppress CAN_TAKE_LOCK tags in this scope HostViolation = 0x00000100, // suppress HOST_CALLS tags in this scope @@ -1548,16 +1416,10 @@ typedef __SafeToUsePostCondition __PostConditionOK; #define NOTHROW do { STATIC_CONTRACT_NOTHROW; REQUEST_TEST(Contract::THROWS_No, Contract::THROWS_Disabled); } while(0) \ -#define ENTRY_POINT do { STATIC_CONTRACT_ENTRY_POINT; REQUEST_TEST(Contract::SO_TOLERANT_Yes, Contract::SO_TOLERANCE_Disabled); } while(0) +#define ENTRY_POINT STATIC_CONTRACT_ENTRY_POINT #define LOADS_TYPE(maxlevel) do { REQUEST_TEST( ((maxlevel) + 1) << Contract::LOADS_TYPE_Shift, Contract::LOADS_TYPE_Disabled ); } while(0) -#define SO_TOLERANT do { STATIC_CONTRACT_SO_TOLERANT; REQUEST_TEST(Contract::SO_TOLERANT_Yes, Contract::SO_TOLERANCE_Disabled); } while(0) - -#define SO_INTOLERANT do { STATIC_CONTRACT_SO_INTOLERANT; REQUEST_TEST(Contract::SO_TOLERANT_No, Contract::SO_TOLERANCE_Disabled); } while(0) - -#define SO_NOT_MAINLINE do { STATIC_CONTRACT_SO_NOT_MAINLINE; REQUEST_TEST(Contract::SO_MAINLINE_No, 0); } while (0) - #define CAN_TAKE_LOCK do { STATIC_CONTRACT_CAN_TAKE_LOCK; REQUEST_TEST(Contract::CAN_TAKE_LOCK_Yes, Contract::CAN_TAKE_LOCK_Disabled); } while(0) #define CANNOT_TAKE_LOCK do { STATIC_CONTRACT_CANNOT_TAKE_LOCK; REQUEST_TEST(Contract::CAN_TAKE_LOCK_No, Contract::CAN_TAKE_LOCK_Disabled); } while(0) @@ -1780,9 +1642,6 @@ typedef __SafeToUsePostCondition __PostConditionOK; #define CANNOT_TAKE_LOCK #define CANNOT_RETAKE_LOCK #define LOADS_TYPE(maxlevel) -#define SO_TOLERANT -#define SO_INTOLERANT -#define SO_NOT_MAINLINE #define ENTRY_POINT #ifdef _DEBUG @@ -1866,7 +1725,7 @@ protected: FORCEINLINE void EnterInternal(UINT_PTR violationMask) { _ASSERTE(0 == (violationMask & ~(ThrowsViolation | GCViolation | ModeViolation | FaultViolation | - FaultNotFatal | SOToleranceViolation | HostViolation | + FaultNotFatal | HostViolation | TakesLockViolation | LoadsTypeViolation)) || violationMask == AllViolation); @@ -2205,7 +2064,6 @@ private: inline ClrDebugState *GetClrDebugState(BOOL fAlloc) { STATIC_CONTRACT_LIMITED_METHOD; - STATIC_CONTRACT_SO_NOT_MAINLINE; ClrDebugState *pState = CheckClrDebugState(); @@ -2223,90 +2081,6 @@ inline ClrDebugState *GetClrDebugState(BOOL fAlloc) } #endif // ENABLE_CONTRACTS_IMPL -#ifdef FEATURE_STACK_PROBE - -#ifdef ENABLE_CONTRACTS_IMPL -class SONotMainlineHolder -{ - public: - DEBUG_NOINLINE void Enter() - { - SCAN_SCOPE_BEGIN; - STATIC_CONTRACT_SO_NOT_MAINLINE; - - m_pClrDebugState = GetClrDebugState(); - if (m_pClrDebugState) - { - m_oldSONotMainlineValue = m_pClrDebugState->IsSONotMainline(); - m_pClrDebugState->SetSONotMainline(); - } - } - - DEBUG_NOINLINE void Leave() - { - SCAN_SCOPE_END; - - m_pClrDebugState = CheckClrDebugState(); - if (m_pClrDebugState) - { - m_pClrDebugState->SetSONotMainline( m_oldSONotMainlineValue ); - } - } - - private: - BOOL m_oldSONotMainlineValue; - ClrDebugState *m_pClrDebugState; -}; - -#define ENTER_SO_NOT_MAINLINE_CODE \ - SONotMainlineHolder __soNotMainlineHolder; \ - __soNotMainlineHolder.Enter(); - -#define LEAVE_SO_NOT_MAINLINE_CODE \ - __soNotMainlineHolder.Leave(); - - -class AutoCleanupSONotMainlineHolder : public SONotMainlineHolder -{ - public: - DEBUG_NOINLINE AutoCleanupSONotMainlineHolder() - { - SCAN_SCOPE_BEGIN; - STATIC_CONTRACT_SO_NOT_MAINLINE; - - Enter(); - } - - DEBUG_NOINLINE ~AutoCleanupSONotMainlineHolder() - { - SCAN_SCOPE_END; - - Leave(); - } -}; - -#define SO_NOT_MAINLINE_FUNCTION \ - AutoCleanupSONotMainlineHolder __soNotMainlineHolder; - -#define SO_NOT_MAINLINE_REGION() \ - AutoCleanupSONotMainlineHolder __soNotMainlineHolder; - -#else // ENABLE_CONTRACTS_IMPL -#define SO_NOT_MAINLINE_FUNCTION STATIC_CONTRACT_SO_NOT_MAINLINE -#define SO_NOT_MAINLINE_REGION() STATIC_CONTRACT_SO_NOT_MAINLINE -#define ENTER_SO_NOT_MAINLINE_CODE -#define LEAVE_SO_NOT_MAINLINE_CODE -#endif - -#else // FEATURE_STACK_PROBE - -#define SO_NOT_MAINLINE_FUNCTION -#define SO_NOT_MAINLINE_REGION() -#define ENTER_SO_NOT_MAINLINE_CODE -#define LEAVE_SO_NOT_MAINLINE_CODE - -#endif // FEATURE_STACK_PROBE - #ifdef ENABLE_CONTRACTS_IMPL class HostNoCallHolder @@ -2577,8 +2351,7 @@ extern Volatile g_DbgSuppressAllocationAsserts; // #define STANDARD_VM_CHECK \ - THROWS; \ - SO_INTOLERANT; \ + THROWS; #define STANDARD_VM_CONTRACT \ CONTRACTL \ @@ -2590,8 +2363,7 @@ extern Volatile g_DbgSuppressAllocationAsserts; #define STATIC_STANDARD_VM_CONTRACT \ STATIC_CONTRACT_THROWS; \ STATIC_CONTRACT_GC_TRIGGERS; \ - STATIC_CONTRACT_MODE_PREEMPTIVE; \ - STATIC_CONTRACT_SO_INTOLERANT + STATIC_CONTRACT_MODE_PREEMPTIVE; #define AFTER_CONTRACTS #include "volatile.h" diff --git a/src/inc/contract.inl b/src/inc/contract.inl index 6a96c18..3c79494 100644 --- a/src/inc/contract.inl +++ b/src/inc/contract.inl @@ -22,24 +22,6 @@ #ifdef ENABLE_CONTRACTS_IMPL -#ifdef FEATURE_STACK_PROBE -/* FLAG to turn on/off dynamic SO Contract checking */ -extern BOOL g_EnableDefaultRWValidation; - -/* Used to report any code with SO_NOT_MAINLINE being run in a test environment - * with COMPLUS_NO_SO_NOT_MAINLINE enabled - */ -void SONotMainlineViolation(const char *szFunction, const char *szFile, int lineNum); - -/* Wrapper over SOTolerantViolation(). Used to report SO_Intolerant functions being called - * from SO_tolerant funcs without stack probing. - */ -void SoTolerantViolationHelper(const char *szFunction, - const char *szFile, - int lineNum); -#endif - - inline void BaseContract::DoChecks(UINT testmask, __in_z const char *szFunction, __in_z const char *szFile, int lineNum) { STATIC_CONTRACT_DEBUG_ONLY; @@ -73,29 +55,6 @@ inline void BaseContract::DoChecks(UINT testmask, __in_z const char *szFunction, m_pClrDebugState->SetDebugOnly(); } -#ifdef FEATURE_STACK_PROBE //Dynamic SO contract checks only required when SO infrastructure is present. - - if (testmask & SO_MAINLINE_No) - { - static DWORD dwCheckNotMainline = -1; - - // Some tests should never hit an SO_NOT_MAINLINE contract - if (dwCheckNotMainline == -1) - dwCheckNotMainline = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_NO_SO_NOT_MAINLINE); - - - if (dwCheckNotMainline) - { - SONotMainlineViolation(m_contractStackRecord.m_szFunction, - m_contractStackRecord.m_szFile, - m_contractStackRecord.m_lineNum); - } - - m_pClrDebugState->SetSONotMainline(); - } - -#endif // FEATURE_STACK_PROBE - switch (testmask & FAULT_Mask) { case FAULT_Forbid: @@ -175,30 +134,6 @@ inline void BaseContract::DoChecks(UINT testmask, __in_z const char *szFunction, break; } -#ifdef FEATURE_STACK_PROBE - - switch (testmask & SO_TOLERANCE_Mask) - { - case SO_TOLERANT_No: - if (g_EnableDefaultRWValidation) - { - m_pClrDebugState->CheckIfSOIntolerantOK(m_contractStackRecord.m_szFunction, - m_contractStackRecord.m_szFile, - m_contractStackRecord.m_lineNum); - } - break; - - case SO_TOLERANT_Yes: - case SO_TOLERANCE_Disabled: - // Nothing - break; - - default: - UNREACHABLE(); - } - -#endif // FEATURE_STACK_PROBE - if (testmask & CAN_RETAKE_LOCK_No) { m_pClrDebugState->OnEnterCannotRetakeLockFunction(); @@ -539,49 +474,6 @@ inline DbgStateLockData * DbgStateLockState::GetDbgStateLockData() return m_pLockData; } -#ifdef FEATURE_STACK_PROBE -// We don't want to allow functions that use holders to EX_TRY to be intolerant -// code... if an exception were to occur, the holders and EX_CATCH/FINALLY would -// have less than 1/4 clean up. -inline void EnsureSOIntolerantOK(const char *szFunction, - const char *szFile, - int lineNum) -{ - // We don't want to use a holder here, because a holder will - // call EnsureSOIntolerantOK - - DWORD error = GetLastError(); - if (! g_EnableDefaultRWValidation) - { - SetLastError(error); - return; - } - ClrDebugState *pClrDebugState = CheckClrDebugState(); - if (! pClrDebugState) - { - SetLastError(error); - return; - } - pClrDebugState->CheckIfSOIntolerantOK(szFunction, szFile, lineNum); - SetLastError(error); -} - -inline void ClrDebugState::CheckIfSOIntolerantOK(const char *szFunction, - const char *szFile, - int lineNum) - -{ - // If we are an RW function on a managed thread, we must be in SO-intolerant mode. Ie. we must be behind a probe. - if (IsSOIntolerant() || IsDebugOnly() || IsSONotMainline() || (m_violationmask & SOToleranceViolation) || - !g_fpShouldValidateSOToleranceOnThisThread || !g_fpShouldValidateSOToleranceOnThisThread()) - { - return; - } - SoTolerantViolationHelper(szFunction, szFile, lineNum); -} - -#endif - inline void CONTRACT_ASSERT(const char *szElaboration, UINT whichTest, diff --git a/src/inc/corexcep.h b/src/inc/corexcep.h index f1bed3e..9235a98 100644 --- a/src/inc/corexcep.h +++ b/src/inc/corexcep.h @@ -22,12 +22,6 @@ #define EXCEPTION_HIJACK 0xe0434f4e // 0xe0000000 | 'COM'+1 -#ifdef FEATURE_STACK_PROBE -#define EXCEPTION_SOFTSO 0xe053534f // 0xe0000000 | 'SSO' - // We can not throw internal C++ exception through managed frame. - // At boundary, we will raise an exception with this error code -#endif - #if defined(_DEBUG) #define EXCEPTION_INTERNAL_ASSERT 0xe0584d4e // 0xe0000000 | 'XMN' // An internal Assert will raise this exception when the config diff --git a/src/inc/daccess.h b/src/inc/daccess.h index bf5b1d6..71a7d01 100644 --- a/src/inc/daccess.h +++ b/src/inc/daccess.h @@ -2159,7 +2159,7 @@ public: name(int dummy) : base(dummy) {} #endif // FEATURE_PAL // helper macro to make the vtables unique for DAC -#define VPTR_UNIQUE(unique) virtual int MakeVTableUniqueForDAC() { STATIC_CONTRACT_SO_TOLERANT; return unique; } +#define VPTR_UNIQUE(unique) virtual int MakeVTableUniqueForDAC() { return unique; } #define VPTR_UNIQUE_BaseDomain (100000) #define VPTR_UNIQUE_SystemDomain (VPTR_UNIQUE_BaseDomain + 1) #define VPTR_UNIQUE_ComMethodFrame (VPTR_UNIQUE_SystemDomain + 1) diff --git a/src/inc/entrypoints.h b/src/inc/entrypoints.h index 064f4ed..c552b66 100644 --- a/src/inc/entrypoints.h +++ b/src/inc/entrypoints.h @@ -11,48 +11,17 @@ #ifndef __ENTRYPOINTS_h__ #define __ENTRYPOINTS_h__ -#define BEGIN_ENTRYPOINT_THROWS \ - BEGIN_SO_INTOLERANT_CODE(GetThread()) \ - - -#define END_ENTRYPOINT_THROWS \ - END_SO_INTOLERANT_CODE; - -#define BEGIN_ENTRYPOINT_THROWS_WITH_THREAD(____thread) \ - BEGIN_SO_INTOLERANT_CODE(____thread) \ - -#define END_ENTRYPOINT_THROWS_WITH_THREAD \ - END_SO_INTOLERANT_CODE; - -#define BEGIN_ENTRYPOINT_NOTHROW_WITH_THREAD(___thread) \ - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW) - -#define END_ENTRYPOINT_NOTHROW_WITH_THREAD \ - END_SO_INTOLERANT_CODE; - -#define BEGIN_ENTRYPOINT_NOTHROW \ - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW) - -#define END_ENTRYPOINT_NOTHROW \ - END_SO_INTOLERANT_CODE; - -extern void (*g_fpHandleSoftStackOverflow)(BOOL fSkipDebugger); -inline void FailedVoidEntryPoint() -{ - if (g_fpHandleSoftStackOverflow) - { - g_fpHandleSoftStackOverflow(FALSE); - } -} -#define BEGIN_ENTRYPOINT_VOIDRET \ - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(FailedVoidEntryPoint();) - -#define END_ENTRYPOINT_VOIDRET \ - END_SO_INTOLERANT_CODE; - -#define BEGIN_CLEANUP_ENTRYPOINT \ - VALIDATE_BACKOUT_STACK_CONSUMPTION; - +#define BEGIN_ENTRYPOINT_THROWS +#define END_ENTRYPOINT_THROWS +#define BEGIN_ENTRYPOINT_THROWS_WITH_THREAD(____thread) +#define END_ENTRYPOINT_THROWS_WITH_THREAD +#define BEGIN_ENTRYPOINT_NOTHROW_WITH_THREAD(___thread) +#define END_ENTRYPOINT_NOTHROW_WITH_THREAD +#define BEGIN_ENTRYPOINT_NOTHROW +#define END_ENTRYPOINT_NOTHROW +#define BEGIN_ENTRYPOINT_VOIDRET +#define END_ENTRYPOINT_VOIDRET +#define BEGIN_CLEANUP_ENTRYPOINT #define END_CLEANUP_ENTRYPOINT #endif // __ENTRYPOINTS_h__ diff --git a/src/inc/ex.h b/src/inc/ex.h index bd1b221..8b9ec3b 100644 --- a/src/inc/ex.h +++ b/src/inc/ex.h @@ -21,7 +21,6 @@ #include "winwrap.h" #include "corerror.h" #include "stresslog.h" -#include "genericstackprobe.h" #include "staticcontract.h" #include "entrypoints.h" @@ -128,12 +127,6 @@ DWORD GetCurrentExceptionCode(); bool IsCurrentExceptionSO(); // --------------------------------------------------------------------------- -// Return TRUE if the current exception is hard( or soft) SO. Soft SO -// is defined when the stack probing code is enabled (FEATURE_STACK_PROBE) -// --------------------------------------------------------------------------- -bool IsSOExceptionCode(DWORD exceptionCode); - -// --------------------------------------------------------------------------- // Standard exception hierarchy & infrastructure for library code & EE // --------------------------------------------------------------------------- @@ -847,13 +840,10 @@ void ExThrowTrap(const char *fcn, const char *file, int line, const char *szType #endif -#define HANDLE_SO_TOLERANCE_FOR_THROW - #define EX_THROW(_type, _args) \ { \ FAULT_NOT_FATAL(); \ \ - HANDLE_SO_TOLERANCE_FOR_THROW; \ _type * ___pExForExThrow = new _type _args ; \ /* 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 */ \ @@ -880,7 +870,6 @@ Exception *ExThrowWithInnerHelper(Exception *inner); { \ FAULT_NOT_FATAL(); \ \ - HANDLE_SO_TOLERANCE_FOR_THROW; \ Exception *_inner2 = ExThrowWithInnerHelper(_inner); \ _type *___pExForExThrow = new _type _args ; \ ___pExForExThrow->SetInnerException(_inner2); \ @@ -948,7 +937,6 @@ Exception *ExThrowWithInnerHelper(Exception *inner); PAL_CPP_CATCH_ALL \ { \ SCAN_EHMARKER_CATCH(); \ - VALIDATE_BACKOUT_STACK_CONSUMPTION; \ __defaultException_t __defaultException; \ CHECK::ResetAssert(); \ ExceptionHolder __pException(__state.m_pExceptionPtr); \ @@ -990,7 +978,6 @@ Exception *ExThrowWithInnerHelper(Exception *inner); __state.m_pExceptionPtr = __pExceptionRaw; \ SCAN_EHMARKER_END_CATCH(); \ SCAN_IGNORE_THROW_MARKER; \ - VALIDATE_BACKOUT_STACK_CONSUMPTION; \ __defaultException_t __defaultException; \ CHECK::ResetAssert(); \ ExceptionHolder __pException(__state.m_pExceptionPtr); \ @@ -1059,18 +1046,10 @@ Exception *ExThrowWithInnerHelper(Exception *inner); } \ SCAN_EHMARKER_END_CATCH(); \ } \ - EX_ENDTRY \ - + EX_ENDTRY + #define EX_ENDTRY \ - PAL_CPP_ENDTRY \ - if (__state.DidCatch()) \ - { \ - RESTORE_SO_TOLERANCE_STATE; \ - } \ - if (__state.DidCatchSO()) \ - { \ - HANDLE_STACKOVERFLOW_AFTER_CATCH; \ - } + PAL_CPP_ENDTRY #define EX_RETHROW \ { \ @@ -1297,6 +1276,10 @@ 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 \ { \ @@ -1310,9 +1293,7 @@ Exception *ExThrowWithInnerHelper(Exception *inner); if (!__state.DidCatchSO()) \ EX_RETHROW; \ EX_END_CATCH_FOR_HOOK; \ - SO_INFRASTRUCTURE_CODE(if (__state.DidCatchSO())) \ - SO_INFRASTRUCTURE_CODE(ThrowStackOverflow();) \ - } \ + } // --------------------------------------------------------------------------- // Inline implementations. Pay no attention to that man behind the curtain. @@ -1321,7 +1302,6 @@ Exception *ExThrowWithInnerHelper(Exception *inner); inline Exception::HandlerState::HandlerState() { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_CANNOT_TAKE_LOCK; STATIC_CONTRACT_SUPPORTS_DAC; diff --git a/src/inc/formattype.cpp b/src/inc/formattype.cpp index 8a7965c..3de456e 100644 --- a/src/inc/formattype.cpp +++ b/src/inc/formattype.cpp @@ -423,15 +423,12 @@ PCCOR_SIGNATURE PrettyPrintTypeOrDef( CONTRACTL { THROWS; - SO_TOLERANT; GC_NOTRIGGER; } CONTRACTL_END; PCCOR_SIGNATURE pBegin, pEnd=NULL; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(ThrowStackOverflow()); - #ifdef __ILDASM__ ULONG L = (ULONG)(out->Size()); #endif @@ -454,7 +451,6 @@ PCCOR_SIGNATURE PrettyPrintTypeOrDef( } } #endif - END_SO_INTOLERANT_CODE; return pEnd; } diff --git a/src/inc/genericstackprobe.h b/src/inc/genericstackprobe.h deleted file mode 100644 index 591bcc8..0000000 --- a/src/inc/genericstackprobe.h +++ /dev/null @@ -1,610 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// -//----------------------------------------------------------------------------- -// Generic Stack Probe Code -// Used to setup stack guards and probes outside the VM tree -//----------------------------------------------------------------------------- - -#ifndef __GENERICSTACKPROBE_h__ -#define __GENERICSTACKPROBE_h__ - -#include "staticcontract.h" -#include "predeftlsslot.h" - -#if defined(DISABLE_CONTRACTS) -#undef FEATURE_STACK_PROBE -#endif - -#if defined(FEATURE_STACK_PROBE) -#ifdef _DEBUG -#define STACK_GUARDS_DEBUG -#else -#define STACK_GUARDS_RELEASE -#endif -#endif - -#ifdef FEATURE_STACK_PROBE -#define SO_INFRASTRUCTURE_CODE(x) x -#define NO_SO_INFRASTRUCTURE_CODE_ASSERTE(x) -#else -#define SO_INFRASTRUCTURE_CODE(x) -#define NO_SO_INFRASTRUCTURE_CODE_ASSERTE(x) _ASSERTE(x); -#endif - -/* This macro is redefined in stackprobe.h - * so that code expanded using this macro is present only for files - * within VM directory. See StackProbe.h for more details - */ -#define VM_NO_SO_INFRASTRUCTURE_CODE(x) - -// The types of stack validation we support in holders. -enum HolderStackValidation -{ - HSV_NoValidation, - HSV_ValidateMinimumStackReq, - HSV_ValidateNormalStackReq, -}; - -// Used to track transitions into the profiler -#define REMOVE_STACK_GUARD_FOR_PROFILER_CALL \ - REMOVE_STACK_GUARD - -// For AMD64, the stack size is 4K, same as X86, but the pointer size is 64, so the -// stack tends to grow a lot faster than X86. -#ifdef _TARGET_AMD64_ -#define ADJUST_PROBE(n) (2 * (n)) -#else -#define ADJUST_PROBE(n) (n) -#endif - -#if defined(FEATURE_STACK_PROBE) - -#ifdef STACK_GUARDS_DEBUG // DAC and non-DAC - all data structures referenced in DAC'ized code - // must be included so we can calculate layout. SO probes are not - // active in the DAC but the SO probe structures contribute to layout - - -// This class is used to place a marker upstack and verify that it was not overrun. It is -// different from the full blown stack probes in that it does not chain with other probes or -// test for stack overflow. Its sole purpose is to verify stack consumption. -// It is effectively an implicit probe though, because we are guaranteeing that we have -// enought stack to run and will not take an SO. So we enter SO-intolerant code when -// we install one of these. - -class StackMarkerStack; -struct ClrDebugState; - -class BaseStackMarker -{ - friend StackMarkerStack; - - ClrDebugState *m_pDebugState; - BOOL m_prevWasSOTolerant; // Were we SO-tolerant when we came in? - BOOL m_fMarkerSet; // Has the marker been set? - BOOL m_fTemporarilyDisabled;// Has the marker been temporarely disabled? - BOOL m_fAddedToStack; // Has this BaseStackMarker been added to the stack of markers for the thread. - float m_numPages; - UINT_PTR *m_pMarker; // Pointer to where to put our marker cookie on the stack. - BaseStackMarker*m_pPrevious; - BOOL m_fProtectedStackPage; - BOOL m_fAllowDisabling; - - BaseStackMarker() {}; // no default construction allowed - - // These should only be called by the ClrDebugState. - void RareDisableMarker(); - void RareReEnableMarker(); - - public: - BaseStackMarker(float numPages, BOOL fAllowDisabling); - - // we have this so that the check of the global can be inlined - // and we don't make the call to CheckMarker unless we need to. - void CheckForBackoutViolation(); - - void SetMarker(float numPages); - void CheckMarker(); - - void ProtectMarkerPageInDebugger(); - void UndoPageProtectionInDebugger(); - -}; - -class StackMarkerStack -{ -public: - // Since this is used from the ClrDebugState which can't have a default constructor, - // we need to provide an Init method to intialize the instance instead of having a constructor. - void Init() - { - m_pTopStackMarker = NULL; - m_fDisabled = FALSE; - } - - void PushStackMarker(BaseStackMarker *pStackMarker); - BaseStackMarker *PopStackMarker(); - - BOOL IsEmpty() - { - return (m_pTopStackMarker == NULL); - } - BOOL IsDisabled() - { - return m_fDisabled; - } - - void RareDisableStackMarkers(); - void RareReEnableStackMarkers(); - -private: - BaseStackMarker *m_pTopStackMarker; // The top of the stack of stack markers for the current thread. - BOOL m_fDisabled; -}; - -#endif // STACK_GUARDS_DEBUG - -#if !defined(DACCESS_COMPILE) - -// In debug builds, we redefine DEFAULT_ENTRY_PROBE_AMOUNT to a global static -// so that we can tune the entry point probe size at runtime. -#define DEFAULT_ENTRY_PROBE_SIZE 12 -#define DEFAULT_ENTRY_PROBE_AMOUNT DEFAULT_ENTRY_PROBE_SIZE - -#define BACKOUT_CODE_STACK_LIMIT 4.0 -#define HOLDER_CODE_NORMAL_STACK_LIMIT BACKOUT_CODE_STACK_LIMIT -#define HOLDER_CODE_MINIMUM_STACK_LIMIT 0.25 - -void DontCallDirectlyForceStackOverflow(); -void SOBackoutViolation(const char *szFunction, const char *szFile, int lineNum); -typedef void *EEThreadHandle; -class SOIntolerantTransitionHandler; -extern bool g_StackProbingEnabled; -extern void (*g_fpCheckForSOInSOIntolerantCode)(); -extern void (*g_fpSetSOIntolerantTransitionMarker)(); -extern BOOL (*g_fpDoProbe)(unsigned int n); -extern void (*g_fpHandleSoftStackOverflow)(BOOL fSkipDebugger); - -// Once we enter SO-intolerant code, we can never take a hard SO as we will be -// in an unknown state. SOIntolerantTransitionHandler is used to detect a hard SO in SO-intolerant -// code and to raise a Fatal Error if one occurs. -class SOIntolerantTransitionHandler -{ -private: - bool m_exceptionOccurred; - void * m_pPreviousHandler; - -public: - FORCEINLINE SOIntolerantTransitionHandler() - { - if (g_StackProbingEnabled) - { - CtorImpl(); - } - } - - FORCEINLINE ~SOIntolerantTransitionHandler() - { - if (g_StackProbingEnabled) - { - DtorImpl(); - } - } - - NOINLINE void CtorImpl(); - NOINLINE void DtorImpl(); - - void SetNoException() - { - m_exceptionOccurred = false; - } - - bool DidExceptionOccur() - { - return m_exceptionOccurred; - } -}; - - -extern void (*g_fpHandleStackOverflowAfterCatch)(); -void HandleStackOverflowAfterCatch(); - -#if defined(STACK_GUARDS_DEBUG) - -#ifdef _WIN64 -#define STACK_COOKIE_VALUE 0x0123456789ABCDEF -#define DISABLED_STACK_COOKIE_VALUE 0xDCDCDCDCDCDCDCDC -#else -#define STACK_COOKIE_VALUE 0x01234567 -#define DISABLED_STACK_COOKIE_VALUE 0xDCDCDCDC -#endif - -// This allows us to adjust the probe amount at run-time in checked builds -#undef DEFAULT_ENTRY_PROBE_AMOUNT -#define DEFAULT_ENTRY_PROBE_AMOUNT g_EntryPointProbeAmount - -class BaseStackGuardGeneric; -class BaseStackGuard; - -extern void (*g_fpRestoreCurrentStackGuard)(BOOL fDisabled); -extern BOOL (*g_fp_BaseStackGuard_RequiresNStackPages)(BaseStackGuardGeneric *pGuard, unsigned int n, BOOL fThrowOnSO); -extern void (*g_fp_BaseStackGuard_CheckStack)(BaseStackGuardGeneric *pGuard); -extern BOOL (*g_fpCheckNStackPagesAvailable)(unsigned int n); -extern BOOL g_ProtectStackPagesInDebugger; -void RestoreSOToleranceState(); -void EnsureSOTolerant(); - -extern BOOL g_EnableBackoutStackValidation; -extern DWORD g_EntryPointProbeAmount; - -//----------------------------------------------------------------------------- -// Check if a cookie is still at the given marker -//----------------------------------------------------------------------------- -inline BOOL IsMarkerOverrun(UINT_PTR *pMarker) -{ - return (*pMarker != STACK_COOKIE_VALUE); -} - -class AutoCleanupStackMarker : public BaseStackMarker -{ -public: - DEBUG_NOINLINE AutoCleanupStackMarker(float numPages) : - BaseStackMarker(numPages, TRUE) - { - SCAN_SCOPE_BEGIN; - ANNOTATION_FN_SO_INTOLERANT; - } - - DEBUG_NOINLINE ~AutoCleanupStackMarker() - { - SCAN_SCOPE_END; - CheckForBackoutViolation(); - } -}; - -#define VALIDATE_BACKOUT_STACK_CONSUMPTION \ - AutoCleanupStackMarker __stackMarker(ADJUST_PROBE(BACKOUT_CODE_STACK_LIMIT)); - -#define VALIDATE_BACKOUT_STACK_CONSUMPTION_FOR(numPages) \ - AutoCleanupStackMarker __stackMarker(ADJUST_PROBE(numPages)); - -#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE \ - BaseStackMarker __stackMarkerNoDisable(ADJUST_PROBE(BACKOUT_CODE_STACK_LIMIT), FALSE); - -#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE_FOR(numPages) \ - BaseStackMarker __stackMarkerNoDisable(ADJUST_PROBE(numPages), FALSE); - -#define UNSAFE_END_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE \ - __stackMarkerNoDisable.CheckForBackoutViolation(); - -#define VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(validationType) \ - _ASSERTE(validationType != HSV_NoValidation); \ - AutoCleanupStackMarker __stackMarker( \ - ADJUST_PROBE(validationType == HSV_ValidateNormalStackReq ? HOLDER_CODE_NORMAL_STACK_LIMIT : HOLDER_CODE_MINIMUM_STACK_LIMIT)); - -class AutoCleanupDisableBackoutStackValidation -{ - public: - AutoCleanupDisableBackoutStackValidation(); - ~AutoCleanupDisableBackoutStackValidation(); - -private: - BOOL m_fAlreadyDisabled; - -}; - -// This macros disables the backout stack validation in the current scope. It should -// only be used in very rare situations. If you think you might have such a situation, -// please talk to the stack overflow devs before using it. -#define DISABLE_BACKOUT_STACK_VALIDATION \ - AutoCleanupDisableBackoutStackValidation __disableBacoutStackValidation; - -// In debug mode, we want to do a little more work on this transition to note the transition in the thread. -class DebugSOIntolerantTransitionHandler : public SOIntolerantTransitionHandler -{ - BOOL m_prevSOTolerantState; - ClrDebugState* m_clrDebugState; - - public: - DebugSOIntolerantTransitionHandler(); - ~DebugSOIntolerantTransitionHandler(); -}; - -// This is the base class structure for our probe infrastructure. We declare it here -// so that we can properly declare instances outside of the VM tree. But we only do the -// probes when we have a managed thread. -class BaseStackGuardGeneric -{ -public: - enum - { - cPartialInit, // Not yet intialized - cInit, // Initialized and installed - cUnwound, // Unwound on a normal path (used for debugging) - cEHUnwound // Unwound on an exception path (used for debugging) - } m_eInitialized; - - // *** Following fields must not move. The fault injection framework depends on them. - BaseStackGuard *m_pPrevGuard; // Previous guard for this thread. - UINT_PTR *m_pMarker; // Pointer to where to put our marker cookie on the stack. - unsigned int m_numPages; // space needed, specified in number of pages - BOOL m_isBoundaryGuard; // used to mark when we've left the EE - BOOL m_fDisabled; // Used to enable/disable stack guard - - - // *** End of fault injection-dependent fields - - // The following fields are really here to provide us with some nice debugging information. - const char *m_szFunction; - const char *m_szFile; - unsigned int m_lineNum; - const char *m_szNextFunction; // Name of the probe that came after us. - const char *m_szNextFile; - unsigned int m_nextLineNum; - DWORD m_UniqueId; - unsigned int m_depth; // How deep is this guard in the list of guards for this thread? - BOOL m_fProtectedStackPage; // TRUE if we protected a stack page with PAGE_NOACCESS. - BOOL m_fEHInProgress; // Is an EH in progress? This is cleared on a catch. - BOOL m_exceptionOccurred; // Did an exception occur through this probe? - -protected: - BaseStackGuardGeneric() - { - } - -public: - BaseStackGuardGeneric(const char *szFunction, const char *szFile, unsigned int lineNum) : - m_pPrevGuard(NULL), m_pMarker(NULL), - m_szFunction(szFunction), m_szFile(szFile), m_lineNum(lineNum), - m_szNextFunction(NULL), m_szNextFile(NULL), m_nextLineNum(0), - m_fProtectedStackPage(FALSE), m_UniqueId(-1), m_numPages(0), - m_eInitialized(cPartialInit), m_fDisabled(FALSE), - m_isBoundaryGuard(FALSE), - m_fEHInProgress(FALSE), - m_exceptionOccurred(FALSE) - { - STATIC_CONTRACT_LEAF; - } - - BOOL RequiresNStackPages(unsigned int n, BOOL fThrowOnSO = TRUE) - { - if (g_fp_BaseStackGuard_RequiresNStackPages == NULL) - { - return TRUE; - } - return g_fp_BaseStackGuard_RequiresNStackPages(this, n, fThrowOnSO); - } - - BOOL RequiresNStackPagesThrowing(unsigned int n) - { - if (g_fp_BaseStackGuard_RequiresNStackPages == NULL) - { - return TRUE; - } - return g_fp_BaseStackGuard_RequiresNStackPages(this, n, TRUE); - } - - BOOL RequiresNStackPagesNoThrow(unsigned int n) - { - if (g_fp_BaseStackGuard_RequiresNStackPages == NULL) - { - return TRUE; - } - return g_fp_BaseStackGuard_RequiresNStackPages(this, n, FALSE); - } - - void CheckStack() - { - if (m_eInitialized == cInit) - { - g_fp_BaseStackGuard_CheckStack(this); - } - } - - void SetNoException() - { - m_exceptionOccurred = FALSE; - } - - BOOL DidExceptionOccur() - { - return m_exceptionOccurred; - } - - BOOL Enabled() - { - return !m_fDisabled; - } - - void DisableGuard() - { - // As long as we don't have threads mucking with other thread's stack - // guards, we don't need to synchronize this. - m_fDisabled = TRUE; - } - - void EnableGuard() - { - // As long as we don't have threads mucking with other thread's stack - // guards, we don't need to synchronize this. - m_fDisabled = FALSE; - } - - -}; - -class StackGuardDisabler -{ - BOOL m_fDisabledGuard; - -public: - StackGuardDisabler(); - ~StackGuardDisabler(); - void NeverRestoreGuard(); - -}; - - - -// Derived version, add a dtor that automatically calls Check_Stack, move convenient, but can't use with SEH. -class AutoCleanupStackGuardGeneric : public BaseStackGuardGeneric -{ -protected: - AutoCleanupStackGuardGeneric() - { - } - -public: - AutoCleanupStackGuardGeneric(const char *szFunction, const char *szFile, unsigned int lineNum) : - BaseStackGuardGeneric(szFunction, szFile, lineNum) - { - STATIC_CONTRACT_LEAF; - } - - ~AutoCleanupStackGuardGeneric() - { - STATIC_CONTRACT_WRAPPER; - CheckStack(); - } -}; - - -// Used to remove stack guard... (kind of like a poor man's BEGIN_SO_TOLERANT -#define REMOVE_STACK_GUARD \ - StackGuardDisabler __guardDisable; - -// Used to transition into intolerant code when handling a SO -#define BEGIN_SO_INTOLERANT_CODE_NOPROBE \ - { \ - DebugSOIntolerantTransitionHandler __soIntolerantTransitionHandler; \ - /* work around unreachable code warning */ \ - if (true) \ - { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT) - -#define END_SO_INTOLERANT_CODE_NOPROBE \ - ; \ - DEBUG_ASSURE_NO_RETURN_END(SO_INTOLERANT) \ - } \ - __soIntolerantTransitionHandler.SetNoException(); \ - } \ - - - -#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(ActionOnSO) \ - { \ - AutoCleanupStackGuardGeneric stack_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \ - if (! stack_guard_XXX.RequiresNStackPagesNoThrow(ADJUST_PROBE(g_EntryPointProbeAmount))) \ - { \ - ActionOnSO; \ - } \ - else \ - { \ - DebugSOIntolerantTransitionHandler __soIntolerantTransitionHandler; \ - ANNOTATION_SO_PROBE_BEGIN(DEFAULT_ENTRY_PROBE_AMOUNT); \ - if (true) \ - { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT) - - -#define END_SO_INTOLERANT_CODE \ - ; \ - DEBUG_ASSURE_NO_RETURN_END(SO_INTOLERANT) \ - } \ - ANNOTATION_SO_PROBE_END; \ - __soIntolerantTransitionHandler.SetNoException(); \ - stack_guard_XXX.SetNoException(); \ - } \ - } \ - - -#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO() \ - EnsureSOTolerant(); \ - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(DontCallDirectlyForceStackOverflow()); \ - - -// Restores the SO-tolerance state and the marker for the current guard if any -#define RESTORE_SO_TOLERANCE_STATE \ - RestoreSOToleranceState(); - -#define HANDLE_STACKOVERFLOW_AFTER_CATCH \ - HandleStackOverflowAfterCatch() - -#elif defined(STACK_GUARDS_RELEASE) - -#define VALIDATE_BACKOUT_STACK_CONSUMPTION -#define VALIDATE_BACKOUT_STACK_CONSUMPTION_FOR -#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE -#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE_FOR(numPages) -#define UNSAFE_END_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE -#define VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(validationType) -#define RESTORE_SO_TOLERANCE_STATE -#define HANDLE_STACKOVERFLOW_AFTER_CATCH \ - HandleStackOverflowAfterCatch() -#define DISABLE_BACKOUT_STACK_VALIDATION -#define BACKOUT_STACK_VALIDATION_VIOLATION -#define BEGIN_SO_INTOLERANT_CODE_NOPROBE -#define END_SO_INTOLERANT_CODE_NOPROBE -#define REMOVE_STACK_GUARD - -#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(ActionOnSO) \ - { \ - if (g_StackProbingEnabled && !g_fpDoProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT)))\ - { \ - ActionOnSO; \ - } else { \ - SOIntolerantTransitionHandler __soIntolerantTransitionHandler; \ - /* work around unreachable code warning */ \ - if (true) \ - { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT) - -#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO() \ - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(DontCallDirectlyForceStackOverflow()); \ - -#define END_SO_INTOLERANT_CODE \ - ; \ - DEBUG_ASSURE_NO_RETURN_END(SO_INTOLERANT) \ - } \ - __soIntolerantTransitionHandler.SetNoException(); \ - } \ - } - -#endif - -#endif // !DACCESS_COMPILE -#endif // FEATURE_STACK_PROBES - -// if the feature is off or we are compiling for DAC, disable all the probes -#if !defined(FEATURE_STACK_PROBE) || defined(DACCESS_COMPILE) - -#define VALIDATE_BACKOUT_STACK_CONSUMPTION -#define VALIDATE_BACKOUT_STACK_CONSUMPTION_FOR -#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE -#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE_FOR(numPages) -#define UNSAFE_END_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE -#define VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(validationType) -#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(ActionOnSO) -#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO() -#define END_SO_INTOLERANT_CODE -#define RESTORE_SO_TOLERANCE_STATE - -#define HANDLE_STACKOVERFLOW_AFTER_CATCH - -#define DISABLE_BACKOUT_STACK_VALIDATION -#define BACKOUT_STACK_VALIDATION_VIOLATION -#define BEGIN_SO_INTOLERANT_CODE_NOPROBE -#define END_SO_INTOLERANT_CODE_NOPROBE -#define REMOVE_STACK_GUARD - -// Probe size is 0 as Stack Overflow probing is not enabled -#define DEFAULT_ENTRY_PROBE_AMOUNT 0 - -#define BACKOUT_CODE_STACK_LIMIT 0 - -#endif //!FEATURE_STACK_PROBE || DACCESS_COMPILE - -#endif // __GENERICSTACKPROBE_h__ diff --git a/src/inc/genericstackprobe.inl b/src/inc/genericstackprobe.inl deleted file mode 100644 index 9b8dd41..0000000 --- a/src/inc/genericstackprobe.inl +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// - - -#ifndef _GENERICSTACKPROBE_INL_ -#define _GENERICSTACKPROBE_INL_ - -#include "genericstackprobe.h" - - -#endif // _GENERICSTACKPROBE_INL_ diff --git a/src/inc/holder.h b/src/inc/holder.h index 76ade76..49c90b7 100644 --- a/src/inc/holder.h +++ b/src/inc/holder.h @@ -8,7 +8,6 @@ #include #include "cor.h" -#include "genericstackprobe.h" #include "staticcontract.h" #include "volatile.h" #include "palclr.h" @@ -62,6 +61,13 @@ _NAME & operator=(_NAME const &); #endif +// The types of stack validation we support in holders. +enum HolderStackValidation +{ + HSV_NoValidation, + HSV_ValidateMinimumStackReq, + HSV_ValidateNormalStackReq, +}; #ifdef _DEBUG @@ -131,11 +137,6 @@ class HolderBase HolderBase(TYPE value) : m_value(value) { - // TODO: Find a way to enable this check. - // We can have a holder in SO tolerant, then probe, then acquire a value. This works - // because the dtor is guaranteed to run with enough stack. - // EnsureSOIntolerantOK(__FUNCTION__, __FILE__, __LINE__); - #ifdef _DEBUG m_pAutoExpVisibleValue = (const AutoExpVisibleValue *)(&m_value); #endif //_DEBUG @@ -306,7 +307,6 @@ class BaseHolder : protected BASE if (VALIDATION_TYPE != HSV_NoValidation) { - VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(VALIDATION_TYPE); this->DoRelease(); } else @@ -385,7 +385,6 @@ class StateHolder { if (VALIDATION_TYPE != HSV_NoValidation) { - VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(VALIDATION_TYPE); RELEASEF(); } else @@ -455,7 +454,6 @@ class ConditionalStateHolder { if (VALIDATION_TYPE != HSV_NoValidation) { - VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(VALIDATION_TYPE); RELEASEF(m_value); } else @@ -728,8 +726,6 @@ FORCEINLINE void SafeArrayDoNothing(SAFEARRAY* p) } - - //----------------------------------------------------------------------------- // Holder/Wrapper are the simplest way to define holders - they synthesizes a base class out of // function pointers @@ -756,7 +752,6 @@ class FunctionBase : protected HolderBase // one that is already being done in BaseHolder & BaseWrapper. if (VALIDATION_TYPE != HSV_NoValidation) { - VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(VALIDATION_TYPE); RELEASEF(this->m_value); } else @@ -974,7 +969,6 @@ FORCEINLINE void DoTheRelease(TYPE *value) { if (value) { - VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(HSV_ValidateNormalStackReq); value->Release(); } } diff --git a/src/inc/metadatatracker.h b/src/inc/metadatatracker.h index 00aa56a..27c8c27 100644 --- a/src/inc/metadatatracker.h +++ b/src/inc/metadatatracker.h @@ -66,7 +66,6 @@ public: THROWS; GC_NOTRIGGER; INJECT_FAULT(ThrowOutOfMemory()); - SO_INTOLERANT; } CONTRACTL_END; @@ -98,7 +97,6 @@ public: NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_INTOLERANT; } CONTRACTL_END; @@ -158,7 +156,6 @@ public: { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_NOT_MAINLINE; if (!Enabled()) return; @@ -189,7 +186,6 @@ public: { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_NOT_MAINLINE; if (s_IBCLogMetaDataAccess != NULL) s_IBCLogMetaDataAccess(address); @@ -212,7 +208,6 @@ public: { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_NOT_MAINLINE; if (s_IBCLogMetaDataSearch != NULL && result != NULL) s_IBCLogMetaDataSearch(result); @@ -266,7 +261,6 @@ public: GC_NOTRIGGER; INJECT_FAULT(ThrowOutOfMemory()); POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - SO_INTOLERANT; } CONTRACT_END; diff --git a/src/inc/ostype.h b/src/inc/ostype.h index f17afb1..b64927c 100644 --- a/src/inc/ostype.h +++ b/src/inc/ostype.h @@ -78,7 +78,6 @@ inline BOOL WinRTSupported() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; #ifdef CROSSGEN_COMPILE return TRUE; diff --git a/src/inc/palclr.h b/src/inc/palclr.h index dabe86f..10ef462 100644 --- a/src/inc/palclr.h +++ b/src/inc/palclr.h @@ -484,19 +484,16 @@ #if defined(_DEBUG_IMPL) && !defined(JIT_BUILD) && !defined(JIT64_BUILD) && !defined(CROSS_COMPILE) && !defined(_TARGET_ARM_) // @ARMTODO: no contracts for speed #define PAL_TRY_HANDLER_DBG_BEGIN \ BOOL ___oldOkayToThrowValue = FALSE; \ - SO_INFRASTRUCTURE_CODE(BOOL ___oldSOTolerantState = FALSE;) \ ClrDebugState *___pState = ::GetClrDebugState(); \ __try \ { \ ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \ - SO_INFRASTRUCTURE_CODE(___oldSOTolerantState = ___pState->IsSOTolerant();) \ ___pState->SetOkToThrow(); \ PAL_ENTER_THROWS_REGION; // Special version that avoids touching the debug state after doing work in a DllMain for process or thread detach. #define PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) \ BOOL ___oldOkayToThrowValue = FALSE; \ - SO_INFRASTRUCTURE_CODE(BOOL ___oldSOTolerantState = FALSE;) \ ClrDebugState *___pState = NULL; \ if (_reason != DLL_PROCESS_ATTACH) \ ___pState = CheckClrDebugState(); \ @@ -505,7 +502,6 @@ if (___pState) \ { \ ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \ - SO_INFRASTRUCTURE_CODE(___oldSOTolerantState = ___pState->IsSOTolerant();) \ ___pState->SetOkToThrow(); \ } \ if ((_reason == DLL_PROCESS_DETACH) || (_reason == DLL_THREAD_DETACH)) \ @@ -523,16 +519,11 @@ { \ _ASSERTE(___pState == CheckClrDebugState()); \ ___pState->SetOkToThrow( ___oldOkayToThrowValue ); \ - SO_INFRASTRUCTURE_CODE(___pState->SetSOTolerance( ___oldSOTolerantState );) \ } \ } -#define PAL_ENDTRY_NAKED_DBG \ - if (__exHandled) \ - { \ - RESTORE_SO_TOLERANCE_STATE; \ - } \ - +#define PAL_ENDTRY_NAKED_DBG + #else #define PAL_TRY_HANDLER_DBG_BEGIN ANNOTATION_TRY_BEGIN; #define PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) ANNOTATION_TRY_BEGIN; diff --git a/src/inc/palclr_win.h b/src/inc/palclr_win.h index c04e0ab..5050586 100644 --- a/src/inc/palclr_win.h +++ b/src/inc/palclr_win.h @@ -88,12 +88,10 @@ #if defined(_DEBUG_IMPL) && !defined(JIT_BUILD) && !defined(JIT64_BUILD) && !defined(_ARM_) // @ARMTODO #define WIN_PAL_TRY_HANDLER_DBG_BEGIN \ BOOL ___oldOkayToThrowValue = FALSE; \ - BOOL ___oldSOTolerantState = FALSE; \ ClrDebugState *___pState = GetClrDebugState(); \ __try \ { \ ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \ - ___oldSOTolerantState = ___pState->IsSOTolerant(); \ ___pState->SetOkToThrow(TRUE); \ ANNOTATION_TRY_BEGIN; @@ -107,7 +105,6 @@ if (___pState) \ { \ ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \ - ___oldSOTolerantState = ___pState->IsSOTolerant(); \ ___pState->SetOkToThrow(TRUE); \ } \ if ((_reason == DLL_PROCESS_DETACH) || (_reason == DLL_THREAD_DETACH)) \ @@ -129,12 +126,8 @@ } \ } -#define WIN_PAL_ENDTRY_NAKED_DBG \ - if (__exHandled) \ - { \ - RESTORE_SO_TOLERANCE_STATE; \ - } \ - +#define WIN_PAL_ENDTRY_NAKED_DBG + #else #define WIN_PAL_TRY_HANDLER_DBG_BEGIN ANNOTATION_TRY_BEGIN; #define WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) ANNOTATION_TRY_BEGIN; diff --git a/src/inc/pedecoder.inl b/src/inc/pedecoder.inl index c8400af..c17c03a 100644 --- a/src/inc/pedecoder.inl +++ b/src/inc/pedecoder.inl @@ -107,7 +107,6 @@ inline PEDecoder::PEDecoder(PTR_VOID mappedBase, bool fixedUp /*= FALSE*/) PRECONDITION(PEDecoder(mappedBase,fixedUp).CheckNTHeaders()); THROWS; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -240,7 +239,6 @@ inline BOOL PEDecoder::Has32BitNTHeaders() const PRECONDITION(HasNTHeaders()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; CANNOT_TAKE_LOCK; SUPPORTS_DAC; @@ -306,7 +304,6 @@ inline const void *PEDecoder::GetPreferredBase() const PRECONDITION(CheckNTHeaders()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } CONTRACT_END; @@ -326,7 +323,6 @@ inline COUNT_T PEDecoder::GetVirtualSize() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; @@ -343,7 +339,6 @@ inline WORD PEDecoder::GetSubsystem() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; @@ -359,7 +354,6 @@ inline WORD PEDecoder::GetDllCharacteristics() const PRECONDITION(CheckNTHeaders()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -585,7 +579,6 @@ inline BOOL PEDecoder::HasDirectoryEntry(int entry) const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; @@ -604,7 +597,6 @@ inline IMAGE_DATA_DIRECTORY *PEDecoder::GetDirectoryEntry(int entry) const NOTHROW; GC_NOTRIGGER; POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -633,7 +625,6 @@ inline TADDR PEDecoder::GetDirectoryEntryData(int entry, COUNT_T *pSize) const NOTHROW; GC_NOTRIGGER; POSTCONDITION(CheckPointer((void *)RETVAL, NULL_OK)); - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -656,7 +647,6 @@ inline TADDR PEDecoder::GetDirectoryData(IMAGE_DATA_DIRECTORY *pDir) const PRECONDITION(CheckDirectory(pDir, 0, NULL_OK)); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; POSTCONDITION(CheckPointer((void *)RETVAL, NULL_OK)); CANNOT_TAKE_LOCK; @@ -676,7 +666,6 @@ inline TADDR PEDecoder::GetDirectoryData(IMAGE_DATA_DIRECTORY *pDir, COUNT_T *pS PRECONDITION(CheckPointer(pSize)); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; POSTCONDITION(CheckPointer((void *)RETVAL, NULL_OK)); CANNOT_TAKE_LOCK; @@ -698,7 +687,6 @@ inline TADDR PEDecoder::GetInternalAddressData(SIZE_T address) const NOTHROW; GC_NOTRIGGER; POSTCONDITION(CheckPointer((void *)RETVAL)); - SO_TOLERANT; } CONTRACT_END; @@ -714,7 +702,6 @@ inline BOOL PEDecoder::HasCorHeader() const NOTHROW; SUPPORTS_DAC; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -729,7 +716,6 @@ inline BOOL PEDecoder::IsILOnly() const PRECONDITION(HasCorHeader()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -794,7 +780,6 @@ inline BOOL PEDecoder::IsStrongNameSigned() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; @@ -811,7 +796,6 @@ inline BOOL PEDecoder::HasStrongNameSignature() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; @@ -865,7 +849,6 @@ inline BOOL PEDecoder::HasTls() const PRECONDITION(CheckNTHeaders()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -880,7 +863,6 @@ inline CHECK PEDecoder::CheckTls() const PRECONDITION(CheckNTHeaders()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -947,7 +929,6 @@ inline IMAGE_COR20_HEADER *PEDecoder::GetCorHeader() const PRECONDITION(HasCorHeader()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL)); CANNOT_TAKE_LOCK; SUPPORTS_DAC; @@ -993,10 +974,8 @@ inline CORCOMPILE_HEADER *PEDecoder::GetNativeHeader() const NOTHROW; GC_NOTRIGGER; POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; SUPPORTS_DAC; CANNOT_TAKE_LOCK; - SO_TOLERANT; } CONTRACT_END; @@ -1076,7 +1055,6 @@ inline BOOL PEDecoder::IsNativeILILOnly() const PRECONDITION(CheckNativeHeader()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -1202,7 +1180,6 @@ inline IMAGE_NT_HEADERS *PEDecoder::FindNTHeaders() const NOTHROW; GC_NOTRIGGER; POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -1221,7 +1198,6 @@ inline IMAGE_COR20_HEADER *PEDecoder::FindCorHeader() const GC_NOTRIGGER; POSTCONDITION(CheckPointer(RETVAL)); CANNOT_TAKE_LOCK; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACT_END; @@ -1239,7 +1215,6 @@ inline CORCOMPILE_HEADER *PEDecoder::FindNativeHeader() const NOTHROW; GC_NOTRIGGER; POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -1388,7 +1363,6 @@ inline BOOL PEDecoder::HasReadyToRunHeader() const NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -1413,10 +1387,8 @@ inline READYTORUN_HEADER * PEDecoder::GetReadyToRunHeader() const NOTHROW; GC_NOTRIGGER; POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; SUPPORTS_DAC; CANNOT_TAKE_LOCK; - SO_TOLERANT; } CONTRACT_END; diff --git a/src/inc/predeftlsslot.h b/src/inc/predeftlsslot.h index fd56780..bf2817e 100644 --- a/src/inc/predeftlsslot.h +++ b/src/inc/predeftlsslot.h @@ -55,8 +55,6 @@ enum PredefinedTlsSlots TlsIdx_PEXCEPTION_RECORD, TlsIdx_PCONTEXT, - TlsIdx_SOIntolerantTransitionHandler, // The thread is entering SO intolerant code. This one is used by - // Thread::IsSOIntolerant to decide the SO mode of the thread. MAX_PREDEFINED_TLS_SLOT }; diff --git a/src/inc/profilepriv.inl b/src/inc/profilepriv.inl index 1af2914..c612b3d 100644 --- a/src/inc/profilepriv.inl +++ b/src/inc/profilepriv.inl @@ -107,7 +107,6 @@ inline BOOL CORProfilerFunctionIDMapperEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -125,7 +124,6 @@ inline BOOL CORProfilerTrackJITInfo() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -140,7 +138,6 @@ inline BOOL CORProfilerTrackCacheSearches() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -155,7 +152,6 @@ inline BOOL CORProfilerTrackModuleLoads() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -170,7 +166,6 @@ inline BOOL CORProfilerTrackAssemblyLoads() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -185,7 +180,6 @@ inline BOOL CORProfilerTrackAppDomainLoads() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -200,7 +194,6 @@ inline BOOL CORProfilerTrackThreads() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -215,7 +208,6 @@ inline BOOL CORProfilerTrackClasses() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -230,7 +222,6 @@ inline BOOL CORProfilerTrackGC() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -245,7 +236,6 @@ inline BOOL CORProfilerTrackAllocationsEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -266,7 +256,6 @@ inline BOOL CORProfilerTrackAllocations() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -282,7 +271,6 @@ inline BOOL CORProfilerEnableRejit() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -297,7 +285,6 @@ inline BOOL CORProfilerTrackExceptions() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -312,7 +299,6 @@ inline BOOL CORProfilerTrackCLRExceptions() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -327,7 +313,6 @@ inline BOOL CORProfilerTrackTransitions() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -342,7 +327,6 @@ inline BOOL CORProfilerTrackEnterLeave() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -362,7 +346,6 @@ inline BOOL CORProfilerTrackCCW() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -377,7 +360,6 @@ inline BOOL CORProfilerTrackRemoting() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -392,7 +374,6 @@ inline BOOL CORProfilerTrackRemotingCookie() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -409,7 +390,6 @@ inline BOOL CORProfilerTrackRemotingAsync() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -426,7 +406,6 @@ inline BOOL CORProfilerTrackSuspends() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -441,7 +420,6 @@ inline BOOL CORProfilerDisableInlining() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -456,7 +434,6 @@ inline BOOL CORProfilerJITMapEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -471,7 +448,6 @@ inline BOOL CORProfilerDisableOptimizations() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; SUPPORTS_DAC; } CONTRACTL_END; @@ -487,7 +463,6 @@ inline BOOL CORProfilerUseProfileImages() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -548,7 +523,6 @@ inline BOOL CORProfilerELT3SlowPathEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -563,7 +537,6 @@ inline BOOL CORProfilerELT3SlowPathEnterEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -578,7 +551,6 @@ inline BOOL CORProfilerELT3SlowPathLeaveEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -593,7 +565,6 @@ inline BOOL CORProfilerELT3SlowPathTailcallEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -608,7 +579,6 @@ inline BOOL CORProfilerELT2FastPathEnterEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -623,7 +593,6 @@ inline BOOL CORProfilerELT2FastPathLeaveEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -638,7 +607,6 @@ inline BOOL CORProfilerELT2FastPathTailcallEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -653,7 +621,6 @@ inline BOOL CORProfilerFunctionArgsEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -668,7 +635,6 @@ inline BOOL CORProfilerFunctionReturnValueEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -683,7 +649,6 @@ inline BOOL CORProfilerFrameInfoEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -698,7 +663,6 @@ inline BOOL CORProfilerStackSnapshotEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -713,7 +677,6 @@ inline BOOL CORProfilerAddsAssemblyReferences() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -728,7 +691,6 @@ inline BOOL CORProfilerInMemorySymbolsUpdatesEnabled() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -743,7 +705,6 @@ inline BOOL CORProfilerIsMonitoringDynamicFunctionUnloads() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -758,7 +719,6 @@ inline BOOL CORProfilerDisableTieredCompilation() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/inc/sarray.inl b/src/inc/sarray.inl index d7e396c..102b3c5 100644 --- a/src/inc/sarray.inl +++ b/src/inc/sarray.inl @@ -62,7 +62,6 @@ SArray::~SArray() CONTRACTL { NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; } CONTRACTL_END; diff --git a/src/inc/sbuffer.inl b/src/inc/sbuffer.inl index 96be7a5..30c93c8 100644 --- a/src/inc/sbuffer.inl +++ b/src/inc/sbuffer.inl @@ -156,7 +156,6 @@ inline SBuffer::SBuffer(ImmutableFlag immutable, const BYTE *buffer, COUNT_T siz POSTCONDITION(Equals(buffer, size)); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC_HOST_ONLY; } CONTRACT_END; @@ -174,13 +173,10 @@ inline SBuffer::~SBuffer() { NOTHROW; DESTRUCTOR_CHECK; - SO_TOLERANT; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC_HOST_ONLY; } CONTRACT_END; - VALIDATE_BACKOUT_STACK_CONSUMPTION; if (IsAllocated()) { @@ -337,7 +333,6 @@ inline COUNT_T SBuffer::GetAllocation() const INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACT_END; @@ -669,7 +664,6 @@ inline BOOL SBuffer::Equals(const SBuffer &compare) const PRECONDITION(compare.Check()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_END; @@ -685,7 +679,6 @@ inline BOOL SBuffer::Equals(const BYTE *compare, COUNT_T size) const PRECONDITION(CheckSize(size)); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_END; @@ -855,7 +848,6 @@ inline void SBuffer::TweakSize(COUNT_T size) POSTCONDITION(GetSize() == size); POSTCONDITION(CheckInvariant(*this)); NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; SUPPORTS_DAC_HOST_ONLY; } @@ -1014,14 +1006,11 @@ inline void SBuffer::DeleteBuffer(BYTE *buffer, COUNT_T allocation) { PRECONDITION(CheckSize(allocation)); POSTCONDITION(CheckPointer(buffer)); - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC_HOST_ONLY; } CONTRACT_END; - VALIDATE_BACKOUT_STACK_CONSUMPTION; CONSISTENCY_CHECK(CheckBuffer(buffer, allocation)); @@ -1048,7 +1037,6 @@ inline CHECK SBuffer::CheckBuffer(const BYTE *buffer, COUNT_T allocation) const { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; PRECONDITION(CheckPointer(buffer)); } @@ -1362,7 +1350,6 @@ inline void SBuffer::SetRepresentationField(int value) PRECONDITION((value & ~REPRESENTATION_MASK) == 0); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC_HOST_ONLY; } CONTRACT_END; diff --git a/src/inc/sstring.inl b/src/inc/sstring.inl index 88139ad..9b0c422 100644 --- a/src/inc/sstring.inl +++ b/src/inc/sstring.inl @@ -58,7 +58,6 @@ inline SString::SString() CONSTRUCTOR_CHECK; POSTCONDITION(IsEmpty()); NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; } CONTRACT_END; @@ -66,7 +65,6 @@ inline SString::SString() RETURN; #else STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; #endif @@ -621,7 +619,6 @@ inline const SString &SString::Empty() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -629,7 +626,6 @@ inline const SString &SString::Empty() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; #endif @@ -1183,7 +1179,6 @@ inline BOOL SString::IsEmpty() const GC_NOTRIGGER; PRECONDITION(CheckPointer(this)); NOTHROW; - SO_TOLERANT; SUPPORTS_DAC; } SS_CONTRACT_END; @@ -1199,7 +1194,6 @@ inline BOOL SString::IsASCII() const GC_NOTRIGGER; PRECONDITION(CheckPointer(this)); NOTHROW; - SO_TOLERANT; } SS_CONTRACT_END; @@ -1519,7 +1513,6 @@ inline COUNT_T SString::SizeToCount(COUNT_T size) const PRECONDITION(CheckSize(size)); SS_POSTCONDITION(CountToSize(RETVAL) == size); NOTHROW; - SO_TOLERANT; SUPPORTS_DAC; } SS_CONTRACT_END; @@ -1536,7 +1529,6 @@ inline COUNT_T SString::GetBufferSizeInCharIncludeNullChar() const { STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; return (GetSize() >> GetCharacterSizeShift()); diff --git a/src/inc/staticcontract.h b/src/inc/staticcontract.h index 09e765c..f7390c9 100644 --- a/src/inc/staticcontract.h +++ b/src/inc/staticcontract.h @@ -51,7 +51,6 @@ #define ANNOTATION_IGNORE_LOCK __annotation(W("CAN_TAKE_LOCK"), W("CANNOT_TAKE_LOCK"), W("CONDITIONAL_EXEMPT")) #define ANNOTATION_IGNORE_FAULT __annotation(W("FAULT"), W("FORBID_FAULT"), W("CONDITIONAL_EXEMPT")) #define ANNOTATION_IGNORE_TRIGGER __annotation(W("GC_TRIGGERS"), W("GC_NOTRIGGER"), W("CONDITIONAL_EXEMPT")) -#define ANNOTATION_IGNORE_SO __annotation(W("SO_TOLERANT"), W("SO_INTOLERANT"), W("CONDITIONAL_EXEMPT")) #define ANNOTATION_VIOLATION(violationmask) __annotation(W("VIOLATION(") L#violationmask W(")")) #define ANNOTATION_UNCHECKED(thecheck) __annotation(W("UNCHECKED(") L#thecheck W(")")) @@ -84,9 +83,6 @@ #define ANNOTATION_FN_FORBID_FAULT __annotation(W("FORBID_FAULT ") SCAN_WIDEN(__FUNCTION__)) #define ANNOTATION_FN_GC_TRIGGERS __annotation(W("GC_TRIGGERS ") SCAN_WIDEN(__FUNCTION__)) #define ANNOTATION_FN_GC_NOTRIGGER __annotation(W("GC_NOTRIGGER ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_SO_TOLERANT __annotation(W("SO_TOLERANT ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_SO_INTOLERANT __annotation(W("SO_INTOLERANT ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_SO_NOT_MAINLINE __annotation(W("SO_NOT_MAINLINE ") SCAN_WIDEN(__FUNCTION__)) #define ANNOTATION_FN_MODE_COOPERATIVE __annotation(W("MODE_COOPERATIVE ") SCAN_WIDEN(__FUNCTION__)) #define ANNOTATION_FN_MODE_PREEMPTIVE __annotation(W("MODE_PREEMPTIVE ") SCAN_WIDEN(__FUNCTION__)) #define ANNOTATION_FN_MODE_ANY __annotation(W("MODE_ANY ") SCAN_WIDEN(__FUNCTION__)) @@ -126,7 +122,6 @@ #define ANNOTATION_IGNORE_LOCK { } #define ANNOTATION_IGNORE_FAULT { } #define ANNOTATION_IGNORE_TRIGGER { } -#define ANNOTATION_IGNORE_SO { } #define ANNOTATION_VIOLATION(violationmask) { } #define ANNOTATION_UNCHECKED(thecheck) { } @@ -150,9 +145,6 @@ #define ANNOTATION_FN_FORBID_FAULT { } #define ANNOTATION_FN_GC_TRIGGERS { } #define ANNOTATION_FN_GC_NOTRIGGER { } -#define ANNOTATION_FN_SO_TOLERANT { } -#define ANNOTATION_FN_SO_INTOLERANT { } -#define ANNOTATION_FN_SO_NOT_MAINLINE { } #define ANNOTATION_FN_MODE_COOPERATIVE { } #define ANNOTATION_FN_MODE_PREEMPTIVE { } #define ANNOTATION_FN_MODE_ANY { } @@ -165,11 +157,6 @@ #define ANNOTATION_SO_PROBE_BEGIN(probeAmount) { } #define ANNOTATION_SO_PROBE_END { } -#define ANNOTATION_SO_TOLERANT { } -#define ANNOTATION_SO_INTOLERANT { } -#define ANNOTATION_SO_NOT_MAINLINE { } -#define ANNOTATION_SO_NOT_MAINLINE_BEGIN { } -#define ANNOTATION_SO_NOT_MAINLINE_END { } #define ANNOTATION_ENTRY_POINT { } #ifdef _DEBUG #define ANNOTATION_DEBUG_ONLY { } @@ -198,25 +185,13 @@ #define STATIC_CONTRACT_LIMITED_METHOD ANNOTATION_FN_LEAF #define STATIC_CONTRACT_WRAPPER ANNOTATION_FN_WRAPPER -#ifdef FEATURE_STACK_PROBE // Static SO contracts only required when SO Infrastructure code is present -#define STATIC_CONTRACT_SO_INTOLERANT ANNOTATION_FN_SO_INTOLERANT -#define STATIC_CONTRACT_SO_TOLERANT ANNOTATION_FN_SO_TOLERANT -#define STATIC_CONTRACT_SO_NOT_MAINLINE ANNOTATION_FN_SO_NOT_MAINLINE - -#define STATIC_CONTRACT_ENTRY_POINT ANNOTATION_ENTRY_POINT; ANNOTATION_FN_SO_TOLERANT -#else // FEATURE_STACK_PROBE -#define STATIC_CONTRACT_SO_INTOLERANT -#define STATIC_CONTRACT_SO_TOLERANT -#define STATIC_CONTRACT_SO_NOT_MAINLINE #define STATIC_CONTRACT_ENTRY_POINT -#endif // FEATURE_STACK_PROBE #ifdef _DEBUG #define STATIC_CONTRACT_DEBUG_ONLY \ ANNOTATION_DEBUG_ONLY; \ STATIC_CONTRACT_CANNOT_TAKE_LOCK; \ - ANNOTATION_VIOLATION(TakesLockViolation); \ - ANNOTATION_FN_SO_NOT_MAINLINE; + ANNOTATION_VIOLATION(TakesLockViolation); #else #define STATIC_CONTRACT_DEBUG_ONLY #endif @@ -241,7 +216,6 @@ namespace StaticContract METHOD_CANNOT_BE_FOLDED_DEBUG; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; } static void used() @@ -289,47 +263,16 @@ typedef StaticContract::ScanThrowMarkerStandard ScanThrowMarker; #define STATIC_CONTRACT_THROWS_TERMINAL \ typedef StaticContract::ScanThrowMarkerTerminal ScanThrowMarker; if (0) ScanThrowMarker::used(); -#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && defined(FEATURE_STACK_PROBE) && !defined(_TARGET_ARM_) // @ARMTODO -extern void EnsureSOIntolerantOK(const char *szFunction, const char *szFile, int lineNum); - -extern BOOL (*g_fpShouldValidateSOToleranceOnThisThread)(); - -// @todo Is there any checks we can do here? -#define ENSURE_SHOULD_NOT_PROBE_FOR_SO - -#define CHECK_IF_SO_INTOLERANT_OK \ - EnsureSOIntolerantOK(__FUNCTION__, __FILE__, __LINE__); - -// Even if we can't have a full-blown contract, we can at least check -// if its ok to run an SO-Intolerant function. -#undef STATIC_CONTRACT_SO_INTOLERANT -#define STATIC_CONTRACT_SO_INTOLERANT \ - ANNOTATION_FN_SO_INTOLERANT; \ - CHECK_IF_SO_INTOLERANT_OK; - -#undef STATIC_CONTRACT_SO_NOT_MAINLINE -#define STATIC_CONTRACT_SO_NOT_MAINLINE \ - ENSURE_SHOULD_NOT_PROBE_FOR_SO \ - ANNOTATION_FN_SO_NOT_MAINLINE - -#else -#define EnsureSOIntolerantOK(x,y,z) - -#endif - - #ifdef _MSC_VER #define SCAN_IGNORE_THROW typedef StaticContract::ScanThrowMarkerIgnore ScanThrowMarker; ANNOTATION_IGNORE_THROW #define SCAN_IGNORE_LOCK ANNOTATION_IGNORE_LOCK #define SCAN_IGNORE_FAULT ANNOTATION_IGNORE_FAULT #define SCAN_IGNORE_TRIGGER ANNOTATION_IGNORE_TRIGGER -#define SCAN_IGNORE_SO ANNOTATION_IGNORE_SO #else #define SCAN_IGNORE_THROW #define SCAN_IGNORE_LOCK #define SCAN_IGNORE_FAULT #define SCAN_IGNORE_TRIGGER -#define SCAN_IGNORE_SO #endif diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h index 3c5a686..a647d0c 100644 --- a/src/inc/utilcode.h +++ b/src/inc/utilcode.h @@ -4634,7 +4634,6 @@ inline void ClrFlsSetThreadType (TlsThreadTypeFlag flag) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; ClrFlsSetValue (TlsIdx_ThreadType, (LPVOID)(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) |flag)); } @@ -4681,7 +4680,6 @@ inline BOOL IsGCThread () STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_SUPPORTS_DAC; - STATIC_CONTRACT_SO_TOLERANT; #if !defined(DACCESS_COMPILE) return IsGCSpecialThread () || IsSuspendEEThread (); diff --git a/src/md/compiler/regmeta_import.cpp b/src/md/compiler/regmeta_import.cpp index f60fc88..67bf9f3 100644 --- a/src/md/compiler/regmeta_import.cpp +++ b/src/md/compiler/regmeta_import.cpp @@ -80,9 +80,6 @@ void STDMETHODCALLTYPE RegMeta::CloseEnum( if (pmdEnum == NULL) return; - // This function may be called through RCW. When hosted, we have probed before this call, so the - // following contract violation is OK. - CONTRACT_VIOLATION(SOToleranceViolation); HENUMInternal::DestroyEnum(pmdEnum); END_CLEANUP_ENTRYPOINT; } // RegMeta::CloseEnum diff --git a/src/md/compiler/regmeta_vm.cpp b/src/md/compiler/regmeta_vm.cpp index 4b227ad..de9ace9 100644 --- a/src/md/compiler/regmeta_vm.cpp +++ b/src/md/compiler/regmeta_vm.cpp @@ -252,10 +252,6 @@ ErrExit: // Thus Release() is in a satellite lib. ULONG RegMeta::Release() { - // This is called during cleanup. We can not fail this call by probing. - // As long as we make sure the cleanup does not use too much space through - // BEGIN_CLEANUP_ENTRYPOINT, we are OK. - CONTRACT_VIOLATION (SOToleranceViolation); BEGIN_CLEANUP_ENTRYPOINT; #if defined(FEATURE_METADATA_IN_VM) diff --git a/src/md/enc/mdinternalrw.cpp b/src/md/enc/mdinternalrw.cpp index 75c7939..c8f844d 100644 --- a/src/md/enc/mdinternalrw.cpp +++ b/src/md/enc/mdinternalrw.cpp @@ -2425,8 +2425,6 @@ MDInternalRW::GetNestedClassProps( HRESULT hr = NOERROR; RID rid; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - LOCKREAD(); if (!m_pStgdb->m_MiniMd.IsSorted(TBL_NestedClass) && !m_pStgdb->m_MiniMd.IsTableVirtualSorted(TBL_NestedClass)) @@ -2454,7 +2452,6 @@ MDInternalRW::GetNestedClassProps( } ErrExit: - END_SO_INTOLERANT_CODE; return hr; } // MDInternalRW::GetNestedClassProps @@ -4334,9 +4331,6 @@ HRESULT MDInternalRW::ApplyEditAndContinue( _ASSERTE(pDeltaMD); _ASSERTE(ppv); - // debugging-specific usages don't need SO hardening - SO_NOT_MAINLINE_FUNCTION; - HRESULT hr = E_FAIL; IMDInternalImportENC *pDeltaMDImport = NULL; diff --git a/src/md/enc/metamodelrw.cpp b/src/md/enc/metamodelrw.cpp index 6a3bc32..74b6b87 100644 --- a/src/md/enc/metamodelrw.cpp +++ b/src/md/enc/metamodelrw.cpp @@ -1805,8 +1805,6 @@ CMiniMdRW::ConvertToRW() if (IsMinimalDelta()) return CLDB_E_INCOMPATIBLE; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - IfFailGo(m_StringHeap.MakeWritable()); IfFailGo(m_GuidHeap.MakeWritable()); IfFailGo(m_UserStringHeap.MakeWritable()); @@ -1828,8 +1826,6 @@ CMiniMdRW::ConvertToRW() m_fIsReadOnly = false; ErrExit: - ; - END_SO_INTOLERANT_CODE; return hr; } // CMiniMdRW::ConvertToRW diff --git a/src/md/runtime/mdinternaldisp.cpp b/src/md/runtime/mdinternaldisp.cpp index 6498b35..ffed8bb 100644 --- a/src/md/runtime/mdinternaldisp.cpp +++ b/src/md/runtime/mdinternaldisp.cpp @@ -170,8 +170,6 @@ STDAPI GetMDInternalInterface( IMDCommon *pInternalROMDCommon = NULL; MDFileFormat format; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - if (ppIUnk == NULL) IfFailGo(E_INVALIDARG); @@ -215,8 +213,6 @@ ErrExit: if ( pInternalROMDCommon ) pInternalROMDCommon->Release(); - END_SO_INTOLERANT_CODE; - return hr; } // GetMDInternalInterface diff --git a/src/strongname/api/common.h b/src/strongname/api/common.h index 113885c..0c959d2 100644 --- a/src/strongname/api/common.h +++ b/src/strongname/api/common.h @@ -315,7 +315,6 @@ namespace Loader #include "regdisp.h" #include "stackframe.h" #include "gms.h" -#include "stackprobe.h" #include "fcall.h" #include "syncblk.h" #include "gcdesc.h" @@ -382,7 +381,6 @@ extern DummyGlobalContract ___contract; #include "domainfile.inl" #include "clsload.inl" #include "method.inl" -#include "stackprobe.inl" #include "syncblk.inl" #include "threads.inl" #include "eehash.inl" diff --git a/src/utilcode/arraylist.cpp b/src/utilcode/arraylist.cpp index 30793c4..f77657d 100644 --- a/src/utilcode/arraylist.cpp +++ b/src/utilcode/arraylist.cpp @@ -44,7 +44,6 @@ PTR_VOID * ArrayListBase::GetPtr(DWORD index) const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_CANNOT_TAKE_LOCK; SUPPORTS_DAC; diff --git a/src/utilcode/ccomprc.cpp b/src/utilcode/ccomprc.cpp index 431b5d5..6071a56 100644 --- a/src/utilcode/ccomprc.cpp +++ b/src/utilcode/ccomprc.cpp @@ -138,7 +138,6 @@ HRESULT GetMUILanguageNames(__inout StringArrayList* pCultureNames) NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pCultureNames)); - SO_INTOLERANT; } CONTRACTL_END; diff --git a/src/utilcode/check.cpp b/src/utilcode/check.cpp index 1ee4d42..c444e0c 100644 --- a/src/utilcode/check.cpp +++ b/src/utilcode/check.cpp @@ -75,7 +75,6 @@ SPECIALIZED_VIOLATION(GCViolation); SPECIALIZED_VIOLATION(ModeViolation); SPECIALIZED_VIOLATION(FaultViolation); SPECIALIZED_VIOLATION(FaultNotFatal); -SPECIALIZED_VIOLATION(SOToleranceViolation); SPECIALIZED_VIOLATION(HostViolation); SPECIALIZED_VIOLATION(TakesLockViolation); SPECIALIZED_VIOLATION(LoadsTypeViolation); @@ -85,26 +84,21 @@ SPECIALIZED_VIOLATION(LoadsTypeViolation); SPECIALIZED_VIOLATION(ThrowsViolation|GCViolation); SPECIALIZED_VIOLATION(ThrowsViolation|GCViolation|TakesLockViolation); -SPECIALIZED_VIOLATION(ThrowsViolation|SOToleranceViolation); SPECIALIZED_VIOLATION(ThrowsViolation|ModeViolation); SPECIALIZED_VIOLATION(ThrowsViolation|FaultNotFatal); SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation); SPECIALIZED_VIOLATION(ThrowsViolation|TakesLockViolation); -SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation|SOToleranceViolation); SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation|TakesLockViolation); SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation|GCViolation); SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation|GCViolation|TakesLockViolation|LoadsTypeViolation); SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation|GCViolation|ModeViolation); SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation|GCViolation|ModeViolation|FaultNotFatal); SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation|GCViolation|ModeViolation|FaultNotFatal|TakesLockViolation); -SPECIALIZED_VIOLATION(GCViolation|SOToleranceViolation); SPECIALIZED_VIOLATION(GCViolation|FaultViolation); -SPECIALIZED_VIOLATION(GCViolation|FaultViolation|SOToleranceViolation); -SPECIALIZED_VIOLATION(GCViolation|FaultViolation|ModeViolation|SOToleranceViolation); -SPECIALIZED_VIOLATION(GCViolation|ModeViolation|SOToleranceViolation); -SPECIALIZED_VIOLATION(GCViolation|ModeViolation|SOToleranceViolation|FaultNotFatal); -SPECIALIZED_VIOLATION(GCViolation|ModeViolation|SOToleranceViolation|FaultNotFatal|TakesLockViolation); +SPECIALIZED_VIOLATION(GCViolation|FaultNotFatal|ModeViolation); SPECIALIZED_VIOLATION(GCViolation|FaultNotFatal|TakesLockViolation); +SPECIALIZED_VIOLATION(GCViolation|FaultNotFatal|TakesLockViolation|ModeViolation); +SPECIALIZED_VIOLATION(GCViolation|ModeViolation); SPECIALIZED_VIOLATION(FaultViolation|FaultNotFatal); SPECIALIZED_VIOLATION(FaultNotFatal|TakesLockViolation); @@ -121,7 +115,6 @@ SPECIALIZED_VIOLATION(FaultNotFatal|TakesLockViolation); void CHECK::Trigger(LPCSTR reason) { - STATIC_CONTRACT_SO_NOT_MAINLINE; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; @@ -168,7 +161,6 @@ void CHECK::Trigger(LPCSTR reason) void CHECK::Setup(LPCSTR message, LPCSTR condition, LPCSTR file, INT line) { - STATIC_CONTRACT_SO_NOT_MAINLINE; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; @@ -222,7 +214,6 @@ void CHECK::Setup(LPCSTR message, LPCSTR condition, LPCSTR file, INT line) LPCSTR CHECK::FormatMessage(LPCSTR messageFormat, ...) { - STATIC_CONTRACT_SO_NOT_MAINLINE; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; @@ -279,7 +270,6 @@ LPCSTR CHECK::AllocateDynamicMessage(const SString &s) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_NOT_MAINLINE; // Make a copy of it. StackScratchBuffer buffer; diff --git a/src/utilcode/clrconfig.cpp b/src/utilcode/clrconfig.cpp index 3d16791..498601f 100644 --- a/src/utilcode/clrconfig.cpp +++ b/src/utilcode/clrconfig.cpp @@ -100,7 +100,6 @@ BOOL CLRConfig::IsConfigEnabled(const ConfigDWORDInfo & info) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_INTOLERANT; } CONTRACTL_END; @@ -206,7 +205,6 @@ DWORD CLRConfig::GetConfigValue(const ConfigDWORDInfo & info, bool acceptExplici NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; // Need this to be tolerant to stack overflows since REGUTIL::GetConfigDWORD was too. (This replaces calls to REGUTIL::GetConfigDWORD) } CONTRACTL_END; diff --git a/src/utilcode/clrhost.cpp b/src/utilcode/clrhost.cpp index e48a193..649e91e 100644 --- a/src/utilcode/clrhost.cpp +++ b/src/utilcode/clrhost.cpp @@ -223,7 +223,6 @@ HMODULE GetCLRModule () //! So don't put in a runtime contract and don't invoke other functions in the CLR (not even _ASSERTE!) STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; // DAC can call in here since we initialize the SxS callbacks in ClrDataAccess::Initialize. #ifdef DACCESS_COMPILE diff --git a/src/utilcode/clrhost_nodependencies.cpp b/src/utilcode/clrhost_nodependencies.cpp index 9b66717..d881e1e 100644 --- a/src/utilcode/clrhost_nodependencies.cpp +++ b/src/utilcode/clrhost_nodependencies.cpp @@ -172,8 +172,6 @@ ClrDebugState *CLRInitDebugState() // and has low perf impact. static ClrDebugState gBadClrDebugState; gBadClrDebugState.ViolationMaskSet( AllViolation ); - // SO_INFRASTRUCTURE_CODE() Macro to remove SO infrastructure code during build - SO_INFRASTRUCTURE_CODE(gBadClrDebugState.BeginSOTolerant();) gBadClrDebugState.SetOkToThrow(); ClrDebugState *pNewClrDebugState = NULL; @@ -340,8 +338,6 @@ ClrDebugState *CLRInitDebugState() LPVOID ClrAllocInProcessHeapBootstrap (DWORD dwFlags, SIZE_T dwBytes) { - STATIC_CONTRACT_SO_INTOLERANT; - #if defined(SELF_NO_HOST) static HANDLE hHeap = NULL; @@ -366,8 +362,6 @@ FastAllocInProcessHeapFunc __ClrAllocInProcessHeap = (FastAllocInProcessHeapFunc BOOL ClrFreeInProcessHeapBootstrap (DWORD dwFlags, LPVOID lpMem) { - STATIC_CONTRACT_SO_INTOLERANT; - #if defined(SELF_NO_HOST) static HANDLE hHeap = NULL; @@ -406,7 +400,6 @@ operator new(size_t n) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // The memory allocation itself should be SO-tolerant. But we must protect the use of it. STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; void * result = ClrAllocInProcessHeap(0, S_SIZE_T(n)); @@ -427,7 +420,6 @@ operator new[](size_t n) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // The memory allocation itself should be SO-tolerant. But we must protect the use of it. STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; void * result = ClrAllocInProcessHeap(0, S_SIZE_T(n)); @@ -449,7 +441,6 @@ void * __cdecl operator new(size_t n, const NoThrow&) NOEXCEPT STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // The memory allocation itself should be SO-tolerant. But we must protect the use of it. STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN())); @@ -469,7 +460,6 @@ void * __cdecl operator new[](size_t n, const NoThrow&) NOEXCEPT STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // The memory allocation itself should be SO-tolerant. But we must protect the use of it. STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN())); @@ -488,7 +478,6 @@ operator delete(void *p) NOEXCEPT { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; // The memory management routines should be SO-tolerant. STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; if (p != NULL) @@ -501,7 +490,6 @@ operator delete[](void *p) NOEXCEPT { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; // The memory management routines should be SO-tolerant. STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; if (p != NULL) @@ -529,7 +517,6 @@ void * __cdecl operator new(size_t n, const CExecutable&) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // The memory management routines should be SO-tolerant. HANDLE hExecutableHeap = ClrGetProcessExecutableHeap(); if (hExecutableHeap == NULL) { @@ -553,7 +540,6 @@ void * __cdecl operator new[](size_t n, const CExecutable&) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // The memory management routines should be SO-tolerant. HANDLE hExecutableHeap = ClrGetProcessExecutableHeap(); if (hExecutableHeap == NULL) { @@ -573,7 +559,6 @@ void * __cdecl operator new(size_t n, const CExecutable&, const NoThrow&) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // The memory management routines should be SO-tolerant. INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN())); @@ -591,7 +576,6 @@ void * __cdecl operator new[](size_t n, const CExecutable&, const NoThrow&) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // The memory management routines should be SO-tolerant. INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN())); @@ -667,7 +651,6 @@ IExecutionEngine *GetExecutionEngine() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; SUPPORTS_DAC_HOST_ONLY; if (g_pExecutionEngine == NULL) @@ -701,7 +684,6 @@ IExecutionEngine *GetExecutionEngine() IEEMemoryManager * GetEEMemoryManager() { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_CANNOT_TAKE_LOCK; @@ -747,7 +729,6 @@ void ClrFlsAssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback) LPVOID *ClrFlsGetBlockGeneric() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return (LPVOID *) GetExecutionEngine()->TLS_GetDataBlock(); } diff --git a/src/utilcode/collections.cpp b/src/utilcode/collections.cpp index c10f8c4..a1b050d 100644 --- a/src/utilcode/collections.cpp +++ b/src/utilcode/collections.cpp @@ -169,7 +169,6 @@ BYTE *CHashTable::Find( // Index of struct in m_pcEntries. CONTRACTL { NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; SUPPORTS_DAC; } diff --git a/src/utilcode/debug.cpp b/src/utilcode/debug.cpp index 943d7a3..40c5c0e 100644 --- a/src/utilcode/debug.cpp +++ b/src/utilcode/debug.cpp @@ -215,7 +215,6 @@ VOID LogAssert( { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_DEBUG_ONLY; // Log asserts to the stress log. Note that we can't include the szExpr b/c that @@ -687,19 +686,6 @@ VOID DbgAssertDialog(const char *szFile, int iLine, const char *szExpr) DWORD dwAssertStacktrace = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_AssertStacktrace); -#if !defined(DACCESS_COMPILE) && defined(FEATURE_STACK_PROBE) - //global g_fpCheckNStackPagesAvailable is not present when SO infrastructure code is not present - // Trying to get a stack trace if there is little stack available can cause a silent process - // teardown, so only try to do this there is plenty of stack. - if ((dwAssertStacktrace) != 0 && (g_fpCheckNStackPagesAvailable != NULL)) - { - if (!g_fpCheckNStackPagesAvailable(12)) - { - fConstrained = TRUE; - } - } -#endif - LONG lAlreadyOwned = InterlockedExchange((LPLONG)&g_BufferLock, 1); if (fConstrained || dwAssertStacktrace == 0 || lAlreadyOwned == 1) { diff --git a/src/utilcode/ex.cpp b/src/utilcode/ex.cpp index 2360f29..1b5bfa7 100644 --- a/src/utilcode/ex.cpp +++ b/src/utilcode/ex.cpp @@ -68,7 +68,6 @@ void Exception::Delete(Exception* pvMemory) { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; SUPPORTS_DAC_HOST_ONLY; // Exceptions aren't currently marshalled by DAC - just used in the host } CONTRACTL_END; @@ -969,7 +968,6 @@ void DECLSPEC_NORETURN ThrowHR(HRESULT hr) void DECLSPEC_NORETURN ThrowHR(HRESULT hr, SString const &msg) { - STATIC_CONTRACT_SO_TOLERANT; WRAPPER_NO_CONTRACT; STRESS_LOG1(LF_EH, LL_INFO100, "ThrowHR: HR = %x\n", hr); @@ -1009,7 +1007,6 @@ void DECLSPEC_NORETURN ThrowHR(HRESULT hr, UINT uText) void DECLSPEC_NORETURN ThrowWin32(DWORD err) { - STATIC_CONTRACT_SO_TOLERANT; WRAPPER_NO_CONTRACT; if (err == ERROR_NOT_ENOUGH_MEMORY) { @@ -1035,7 +1032,6 @@ void DECLSPEC_NORETURN ThrowOutOfMemory() { THROWS; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -1067,40 +1063,12 @@ void DECLSPEC_NORETURN ThrowOutOfMemory() #include "corexcep.h" -#ifdef FEATURE_STACK_PROBE -void DECLSPEC_NORETURN ThrowStackOverflow() -{ - CONTRACTL - { - // This should be throws... But it isn't because a SO doesn't technically - // fall into the same THROW/NOTHROW conventions as the rest of the contract - // infrastructure. - NOTHROW; - - GC_NOTRIGGER; - SO_TOLERANT; - SUPPORTS_DAC; - } - CONTRACTL_END; - - //g_hrFatalError=COR_E_STACKOVERFLOW; - PTR_INT32 p_ghrFatalError = dac_cast(GVAL_ADDR(g_hrFatalError)); - _ASSERTE(p_ghrFatalError != NULL); - *p_ghrFatalError = COR_E_STACKOVERFLOW; - - - RaiseException(EXCEPTION_SOFTSO, 0, 0, NULL); - UNREACHABLE(); -} -#endif - void DECLSPEC_NORETURN ThrowMessage(LPCSTR string, ...) { CONTRACTL { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1308,22 +1276,7 @@ DWORD GetCurrentExceptionCode() bool IsCurrentExceptionSO() { WRAPPER_NO_CONTRACT; - DWORD exceptionCode = GetCurrentExceptionCode(); - return IsSOExceptionCode(exceptionCode); -} - -bool IsSOExceptionCode(DWORD exceptionCode) -{ - if (exceptionCode == STATUS_STACK_OVERFLOW -#ifdef FEATURE_STACK_PROBE - || exceptionCode == EXCEPTION_SOFTSO -#endif - ) - { - return TRUE; - } - else - return FALSE; + return GetCurrentExceptionCode() == STATUS_STACK_OVERFLOW; } @@ -1417,7 +1370,6 @@ BOOL WasThrownByUs(const EXCEPTION_RECORD *pcER, DWORD dwExceptionCode) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; _ASSERTE(IsInstanceTaggedSEHCode(dwExceptionCode)); diff --git a/src/utilcode/genericstackprobe.cpp b/src/utilcode/genericstackprobe.cpp deleted file mode 100644 index aa7e198..0000000 --- a/src/utilcode/genericstackprobe.cpp +++ /dev/null @@ -1,510 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// -//***************************************************************************** -// genericstackprobe.cpp -// -// This contains code for generic SO stack probes outside the VM, where we don't have a thread object -// -//***************************************************************************** - -#include "stdafx.h" // Precompiled header key. -#include "utilcode.h" -#include "genericstackprobe.h" -#include "log.h" - -#if defined(FEATURE_STACK_PROBE) && !defined(DACCESS_COMPILE) - -#ifdef ENABLE_CONTRACTS_IMPL -BOOL g_EnableDefaultRWValidation = FALSE; -#endif - -bool g_StackProbingEnabled; -void (*g_fpCheckForSOInSOIntolerantCode)(); -void (*g_fpSetSOIntolerantTransitionMarker)(); -BOOL (*g_fpDoProbe)(unsigned int n); -void (*g_fpHandleSoftStackOverflow)(BOOL fSkipDebugger); - -// This function is used for NO_THROW probes that have no error return path. In this -// case, we'll just force a stack overflow exception. Do not call it directly - use -// one of the FORCE_SO macros. -void DontCallDirectlyForceStackOverflow() -{ -#ifdef _PREFAST_ -#pragma warning(push) -#pragma warning(disable:26001) // "Suppress PREFast warning about underflows" -#endif - - UINT_PTR *sp = NULL; - // we don't have access to GetCurrentSP from here, so just get an approximation - sp = (UINT_PTR *)&sp; - while (TRUE) - { - sp -= (GetOsPageSize() / sizeof(UINT_PTR)); - *sp = NULL; - } - -#ifdef _PREFAST_ -#pragma warning(pop) -#endif -} - -void (*g_fpHandleStackOverflowAfterCatch)() = 0; - -// HandleStackOverflowAfterCatch -// -void HandleStackOverflowAfterCatch() -{ - if (!g_fpHandleStackOverflowAfterCatch) - { - // If g_fpUnwindGuardChainTo has not been set, then we haven't called InitStackProbes - // and we aren't probing, so bail. - return; - } - - // Reset the SO-tolerance state and restore the current guard - g_fpHandleStackOverflowAfterCatch(); -} - -NOINLINE void SOIntolerantTransitionHandler::CtorImpl() -{ - m_exceptionOccurred = true; - m_pPreviousHandler = ClrFlsGetValue(TlsIdx_SOIntolerantTransitionHandler); - g_fpSetSOIntolerantTransitionMarker(); -} - -NOINLINE void SOIntolerantTransitionHandler::DtorImpl() -{ - // if we take a stack overflow exception in SO intolerant code, then we must - // rip the process. We check this by determining if the SP is beyond the calculated - // limit. Checking for the guard page being present is too much overhead during - // exception handling (if you can believe that) and impacts perf. - - if (m_exceptionOccurred) - { - g_fpCheckForSOInSOIntolerantCode(); - } - - ClrFlsSetValue(TlsIdx_SOIntolerantTransitionHandler, m_pPreviousHandler); -} - -#ifdef STACK_GUARDS_DEBUG - -// If this is TRUE, we'll make the stack page that we put our stack marker in PAGE_NOACCESS so that you get an AV -// as soon as you go past the stack guard. -BOOL g_ProtectStackPagesInDebugger = FALSE; - -// This is the smallest size backout probe for which we will try to do a virtual protect for debugging. -// If this number is too small, the 1 page ganularity of VirtualProtect becomes a problem. This number -// should be less than or equal to the default backout probe size. -#define MINIMUM_PAGES_FOR_DEBUGGER_PROTECTION 4.0 - -void (*g_fpRestoreCurrentStackGuard)(BOOL fDisabled) = 0; -BOOL g_EnableBackoutStackValidation = FALSE; -BOOL (*g_fpShouldValidateSOToleranceOnThisThread)() = 0; -BOOL (*g_fp_BaseStackGuard_RequiresNStackPages)(BaseStackGuardGeneric *pGuard, unsigned int n, BOOL fThrowOnSO) = NULL; -void (*g_fp_BaseStackGuard_CheckStack)(BaseStackGuardGeneric *pGuard) = NULL; -BOOL (*g_fpCheckNStackPagesAvailable)(unsigned int n) = NULL; - -// Always initialize g_EntryPointProbeAmount to a valid value as there could be a race where a -// function probes with g_EntryPointProbeAmount's value before it is initialized in InitStackProbes. -DWORD g_EntryPointProbeAmount = DEFAULT_ENTRY_PROBE_SIZE; - -// RestoreSOToleranceState -// -// Restores the EE SO-tolerance state after a catch. - -void RestoreSOToleranceState() -{ - if (!g_fpRestoreCurrentStackGuard) - { - // If g_fpUnwindGuardChainTo has not been set, then we haven't called InitStackProbes - // and we aren't probing, so bail. - return; - } - - // Reset the SO-tolerance state and restore the current guard - g_fpRestoreCurrentStackGuard(FALSE); -} - -// -// EnsureSOTolerant ASSERTS if we are not in an SO-tolerant mode -// -void EnsureSOTolerant() -{ -#ifdef ENABLE_CONTRACTS_IMPL - ClrDebugState *pClrDebugState = GetClrDebugState(); - _ASSERTE(! pClrDebugState || pClrDebugState->IsSOTolerant()); -#endif -} - -DEBUG_NOINLINE DebugSOIntolerantTransitionHandler::DebugSOIntolerantTransitionHandler() - : SOIntolerantTransitionHandler() -{ - SCAN_SCOPE_BEGIN; - // This CANNOT be a STATIC_CONTRACT_SO_INTOLERANT b/c that isn't - // really just a static contract, it is actually calls EnsureSOIntolerantOK - // as well. Instead we just use the annotation. - ANNOTATION_FN_SO_INTOLERANT; -#ifdef ENABLE_CONTRACTS_IMPL - m_clrDebugState = GetClrDebugState(); - if (m_clrDebugState) - { - m_prevSOTolerantState = m_clrDebugState->BeginSOIntolerant(); - } -#endif -} - -DEBUG_NOINLINE DebugSOIntolerantTransitionHandler::~DebugSOIntolerantTransitionHandler() -{ - SCAN_SCOPE_END; - - if (m_clrDebugState) - { - m_clrDebugState->SetSOTolerance(m_prevSOTolerantState); - } -} - -// This is effectively an implicit probe, because we are guaranteeing that we have -// enought stack to run and will not take an SO. So we enter SO-intolerant code when -// we install one of these. -DEBUG_NOINLINE BaseStackMarker::BaseStackMarker(float numPages, BOOL fAllowDisabling) - : m_prevWasSOTolerant(FALSE) - , m_pDebugState( -#ifdef ENABLE_CONTRACTS_IMPL - CheckClrDebugState() -#else - NULL -#endif - ) - , m_fMarkerSet(FALSE) - , m_fTemporarilyDisabled(FALSE), m_fAddedToStack(FALSE), m_pPrevious(NULL) - , m_numPages(0.0), m_pMarker(NULL) - , m_fProtectedStackPage(FALSE), m_fAllowDisabling(fAllowDisabling) -{ - SCAN_SCOPE_BEGIN; - // This CANNOT be a STATIC_CONTRACT_SO_INTOLERANT b/c that isn't - // really just a static contract, it is actually calls EnsureSOIntolerantOK - // as well. Instead we just use the annotation. - ANNOTATION_FN_SO_INTOLERANT; - - { - DEBUG_ONLY_REGION(); - // If backout stack validation isn't enabled then we are done. - if (!g_EnableBackoutStackValidation) - { - return; - } - - // If we can't talk to other markers then the markers could get in each others way - if (!m_pDebugState) - { - return; - } - - // Allow only the lowest marker to be active at any one time. Yes, this means that - // the stack will only ever have one element in it. However having multiple markers - // is problematic for debugging and conflicts with the VirtualProtect option. It - // adds little value, in that small backout checks stop happening in exception - // codepaths, but these get plenty of coverage in success cases and the lowest - // placed marked is the one that could actually indicate a stack overflow. - if (!m_pDebugState->GetStackMarkerStack().IsEmpty()) - { - return; - } - - // Switch the SO tolerance mode - m_prevWasSOTolerant = m_pDebugState->SetSOTolerance(FALSE); - - // If we have less then numPages left before the end of the stack then there is - // no point in adding a marker since we will take an SO anyway if we use too much - // stack. Putting the marker is actually very bad since it artificially forces an - // SO in cases where it wouldn't normally occur if we use less than num pages of stack. - if (g_fpCheckNStackPagesAvailable && - !g_fpCheckNStackPagesAvailable(numPages < 1 ? 1 : (unsigned int)numPages)) - { - return; - } - - if (m_fAllowDisabling) - { - // Push ourselves on to the stack of stack markers on the CLR debug state. - m_pDebugState->GetStackMarkerStack().PushStackMarker(this); - m_fAddedToStack = TRUE; - } - - // Set the actual stack guard marker if we have enough stack to do so. - SetMarker(numPages); - - if (m_fMarkerSet && m_fAllowDisabling) - { - ProtectMarkerPageInDebugger(); - } - } -} - -// we have this so that the check of the global can be inlined -// and we don't make the call to CheckMarker unless we need to. -DEBUG_NOINLINE void BaseStackMarker::CheckForBackoutViolation() -{ - SCAN_SCOPE_END; - - // If backout stack validation isn't enabled then we are done. - if (!g_EnableBackoutStackValidation) - { - return; - } - - { - DEBUG_ONLY_REGION() - - // The marker should always be re-enabled at this point. - CONSISTENCY_CHECK_MSG(!m_fTemporarilyDisabled, "The stack guard was disabled but not properly re-enabled. This is a bug somewhere in the code called after this marker has been set up."); - - if (!m_pDebugState || m_fTemporarilyDisabled) - { - return; - } - - // Reset the SO tolerance of the thread. - m_pDebugState->SetSOTolerance(m_prevWasSOTolerant); - - if (m_fAddedToStack) - { - // Pop ourselves off of the stack of stack markers on the CLR debug state. - CONSISTENCY_CHECK(m_pDebugState != NULL); - BaseStackMarker *pPopResult = m_pDebugState->GetStackMarkerStack().PopStackMarker(); - - CONSISTENCY_CHECK_MSG(pPopResult == this, "The marker we pop off the stack should always be the current marker."); - CONSISTENCY_CHECK_MSG(m_pPrevious == NULL, "PopStackMarker should reset the current marker's m_pPrevious field to NULL."); - } - - // Not cancellable markers should only be checked when no cancellable markers are present. - if (!m_fAllowDisabling && !(m_pDebugState->GetStackMarkerStack().IsEmpty())) - { - return; - } - - if (m_fProtectedStackPage) - { - UndoPageProtectionInDebugger(); - } - - if (m_fMarkerSet) - { - // Check to see if we overwrote the stack guard marker. - CheckMarker(); - } - } -} - -void BaseStackMarker::SetMarker(float numPages) -{ - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - - m_numPages = numPages; - - // Use the address of the argument to get the current stack pointer. Note that this - // won't be the exact SP; however it will be close enough. - LPVOID pStack = &numPages; - - UINT_PTR *pMarker = (UINT_PTR*)pStack - (int)(GetOsPageSize() / sizeof(UINT_PTR) * m_numPages); - - // We might not have committed our stack yet, so allocate the number of pages - // we need so that they will be commited and we won't AV when we try to set the mark. - _alloca( (int)(GetOsPageSize() * m_numPages) ); - m_pMarker = pMarker; - *m_pMarker = STACK_COOKIE_VALUE; - - m_fMarkerSet = TRUE; - -} - -void BaseStackMarker::RareDisableMarker() -{ - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - - if (m_fProtectedStackPage) - { - UndoPageProtectionInDebugger(); - } - - m_fTemporarilyDisabled = TRUE; - - if (m_fMarkerSet) - { - *m_pMarker = DISABLED_STACK_COOKIE_VALUE; - } -} - -void BaseStackMarker::RareReEnableMarker() -{ - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - - m_fTemporarilyDisabled = FALSE; - - if (m_fMarkerSet) { - *m_pMarker = STACK_COOKIE_VALUE; - } - - if (m_fProtectedStackPage) - { - ProtectMarkerPageInDebugger(); - } -} - -//----------------------------------------------------------------------------- -// Protect the page where we put the marker if a debugger is attached. That way, you get an AV right away -// when you go past the stack guard when running under a debugger. -//----------------------------------------------------------------------------- -void BaseStackMarker::ProtectMarkerPageInDebugger() -{ - WRAPPER_NO_CONTRACT; - DEBUG_ONLY_FUNCTION; - - if (!g_ProtectStackPagesInDebugger) - { - return; - } - - if (m_numPages < MINIMUM_PAGES_FOR_DEBUGGER_PROTECTION) - { - return; - } - - DWORD flOldProtect; - - LOG((LF_EH, LL_INFO100000, "BSM::PMP: m_pMarker 0x%p, value 0x%p\n", m_pMarker, *m_pMarker)); - - // We cannot call into host for VirtualProtect. EEVirtualProtect will try to restore previous - // guard, but the location has been marked with PAGE_NOACCESS. -#undef VirtualProtect - BOOL fSuccess = ::VirtualProtect(m_pMarker, 1, PAGE_NOACCESS, &flOldProtect); - _ASSERTE(fSuccess); - -#define VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) \ - Dont_Use_VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) - - m_fProtectedStackPage = fSuccess; -} - -//----------------------------------------------------------------------------- -// Remove page protection installed for this probe -//----------------------------------------------------------------------------- -void BaseStackMarker::UndoPageProtectionInDebugger() -{ - WRAPPER_NO_CONTRACT; - DEBUG_ONLY_FUNCTION; - - _ASSERTE(m_fProtectedStackPage); - _ASSERTE(!m_fTemporarilyDisabled); - - DWORD flOldProtect; - // EEVirtualProtect installs a BoundaryStackGuard. To avoid recursion, we call - // into OS for VirtualProtect instead. -#undef VirtualProtect - BOOL fSuccess = ::VirtualProtect(m_pMarker, 1, PAGE_READWRITE, &flOldProtect); - _ASSERTE(fSuccess); - - LOG((LF_EH, LL_INFO100000, "BSM::UMP m_pMarker 0x%p\n", m_pMarker)); - -#define VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) \ - Dont_Use_VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) -} - -void BaseStackMarker::CheckMarker() -{ - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - - if ( IsMarkerOverrun(m_pMarker) ) - { - SOBackoutViolation(__FUNCTION__, __FILE__, __LINE__); - } -} - -AutoCleanupDisableBackoutStackValidation::AutoCleanupDisableBackoutStackValidation() -{ - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; -#ifdef ENABLE_CONTRACTS_IMPL - m_fAlreadyDisabled = GetClrDebugState()->GetStackMarkerStack().IsDisabled(); - if (!m_fAlreadyDisabled) - { - GetClrDebugState()->GetStackMarkerStack().RareDisableStackMarkers(); - } -#endif -} - -AutoCleanupDisableBackoutStackValidation::~AutoCleanupDisableBackoutStackValidation() -{ - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - -#ifdef ENABLE_CONTRACTS_IMPL - if (!m_fAlreadyDisabled) - { - GetClrDebugState()->GetStackMarkerStack().RareReEnableStackMarkers(); - } -#endif -} - -inline void StackMarkerStack::PushStackMarker(BaseStackMarker *pStackMarker) -{ - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - - pStackMarker->m_pPrevious = m_pTopStackMarker; - m_pTopStackMarker = pStackMarker; -} - -BaseStackMarker *StackMarkerStack::PopStackMarker() -{ - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - - BaseStackMarker *pOldTop = m_pTopStackMarker; - m_pTopStackMarker = pOldTop->m_pPrevious; - pOldTop->m_pPrevious = NULL; - return pOldTop; -} - -void StackMarkerStack::RareDisableStackMarkers() -{ - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - - // Walk up the stack of markers and disable them all. - BaseStackMarker *pCurrentStackMarker = m_pTopStackMarker; - while (pCurrentStackMarker) - { - pCurrentStackMarker->RareDisableMarker(); - pCurrentStackMarker = pCurrentStackMarker->m_pPrevious; - } - m_fDisabled = TRUE; -} - -void StackMarkerStack::RareReEnableStackMarkers() -{ - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_DEBUG_ONLY; - - // Walk up the stack of markers and re-enable them all. - BaseStackMarker *pCurrentStackMarker = m_pTopStackMarker; - while (pCurrentStackMarker) - { - pCurrentStackMarker->RareReEnableMarker(); - pCurrentStackMarker = pCurrentStackMarker->m_pPrevious; - } - m_fDisabled = FALSE; -} - -#endif // STACK_GUARDS_DEBUG - -#endif // FEATURE_STACK_PROBE && !DACCESS_COMPILE diff --git a/src/utilcode/loaderheap.cpp b/src/utilcode/loaderheap.cpp index a2f8c4f..0f3a069 100644 --- a/src/utilcode/loaderheap.cpp +++ b/src/utilcode/loaderheap.cpp @@ -236,7 +236,6 @@ BOOL RangeList::IsInRangeWorker(TADDR address, TADDR *pID /* = NULL */) NOTHROW; FORBID_FAULT; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END diff --git a/src/utilcode/log.cpp b/src/utilcode/log.cpp index c07ac8b..bde9fe5 100644 --- a/src/utilcode/log.cpp +++ b/src/utilcode/log.cpp @@ -388,8 +388,6 @@ VOID LogSpew(DWORD facility, DWORD level, const char *fmt, ... ) { STATIC_CONTRACT_WRAPPER; - ENTER_SO_NOT_MAINLINE_CODE; - #ifdef SELF_NO_HOST if (TRUE) #else //!SELF_NO_HOST @@ -406,16 +404,12 @@ VOID LogSpew(DWORD facility, DWORD level, const char *fmt, ... ) // Cannot acquire the required lock, as this would call back // into the host. Eat the log message. } - - LEAVE_SO_NOT_MAINLINE_CODE; } VOID LogSpew2(DWORD facility2, DWORD level, const char *fmt, ... ) { STATIC_CONTRACT_WRAPPER; - ENTER_SO_NOT_MAINLINE_CODE; - #ifdef SELF_NO_HOST if (TRUE) #else //!SELF_NO_HOST @@ -432,16 +426,12 @@ VOID LogSpew2(DWORD facility2, DWORD level, const char *fmt, ... ) // Cannot acquire the required lock, as this would call back // into the host. Eat the log message. } - - LEAVE_SO_NOT_MAINLINE_CODE; } VOID LogSpewAlways (const char *fmt, ... ) { STATIC_CONTRACT_WRAPPER; - ENTER_SO_NOT_MAINLINE_CODE; - #ifdef SELF_NO_HOST if (TRUE) #else //!SELF_NO_HOST @@ -458,8 +448,6 @@ VOID LogSpewAlways (const char *fmt, ... ) // Cannot acquire the required lock, as this would call back // into the host. Eat the log message. } - - LEAVE_SO_NOT_MAINLINE_CODE; } #endif // LOGGING diff --git a/src/utilcode/longfilepathwrappers.cpp b/src/utilcode/longfilepathwrappers.cpp index edd0aee..af77a01 100644 --- a/src/utilcode/longfilepathwrappers.cpp +++ b/src/utilcode/longfilepathwrappers.cpp @@ -42,7 +42,6 @@ LoadLibraryExWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -50,7 +49,6 @@ LoadLibraryExWrapper( HMODULE ret = NULL; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return NULL;) EX_TRY { @@ -69,7 +67,6 @@ LoadLibraryExWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK) { @@ -97,7 +94,6 @@ CreateFileWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -105,8 +101,6 @@ CreateFileWrapper( DWORD lastError; HANDLE ret = INVALID_HANDLE_VALUE; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return NULL;) - EX_TRY { LongPathString path(LongPathString::Literal, lpFileName); @@ -126,7 +120,6 @@ CreateFileWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -149,7 +142,6 @@ SetFileAttributesWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -157,8 +149,6 @@ SetFileAttributesWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString path(LongPathString::Literal, lpFileName); @@ -174,7 +164,6 @@ SetFileAttributesWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -196,7 +185,6 @@ GetFileAttributesWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -204,8 +192,6 @@ GetFileAttributesWrapper( DWORD ret = INVALID_FILE_ATTRIBUTES; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return INVALID_FILE_ATTRIBUTES;) - EX_TRY { LongPathString path(LongPathString::Literal, lpFileName); @@ -220,7 +206,6 @@ GetFileAttributesWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -244,7 +229,6 @@ GetFileAttributesExWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -252,8 +236,6 @@ GetFileAttributesExWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString path(LongPathString::Literal, lpFileName); @@ -271,7 +253,6 @@ GetFileAttributesExWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -293,7 +274,6 @@ DeleteFileWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -301,8 +281,6 @@ DeleteFileWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString path(LongPathString::Literal, lpFileName); @@ -317,7 +295,6 @@ DeleteFileWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -342,7 +319,6 @@ CopyFileWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -350,8 +326,6 @@ CopyFileWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString Existingpath(LongPathString::Literal, lpExistingFileName); @@ -369,7 +343,6 @@ CopyFileWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -393,7 +366,6 @@ MoveFileExWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -401,8 +373,6 @@ MoveFileExWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString Existingpath(LongPathString::Literal, lpExistingFileName); @@ -420,7 +390,6 @@ MoveFileExWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -448,7 +417,6 @@ SearchPathWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -456,8 +424,6 @@ SearchPathWrapper( DWORD ret = 0; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return 0;) - EX_TRY { LongPathString Existingpath(LongPathString::Literal, lpPath); @@ -518,7 +484,6 @@ SearchPathWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK) { @@ -542,7 +507,6 @@ GetShortPathNameWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -550,8 +514,6 @@ GetShortPathNameWrapper( HRESULT hr = S_OK; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return 0;) - EX_TRY { LongPathString longPath(LongPathString::Literal, lpszLongPath); @@ -582,7 +544,6 @@ GetShortPathNameWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -605,7 +566,6 @@ GetLongPathNameWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -613,8 +573,6 @@ GetLongPathNameWrapper( HRESULT hr = S_OK; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return 0;) - EX_TRY { LongPathString shortPath(LongPathString::Literal, lpszShortPath); @@ -646,7 +604,6 @@ GetLongPathNameWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -669,7 +626,6 @@ CreateDirectoryWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -677,8 +633,6 @@ CreateDirectoryWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString path(LongPathString::Literal, lpPathName); @@ -694,7 +648,6 @@ CreateDirectoryWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -716,7 +669,6 @@ RemoveDirectoryWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -724,8 +676,6 @@ RemoveDirectoryWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString path(LongPathString::Literal, lpPathName); @@ -740,7 +690,6 @@ RemoveDirectoryWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -762,7 +711,6 @@ GetModuleFileNameWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -770,8 +718,6 @@ GetModuleFileNameWrapper( DWORD ret = 0; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return 0;) - EX_TRY { COUNT_T size = buffer.GetUnicodeAllocation() + 1; @@ -800,7 +746,6 @@ GetModuleFileNameWrapper( buffer.CloseBuffer(ret); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK) { @@ -824,7 +769,6 @@ UINT WINAPI GetTempFileNameWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -832,8 +776,6 @@ UINT WINAPI GetTempFileNameWrapper( UINT ret = 0; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return 0;) - EX_TRY { //Change the behaviour in Redstone to retry @@ -852,7 +794,6 @@ UINT WINAPI GetTempFileNameWrapper( } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK) { @@ -872,7 +813,6 @@ DWORD WINAPI GetTempPathWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -880,8 +820,6 @@ DWORD WINAPI GetTempPathWrapper( DWORD ret = 0; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return 0;) - EX_TRY { //Change the behaviour in Redstone to retry @@ -896,7 +834,6 @@ DWORD WINAPI GetTempPathWrapper( lpBuffer.CloseBuffer(ret); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK) { @@ -917,7 +854,6 @@ DWORD WINAPI GetCurrentDirectoryWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -925,8 +861,6 @@ DWORD WINAPI GetCurrentDirectoryWrapper( DWORD ret = 0; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return 0;) - EX_TRY { //Change the behaviour in Redstone to retry @@ -941,7 +875,6 @@ DWORD WINAPI GetCurrentDirectoryWrapper( lpBuffer.CloseBuffer(ret); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK) { @@ -963,7 +896,6 @@ DWORD WINAPI GetEnvironmentVariableWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -971,8 +903,6 @@ DWORD WINAPI GetEnvironmentVariableWrapper( DWORD ret = 0; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return 0;) - EX_TRY { @@ -1004,7 +934,6 @@ DWORD WINAPI GetEnvironmentVariableWrapper( lpBuffer.CloseBuffer(ret); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK) { @@ -1031,7 +960,6 @@ CreateHardLinkWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -1039,8 +967,6 @@ CreateHardLinkWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString Existingpath(LongPathString::Literal, lpExistingFileName); @@ -1058,7 +984,6 @@ CreateHardLinkWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -1086,7 +1011,6 @@ CopyFileExWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -1094,8 +1018,6 @@ CopyFileExWrapper( BOOL ret = FALSE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString Existingpath(LongPathString::Literal, lpExistingFileName); @@ -1116,7 +1038,6 @@ CopyFileExWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { @@ -1143,7 +1064,6 @@ FindFirstFileExWrapper( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -1151,8 +1071,6 @@ FindFirstFileExWrapper( HANDLE ret = INVALID_HANDLE_VALUE; DWORD lastError; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return FALSE;) - EX_TRY { LongPathString path(LongPathString::Literal, lpFileName); @@ -1172,7 +1090,6 @@ FindFirstFileExWrapper( lastError = GetLastError(); } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK ) { diff --git a/src/utilcode/pedecoder.cpp b/src/utilcode/pedecoder.cpp index d442d34..794540a 100644 --- a/src/utilcode/pedecoder.cpp +++ b/src/utilcode/pedecoder.cpp @@ -160,7 +160,6 @@ BOOL PEDecoder::HasNTHeaders() const GC_NOTRIGGER; SUPPORTS_DAC; PRECONDITION(HasContents()); - SO_TOLERANT; } CONTRACT_END; @@ -243,7 +242,6 @@ CHECK PEDecoder::CheckNTHeaders() const GC_NOTRIGGER; SUPPORTS_DAC; PRECONDITION(HasContents()); - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -392,7 +390,6 @@ CHECK PEDecoder::CheckSection(COUNT_T previousAddressEnd, COUNT_T addressStart, NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -450,7 +447,6 @@ BOOL PEDecoder::HasWriteableSections() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -482,7 +478,6 @@ CHECK PEDecoder::CheckDirectoryEntry(int entry, int forbiddenFlags, IsNullOK ok) PRECONDITION(HasDirectoryEntry(entry)); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -501,7 +496,6 @@ CHECK PEDecoder::CheckDirectory(IMAGE_DATA_DIRECTORY *pDir, int forbiddenFlags, NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -518,7 +512,6 @@ CHECK PEDecoder::CheckRva(RVA rva, COUNT_T size, int forbiddenFlags, IsNullOK ok NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -557,7 +550,6 @@ CHECK PEDecoder::CheckRva(RVA rva, IsNullOK ok) const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -684,7 +676,6 @@ CHECK PEDecoder::CheckInternalAddress(SIZE_T address, IsNullOK ok) const PRECONDITION(CheckNTHeaders()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -704,7 +695,6 @@ CHECK PEDecoder::CheckInternalAddress(SIZE_T address, COUNT_T size, IsNullOK ok) PRECONDITION(CheckNTHeaders()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -730,7 +720,6 @@ RVA PEDecoder::InternalAddressToRva(SIZE_T address) const NOTHROW; GC_NOTRIGGER; POSTCONDITION(CheckRva(RETVAL)); - SO_TOLERANT; } CONTRACT_END; @@ -758,7 +747,6 @@ IMAGE_SECTION_HEADER *PEDecoder::FindSection(LPCSTR sectionName) const NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } CONTRACT_END; @@ -810,7 +798,6 @@ IMAGE_SECTION_HEADER *PEDecoder::RvaToSection(RVA rva) const CANNOT_TAKE_LOCK; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_END; @@ -846,7 +833,6 @@ IMAGE_SECTION_HEADER *PEDecoder::OffsetToSection(COUNT_T fileOffset) const GC_NOTRIGGER; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_END; @@ -878,7 +864,6 @@ TADDR PEDecoder::GetRvaData(RVA rva, IsNullOK ok /*= NULL_NOT_OK*/) const PRECONDITION(CheckRva(rva, NULL_OK)); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -930,7 +915,6 @@ BOOL PEDecoder::PointerInPE(PTR_CVOID data) const NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -1011,7 +995,6 @@ inline PTR_STORAGESTREAM NextStorageStream(PTR_STORAGESTREAM pSS) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -1032,7 +1015,6 @@ CHECK PEDecoder::CheckCorHeader() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -1852,7 +1834,6 @@ BOOL PEDecoder::HasNativeHeader() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_END; @@ -1871,7 +1852,6 @@ CHECK PEDecoder::CheckNativeHeader() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_CHECK_END; @@ -1955,7 +1935,6 @@ READYTORUN_HEADER * PEDecoder::FindReadyToRunHeader() const NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; @@ -2382,7 +2361,6 @@ CORCOMPILE_CODE_MANAGER_ENTRY *PEDecoder::GetNativeCodeManagerTable() const SUPPORTS_DAC; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_END; @@ -2400,7 +2378,6 @@ PCODE PEDecoder::GetNativeHotCode(COUNT_T * pSize) const SUPPORTS_DAC; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_END; @@ -2421,7 +2398,6 @@ PCODE PEDecoder::GetNativeCode(COUNT_T * pSize) const SUPPORTS_DAC; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACT_END; @@ -2732,16 +2708,13 @@ BOOL PEDecoder::ForceRelocForDLL(LPCWSTR lpFileName) #ifdef _DEBUG STATIC_CONTRACT_NOTHROW; \ ANNOTATION_DEBUG_ONLY; \ - STATIC_CONTRACT_CANNOT_TAKE_LOCK; \ - ANNOTATION_FN_SO_NOT_MAINLINE; + STATIC_CONTRACT_CANNOT_TAKE_LOCK; #endif #if defined(DACCESS_COMPILE) || defined(FEATURE_PAL) return TRUE; #else - CONTRACT_VIOLATION(SOToleranceViolation); - // Contracts in ConfigDWORD do WszLoadLibrary(MSCOREE_SHIM_W). // This check prevents recursion. if (wcsstr(lpFileName, MSCOREE_SHIM_W) != 0) diff --git a/src/utilcode/posterror.cpp b/src/utilcode/posterror.cpp index 63ce100..3c97db7 100644 --- a/src/utilcode/posterror.cpp +++ b/src/utilcode/posterror.cpp @@ -84,13 +84,11 @@ HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResour { DISABLED(NOTHROW); GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; HRESULT retVal = E_OUTOFMEMORY; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); SString::Startup(); EX_TRY { @@ -108,8 +106,6 @@ HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResour } EX_END_CATCH(SwallowAllExceptions); - END_SO_INTOLERANT_CODE; - return retVal; } @@ -127,13 +123,11 @@ STDAPI UtilLoadStringRCEx( { DISABLED(NOTHROW); GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; HRESULT retVal = E_OUTOFMEMORY; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); EX_TRY { SString::Startup(); @@ -150,7 +144,6 @@ STDAPI UtilLoadStringRCEx( retVal = E_OUTOFMEMORY; } EX_END_CATCH(SwallowAllExceptions); - END_SO_INTOLERANT_CODE; return retVal; } diff --git a/src/utilcode/regutil.cpp b/src/utilcode/regutil.cpp index c38c389..5c6a6db 100644 --- a/src/utilcode/regutil.cpp +++ b/src/utilcode/regutil.cpp @@ -42,7 +42,6 @@ LPWSTR REGUTIL::EnvGetString(LPCWSTR name, BOOL fPrependCOMPLUS) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -79,7 +78,6 @@ LPWSTR REGUTIL::EnvGetString(LPCWSTR name, BOOL fPrependCOMPLUS) NewArrayHolder ret = NULL; HRESULT hr = S_OK; DWORD Len; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return NULL;) EX_TRY { PathString temp; @@ -92,7 +90,6 @@ LPWSTR REGUTIL::EnvGetString(LPCWSTR name, BOOL fPrependCOMPLUS) } EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE if (hr != S_OK) { @@ -135,7 +132,6 @@ DWORD REGUTIL::GetConfigDWORD_DontUse_(LPCWSTR name, DWORD defValue, CORConfigLe NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -177,7 +173,6 @@ ULONGLONG REGUTIL::GetConfigULONGLONG_DontUse_(LPCWSTR name, ULONGLONG defValue, NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -201,7 +196,6 @@ HRESULT REGUTIL::GetConfigInteger(LPCWSTR name, ULONGLONG defValue, __out ULONGL NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; diff --git a/src/utilcode/sstring.cpp b/src/utilcode/sstring.cpp index 74df619..d045e9b 100644 --- a/src/utilcode/sstring.cpp +++ b/src/utilcode/sstring.cpp @@ -2698,7 +2698,6 @@ void SString::Clear() POSTCONDITION(IsEmpty()); NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC_HOST_ONLY; } CONTRACT_END; diff --git a/src/utilcode/stresslog.cpp b/src/utilcode/stresslog.cpp index f63ade8..722c5b7 100644 --- a/src/utilcode/stresslog.cpp +++ b/src/utilcode/stresslog.cpp @@ -249,7 +249,6 @@ ThreadStressLog* StressLog::CreateThreadStressLog() { NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -278,7 +277,6 @@ ThreadStressLog* StressLog::CreateThreadStressLog() { return NULL; } - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return NULL); StressLogLockHolder lockh(theLog.lock, FALSE); class NestedCaller @@ -325,8 +323,6 @@ ThreadStressLog* StressLog::CreateThreadStressLog() { if (noFLSNow == FALSE && theLog.facilitiesToLog != 0) msgs = CreateThreadStressLogHelper(); - END_SO_INTOLERANT_CODE; - return msgs; } @@ -336,7 +332,6 @@ ThreadStressLog* StressLog::CreateThreadStressLogHelper() { NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_INTOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -534,7 +529,6 @@ void ThreadStressLog::LogMsg(unsigned facility, int cArgs, const char* format, v { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // Asserts in this function cause infinite loops in the asserting mechanism. // Just use debug breaks instead. @@ -638,7 +632,6 @@ void StressLog::LogMsg (unsigned level, unsigned facility, int cArgs, const char STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; // Any stresslog LogMsg could theoretically create a new stress log and thus diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp index 6a48e0c..9807611 100644 --- a/src/utilcode/util.cpp +++ b/src/utilcode/util.cpp @@ -44,8 +44,7 @@ void InitWinRTStatus() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; - + WinRTStatusEnum winRTStatus = WINRT_STATUS_UNSUPPORTED; const WCHAR wszComBaseDll[] = W("\\combase.dll"); @@ -931,7 +930,6 @@ DWORD LCM(DWORD u, DWORD v) CONTRACTL { NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; } CONTRACTL_END; @@ -1033,7 +1031,6 @@ DWORD LCM(DWORD u, DWORD v) CONTRACTL { NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; } CONTRACTL_END; @@ -1089,7 +1086,6 @@ DWORD LCM(DWORD u, DWORD v) CONTRACTL { NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; } CONTRACTL_END; @@ -1159,7 +1155,6 @@ retry: CONTRACTL { NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; } CONTRACTL_END; @@ -1269,7 +1264,6 @@ int GetCurrentProcessCpuCount() CONTRACTL { NOTHROW; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -1324,7 +1318,6 @@ DWORD_PTR GetCurrentProcessCpuMask() CONTRACTL { NOTHROW; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -1867,7 +1860,6 @@ HRESULT validateOneArg( CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; @@ -1883,7 +1875,6 @@ HRESULT validateOneArg( HRESULT hr = S_OK; // Value returned. BOOL bRepeat = TRUE; // MODOPT and MODREQ belong to the arg after them - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); while(bRepeat) { bRepeat = FALSE; @@ -2078,8 +2069,6 @@ HRESULT validateOneArg( } // switch (ulElementType) } // end while(bRepeat) ErrExit: - - END_SO_INTOLERANT_CODE; return hr; } // validateOneArg() diff --git a/src/utilcode/util_nodependencies.cpp b/src/utilcode/util_nodependencies.cpp index c84aa5b..1148aca 100644 --- a/src/utilcode/util_nodependencies.cpp +++ b/src/utilcode/util_nodependencies.cpp @@ -32,7 +32,6 @@ void InitRunningOnVersionStatus () STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; BOOL fSupportedPlatform = FALSE; OSVERSIONINFOEX sVer; diff --git a/src/utilcode/utilmessagebox.cpp b/src/utilcode/utilmessagebox.cpp index d4de492..c8ef2ee 100644 --- a/src/utilcode/utilmessagebox.cpp +++ b/src/utilcode/utilmessagebox.cpp @@ -370,8 +370,8 @@ int UtilMessageBoxCatastrophicVA( HWND hwnd = NULL; - // We are already in a catastrophic situation so we can tolerate faults as well as SO & GC mode violations to keep going. - CONTRACT_VIOLATION(FaultNotFatal | GCViolation | ModeViolation | SOToleranceViolation); + // We are already in a catastrophic situation so we can tolerate faults as well as GC mode violations to keep going. + CONTRACT_VIOLATION(FaultNotFatal | GCViolation | ModeViolation); if (!ShouldDisplayMsgBoxOnCriticalFailure()) return IDABORT; @@ -398,8 +398,8 @@ int UtilMessageBoxCatastrophicNonLocalizedVA( HWND hwnd = NULL; - // We are already in a catastrophic situation so we can tolerate faults as well as SO & GC mode violations to keep going. - CONTRACT_VIOLATION(FaultNotFatal | GCViolation | ModeViolation | SOToleranceViolation); + // We are already in a catastrophic situation so we can tolerate faults as well as GC mode violations to keep going. + CONTRACT_VIOLATION(FaultNotFatal | GCViolation | ModeViolation); if (!ShouldDisplayMsgBoxOnCriticalFailure()) return IDABORT; diff --git a/src/utilcode/winfix.cpp b/src/utilcode/winfix.cpp index ea18130..2d72ae7 100644 --- a/src/utilcode/winfix.cpp +++ b/src/utilcode/winfix.cpp @@ -199,7 +199,6 @@ void EnsureCharSetInfoInitialized() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; if (!g_fEnsureCharSetInfoInitialized) { diff --git a/src/vm/amd64/cgenamd64.cpp b/src/vm/amd64/cgenamd64.cpp index 814f04d..e0e6a47 100644 --- a/src/vm/amd64/cgenamd64.cpp +++ b/src/vm/amd64/cgenamd64.cpp @@ -364,7 +364,6 @@ BOOL isJumpRel32(PCODE pCode) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -383,7 +382,6 @@ PCODE decodeJump32(PCODE pBuffer) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -399,7 +397,6 @@ BOOL isJumpRel64(PCODE pCode) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -417,7 +414,6 @@ PCODE decodeJump64(PCODE pBuffer) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -730,7 +726,6 @@ BOOL DoesSlotCallPrestub(PCODE pCode) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(pCode != GetPreStubEntryPoint()); } CONTRACTL_END; @@ -811,7 +806,6 @@ DWORD GetOffsetAtEndOfFunction(ULONGLONG uImageBase, MODE_ANY; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION((offsetNum > 0) && (offsetNum < 20)); /* we only allow reasonable offsetNums 1..19 */ } CONTRACTL_END; @@ -852,8 +846,6 @@ EXTERN_C PCODE VirtualMethodFixupWorker(TransitionBlock * pTransitionBlock, CORC Thread::ObjectRefFlush(CURRENT_THREAD); #endif - BEGIN_SO_INTOLERANT_CODE(CURRENT_THREAD); - _ASSERTE(IS_ALIGNED((size_t)pThunk, sizeof(INT64))); FrameWithCookie frame(pTransitionBlock); @@ -919,9 +911,6 @@ EXTERN_C PCODE VirtualMethodFixupWorker(TransitionBlock * pTransitionBlock, CORC } // Ready to return - - END_SO_INTOLERANT_CODE; - return pCode; } diff --git a/src/vm/amd64/cgencpu.h b/src/vm/amd64/cgencpu.h index 22ed364..619fd4b 100644 --- a/src/vm/amd64/cgencpu.h +++ b/src/vm/amd64/cgencpu.h @@ -301,7 +301,6 @@ inline PCODE GetIP(const CONTEXT * context) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; @@ -317,7 +316,6 @@ inline void SetIP(CONTEXT* context, PCODE rip) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; @@ -333,7 +331,6 @@ inline TADDR GetSP(const CONTEXT * context) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; @@ -348,7 +345,6 @@ inline void SetSP(CONTEXT *context, TADDR rsp) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; diff --git a/src/vm/amd64/excepamd64.cpp b/src/vm/amd64/excepamd64.cpp index d4248e7..003edce 100644 --- a/src/vm/amd64/excepamd64.cpp +++ b/src/vm/amd64/excepamd64.cpp @@ -158,7 +158,6 @@ RtlVirtualUnwind ( { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -194,7 +193,6 @@ RtlVirtualUnwind_Worker ( { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/amd64/gmsamd64.cpp b/src/vm/amd64/gmsamd64.cpp index d595db0..24eabf6 100644 --- a/src/vm/amd64/gmsamd64.cpp +++ b/src/vm/amd64/gmsamd64.cpp @@ -19,7 +19,6 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 0c2ebd6..c225c58 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -143,7 +143,6 @@ BOOL CompareCLSID(UPTR u1, UPTR u2) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2770,7 +2769,6 @@ AppDomain *SystemDomain::GetAppDomainAtId(ADID index) if (!SystemDomain::IsUnderDomainLock() && !IsGCThread()) { MODE_COOPERATIVE;} else { DISABLED(MODE_ANY);} #endif GC_NOTRIGGER; - SO_TOLERANT; NOTHROW; } CONTRACTL_END; @@ -3152,7 +3150,6 @@ StackWalkAction SystemDomain::CallersMethodCallbackWithStackMark(CrawlFrame* pCf THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -3294,7 +3291,6 @@ StackWalkAction SystemDomain::CallersMethodCallbackWithStackMark(CrawlFrame* pCf StackWalkAction SystemDomain::CallersMethodCallback(CrawlFrame* pCf, VOID* data) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; MethodDesc *pFunc = pCf->GetFunction(); /* We asked to be called back only for functions */ @@ -4739,7 +4735,6 @@ public: void Invoke() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; SetupThread(); pThis->LoadDomainAssembly(pSpec, pFile, targetLevel); } @@ -6202,10 +6197,6 @@ EndTry2:; } { - // This is not executed for SO exceptions so we need to disable the backout - // stack validation to prevent false violations from being reported. - DISABLE_BACKOUT_STACK_VALIDATION; - BOOL fFailure = PostBindResolveAssembly(pSpec, &NewSpec, ex->GetHR(), &pFailedSpec); if (fFailure) { @@ -6753,7 +6744,6 @@ BOOL AppDomain::StopEEAndUnwindThreads(unsigned int retryCount, BOOL *pFMarkUnlo THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -7096,11 +7086,9 @@ DWORD DomainLocalModule::GetClassFlags(MethodTable* pMT, DWORD iClassIndex /*=(D CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; - { // SO tolerance exception for debug-only assertion. - CONTRACT_VIOLATION(SOToleranceViolation); + { CONSISTENCY_CHECK(GetDomainFile()->GetModule() == pMT->GetModuleForStatics()); } @@ -7796,7 +7784,6 @@ UINT32 BaseDomain::LookupTypeID(PTR_MethodTable pMT) { CONTRACTL { NOTHROW; - SO_TOLERANT; WRAPPER(GC_TRIGGERS); PRECONDITION(pMT->GetDomain() == this); } CONTRACTL_END; @@ -7808,7 +7795,6 @@ UINT32 BaseDomain::LookupTypeID(PTR_MethodTable pMT) PTR_MethodTable BaseDomain::LookupType(UINT32 id) { CONTRACTL { NOTHROW; - SO_TOLERANT; WRAPPER(GC_TRIGGERS); CONSISTENCY_CHECK(id != TYPE_ID_THIS_CLASS); } CONTRACTL_END; @@ -7827,7 +7813,6 @@ void BaseDomain::RemoveTypesFromTypeIDMap(LoaderAllocator* pLoaderAllocator) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; m_typeIDMap.RemoveTypes(pLoaderAllocator); diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp index 8e13b51..e949af2 100644 --- a/src/vm/appdomain.hpp +++ b/src/vm/appdomain.hpp @@ -306,7 +306,6 @@ struct DomainLocalModule { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; SUPPORTS_DAC; } @@ -337,7 +336,6 @@ struct DomainLocalModule { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; SUPPORTS_DAC; } @@ -1073,7 +1071,6 @@ public: ADID GetId (void) { LIMITED_METHOD_DAC_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return m_dwId; } @@ -1086,7 +1083,6 @@ public: virtual PTR_AppDomain AsAppDomain() { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(!"Not an AppDomain"); return NULL; } @@ -2902,7 +2898,6 @@ private: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/array.cpp b/src/vm/array.cpp index b93657c..d5366a2 100644 --- a/src/vm/array.cpp +++ b/src/vm/array.cpp @@ -1295,7 +1295,6 @@ void ArrayStubCache::CompileStub(const BYTE *pRawStub, UINT ArrayStubCache::Length(const BYTE *pRawStub) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return ((ArrayOpScript*)pRawStub)->Length(); } diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp index 4bd4a18..cdbcbf4 100644 --- a/src/vm/assembly.cpp +++ b/src/vm/assembly.cpp @@ -381,9 +381,6 @@ Assembly * Assembly::Create( NewHolder pAssembly (new Assembly(pDomain, pFile, debuggerFlags, fIsCollectible)); - // If there are problems that arise from this call stack, we'll chew up a lot of stack - // with the various EX_TRY/EX_HOOKs that we will encounter. - INTERIOR_STACK_PROBE_FOR(GetThread(), DEFAULT_ENTRY_PROBE_SIZE); #ifdef PROFILING_SUPPORTED { BEGIN_PIN_PROFILER(CORProfilerTrackAssemblyLoads()); @@ -412,7 +409,6 @@ Assembly * Assembly::Create( EX_END_HOOK; #endif pAssembly.SuppressRelease(); - END_INTERIOR_STACK_PROBE; return pAssembly; } // Assembly::Create @@ -758,7 +754,6 @@ DomainAssembly *Assembly::FindDomainAssembly(AppDomain *pDomain) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACT_END; diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index 30698cc..4167263 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -27,7 +27,6 @@ #include "interoputil.h" #include "frames.h" #include "typeparse.h" -#include "stackprobe.h" #include "appdomainnative.hpp" #include "../binder/inc/clrprivbindercoreclr.h" diff --git a/src/vm/assemblyspec.cpp b/src/vm/assemblyspec.cpp index b2d33b3..85d26c6 100644 --- a/src/vm/assemblyspec.cpp +++ b/src/vm/assemblyspec.cpp @@ -454,7 +454,6 @@ void AssemblySpec::AssemblyNameInit(ASSEMBLYNAMEREF* pAsmName, PEImage* pImageIn THROWS; MODE_COOPERATIVE; GC_TRIGGERS; - SO_INTOLERANT; PRECONDITION(IsProtectedByGCFrame (pAsmName)); } CONTRACTL_END; diff --git a/src/vm/assemblyspec.hpp b/src/vm/assemblyspec.hpp index 97bbd5f..2960aea 100644 --- a/src/vm/assemblyspec.hpp +++ b/src/vm/assemblyspec.hpp @@ -19,7 +19,6 @@ #include "memorypool.h" #include "assemblyspecbase.h" #include "domainfile.h" -#include "genericstackprobe.h" #include "holder.h" class AppDomain; diff --git a/src/vm/binder.cpp b/src/vm/binder.cpp index 3507ad1..5aaf976 100644 --- a/src/vm/binder.cpp +++ b/src/vm/binder.cpp @@ -475,7 +475,6 @@ void MscorlibBinder::TriggerGCUnderStress() { THROWS; GC_TRIGGERS; - SO_TOLERANT; INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; diff --git a/src/vm/callhelpers.cpp b/src/vm/callhelpers.cpp index 7b5396a..e194161 100644 --- a/src/vm/callhelpers.cpp +++ b/src/vm/callhelpers.cpp @@ -25,12 +25,6 @@ void AssertMulticoreJitAllowedModule(PCODE pTarget) { - CONTRACTL - { - SO_NOT_MAINLINE; - } - CONTRACTL_END; - MethodDesc* pMethod = Entry2MethodDesc(pTarget, NULL); Module * pModule = pMethod->GetModule_NoLogging(); @@ -60,8 +54,6 @@ void CallDescrWorkerWithHandler( CallDescrData * pCallDescrData, BOOL fCriticalCall) { - STATIC_CONTRACT_SO_INTOLERANT; - #if defined(FEATURE_MULTICOREJIT) && defined(_DEBUG) // For multicore JITting, background thread should not call managed code, except when calling system code (e.g. throwing managed exception) @@ -103,7 +95,6 @@ void CallDescrWorker(CallDescrData * pCallDescrData) #endif // 0 STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(!NingenEnabled() && "You cannot invoke managed code inside the ngen compilation process."); diff --git a/src/vm/callhelpers.h b/src/vm/callhelpers.h index 032cec4..f9e738b 100644 --- a/src/vm/callhelpers.h +++ b/src/vm/callhelpers.h @@ -542,13 +542,11 @@ enum EEToManagedCallFlags CURRENT_THREAD->HandleThreadAbort(); \ } \ } \ - BEGIN_SO_TOLERANT_CODE(CURRENT_THREAD); \ INSTALL_CALL_TO_MANAGED_EXCEPTION_HOLDER(); \ INSTALL_COMPLUS_EXCEPTION_HANDLER_NO_DECLARE(); #define END_CALL_TO_MANAGED() \ UNINSTALL_COMPLUS_EXCEPTION_HANDLER(); \ - END_SO_TOLERANT_CODE; \ } /***********************************************************************/ diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 3502b2d..d824a14 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -1475,18 +1475,15 @@ PTR_Module Module::ComputePreferredZapModule(Module * pDefinitionModule, NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; PTR_Module ret = NULL; - INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(DontCallDirectlyForceStackOverflow()); ret = Module::ComputePreferredZapModuleHelper( pDefinitionModule, classInst, methodInst ); - END_INTERIOR_STACK_PROBE; return ret; } @@ -1661,7 +1658,6 @@ PTR_Module Module::ComputePreferredZapModule(TypeKey *pKey) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } @@ -1687,7 +1683,6 @@ PTR_Module Module::GetPreferredZapModuleForMethodTable(MethodTable *pMT) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } @@ -1695,8 +1690,6 @@ PTR_Module Module::GetPreferredZapModuleForMethodTable(MethodTable *pMT) PTR_Module pRet=NULL; - INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(10, NO_FORBIDGC_LOADER_USE_ThrowSO();); - if (pMT->IsArray()) { TypeHandle elemTH = pMT->GetApproxArrayElementTypeHandle(); @@ -1713,7 +1706,6 @@ PTR_Module Module::GetPreferredZapModuleForMethodTable(MethodTable *pMT) // then its loader module is simply the module containing its TypeDef pRet= pMT->GetModule(); } - END_INTERIOR_STACK_PROBE; return pRet; } @@ -1725,7 +1717,6 @@ PTR_Module Module::GetPreferredZapModuleForTypeDesc(PTR_TypeDesc pTD) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1749,7 +1740,6 @@ PTR_Module Module::GetPreferredZapModuleForTypeHandle(TypeHandle t) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1767,7 +1757,6 @@ PTR_Module Module::GetPreferredZapModuleForMethodDesc(const MethodDesc *pMD) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1796,7 +1785,6 @@ PTR_Module Module::GetPreferredZapModuleForFieldDesc(FieldDesc * pFD) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1814,7 +1802,6 @@ BOOL Module::IsEditAndContinueCapable(Assembly *pAssembly, PEFile *file) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } @@ -1893,7 +1880,6 @@ DomainAssembly* Module::FindDomainAssembly(AppDomain *pDomain) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACT_END; @@ -1932,7 +1918,6 @@ DomainFile *Module::FindDomainFile(AppDomain *pDomain) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACT_END; @@ -2767,7 +2752,6 @@ BOOL Module::IsPreV4Assembly() { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END @@ -4357,7 +4341,6 @@ BOOL Module::IsSigInIL(PCCOR_SIGNATURE signature) FORBID_FAULT; MODE_ANY; NOTHROW; - SO_TOLERANT; GC_NOTRIGGER; } CONTRACTL_END; @@ -5727,7 +5710,6 @@ PTR_TADDR LookupMapBase::GetElementPtr(DWORD rid) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -5788,7 +5770,6 @@ INT32 LookupMapBase::GetNextCompressedEntry(BitStreamReader *pTableStream, INT32 NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; PRECONDITION(MapIsCompressed()); } @@ -5818,7 +5799,6 @@ TADDR LookupMapBase::GetValueFromCompressedMap(DWORD rid) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; PRECONDITION(MapIsCompressed()); } @@ -6173,7 +6153,6 @@ HRESULT Module::GetPropertyInfoForMethodDef(mdMethodDef md, mdProperty *ppd, LPC NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -6304,7 +6283,6 @@ BOOL Module::MightContainMatchingProperty(mdProperty tkProperty, ULONG nameHash) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -10034,7 +10012,6 @@ BYTE *Module::GetNativeFixupBlobData(RVA rva) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL)); } CONTRACT_END; @@ -10182,7 +10159,6 @@ BOOL Module::IsZappedCode(PCODE code) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -10217,7 +10193,6 @@ BOOL Module::IsZappedPrecode(PCODE code) NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; @@ -10241,7 +10216,6 @@ PCCOR_SIGNATURE Module::GetEncodedSig(RVA fixupRva, Module **ppDefiningModule) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; POSTCONDITION(CheckPointer(RETVAL)); SUPPORTS_DAC; } @@ -10268,7 +10242,6 @@ PCCOR_SIGNATURE Module::GetEncodedSigIfLoaded(RVA fixupRva, Module **ppDefiningM NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; POSTCONDITION(CheckPointer(RETVAL)); SUPPORTS_DAC; } @@ -14161,10 +14134,6 @@ void Module::ExpandAll() } CONTRACTL_END; - //This is called from inside EEStartupHelper, so it breaks the SO rules. However, this is debug only - //(and only supported for limited jit testing), so it's ok here. - CONTRACT_VIOLATION(SOToleranceViolation); - //If the EE isn't started yet, it's not safe to jit. We fail in COM jitting a p/invoke. if (!g_fEEStarted) return; diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h index 497c79e..aa0b789 100644 --- a/src/vm/ceeload.h +++ b/src/vm/ceeload.h @@ -2608,7 +2608,6 @@ public: GC_NOTRIGGER; SUPPORTS_DAC; CANNOT_TAKE_LOCK; - SO_TOLERANT; } CONTRACT_END; diff --git a/src/vm/ceeload.inl b/src/vm/ceeload.inl index 20c8d8c..4997f57 100644 --- a/src/vm/ceeload.inl +++ b/src/vm/ceeload.inl @@ -400,7 +400,6 @@ inline MethodDesc *Module::LookupMethodDef(mdMethodDef token) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 6186a0c..3b50c02 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -156,7 +156,6 @@ #include "util.hpp" #include "shimload.h" #include "comthreadpool.h" -#include "stackprobe.h" #include "posterror.h" #include "virtualcallstub.h" #include "strongnameinternal.h" @@ -416,7 +415,6 @@ HRESULT EnsureEEStarted(COINITIEE flags) static BOOL WINAPI DbgCtrlCHandler(DWORD dwCtrlType) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; #if defined(DEBUGGING_SUPPORTED) // Note that if a managed-debugger is attached, it's actually attached with the native @@ -519,7 +517,6 @@ void InitGSCookie() { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -943,14 +940,6 @@ void EEStartupHelper(COINITIEE fFlags) StackwalkCache::Init(); - // In coreclr, clrjit is compiled into it, but SO work in clrjit has not been done. -#ifdef FEATURE_STACK_PROBE - if (CLRHosted() && GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) == eRudeUnloadAppDomain) - { - InitStackProbes(); - } -#endif - // This isn't done as part of InitializeGarbageCollector() above because it // requires write barriers to have been set up on x86, which happens as part // of InitJITHelpers1. @@ -1276,7 +1265,7 @@ static void ExternalShutdownHelper(int exitCode, ShutdownCompleteAction sca) ENTRY_POINT; } CONTRACTL_END; - CONTRACT_VIOLATION(GCViolation | ModeViolation | SOToleranceViolation); + CONTRACT_VIOLATION(GCViolation | ModeViolation); if (g_fEEShutDown || !g_fEEStarted) return; @@ -1809,8 +1798,6 @@ part2: SystemDomain::DetachEnd(); } - TerminateStackProbes(); - // Unregister our vectored exception and continue handlers from the OS. // This will ensure that if any other DLL unload (after ours) has an exception, // we wont attempt to process that exception (which could lead to various @@ -1954,9 +1941,6 @@ static LONG s_ActiveShutdownThreadCount = 0; // DWORD WINAPI EEShutDownProcForSTAThread(LPVOID lpParameter) { - STATIC_CONTRACT_SO_INTOLERANT;; - - ClrFlsSetThreadType(ThreadType_ShutdownHelper); EEShutDownHelper(FALSE); @@ -2024,7 +2008,6 @@ void STDMETHODCALLTYPE EEShutDown(BOOL fIsDllUnloading) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; // we don't need to cleanup 'cus we're shutting down PRECONDITION(g_fEEStarted); } CONTRACTL_END; @@ -2034,14 +2017,6 @@ void STDMETHODCALLTYPE EEShutDown(BOOL fIsDllUnloading) return; } - // Stop stack probing and asserts right away. Once we're shutting down, we can do no more. - // And we don't want to SO-protect anything at this point anyway. This really only has impact - // on a debug build. - TerminateStackProbes(); - - // The process is shutting down. No need to check SO contract. - SO_NOT_MAINLINE_FUNCTION; - // We only do the first part of the shutdown once. static LONG OnlyOne = -1; @@ -2173,7 +2148,6 @@ NOINLINE BOOL CanRunManagedCodeRare(LoaderLockCheck::kind checkKind, HINSTANCE h NOTHROW; if (checkKind == LoaderLockCheck::ForMDA) { GC_TRIGGERS; } else { GC_NOTRIGGER; }; // because of the CustomerDebugProbe MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; // If we are shutting down the runtime, then we cannot run code. @@ -2233,7 +2207,6 @@ BOOL CanRunManagedCode(LoaderLockCheck::kind checkKind, HINSTANCE hInst /*= 0*/) NOTHROW; if (checkKind == LoaderLockCheck::ForMDA) { GC_TRIGGERS; } else { GC_NOTRIGGER; }; // because of the CustomerDebugProbe MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; // Special-case the common success cases @@ -2278,7 +2251,6 @@ HRESULT STDAPICALLTYPE CoInitializeEE(DWORD fFlags) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -2322,7 +2294,6 @@ BOOL ExecuteDLL_ReturnOrThrow(HRESULT hr, BOOL fFromThunk) if (fFromThunk) THROWS; else NOTHROW; WRAPPER(GC_TRIGGERS); MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; // If we have a failure result, and we're called from a thunk, @@ -2396,10 +2367,6 @@ BOOL STDMETHODCALLTYPE EEDllMain( // TRUE on success, FALSE on error. STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - // this runs at the top of a thread, SO is not a concern here... - STATIC_CONTRACT_SO_NOT_MAINLINE; - - // HRESULT hr; // BEGIN_EXTERNAL_ENTRYPOINT(&hr); // EE isn't spun up enough to use this macro @@ -2453,12 +2420,6 @@ BOOL STDMETHODCALLTYPE EEDllMain( // TRUE on success, FALSE on error. _ASSERTE(pParam->lpReserved || !g_fEEStarted); g_fProcessDetach = TRUE; -#if defined(ENABLE_CONTRACTS_IMPL) && defined(FEATURE_STACK_PROBE) - // We are shutting down process. No need to check SO contract. - // And it is impossible to enforce SO contract in global dtor, like ModIntPairList. - g_EnableDefaultRWValidation = FALSE; -#endif - if (g_fEEStarted) { // GetThread() may be set to NULL for Win9x during shutdown. @@ -2671,7 +2632,6 @@ static HRESULT GetThreadUICultureNames(__inout StringArrayList* pCultureNames) GC_NOTRIGGER; MODE_ANY; PRECONDITION(CheckPointer(pCultureNames)); - SO_INTOLERANT; } CONTRACTL_END; @@ -2791,7 +2751,6 @@ void SetLatchedExitCode (INT32 code) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -2819,7 +2778,6 @@ static int GetThreadUICultureId(__out LocaleIDValue* pLocale) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT;; } CONTRACTL_END; @@ -2892,7 +2850,6 @@ static int GetThreadUICultureId(__out LocaleIDValue* pLocale) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT;; } CONTRACTL_END; _ASSERTE(sizeof(LocaleIDValue)/sizeof(WCHAR) >= LOCALE_NAME_MAX_LENGTH); @@ -2974,7 +2931,6 @@ BOOL AreAnyViolationBitsOn() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/class.cpp b/src/vm/class.cpp index 8c51e63..5ec3721 100644 --- a/src/vm/class.cpp +++ b/src/vm/class.cpp @@ -1797,7 +1797,6 @@ LPCUTF8 MethodTable::GetFullyQualifiedNameInfo(LPCUTF8 *ppszNamespace) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END @@ -2386,7 +2385,6 @@ WORD SparseVTableMap::LookupVTSlot(WORD MTSlot) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END @@ -3173,7 +3171,6 @@ DWORD EEClass::GetPackableField(EEClassFieldId eField) GC_NOTRIGGER; MODE_ANY; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; @@ -3192,7 +3189,6 @@ void EEClass::SetPackableField(EEClassFieldId eField, DWORD dwValue) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/classcompat.cpp b/src/vm/classcompat.cpp index e96ed2a..d442f11 100644 --- a/src/vm/classcompat.cpp +++ b/src/vm/classcompat.cpp @@ -39,7 +39,6 @@ #include "listlock.h" #include "methodimpl.h" #include "guidfromname.h" -#include "stackprobe.h" #include "encee.h" #include "encee.h" #include "comsynchronizable.h" diff --git a/src/vm/classcompat.h b/src/vm/classcompat.h index a958a30..609f1e5 100644 --- a/src/vm/classcompat.h +++ b/src/vm/classcompat.h @@ -361,7 +361,6 @@ private: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/classfactory.cpp b/src/vm/classfactory.cpp index 3c5a97a..6f88a5c 100644 --- a/src/vm/classfactory.cpp +++ b/src/vm/classfactory.cpp @@ -75,7 +75,6 @@ public: NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppv, NULL_OK)); } CONTRACTL_END; @@ -103,7 +102,6 @@ public: NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -120,7 +118,6 @@ public: NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(m_cbRefCount > 0); } CONTRACTL_END; @@ -143,15 +140,6 @@ public: { HRESULT hr = S_OK; #ifdef FEATURE_CORRUPTING_EXCEPTIONS - // SetupForComCallHR uses "SO_INTOLERANT_CODE_NOTHROW" to setup the SO-Intolerant transition - // for COM Interop. However, "SO_INTOLERANT_CODE_NOTHROW" expects that no exception can escape - // through this boundary but all it does is (in addition to checking that no exception has escaped it) - // do stack probing. - // - // However, Corrupting Exceptions [CE] can escape the COM Interop boundary. Thus, to address that scenario, - // we use the macro below that uses BEGIN_SO_INTOLERANT_CODE_NOTHROW to do the equivalent of - // SO_INTOLERANT_CODE_NOTHROW and yet allow for CEs to escape through. Since there will be a corresponding - // END_SO_INTOLERANT_CODE, the call is splitted into two parts: the Begin and End (see below). BeginSetupForComCallHRWithEscapingCorruptingExceptions(); #else // !FEATURE_CORRUPTING_EXCEPTIONS SetupForComCallHR(); @@ -166,7 +154,6 @@ public: #endif // FEATURE_CORRUPTING_EXCEPTIONS GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -196,7 +183,6 @@ public: NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -212,15 +198,6 @@ public: HRESULT hr = S_OK; #ifdef FEATURE_CORRUPTING_EXCEPTIONS - // SetupForComCallHR uses "SO_INTOLERANT_CODE_NOTHROW" to setup the SO-Intolerant transition - // for COM Interop. However, "SO_INTOLERANT_CODE_NOTHROW" expects that no exception can escape - // through this boundary but all it does is (in addition to checking that no exception has escaped it) - // do stack probing. - // - // However, Corrupting Exceptions [CE] can escape the COM Interop boundary. Thus, to address that scenario, - // we use the macro below that uses BEGIN_SO_INTOLERANT_CODE_NOTHROW to do the equivalent of - // SO_INTOLERANT_CODE_NOTHROW and yet allow for CEs to escape through. Since there will be a corresponding - // END_SO_INTOLERANT_CODE, the call is splitted into two parts: the Begin and End (see below). BeginSetupForComCallHRWithEscapingCorruptingExceptions(); #else // !FEATURE_CORRUPTING_EXCEPTIONS SetupForComCallHR(); @@ -236,7 +213,6 @@ public: GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -283,15 +259,6 @@ done: ; HRESULT hr = S_OK; #ifdef FEATURE_CORRUPTING_EXCEPTIONS - // SetupForComCallHR uses "SO_INTOLERANT_CODE_NOTHROW" to setup the SO-Intolerant transition - // for COM Interop. However, "SO_INTOLERANT_CODE_NOTHROW" expects that no exception can escape - // through this boundary but all it does is (in addition to checking that no exception has escaped it) - // do stack probing. - // - // However, Corrupting Exceptions [CE] can escape the COM Interop boundary. Thus, to address that scenario, - // we use the macro below that uses BEGIN_SO_INTOLERANT_CODE_NOTHROW to do the equivalent of - // SO_INTOLERANT_CODE_NOTHROW and yet allow for CEs to escape through. Since there will be a corresponding - // END_SO_INTOLERANT_CODE, the call is splitted into two parts: the Begin and End (see below). BeginSetupForComCallHRWithEscapingCorruptingExceptions(); #else // !FEATURE_CORRUPTING_EXCEPTIONS SetupForComCallHR(); @@ -306,7 +273,6 @@ done: ; #endif // FEATURE_CORRUPTING_EXCEPTIONS GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -343,7 +309,6 @@ private: GC_TRIGGERS; MODE_ANY; INJECT_FAULT(COMPlusThrowOM();); - SO_TOLERANT; } CONTRACTL_END; @@ -355,10 +320,8 @@ private: MethodTable* tempMT = NULL; EX_TRY { - BEGIN_SO_INTOLERANT_CODE(pThread); GCX_COOP(); tempMT = GetTypeForCLSID(m_ClsId); - END_SO_INTOLERANT_CODE; } EX_CATCH { @@ -387,7 +350,6 @@ STDMETHODIMP EEClassFactory::GetLicInfo(LPLICINFO pLicInfo) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -451,7 +413,6 @@ STDMETHODIMP EEClassFactory::RequestLicKey(DWORD dwReserved, BSTR * pbstrKey) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -596,7 +557,6 @@ HRESULT STDMETHODCALLTYPE EEAllocateInstance(LPUNKNOWN pOuter, MethodTable* pMT, #endif // FEATURE_CORRUPTING_EXCEPTIONS GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pMT)); PRECONDITION(CheckPointer(ppv, NULL_OK)); } @@ -739,7 +699,6 @@ HRESULT STDMETHODCALLTYPE EEDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVO NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppv, NULL_OK)); } CONTRACTL_END; @@ -758,10 +717,8 @@ HRESULT STDMETHODCALLTYPE EEDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVO { Thread *pThread = GetThread(); - BEGIN_SO_INTOLERANT_CODE(pThread); GCX_COOP(); pMT = GetTypeForCLSID(rclsid); - END_SO_INTOLERANT_CODE; } // If we can't find the class based on the CLSID or if the registered managed @@ -836,7 +793,6 @@ STDAPI ClrCreateManagedInstance(LPCWSTR typeName, REFIID riid, LPVOID FAR *ppv) DISABLED(NOTHROW); GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(typeName, NULL_OK)); PRECONDITION(CheckPointer(ppv, NULL_OK)); } diff --git a/src/vm/classhash.cpp b/src/vm/classhash.cpp index 31c7e84..3b01441 100644 --- a/src/vm/classhash.cpp +++ b/src/vm/classhash.cpp @@ -722,7 +722,6 @@ public: virtual void UseKeys(__in_ecount(2) LPUTF8 *pKey1) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; SUPPORTS_DAC; bReturn = ( diff --git a/src/vm/clrex.cpp b/src/vm/clrex.cpp index 6b28786..5f4354b 100644 --- a/src/vm/clrex.cpp +++ b/src/vm/clrex.cpp @@ -45,7 +45,6 @@ CLRException::~CLRException() { CAN_TAKE_LOCK; // because of DestroyHandle } - SO_TOLERANT; } CONTRACTL_END; @@ -159,12 +158,6 @@ OBJECTREF CLRException::GetThrowable() if (throwable == NULL) { - // We need to disable the backout stack validation at this point since GetThrowable can - // take arbitrarily large amounts of stack for different exception types; however we know - // for a fact that we will never go through this code path if the exception is a stack - // overflow exception since we already handled that case above with the pre-allocated SO exception. - DISABLE_BACKOUT_STACK_VALIDATION; - class RestoreLastException { Thread *m_pThread; @@ -230,7 +223,6 @@ OBJECTREF CLRException::GetThrowable() } { - DISABLE_BACKOUT_STACK_VALIDATION; if (throwable == NULL) { STRESS_LOG0(LF_EH, LL_INFO100, "CLRException::GetThrowable: We have failed to track exceptions accurately through the system.\n"); @@ -282,21 +274,11 @@ HRESULT CLRException::GetHR() DISABLED(NOTHROW); GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; - HRESULT hr = E_FAIL; - - BEGIN_SO_INTOLERANT_CODE(GetThread()); - -// Is it legal to switch to GCX_COOP in a SO_TOLERANT region? GCX_COOP(); - hr = GetExceptionHResult(GetThrowable()); - - END_SO_INTOLERANT_CODE; - - return hr; + return GetExceptionHResult(GetThrowable()); } #ifdef FEATURE_COMINTEROP @@ -307,7 +289,6 @@ HRESULT CLRException::SetErrorInfo() GC_TRIGGERS; NOTHROW; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -368,7 +349,6 @@ IErrorInfo *CLRException::GetErrorInfo() GC_TRIGGERS; THROWS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -379,9 +359,6 @@ IErrorInfo *CLRException::GetErrorInfo() // Not all codepaths expect to have it initialized (e.g. hosting APIs). if (g_fComStarted) { - // We probe here for SO since GetThrowable and GetComIPFromObjectRef are SO intolerant - BEGIN_SO_INTOLERANT_CODE(GetThread()); - // Get errorinfo only when our SO probe succeeds { // Switch to coop mode since GetComIPFromObjectRef requires that @@ -400,8 +377,6 @@ IErrorInfo *CLRException::GetErrorInfo() GCPROTECT_END(); } - - END_SO_INTOLERANT_CODE; } else { @@ -550,7 +525,6 @@ BOOL CLRException::IsPreallocatedExceptionObject(OBJECTREF o) GC_NOTRIGGER; MODE_COOPERATIVE; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -590,7 +564,6 @@ BOOL CLRException::IsPreallocatedExceptionHandle(OBJECTHANDLE h) GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -625,7 +598,6 @@ OBJECTHANDLE CLRException::GetPreallocatedHandleForObject(OBJECTREF o) GC_NOTRIGGER; MODE_COOPERATIVE; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -667,7 +639,6 @@ OBJECTREF CLRException::GetBestOutOfMemoryException() { NOTHROW; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -677,15 +648,11 @@ OBJECTREF CLRException::GetBestOutOfMemoryException() { FAULT_NOT_FATAL(); - BEGIN_SO_INTOLERANT_CODE(GetThread()); - EXCEPTIONREF pOutOfMemory = (EXCEPTIONREF)AllocateObject(g_pOutOfMemoryExceptionClass); pOutOfMemory->SetHResult(COR_E_OUTOFMEMORY); pOutOfMemory->SetXCode(EXCEPTION_COMPLUS); retVal = pOutOfMemory; - - END_SO_INTOLERANT_CODE; } EX_CATCH { @@ -708,7 +675,6 @@ OBJECTREF CLRException::GetThrowableFromException(Exception *pException) GC_TRIGGERS; NOTHROW; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -885,7 +851,6 @@ OBJECTREF CLRException::GetThrowableFromExceptionRecord(EXCEPTION_RECORD *pExcep GC_NOTRIGGER; NOTHROW; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -902,7 +867,6 @@ void CLRException::HandlerState::CleanupTry() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; if (m_pThread != NULL) { @@ -932,7 +896,6 @@ void CLRException::HandlerState::SetupCatch(INDEBUG_COMMA(__in_z const char * sz STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; bool fVMInitialized = g_fEEStarted?true:false; Exception::HandlerState::SetupCatch(INDEBUG_COMMA(szFile) lineNum, fVMInitialized); @@ -948,7 +911,7 @@ void CLRException::HandlerState::SetupCatch(INDEBUG_COMMA(__in_z const char * sz if (!DidCatchCxx()) { - if (IsSOExceptionCode(exceptionCode)) + if (exceptionCode == STATUS_STACK_OVERFLOW) { // Handle SO exception // @@ -988,7 +951,6 @@ void CLRException::HandlerState::SucceedCatch() STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; LOG((LF_EH, LL_INFO100, "EX_CATCH catch succeeded (CLRException::HandlerState)\n")); @@ -2545,7 +2507,6 @@ void GetLastThrownObjectExceptionFromThread_Internal(Exception **ppException) GC_TRIGGERS; THROWS; MODE_ANY; - SO_TOLERANT; // no risk of an SO after we've allocated the object here } CONTRACTL_END; diff --git a/src/vm/clrex.h b/src/vm/clrex.h index a550a71..87ad5d0 100644 --- a/src/vm/clrex.h +++ b/src/vm/clrex.h @@ -12,6 +12,11 @@ #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" @@ -811,11 +816,6 @@ class EEFileLoadException : public EEException #define GET_EXCEPTION() (__pException == NULL ? __defaultException.Validate() : __pException.GetValue()) #endif // _DEBUG -// When we throw an exception, we need stay in SO-intolerant state and -// probe for sufficient stack so that we don't SO during the processing. -#undef HANDLE_SO_TOLERANCE_FOR_THROW -#define HANDLE_SO_TOLERANCE_FOR_THROW STACK_PROBE_FOR_THROW(GetThread()); - LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv); // Re-define the macro to add automatic restoration of the guard page to PAL_EXCEPT and PAL_EXCEPT_FILTER and @@ -899,9 +899,7 @@ LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv); #undef EX_ENDTRY #define EX_ENDTRY \ PAL_CPP_ENDTRY \ - SO_INFRASTRUCTURE_CODE(if (__state.DidCatch()) { RESTORE_SO_TOLERANCE_STATE; }) \ - SO_INFRASTRUCTURE_CODE(if (__state.DidCatchSO()) { HANDLE_STACKOVERFLOW_AFTER_CATCH; }) \ - NO_SO_INFRASTRUCTURE_CODE_ASSERTE(!__state.DidCatchSO()) \ + _ASSERTE(!__state.DidCatchSO()); // CLRException::GetErrorInfo below invokes GetComIPFromObjectRef @@ -1011,14 +1009,12 @@ NOINLINE BOOL HasIllegalReentrancyRare(); } \ if (CURRENT_THREAD != NULL) \ { \ - BEGIN_SO_INTOLERANT_CODE_NOTHROW(CURRENT_THREAD, *__phr = COR_E_STACKOVERFLOW); \ EX_TRY_THREAD(CURRENT_THREAD); \ { \ #define END_EXTERNAL_ENTRYPOINT \ } \ EX_CATCH_HRESULT(*__phr); \ - END_SO_INTOLERANT_CODE; \ } \ } \ } \ @@ -1032,7 +1028,6 @@ NOINLINE BOOL HasIllegalReentrancyRare(); *__phr = GET_EXCEPTION()->GetHR(); \ } \ EX_END_CATCH(RethrowCorruptingExceptionsEx(fCond)); \ - END_SO_INTOLERANT_CODE; \ } \ } \ } \ diff --git a/src/vm/clrex.inl b/src/vm/clrex.inl index 06c82f8..100cf51 100644 --- a/src/vm/clrex.inl +++ b/src/vm/clrex.inl @@ -18,7 +18,6 @@ inline CLRException::HandlerState::HandlerState(Thread * pThread) STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; m_pThread = pThread; if (m_pThread == NULL) @@ -39,7 +38,6 @@ inline CLRException::HandlerState::HandlerState(Thread * pThread, CLRException:: STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(pThread != NULL); m_pThread = pThread; diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp index 90fb070..7b35d18 100644 --- a/src/vm/clsload.cpp +++ b/src/vm/clsload.cpp @@ -36,7 +36,6 @@ #include "typehash.h" #include "comdelegate.h" #include "array.h" -#include "stackprobe.h" #include "posterror.h" #include "wrappers.h" #include "generics.h" @@ -86,7 +85,6 @@ PTR_Module ClassLoader::ComputeLoaderModuleWorker( MODE_ANY; PRECONDITION(CheckPointer(pDefinitionModule, NULL_OK)); POSTCONDITION(CheckPointer(RETVAL)); - SO_INTOLERANT; SUPPORTS_DAC; } CONTRACT_END @@ -209,7 +207,6 @@ PTR_Module ClassLoader::ComputeLoaderModuleForCompilation( MODE_ANY; PRECONDITION(CheckPointer(pDefinitionModule, NULL_OK)); POSTCONDITION(CheckPointer(RETVAL)); - SO_INTOLERANT; } CONTRACT_END @@ -1147,7 +1144,6 @@ TypeHandle ClassLoader::LoadConstructedTypeThrowing(TypeKey *pKey, if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } if (FORBIDGC_LOADER_USE_ENABLED() || fLoadTypes != LoadTypes) { LOADS_TYPE(CLASS_LOAD_BEGIN); } else { LOADS_TYPE(level); } - if (fLoadTypes == DontLoadTypes) SO_TOLERANT; else SO_INTOLERANT; PRECONDITION(CheckPointer(pKey)); PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); PRECONDITION(CheckPointer(pInstContext, NULL_OK)); @@ -1235,8 +1231,6 @@ void ClassLoader::EnsureLoaded(TypeHandle typeHnd, ClassLoadLevel level) if (typeHnd.GetLoadLevel() < level) { - INTERIOR_STACK_PROBE_CHECK_THREAD; - #ifdef FEATURE_PREJIT if (typeHnd.GetLoadLevel() == CLASS_LOAD_UNRESTOREDTYPEKEY) { @@ -1250,8 +1244,6 @@ void ClassLoader::EnsureLoaded(TypeHandle typeHnd, ClassLoadLevel level) Module *pLoaderModule = ComputeLoaderModule(&typeKey); pLoaderModule->GetClassLoader()->LoadTypeHandleForTypeKey(&typeKey, typeHnd, level); } - - END_INTERIOR_STACK_PROBE; } #endif // DACCESS_COMPILE @@ -1780,8 +1772,6 @@ ClassLoader::LoadTypeHandleThrowing( } CONTRACT_END TypeHandle typeHnd; - INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(RETURN_FROM_INTERIOR_PROBE(TypeHandle())); - Module * pFoundModule = NULL; mdToken FoundCl; HashedTypeEntry foundEntry; @@ -1944,7 +1934,6 @@ ClassLoader::LoadTypeHandleThrowing( #endif // !DACCESS_COMPILE } - END_INTERIOR_STACK_PROBE; RETURN typeHnd; } // ClassLoader::LoadTypeHandleThrowing @@ -2539,10 +2528,6 @@ TypeHandle ClassLoader::LoadTypeDefThrowing(Module *pModule, RETURN(typeHnd); } - // We don't want to probe on any threads except for those with a managed thread. This function - // can be called from the GC thread etc. so need to control how we probe. - INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(goto Exit;); - IMDInternalImport *pInternalImport = pModule->GetMDImport(); #ifndef DACCESS_COMPILE @@ -2667,11 +2652,6 @@ TypeHandle ClassLoader::LoadTypeDefThrowing(Module *pModule, #endif // !DACCESS_COMPILE } -// If stack guards are disabled, then this label is unreferenced and produces a compile error. -#if defined(FEATURE_STACK_PROBE) && !defined(DACCESS_COMPILE) -Exit: -#endif - #ifndef DACCESS_COMPILE if ((fUninstantiated == FailIfUninstDefOrRef) && !typeHnd.IsNull() && typeHnd.IsGenericTypeDefinition()) { @@ -2686,7 +2666,6 @@ Exit: } #endif ; - END_INTERIOR_STACK_PROBE; RETURN(typeHnd); } @@ -3757,15 +3736,6 @@ TypeHandle ClassLoader::LoadTypeHandleForTypeKey(TypeKey *pTypeKey, GCX_PREEMP(); - // Type loading can be recursive. Probe for sufficient stack. - // - // Execution of the FINALLY in LoadTypeHandleForTypeKey_Body can eat - // a lot of stack because LoadTypeHandleForTypeKey_Inner can rethrow - // any non-SO exceptions that it takes, ensure that we have plenty - // of stack before getting into it (>24 pages on AMD64, remember - // that num pages probed is 2*N on AMD64). - INTERIOR_STACK_PROBE_FOR(GetThread(),20); - #ifdef _DEBUG if (LoggingOn(LF_CLASSLOADER, LL_INFO1000)) { @@ -3799,8 +3769,6 @@ TypeHandle ClassLoader::LoadTypeHandleForTypeKey(TypeKey *pTypeKey, PushFinalLevels(typeHnd, targetLevel, pInstContext); - END_INTERIOR_STACK_PROBE; - return typeHnd; } @@ -3826,9 +3794,6 @@ TypeHandle ClassLoader::LoadTypeHandleForTypeKeyNoLock(TypeKey *pTypeKey, TypeHandle typeHnd = TypeHandle(); - // Type loading can be recursive. Probe for sufficient stack. - INTERIOR_STACK_PROBE_FOR(GetThread(),8); - ClassLoadLevel currentLevel = CLASS_LOAD_BEGIN; ClassLoadLevel targetLevelUnderLock = targetLevel < CLASS_DEPENDENCIES_LOADED ? targetLevel : (ClassLoadLevel) (CLASS_DEPENDENCIES_LOADED-1); while (currentLevel < targetLevelUnderLock) @@ -3840,8 +3805,6 @@ TypeHandle ClassLoader::LoadTypeHandleForTypeKeyNoLock(TypeKey *pTypeKey, PushFinalLevels(typeHnd, targetLevel, pInstContext); - END_INTERIOR_STACK_PROBE; - return typeHnd; } @@ -4145,7 +4108,6 @@ ClassLoader::LoadArrayTypeThrowing( if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } if (FORBIDGC_LOADER_USE_ENABLED() || fLoadTypes != LoadTypes) { LOADS_TYPE(CLASS_LOAD_BEGIN); } else { LOADS_TYPE(level); } - if (fLoadTypes == DontLoadTypes) SO_TOLERANT; else SO_INTOLERANT; MODE_ANY; SUPPORTS_DAC; POSTCONDITION(CheckPointer(RETVAL, ((fLoadTypes == LoadTypes) ? NULL_NOT_OK : NULL_OK))); @@ -5258,9 +5220,6 @@ BOOL ClassLoader::CanAccess( // TRUE if access is all MODE_ANY; } CONTRACT_END; - - // Recursive: CanAccess->CheckAccessMember->CanAccessClass->CanAccess - INTERIOR_STACK_PROBE(GetThread()); AccessCheckOptions accessCheckOptionsNoThrow(accessCheckOptions, FALSE); @@ -5312,13 +5271,11 @@ BOOL ClassLoader::CanAccess( // TRUE if access is all if (!canAccess) { BOOL fail = accessCheckOptions.FailOrThrow(pContext); - RETURN_FROM_INTERIOR_PROBE(fail); + RETURN(fail); } } - RETURN_FROM_INTERIOR_PROBE(TRUE); - - END_INTERIOR_STACK_PROBE; + RETURN(TRUE); } // BOOL ClassLoader::CanAccess() //****************************************************************************** diff --git a/src/vm/clsload.inl b/src/vm/clsload.inl index 7dcd1a5..925703c 100644 --- a/src/vm/clsload.inl +++ b/src/vm/clsload.inl @@ -68,7 +68,6 @@ inline void AccessCheckOptions::Initialize( { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_ANY; diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp index 0e5c189..422cc28 100644 --- a/src/vm/codeman.cpp +++ b/src/vm/codeman.cpp @@ -661,7 +661,6 @@ ExecutionManager::ReaderLockHolder::ReaderLockHolder(HostCallPreference hostCall NOTHROW; if (hostCallPreference == AllowHostCalls) { HOST_CALLS; } else { HOST_NOCALLS; } GC_NOTRIGGER; - SO_TOLERANT; CAN_TAKE_LOCK; } CONTRACTL_END; @@ -696,7 +695,6 @@ ExecutionManager::ReaderLockHolder::~ReaderLockHolder() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -921,7 +919,6 @@ ExecutionManager::ScanFlag ExecutionManager::GetScanFlags() CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; HOST_NOCALLS; SUPPORTS_DAC; } CONTRACTL_END; @@ -3682,7 +3679,6 @@ BOOL EEJitManager::JitCodeToMethodInfo( CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -3725,7 +3721,6 @@ StubCodeBlockKind EEJitManager::GetStubCodeBlockKind(RangeSection * pRangeSectio CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -3741,7 +3736,6 @@ TADDR EEJitManager::FindMethodCode(PCODE currentPC) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -3883,7 +3877,6 @@ PTR_RUNTIME_FUNCTION EEJitManager::LazyGetFunctionEntry(EECodeInfo * pCodeInfo) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -4172,7 +4165,6 @@ ExecutionManager::FindCodeRange(PCODE currentPC, ScanFlag scanFlag) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -4193,7 +4185,6 @@ ExecutionManager::FindCodeRangeWithLock(PCODE currentPC) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -4222,7 +4213,6 @@ MethodDesc * ExecutionManager::GetCodeMethodDesc(PCODE currentPC) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END @@ -4238,7 +4228,6 @@ BOOL ExecutionManager::IsManagedCode(PCODE currentPC) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; if (currentPC == NULL) @@ -4257,7 +4246,6 @@ BOOL ExecutionManager::IsManagedCodeWithLock(PCODE currentPC) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; ReaderLockHolder rlh; @@ -4270,7 +4258,6 @@ BOOL ExecutionManager::IsManagedCode(PCODE currentPC, HostCallPreference hostCal CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; #ifdef DACCESS_COMPILE @@ -4301,7 +4288,6 @@ BOOL ExecutionManager::IsManagedCodeWorker(PCODE currentPC) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; // This may get called for arbitrary code addresses. Note that the lock is @@ -4426,7 +4412,6 @@ RangeSection* ExecutionManager::GetRangeSection(TADDR addr) NOTHROW; HOST_NOCALLS; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -4551,7 +4536,6 @@ PTR_Module ExecutionManager::FindZapModule(TADDR currentData) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; STATIC_CONTRACT_HOST_CALLS; SUPPORTS_DAC; @@ -4582,7 +4566,6 @@ PTR_Module ExecutionManager::FindReadyToRunModule(TADDR currentData) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; STATIC_CONTRACT_HOST_CALLS; SUPPORTS_DAC; @@ -4616,7 +4599,6 @@ PTR_Module ExecutionManager::FindModuleForGCRefMap(TADDR currentData) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -5476,7 +5458,6 @@ BOOL NativeImageJitManager::JitCodeToMethodInfo(RangeSection * pRangeSection, EECodeInfo * pCodeInfo) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; @@ -5832,7 +5813,6 @@ StubCodeBlockKind NativeImageJitManager::GetStubCodeBlockKind(RangeSection * pRa { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -6166,7 +6146,6 @@ int NativeUnwindInfoLookupTable::LookupUnwindInfoForMethod(DWORD RelativePc, int High) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; @@ -6761,7 +6740,6 @@ StubCodeBlockKind ReadyToRunJitManager::GetStubCodeBlockKind(RangeSection * pRan { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -6925,7 +6903,6 @@ BOOL ReadyToRunJitManager::JitCodeToMethodInfo(RangeSection * pRangeSection, CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/vm/codeman.h b/src/vm/codeman.h index 13c7543..e08721c 100644 --- a/src/vm/codeman.h +++ b/src/vm/codeman.h @@ -1256,7 +1256,6 @@ public: CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/vm/codepitchingmanager.cpp b/src/vm/codepitchingmanager.cpp index 6a937fb..2bae33e 100644 --- a/src/vm/codepitchingmanager.cpp +++ b/src/vm/codepitchingmanager.cpp @@ -307,7 +307,6 @@ StackWalkAction CrawlFrameVisitor(CrawlFrame* pCf, Thread* pMdThread) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/comcache.cpp b/src/vm/comcache.cpp index a783407..c63ec56 100644 --- a/src/vm/comcache.cpp +++ b/src/vm/comcache.cpp @@ -1548,7 +1548,6 @@ HRESULT __stdcall CtxEntry::EnterContextCallback(ComCallData* pComCallData) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pComCallData)); } CONTRACTL_END; diff --git a/src/vm/comcallablewrapper.cpp b/src/vm/comcallablewrapper.cpp index 749af9a..ea18275 100644 --- a/src/vm/comcallablewrapper.cpp +++ b/src/vm/comcallablewrapper.cpp @@ -1004,12 +1004,10 @@ LONGLONG SimpleComCallWrapper::ReleaseImplWithLogging(LONGLONG * pRefCount) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; LONGLONG newRefCount; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), goto NoLog ); StackSString ssMessage; ComCallWrapper *pWrap = GetMainWrapper(); @@ -1020,14 +1018,7 @@ LONGLONG SimpleComCallWrapper::ReleaseImplWithLogging(LONGLONG * pRefCount) LogRefCount(pWrap, ssMessage, GET_EXT_COM_REF(newRefCount)); - END_SO_INTOLERANT_CODE; return newRefCount; - -#ifdef FEATURE_STACK_PROBE // this code is unreachable if FEATURE_STACK_PROBE is not defined -NoLog: - // Decrement the ref count - return ::InterlockedDecrement64(pRefCount); -#endif // FEATURE_STACK_PROBE } @@ -1743,7 +1734,6 @@ IUnknown* SimpleComCallWrapper::QIStandardInterface(Enum_StdInterfaces index) MODE_ANY; \ NOTHROW; \ GC_NOTRIGGER; \ - SO_TOLERANT; \ POSTCONDITION(RETVAL == !!IsEqualGUID(iid, riid)); \ } \ CONTRACT_END; \ @@ -1899,7 +1889,6 @@ void SimpleComCallWrapper::ResetOuter() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -1921,7 +1910,6 @@ IUnknown* SimpleComCallWrapper::GetOuter() GC_NOTRIGGER; MODE_ANY; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - SO_TOLERANT; } CONTRACT_END; diff --git a/src/vm/comcallablewrapper.h b/src/vm/comcallablewrapper.h index 27206ac..a8cce3d 100644 --- a/src/vm/comcallablewrapper.h +++ b/src/vm/comcallablewrapper.h @@ -1206,7 +1206,6 @@ public: WRAPPER(GC_TRIGGERS); MODE_COOPERATIVE; PRECONDITION(CheckPointer(m_ppThis)); - SO_TOLERANT; } CONTRACT_END; @@ -1295,7 +1294,6 @@ public: INSTANCE_CHECK; POSTCONDITION(CheckPointer(RETVAL)); SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_END; @@ -1552,7 +1550,6 @@ public: WRAPPER(THROWS); WRAPPER(GC_TRIGGERS); MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACT_END; @@ -1694,7 +1691,6 @@ public: MODE_ANY; PRECONDITION(CheckPointer(pUnk)); POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; SUPPORTS_DAC; } CONTRACT_END; @@ -1719,7 +1715,6 @@ public: SUPPORTS_DAC; INSTANCE_CHECK; POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; } CONTRACT_END; @@ -1773,7 +1768,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -1794,7 +1788,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -1819,7 +1812,6 @@ public: NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -1841,13 +1833,11 @@ private: NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; if (!CanRunManagedCode()) return; - SO_INTOLERANT_CODE_NOTHROW(GetThread(), return; ); m_pWrap->Cleanup(); } @@ -1860,7 +1850,6 @@ public: NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -2183,7 +2172,6 @@ inline ULONG ComCallWrapper::AddRef() WRAPPER(THROWS); WRAPPER(GC_TRIGGERS); MODE_ANY; - SO_TOLERANT; INSTANCE_CHECK; } CONTRACTL_END; @@ -2204,7 +2192,6 @@ inline ULONG ComCallWrapper::Release() WRAPPER(THROWS); WRAPPER(GC_TRIGGERS); MODE_ANY; - SO_TOLERANT; INSTANCE_CHECK; PRECONDITION(CheckPointer(m_pSimpleWrapper)); } @@ -2331,7 +2318,6 @@ inline PTR_ComCallWrapper ComCallWrapper::GetWrapperFromIP(PTR_IUnknown pUnk) PRECONDITION(CheckPointer(pUnk)); POSTCONDITION(CheckPointer(RETVAL)); SUPPORTS_DAC; - SO_TOLERANT; } CONTRACT_END; diff --git a/src/vm/comconnectionpoints.cpp b/src/vm/comconnectionpoints.cpp index 4e4ceef..290d9b6 100644 --- a/src/vm/comconnectionpoints.cpp +++ b/src/vm/comconnectionpoints.cpp @@ -61,7 +61,6 @@ HRESULT __stdcall ConnectionPoint::QueryInterface(REFIID riid, void** ppv) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppv, NULL_OK)); } CONTRACTL_END; @@ -101,7 +100,6 @@ ULONG __stdcall ConnectionPoint::AddRef() NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -118,7 +116,6 @@ ULONG __stdcall ConnectionPoint::Release() NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -144,7 +141,6 @@ HRESULT __stdcall ConnectionPoint::GetConnectionInterface(IID *pIID) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pIID, NULL_OK)); } CONTRACTL_END; @@ -169,7 +165,6 @@ HRESULT __stdcall ConnectionPoint::GetConnectionPointContainer(IConnectionPointC NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppCPC, NULL_OK)); } CONTRACTL_END; @@ -203,7 +198,6 @@ HRESULT __stdcall ConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk, NULL_OK)); PRECONDITION(CheckPointer(pdwCookie, NULL_OK)); } @@ -238,7 +232,6 @@ HRESULT __stdcall ConnectionPoint::Unadvise(DWORD dwCookie) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -268,7 +261,6 @@ HRESULT __stdcall ConnectionPoint::EnumConnections(IEnumConnections **ppEnum) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppEnum, NULL_OK)); } CONTRACTL_END; @@ -787,7 +779,6 @@ HRESULT __stdcall ConnectionPointEnum::QueryInterface(REFIID riid, void** ppv) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppv, NULL_OK)); } CONTRACTL_END; @@ -827,7 +818,6 @@ ULONG __stdcall ConnectionPointEnum::AddRef() NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -844,7 +834,6 @@ ULONG __stdcall ConnectionPointEnum::Release() NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -872,7 +861,6 @@ HRESULT __stdcall ConnectionPointEnum::Next(ULONG cConnections, IConnectionPoint NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppCP, NULL_OK)); PRECONDITION(CheckPointer(pcFetched, NULL_OK)); } @@ -914,7 +902,6 @@ HRESULT __stdcall ConnectionPointEnum::Skip(ULONG cConnections) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -949,7 +936,6 @@ HRESULT __stdcall ConnectionPointEnum::Reset() NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -971,7 +957,6 @@ HRESULT __stdcall ConnectionPointEnum::Clone(IEnumConnectionPoints **ppEnum) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppEnum, NULL_OK)); } CONTRACTL_END; @@ -1008,7 +993,6 @@ ConnectionEnum::ConnectionEnum(ConnectionPoint *pConnectionPoint) { NOTHROW; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -1022,7 +1006,6 @@ ConnectionEnum::~ConnectionEnum() { NOTHROW; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -1037,7 +1020,6 @@ HRESULT __stdcall ConnectionEnum::QueryInterface(REFIID riid, void** ppv) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppv, NULL_OK)); } CONTRACTL_END; @@ -1076,7 +1058,6 @@ ULONG __stdcall ConnectionEnum::AddRef() { NOTHROW; GC_TRIGGERS; - SO_TOLERANT; MODE_PREEMPTIVE; } CONTRACTL_END; @@ -1094,7 +1075,6 @@ ULONG __stdcall ConnectionEnum::Release() NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -1115,7 +1095,6 @@ HRESULT __stdcall ConnectionEnum::Next(ULONG cConnections, CONNECTDATA* rgcd, UL NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(rgcd, NULL_OK)); PRECONDITION(CheckPointer(pcFetched, NULL_OK)); } @@ -1171,7 +1150,6 @@ HRESULT __stdcall ConnectionEnum::Skip(ULONG cConnections) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -1203,7 +1181,6 @@ HRESULT __stdcall ConnectionEnum::Reset() NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -1225,7 +1202,6 @@ HRESULT __stdcall ConnectionEnum::Clone(IEnumConnections **ppEnum) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ppEnum, NULL_OK)); } CONTRACTL_END; @@ -1237,7 +1213,6 @@ HRESULT __stdcall ConnectionEnum::Clone(IEnumConnections **ppEnum) // Initialize the out parameters. *ppEnum = NULL; - // This should setup a SO_INTOLERANT region, why isn't it? SetupForComCallHR(); ConnectionEnum *pConEnum = new(nothrow) ConnectionEnum(m_pConnectionPoint); diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp index 12edc53..63cd544 100644 --- a/src/vm/comdelegate.cpp +++ b/src/vm/comdelegate.cpp @@ -3432,7 +3432,6 @@ BOOL COMDelegate::IsSecureDelegate(DELEGATEREF dRef) MODE_ANY; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; DELEGATEREF innerDel = NULL; diff --git a/src/vm/commodule.cpp b/src/vm/commodule.cpp index c55da6b..4d650c7 100644 --- a/src/vm/commodule.cpp +++ b/src/vm/commodule.cpp @@ -1139,7 +1139,6 @@ static VOID __stdcall DReleaseTarget(IUnknown *punk) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/common.h b/src/vm/common.h index 3b16100..f6971e1 100644 --- a/src/vm/common.h +++ b/src/vm/common.h @@ -333,7 +333,6 @@ namespace Loader #include "regdisp.h" #include "stackframe.h" #include "gms.h" -#include "stackprobe.h" #include "fcall.h" #include "syncblk.h" #include "gcdesc.h" @@ -464,7 +463,6 @@ extern DummyGlobalContract ___contract; #include "clsload.inl" #include "domainfile.inl" #include "method.inl" -#include "stackprobe.inl" #include "syncblk.inl" #include "threads.inl" #include "eehash.inl" diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index 323c66a..cd78e1c 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -205,13 +205,8 @@ HRESULT MakeCrossDomainCallbackWorker( LPVOID pArgs) { STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_INTOLERANT; - HRESULT hrRetVal = E_UNEXPECTED; - BEGIN_SO_TOLERANT_CODE(GetThread()); - hrRetVal = pfnCallback(pArgs); - END_SO_TOLERANT_CODE; - return hrRetVal; + return pfnCallback(pArgs); } HRESULT CEECompileInfo::MakeCrossDomainCallback( diff --git a/src/vm/compile.h b/src/vm/compile.h index e86cd07..52a96a1 100644 --- a/src/vm/compile.h +++ b/src/vm/compile.h @@ -408,7 +408,6 @@ class CEECompileInfo : public ICorCompileInfo { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/comsynchronizable.cpp b/src/vm/comsynchronizable.cpp index b495b94..ee324d4 100644 --- a/src/vm/comsynchronizable.cpp +++ b/src/vm/comsynchronizable.cpp @@ -189,7 +189,6 @@ void ThreadNative::KickOffThread_Worker(LPVOID ptr) GC_TRIGGERS; THROWS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -211,7 +210,6 @@ void ThreadNative::KickOffThread_Worker(LPVOID ptr) pThread = GetThread(); _ASSERTE(pThread); GCPROTECT_BEGIN(gc); - BEGIN_SO_INTOLERANT_CODE(pThread); gc.orDelegate = ObjectFromHandle(args->share->m_Threadable); gc.orThreadStartArg = ObjectFromHandle(args->share->m_ThreadStartArg); @@ -249,7 +247,6 @@ void ThreadNative::KickOffThread_Worker(LPVOID ptr) } STRESS_LOG2(LF_SYNC, LL_INFO10, "Managed thread exiting normally for delegate %p Type %pT\n", OBJECTREFToObject(gc.orDelegate), (size_t) gc.orDelegate->GetMethodTable()); - END_SO_INTOLERANT_CODE; GCPROTECT_END(); } @@ -288,16 +285,12 @@ ULONG WINAPI ThreadNative::KickOffThread(void* pass) GC_TRIGGERS; THROWS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; ULONG retVal = 0; // Before we do anything else, get Setup so that we have a real thread. - // Our thread isn't setup yet, so we can't use the standard probe - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return E_FAIL); - KickOffThread_Args args; // don't have a separate var becuase this can be updated in the worker args.share = (SharedState *) pass; @@ -381,8 +374,6 @@ ULONG WINAPI ThreadNative::KickOffThread(void* pass) DestroyThread(pThread); } - END_SO_INTOLERANT_CODE; - return retVal; } diff --git a/src/vm/comthreadpool.cpp b/src/vm/comthreadpool.cpp index 11319e1..b76fa7b 100644 --- a/src/vm/comthreadpool.cpp +++ b/src/vm/comthreadpool.cpp @@ -131,7 +131,7 @@ FCIMPL2(FC_BOOL_RET, ThreadPoolNative::CorSetMaxThreads,DWORD workerThreads, DWO FCALL_CONTRACT; BOOL bRet = FALSE; - HELPER_METHOD_FRAME_BEGIN_RET_0(); // Eventually calls BEGIN_SO_INTOLERANT_CODE_NOTHROW + HELPER_METHOD_FRAME_BEGIN_RET_0(); bRet = ThreadpoolMgr::SetMaxThreads(workerThreads,completionPortThreads); HELPER_METHOD_FRAME_END(); @@ -155,7 +155,7 @@ FCIMPL2(FC_BOOL_RET, ThreadPoolNative::CorSetMinThreads,DWORD workerThreads, DWO FCALL_CONTRACT; BOOL bRet = FALSE; - HELPER_METHOD_FRAME_BEGIN_RET_0(); // Eventually calls BEGIN_SO_INTOLERANT_CODE_NOTHROW + HELPER_METHOD_FRAME_BEGIN_RET_0(); bRet = ThreadpoolMgr::SetMinThreads(workerThreads,completionPortThreads); HELPER_METHOD_FRAME_END(); @@ -388,7 +388,7 @@ FCIMPL5(LPVOID, ThreadPoolNative::CorRegisterWaitForSingleObject, gc.waitObject = (WAITHANDLEREF) ObjectToOBJECTREF(waitObjectUNSAFE); gc.state = (OBJECTREF) stateUNSAFE; gc.registeredWaitObject = (OBJECTREF) registeredWaitObjectUNSAFE; - HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); // Eventually calls BEGIN_SO_INTOLERANT_CODE_NOTHROW + HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); if(gc.waitObject == NULL) COMPlusThrow(kArgumentNullException); @@ -487,7 +487,7 @@ FCIMPL2(FC_BOOL_RET, ThreadPoolNative::CorUnregisterWait, LPVOID WaitHandle, Obj BOOL retVal = false; SAFEHANDLEREF refSH = (SAFEHANDLEREF) ObjectToOBJECTREF(objectToNotify); - HELPER_METHOD_FRAME_BEGIN_RET_1(refSH); // Eventually calls BEGIN_SO_INTOLERANT_CODE_NOTHROW + HELPER_METHOD_FRAME_BEGIN_RET_1(refSH); HANDLE hWait = (HANDLE) WaitHandle; HANDLE hObjectToNotify = NULL; @@ -541,7 +541,7 @@ FCIMPL1(void, ThreadPoolNative::CorWaitHandleCleanupNative, LPVOID WaitHandle) { FCALL_CONTRACT; - HELPER_METHOD_FRAME_BEGIN_0(); // Eventually calls BEGIN_SO_INTOLERANT_CODE_NOTHROW + HELPER_METHOD_FRAME_BEGIN_0(); HANDLE hWait = (HANDLE)WaitHandle; ThreadpoolMgr::WaitHandleCleanup(hWait); @@ -570,8 +570,6 @@ void SetAsyncResultProperties( STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; - } VOID BindIoCompletionCallBack_Worker(LPVOID args) @@ -579,7 +577,6 @@ VOID BindIoCompletionCallBack_Worker(LPVOID args) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_INTOLERANT; DWORD ErrorCode = ((BindIoCompletion_Args *)args)->ErrorCode; DWORD numBytesTransferred = ((BindIoCompletion_Args *)args)->numBytesTransferred; @@ -639,7 +636,6 @@ void __stdcall BindIoCompletionCallbackStubEx(DWORD ErrorCode, THROWS; MODE_ANY; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; @@ -688,7 +684,7 @@ FCIMPL1(FC_BOOL_RET, ThreadPoolNative::CorBindIoCompletionCallback, HANDLE fileH BOOL retVal = FALSE; - HELPER_METHOD_FRAME_BEGIN_RET_0(); // Eventually calls BEGIN_SO_INTOLERANT_CODE_NOTHROW + HELPER_METHOD_FRAME_BEGIN_RET_0(); HANDLE hFile = (HANDLE) fileHandle; DWORD errCode = 0; @@ -721,7 +717,7 @@ FCIMPL1(FC_BOOL_RET, ThreadPoolNative::CorPostQueuedCompletionStatus, LPOVERLAPP BOOL res = FALSE; - HELPER_METHOD_FRAME_BEGIN_RET_1(overlapped); // Eventually calls BEGIN_SO_INTOLERANT_CODE_NOTHROW + HELPER_METHOD_FRAME_BEGIN_RET_1(overlapped); // OS doesn't signal handle, so do it here lpOverlapped->Internal = 0; @@ -793,7 +789,6 @@ VOID WINAPI AppDomainTimerCallback(PVOID callbackState, BOOLEAN timerOrWaitFired THROWS; MODE_ANY; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; diff --git a/src/vm/comtoclrcall.cpp b/src/vm/comtoclrcall.cpp index db262f1..98391b9 100644 --- a/src/vm/comtoclrcall.cpp +++ b/src/vm/comtoclrcall.cpp @@ -101,7 +101,6 @@ void ProfilerTransitionCallbackHelper(MethodDesc* pMD, Thread* pThread, COR_PRF_ NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pMD)); PRECONDITION(CheckPointer(pThread)); PRECONDITION(CORProfilerTrackTransitions()); @@ -132,10 +131,6 @@ extern "C" HRESULT STDCALL StubRareDisableHRWorker(Thread *pThread) // Do not add a CONTRACT here. We haven't set up SEH. We rely // on HandleThreadAbort dealing with this situation properly. - // @todo - We need to probe here, but can't introduce destructors etc. - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - - // WARNING!!!! // when we start executing here, we are actually in cooperative mode. But we // haven't synchronized with the barrier to reentry yet. So we are in a highly @@ -170,8 +165,6 @@ extern "C" HRESULT STDCALL StubRareDisableHRWorker(Thread *pThread) // should always be in coop mode here _ASSERTE(pThread->PreemptiveGCDisabled()); - END_CONTRACT_VIOLATION; - // Note that this code does not handle rare signatures that do not return HRESULT properly return hr; @@ -209,8 +202,8 @@ inline static void InvokeStub(ComCallMethodDesc *pCMD, PCODE pManagedTarget, OBJ PERMANENT_CONTRACT_VIOLATION(ThrowsViolation, ReasonILStubWillNotThrow); // - // NOTE! We do not use BEGIN_CALL_TO_MANAGEDEX around this call because we stayed in the SO_TOLERANT - // mode and COMToCLRDispatchHelper is responsible for pushing/popping the CPFH into the FS:0 chain. + // NOTE! We do not use BEGIN_CALL_TO_MANAGEDEX around this call because COMToCLRDispatchHelper is + // responsible for pushing/popping the CPFH into the FS:0 chain. // *pRetValOut = COMToCLRDispatchHelper( @@ -279,7 +272,6 @@ OBJECTREF COMToCLRGetObjectAndTarget_Delegate(ComCallWrapper * pWrap, PCODE * pp NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -302,7 +294,6 @@ bool COMToCLRGetObjectAndTarget_WinRTCtor(Thread * pThread, MethodDesc * pRealMD NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -322,8 +313,6 @@ bool COMToCLRGetObjectAndTarget_WinRTCtor(Thread * pThread, MethodDesc * pRealMD bool fSuccess = true; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, { *pRetValOut = COR_E_STACKOVERFLOW; return false; } ); - EX_TRY { *pObjectOut = AllocateObject(pMT); @@ -335,8 +324,6 @@ bool COMToCLRGetObjectAndTarget_WinRTCtor(Thread * pThread, MethodDesc * pRealMD } EX_END_CATCH(SwallowAllExceptions); - END_SO_INTOLERANT_CODE; - return fSuccess; } @@ -348,7 +335,6 @@ OBJECTREF COMToCLRGetObjectAndTarget_Virtual(ComCallWrapper * pWrap, MethodDesc NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -390,7 +376,6 @@ OBJECTREF COMToCLRGetObjectAndTarget_NonVirtual(ComCallWrapper * pWrap, MethodDe NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -409,7 +394,6 @@ void COMToCLRInvokeTarget(PCODE pManagedTarget, OBJECTREF pObject, ComCallMethod NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -433,7 +417,6 @@ void COMToCLRWorkerBody_Rare(Thread * pThread, ComMethodFrame * pFrame, ComCallW NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -494,7 +477,6 @@ void COMToCLRWorkerBody( NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -565,20 +547,6 @@ void COMToCLRWorkerBody( return; } -void COMToCLRWorkerBody_SOIntolerant(Thread * pThread, ComMethodFrame * pFrame, ComCallWrapper * pWrap, UINT64 * pRetValOut) -{ - STATIC_CONTRACT_THROWS; // THROWS due to END_SO_TOLERANT_CODE - STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_INTOLERANT; - - BEGIN_SO_TOLERANT_CODE(pThread); - - COMToCLRWorkerBody(pThread, pFrame, pWrap, pRetValOut); - - END_SO_TOLERANT_CODE; -} - //------------------------------------------------------------------ // UINT64 __stdcall COMToCLRWorker(Thread *pThread, // ComMethodFrame* pFrame) @@ -598,7 +566,6 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra // to leave the MODE_ contract enabled on x86. DISABLED(MODE_PREEMPTIVE); #endif - SO_TOLERANT; PRECONDITION(CheckPointer(pFrame)); PRECONDITION(CheckPointer(pThread, NULL_OK)); } @@ -769,9 +736,6 @@ static UINT64 __stdcall FieldCallWorker(Thread *pThread, ComMethodFrame* pFrame) HRESULT hrRetVal = S_OK; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, return COR_E_STACKOVERFLOW); - // BEGIN_ENTRYPOINT_NOTHROW_WITH_THREAD(pThread); - IUnknown** pip = (IUnknown **)pFrame->GetPointerToArguments(); IUnknown* pUnk = (IUnknown *)*pip; _ASSERTE(pUnk != NULL); @@ -809,9 +773,6 @@ static UINT64 __stdcall FieldCallWorker(Thread *pThread, ComMethodFrame* pFrame) LOG((LF_STUBS, LL_INFO1000000, "FieldCallWorker leave\n")); - END_SO_INTOLERANT_CODE; - //END_ENTRYPOINT_NOTHROW_WITH_THREAD; - return hrRetVal; } diff --git a/src/vm/comtoclrcall.h b/src/vm/comtoclrcall.h index 5425fc0..03d05ee 100644 --- a/src/vm/comtoclrcall.h +++ b/src/vm/comtoclrcall.h @@ -133,7 +133,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(IsFieldCall()); } CONTRACT_END; @@ -149,7 +148,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(IsMethodCall()); } CONTRACT_END; @@ -249,7 +247,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(!IsFieldCall()); PRECONDITION(CheckPointer(m_pMD)); POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); @@ -267,7 +264,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(!IsFieldCall()); POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); SUPPORTS_DAC; @@ -298,7 +294,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(IsFieldCall()); PRECONDITION(CheckPointer(m_pFD)); POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); @@ -331,7 +326,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(IsMethodCall()); PRECONDITION(CheckPointer(m_pMD)); } @@ -348,7 +342,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(m_flags & enum_NativeInfoInitialized); SUPPORTS_DAC; } @@ -377,7 +370,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(IsMethodCall()); PRECONDITION(CheckPointer(m_pMD)); } diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp index 56408c5..60874c3 100644 --- a/src/vm/comutilnative.cpp +++ b/src/vm/comutilnative.cpp @@ -972,7 +972,6 @@ FCIMPL1(int, GCInterface::WaitForFullGCApproach, int millisecondsTimeout) THROWS; MODE_COOPERATIVE; DISABLED(GC_TRIGGERS); // can't use this in an FCALL because we're in forbid gc mode until we setup a H_M_F. - SO_TOLERANT; } CONTRACTL_END; @@ -997,7 +996,6 @@ FCIMPL1(int, GCInterface::WaitForFullGCComplete, int millisecondsTimeout) THROWS; MODE_COOPERATIVE; DISABLED(GC_TRIGGERS); // can't use this in an FCALL because we're in forbid gc mode until we setup a H_M_F. - SO_TOLERANT; } CONTRACTL_END; @@ -1279,7 +1277,6 @@ FCIMPLEND FORCEINLINE UINT64 GCInterface::InterlockedAdd (UINT64 *pAugend, UINT64 addend) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; UINT64 oldMemValue; UINT64 newMemValue; @@ -1300,7 +1297,6 @@ FORCEINLINE UINT64 GCInterface::InterlockedAdd (UINT64 *pAugend, UINT64 addend) FORCEINLINE UINT64 GCInterface::InterlockedSub(UINT64 *pMinuend, UINT64 subtrahend) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; UINT64 oldMemValue; UINT64 newMemValue; @@ -1879,7 +1875,6 @@ static BOOL HasOverriddenMethod(MethodTable* mt, MethodTable* classMT, WORD meth NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; _ASSERTE(mt != NULL); @@ -2038,7 +2033,6 @@ static INT32 FastGetValueTypeHashCodeHelper(MethodTable *mt, void *pObjRef) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; INT32 hashCode = 0; @@ -2254,7 +2248,6 @@ static bool HasOverriddenStreamMethod(MethodTable * pMT, WORD slot) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; PCODE actual = pMT->GetRestoredSlot(slot); diff --git a/src/vm/comwaithandle.cpp b/src/vm/comwaithandle.cpp index 5fd73c5..935a8f0 100644 --- a/src/vm/comwaithandle.cpp +++ b/src/vm/comwaithandle.cpp @@ -81,9 +81,8 @@ private: void AcquireSafeHandleFromWaitHandle(WAITHANDLEREF wh) { CONTRACTL { - THROWS; - GC_TRIGGERS; - SO_INTOLERANT; + THROWS; + GC_TRIGGERS; MODE_COOPERATIVE; PRECONDITION(wh != NULL); } CONTRACTL_END; @@ -97,9 +96,8 @@ void AcquireSafeHandleFromWaitHandle(WAITHANDLEREF wh) void ReleaseSafeHandleFromWaitHandle(WAITHANDLEREF wh) { CONTRACTL { - THROWS; - GC_TRIGGERS; - SO_TOLERANT; + THROWS; + GC_TRIGGERS; MODE_COOPERATIVE; PRECONDITION(wh != NULL); } CONTRACTL_END; diff --git a/src/vm/contractimpl.cpp b/src/vm/contractimpl.cpp index 1a83712..870dc4f 100644 --- a/src/vm/contractimpl.cpp +++ b/src/vm/contractimpl.cpp @@ -65,7 +65,6 @@ UINT32 TypeIDMap::LookupTypeID(PTR_MethodTable pMT) { CONTRACTL { NOTHROW; - SO_TOLERANT; PRECONDITION(CheckPointer(GetThread())); if (GetThread()->PreemptiveGCDisabled()) { GC_NOTRIGGER; } else { GC_TRIGGERS; } } CONTRACTL_END; @@ -82,7 +81,6 @@ PTR_MethodTable TypeIDMap::LookupType(UINT32 id) { CONTRACTL { NOTHROW; - SO_TOLERANT; PRECONDITION(CheckPointer(GetThread())); if (GetThread()->PreemptiveGCDisabled()) { GC_NOTRIGGER; } else { GC_TRIGGERS; } PRECONDITION(id <= TypeIDProvider::MAX_TYPE_ID); @@ -161,7 +159,6 @@ void TypeIDMap::RemoveTypes(LoaderAllocator *pLoaderAllocator) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; // Take the lock diff --git a/src/vm/contractimpl.h b/src/vm/contractimpl.h index d0652c1..3149a4d 100644 --- a/src/vm/contractimpl.h +++ b/src/vm/contractimpl.h @@ -412,7 +412,6 @@ public: THROWS; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(m_nextID != 0); PRECONDITION(m_incSize != 0); @@ -440,7 +439,6 @@ public: THROWS; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(m_nextFatID != 0); PRECONDITION(m_incSize != 0); diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp index d2859cc..ae73123 100644 --- a/src/vm/corhost.cpp +++ b/src/vm/corhost.cpp @@ -597,15 +597,8 @@ HRESULT ExecuteInAppDomainHelper(FExecuteInAppDomainCallback pCallback, void * cookie) { STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_SO_INTOLERANT; - HRESULT hr = S_OK; - - BEGIN_SO_TOLERANT_CODE(GetThread()); - hr = pCallback(cookie); - END_SO_TOLERANT_CODE; - - return hr; + return pCallback(cookie); } HRESULT CorHost2::ExecuteInAppDomain(DWORD dwAppDomainId, @@ -640,7 +633,7 @@ HRESULT CorHost2::ExecuteInAppDomain(DWORD dwAppDomainId, ENTER_DOMAIN_ID(ADID(dwAppDomainId)) { // We are calling an unmanaged function pointer, either an unmanaged function, or a marshaled out delegate. - // The thread should be in preemptive mode, and SO_Tolerant. + // The thread should be in preemptive mode. GCX_PREEMP(); hr=ExecuteInAppDomainHelper (pCallback, cookie); } @@ -1194,7 +1187,6 @@ STDMETHODIMP CorHost2::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone) STDMETHODIMP CorHost2::UnloadAppDomain2(DWORD dwDomainId, BOOL fWaitUntilDone, int *pLatchedExitCode) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; if (!m_fStarted) return HOST_E_INVALIDOPERATION; @@ -1310,7 +1302,6 @@ ULONG CorRuntimeHostBase::AddRef() { WRAPPER(THROWS); WRAPPER(GC_TRIGGERS); - SO_TOLERANT; } CONTRACTL_END; return InterlockedIncrement(&m_cRef); @@ -1340,7 +1331,6 @@ HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; // no global state updates that need guarding. } CONTRACTL_END; @@ -1405,7 +1395,6 @@ HRESULT CorHost2::GetBucketParametersForCurrentException(BucketParameters *pPara { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1430,13 +1419,11 @@ HRESULT CorHost2::CreateObject(REFIID riid, void **ppUnk) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; HRESULT hr = S_OK; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW; ); CorHost2 *pCorHost = new (nothrow) CorHost2(); if (!pCorHost) { @@ -1448,7 +1435,6 @@ HRESULT CorHost2::CreateObject(REFIID riid, void **ppUnk) if (FAILED(hr)) delete pCorHost; } - END_SO_INTOLERANT_CODE; return (hr); } @@ -1636,14 +1622,12 @@ public: virtual ULONG STDMETHODCALLTYPE AddRef(void) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return 1; } virtual ULONG STDMETHODCALLTYPE Release(void) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return 1; } @@ -1651,7 +1635,6 @@ public: void **ppvObject) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; if (riid != IID_ICLRPolicyManager && riid != IID_IUnknown) return (E_NOINTERFACE); @@ -1903,7 +1886,6 @@ HRESULT CCLRGCManager::_SetGCSegmentSize(SIZE_T SegmentSize) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1929,7 +1911,6 @@ HRESULT CCLRGCManager::_SetGCMaxGen0Size(SIZE_T MaxGen0Size) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -2086,7 +2067,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; // no global state updates } CONTRACTL_END; @@ -2263,7 +2243,6 @@ HRESULT CCLRErrorReportingManager::QueryInterface(REFIID riid, void** ppUnk) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -2689,7 +2668,6 @@ extern "C" IExecutionEngine * __stdcall IEE() HRESULT STDMETHODCALLTYPE CExecutionEngine::QueryInterface(REFIID id, void **pInterface) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; if (!pInterface) return E_POINTER; @@ -2771,7 +2749,6 @@ void **CExecutionEngine::CheckThreadState(DWORD slot, BOOL force) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; // @TODO: Decide on an exception strategy for all the DLLs of the CLR, and then // enable all the exceptions out of this method. @@ -2799,9 +2776,6 @@ void **CExecutionEngine::CheckThreadState(DWORD slot, BOOL force) goto LError; } memset (pTlsInfo, 0, sizeof(ClrTlsInfo)); - // We save the last intolerant marker on stack in this slot. - // -1 is the larget unsigned number, and therefore our marker is always smaller than it. - pTlsInfo->data[TlsIdx_SOIntolerantTransitionHandler] = (void*)(-1); } if (!fInTls && pTlsInfo) @@ -2841,7 +2815,6 @@ void **CExecutionEngine::CheckThreadStateNoCreate(DWORD slot STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; // !!! This function is called during Thread::SwitchIn and SwitchOut // !!! It is extremely important that while executing this function, we will not @@ -2865,7 +2838,6 @@ void CExecutionEngine::SetupTLSForThread(Thread *pThread) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_ANY; #ifdef STRESS_LOG @@ -3000,7 +2972,6 @@ void FreeClrDebugState(LPVOID pTlsData); VOID STDMETHODCALLTYPE CExecutionEngine::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; CheckThreadState(slot); @@ -3030,7 +3001,6 @@ LPVOID* STDMETHODCALLTYPE CExecutionEngine::TLS_GetDataBlock() STATIC_CONTRACT_THROWS; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; return CExecutionEngine::GetTlsData(); } @@ -3038,21 +3008,18 @@ LPVOID* STDMETHODCALLTYPE CExecutionEngine::TLS_GetDataBlock() LPVOID STDMETHODCALLTYPE CExecutionEngine::TLS_GetValue(DWORD slot) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EETlsGetValue(slot); } BOOL STDMETHODCALLTYPE CExecutionEngine::TLS_CheckValue(DWORD slot, LPVOID * pValue) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EETlsCheckValue(slot, pValue); } VOID STDMETHODCALLTYPE CExecutionEngine::TLS_SetValue(DWORD slot, LPVOID pData) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; EETlsSetValue(slot,pData); } @@ -3060,7 +3027,6 @@ VOID STDMETHODCALLTYPE CExecutionEngine::TLS_SetValue(DWORD slot, LPVOID pData) VOID STDMETHODCALLTYPE CExecutionEngine::TLS_ThreadDetaching() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; CExecutionEngine::ThreadDetaching(NULL); } @@ -3086,26 +3052,19 @@ CRITSEC_COOKIE STDMETHODCALLTYPE CExecutionEngine::CreateLock(LPCSTR szTag, LPCS void STDMETHODCALLTYPE CExecutionEngine::DestroyLock(CRITSEC_COOKIE cookie) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; ::EEDeleteCriticalSection(cookie); } void STDMETHODCALLTYPE CExecutionEngine::AcquireLock(CRITSEC_COOKIE cookie) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - BEGIN_SO_INTOLERANT_CODE(GetThread()); ::EEEnterCriticalSection(cookie); - END_SO_INTOLERANT_CODE; } void STDMETHODCALLTYPE CExecutionEngine::ReleaseLock(CRITSEC_COOKIE cookie) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - BEGIN_SO_INTOLERANT_CODE(GetThread()); ::EELeaveCriticalSection(cookie); - END_SO_INTOLERANT_CODE; } // Locking routines supplied by the EE to the other DLLs of the CLR. In a _DEBUG @@ -3187,7 +3146,6 @@ EVENT_COOKIE STDMETHODCALLTYPE CExecutionEngine::CreateManualEvent(BOOL bInitial void STDMETHODCALLTYPE CExecutionEngine::CloseEvent(EVENT_COOKIE event) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; if (event) { CLREvent *pEvent = CookieToCLREvent(event); pEvent->CloseEvent(); @@ -3201,7 +3159,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrSetEvent(EVENT_COOKIE event) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3218,7 +3175,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrResetEvent(EVENT_COOKIE event) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3234,7 +3190,6 @@ DWORD STDMETHODCALLTYPE CExecutionEngine::WaitForEvent(EVENT_COOKIE event, BOOL bAlertable) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; if (event) { CLREvent *pEvent = CookieToCLREvent(event); return pEvent->Wait(dwMilliseconds,bAlertable); @@ -3249,14 +3204,12 @@ DWORD STDMETHODCALLTYPE CExecutionEngine::WaitForSingleObject(HANDLE handle, DWORD dwMilliseconds) { STATIC_CONTRACT_WRAPPER; - STATIC_CONTRACT_SO_TOLERANT; return ::WaitForSingleObject(handle,dwMilliseconds); } static inline SEMAPHORE_COOKIE CLRSemaphoreToCookie(CLRSemaphore * pSemaphore) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE((((uintptr_t) pSemaphore) & POISON_BITS) == 0); #ifdef _DEBUG @@ -3287,7 +3240,6 @@ SEMAPHORE_COOKIE STDMETHODCALLTYPE CExecutionEngine::ClrCreateSemaphore(DWORD dw THROWS; MODE_ANY; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -3304,7 +3256,6 @@ void STDMETHODCALLTYPE CExecutionEngine::ClrCloseSemaphore(SEMAPHORE_COOKIE sema { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3321,7 +3272,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrReleaseSemaphore(SEMAPHORE_COOKIE se { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3334,7 +3284,6 @@ DWORD STDMETHODCALLTYPE CExecutionEngine::ClrWaitForSemaphore(SEMAPHORE_COOKIE s BOOL bAlertable) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; CLRSemaphore *pSemaphore = CookieToCLRSemaphore(semaphore); return pSemaphore->Wait(dwMilliseconds,bAlertable); } @@ -3372,7 +3321,6 @@ MUTEX_COOKIE STDMETHODCALLTYPE CExecutionEngine::ClrCreateMutex(LPSECURITY_ATTRI NOTHROW; MODE_ANY; GC_NOTRIGGER; - SO_TOLERANT; // we catch any erros and free the allocated memory } CONTRACTL_END; @@ -3401,7 +3349,6 @@ void STDMETHODCALLTYPE CExecutionEngine::ClrCloseMutex(MUTEX_COOKIE mutex) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3416,7 +3363,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrReleaseMutex(MUTEX_COOKIE mutex) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3432,7 +3378,6 @@ DWORD STDMETHODCALLTYPE CExecutionEngine::ClrWaitForMutex(MUTEX_COOKIE mutex, { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3444,8 +3389,6 @@ DWORD STDMETHODCALLTYPE CExecutionEngine::ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD STDMETHODCALLTYPE CExecutionEngine::ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - return EESleepEx(dwMilliseconds,bAlertable); } #define ClrSleepEx EESleepEx @@ -3454,7 +3397,6 @@ DWORD STDMETHODCALLTYPE CExecutionEngine::ClrSleepEx(DWORD dwMilliseconds, BOOL BOOL STDMETHODCALLTYPE CExecutionEngine::ClrAllocationDisallowed() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEAllocationDisallowed(); } #define ClrAllocationDisallowed EEAllocationDisallowed @@ -3466,7 +3408,6 @@ LPVOID STDMETHODCALLTYPE CExecutionEngine::ClrVirtualAlloc(LPVOID lpAddress, DWORD flProtect) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEVirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect); } #define ClrVirtualAlloc EEVirtualAlloc @@ -3477,7 +3418,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrVirtualFree(LPVOID lpAddress, DWORD dwFreeType) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEVirtualFree(lpAddress, dwSize, dwFreeType); } #define ClrVirtualFree EEVirtualFree @@ -3488,7 +3428,6 @@ SIZE_T STDMETHODCALLTYPE CExecutionEngine::ClrVirtualQuery(LPCVOID lpAddress, SIZE_T dwLength) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEVirtualQuery(lpAddress, lpBuffer, dwLength); } #define ClrVirtualQuery EEVirtualQuery @@ -3507,7 +3446,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrVirtualProtect(LPVOID lpAddress, PDWORD lpflOldProtect) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // Get the UEF installation details - we will use these to validate // that the calls to ClrVirtualProtect are not going to affect the UEF. @@ -3623,7 +3561,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrVirtualProtect(LPVOID lpAddress, HANDLE STDMETHODCALLTYPE CExecutionEngine::ClrGetProcessHeap() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEGetProcessHeap(); } #define ClrGetProcessHeap EEGetProcessHeap @@ -3632,7 +3569,6 @@ HANDLE STDMETHODCALLTYPE CExecutionEngine::ClrGetProcessHeap() HANDLE STDMETHODCALLTYPE CExecutionEngine::ClrGetProcessExecutableHeap() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEGetProcessExecutableHeap(); } #define ClrGetProcessExecutableHeap EEGetProcessExecutableHeap @@ -3644,7 +3580,6 @@ HANDLE STDMETHODCALLTYPE CExecutionEngine::ClrHeapCreate(DWORD flOptions, SIZE_T dwMaximumSize) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEHeapCreate(flOptions, dwInitialSize, dwMaximumSize); } #define ClrHeapCreate EEHeapCreate @@ -3653,7 +3588,6 @@ HANDLE STDMETHODCALLTYPE CExecutionEngine::ClrHeapCreate(DWORD flOptions, BOOL STDMETHODCALLTYPE CExecutionEngine::ClrHeapDestroy(HANDLE hHeap) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEHeapDestroy(hHeap); } #define ClrHeapDestroy EEHeapDestroy @@ -3664,13 +3598,6 @@ LPVOID STDMETHODCALLTYPE CExecutionEngine::ClrHeapAlloc(HANDLE hHeap, SIZE_T dwBytes) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - - // We need to guarentee a very small stack consumption in allocating. And we can't allow - // an SO to happen while calling into the host. This will force a hard SO which is OK because - // we shouldn't ever get this close inside the EE in SO-intolerant code, so this should - // only fail if we call directly in from outside the EE, such as the JIT. - MINIMAL_STACK_PROBE_CHECK_THREAD(GetThread()); return EEHeapAlloc(hHeap, dwFlags, dwBytes); } @@ -3682,7 +3609,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrHeapFree(HANDLE hHeap, LPVOID lpMem) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEHeapFree(hHeap, dwFlags, lpMem); } #define ClrHeapFree EEHeapFree @@ -3693,7 +3619,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrHeapValidate(HANDLE hHeap, LPCVOID lpMem) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return EEHeapValidate(hHeap, dwFlags, lpMem); } #define ClrHeapValidate EEHeapValidate @@ -3706,7 +3631,6 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrHeapValidate(HANDLE hHeap, void CExecutionEngine::GetLastThrownObjectExceptionFromThread(void **ppvException) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // Cast to our real type. Exception **ppException = reinterpret_cast(ppvException); diff --git a/src/vm/crst.h b/src/vm/crst.h index fa8c307..d2e7075 100644 --- a/src/vm/crst.h +++ b/src/vm/crst.h @@ -391,8 +391,6 @@ private: inline ~CrstHolder() { WRAPPER_NO_CONTRACT; - - VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(HSV_ValidateMinimumStackReq); ReleaseLock(m_pCrst); } }; diff --git a/src/vm/customattribute.cpp b/src/vm/customattribute.cpp index e77d55a..97a9c80 100644 --- a/src/vm/customattribute.cpp +++ b/src/vm/customattribute.cpp @@ -866,7 +866,6 @@ FCIMPL5(VOID, COMCustomAttribute::ParseAttributeUsageAttribute, PVOID pData, ULO int inherited = 0; int allowMultiple = 1; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); { CustomAttributeParser ca(pData, cData); @@ -897,7 +896,6 @@ FCIMPL5(VOID, COMCustomAttribute::ParseAttributeUsageAttribute, PVOID pData, ULO *pInherited = namedArgs[inherited].val.boolean == TRUE; *pAllowMultiple = namedArgs[allowMultiple].val.boolean == TRUE; } - END_SO_INTOLERANT_CODE; } FCIMPLEND diff --git a/src/vm/custommarshalerinfo.h b/src/vm/custommarshalerinfo.h index 95390f2..1670077 100644 --- a/src/vm/custommarshalerinfo.h +++ b/src/vm/custommarshalerinfo.h @@ -87,7 +87,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; diff --git a/src/vm/dataimage.cpp b/src/vm/dataimage.cpp index 1abd576..108c6df 100644 --- a/src/vm/dataimage.cpp +++ b/src/vm/dataimage.cpp @@ -597,7 +597,6 @@ void DataImage::StoreRvaInfo(FieldDesc * pFD, int __cdecl DataImage::rvaInfoVectorEntryCmp(const void* a_, const void* b_) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; DataImage::RvaInfoStructure *a = (DataImage::RvaInfoStructure *)a_; DataImage::RvaInfoStructure *b = (DataImage::RvaInfoStructure *)b_; int rvaComparisonResult = (int)(a->rva - b->rva); diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp index daadc91..3402a8b 100644 --- a/src/vm/debugdebugger.cpp +++ b/src/vm/debugdebugger.cpp @@ -211,7 +211,6 @@ FCIMPLEND { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/debughelp.cpp b/src/vm/debughelp.cpp index b604346..ebc9e09 100644 --- a/src/vm/debughelp.cpp +++ b/src/vm/debughelp.cpp @@ -20,7 +20,6 @@ BOOL isMemoryReadable(const TADDR start, unsigned len) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -108,7 +107,6 @@ bool isRetAddr(TADDR retAddr, TADDR* whereCalled) { NOTHROW; GC_NOTRIGGER; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/dispatchinfo.cpp b/src/vm/dispatchinfo.cpp index 78007b2..983d423 100644 --- a/src/vm/dispatchinfo.cpp +++ b/src/vm/dispatchinfo.cpp @@ -2306,7 +2306,6 @@ void DispatchInfo::MarshalParamNativeToManaged(DispatchMemberInfo *pMemberInfo, THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -2359,7 +2358,6 @@ void DispatchInfo::MarshalReturnValueManagedToNative(DispatchMemberInfo *pMember THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -3017,7 +3015,6 @@ MethodDesc* DispatchInfo::GetInvokeMemberMD() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; POSTCONDITION(CheckPointer(RETVAL)); } CONTRACT_END; @@ -3034,7 +3031,6 @@ OBJECTREF DispatchInfo::GetReflectionObject() THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -3182,7 +3178,6 @@ DISPID DispatchInfo::GenerateDispID() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -3670,7 +3665,6 @@ MethodDesc* DispatchExInfo::GetInvokeMemberMD() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; POSTCONDITION(CheckPointer(RETVAL)); } CONTRACT_END; diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp index 18e77d8..7dedce6 100644 --- a/src/vm/dllimport.cpp +++ b/src/vm/dllimport.cpp @@ -6996,7 +6996,6 @@ EXTERN_C LPVOID STDCALL NDirectImportWorker(NDirectMethodDesc* pMD) THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp index 31bc7a8..0fd9c81 100644 --- a/src/vm/domainfile.cpp +++ b/src/vm/domainfile.cpp @@ -93,7 +93,6 @@ LoaderAllocator * DomainFile::GetLoaderAllocator() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -382,7 +381,6 @@ DomainAssembly *DomainFile::GetDomainAssembly() SUPPORTS_DAC; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -514,7 +512,6 @@ BOOL DomainFile::DoIncrementalLoad(FileLoadLevel level) Thread *pThread; pThread = GetThread(); _ASSERTE(pThread); - INTERIOR_STACK_PROBE_FOR(pThread, 8); switch (level) { @@ -582,8 +579,6 @@ BOOL DomainFile::DoIncrementalLoad(FileLoadLevel level) UNREACHABLE(); } - END_INTERIOR_STACK_PROBE; - #ifdef FEATURE_MULTICOREJIT { Module * pModule = GetModule(); @@ -1658,7 +1653,6 @@ void DomainAssembly::DeliverAsyncEvents() NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; diff --git a/src/vm/domainfile.inl b/src/vm/domainfile.inl index e82ee3e..9c14a29 100644 --- a/src/vm/domainfile.inl +++ b/src/vm/domainfile.inl @@ -7,7 +7,6 @@ inline Module* DomainFile::GetCurrentModule() { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; SUPPORTS_DAC; return m_pModule; @@ -47,7 +46,6 @@ inline Module* DomainFile::GetModule() inline Assembly* DomainAssembly::GetCurrentAssembly() { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return m_pAssembly; } @@ -70,14 +68,8 @@ inline Assembly* DomainAssembly::GetLoadedAssembly() inline Assembly* DomainAssembly::GetAssembly() { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - { - // CheckLoadLevel() is SO_INTOLERANT. However, this is only done in - // debug for the consistency check, so we can accept the SO violation. - CONTRACT_VIOLATION(SOToleranceViolation); - CONSISTENCY_CHECK(CheckLoadLevel(FILE_LOAD_ALLOCATE)); - } + CONSISTENCY_CHECK(CheckLoadLevel(FILE_LOAD_ALLOCATE)); return m_pAssembly; } diff --git a/src/vm/dwreport.cpp b/src/vm/dwreport.cpp index 0890f3f..fc5838e 100644 --- a/src/vm/dwreport.cpp +++ b/src/vm/dwreport.cpp @@ -766,7 +766,6 @@ HRESULT RetrieveManagedBucketParameters( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -856,7 +855,6 @@ HRESULT GetBucketParametersForCurrentException( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/dynamicmethod.cpp b/src/vm/dynamicmethod.cpp index cbec6ae..5b9a6fa 100644 --- a/src/vm/dynamicmethod.cpp +++ b/src/vm/dynamicmethod.cpp @@ -1054,7 +1054,6 @@ void LCGMethodResolver::GetJitContextCoop(SecurityControlFlags * securityControl THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(securityControlFlags)); PRECONDITION(CheckPointer(typeOwner)); @@ -1479,7 +1478,6 @@ void* ChunkAllocator::New(size_t size) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/ecall.cpp b/src/vm/ecall.cpp index 3812ff1..b8e0d64 100644 --- a/src/vm/ecall.cpp +++ b/src/vm/ecall.cpp @@ -595,7 +595,6 @@ MethodDesc* ECall::MapTargetBackToMethod(PCODE pTarg, PCODE * ppAdjustedEntryPoi GC_NOTRIGGER; MODE_ANY; HOST_NOCALLS; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -633,7 +632,6 @@ CorInfoIntrinsics ECall::GetIntrinsicID(MethodDesc* pMD) THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; PRECONDITION(pMD->IsFCall()); } CONTRACTL_END; @@ -737,7 +735,6 @@ void HCallAssert(void*& cache, void* target) { CONTRACTL { - SO_TOLERANT; // STATIC_CONTRACT_DEBUG_ONLY NOTHROW; GC_NOTRIGGER; MODE_ANY; diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp index a11dacd..d964243 100644 --- a/src/vm/eeconfig.cpp +++ b/src/vm/eeconfig.cpp @@ -1278,7 +1278,6 @@ HRESULT EEConfig::GetConfigValueCallback(__in_z LPCWSTR pKey, __deref_out_opt LP NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pValue)); PRECONDITION(CheckPointer(pKey)); } CONTRACT_END; @@ -1312,7 +1311,6 @@ HRESULT EEConfig::GetConfiguration_DontUse_(__in_z LPCWSTR pKey, ConfigSearch di NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; // TODO: Verify this does not do anything that would make it so_intolerant PRECONDITION(CheckPointer(pValue)); PRECONDITION(CheckPointer(pKey)); } CONTRACT_END; @@ -1330,9 +1328,7 @@ HRESULT EEConfig::GetConfiguration_DontUse_(__in_z LPCWSTR pKey, ConfigSearch di ConfigStringHashtable* table = iter.Next(); if(table != NULL) { - BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, RETURN E_FAIL;) pair = table->Lookup(pKey); - END_SO_INTOLERANT_CODE if(pair != NULL) { *pValue = pair->value; @@ -1347,9 +1343,7 @@ HRESULT EEConfig::GetConfiguration_DontUse_(__in_z LPCWSTR pKey, ConfigSearch di table != NULL; table = iter.Next()) { - BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, RETURN E_FAIL;) pair = table->Lookup(pKey); - END_SO_INTOLERANT_CODE if(pair != NULL) { *pValue = pair->value; @@ -1363,9 +1357,7 @@ HRESULT EEConfig::GetConfiguration_DontUse_(__in_z LPCWSTR pKey, ConfigSearch di table != NULL; table = iter.Previous()) { - BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, RETURN E_FAIL;) pair = table->Lookup(pKey); - END_SO_INTOLERANT_CODE if(pair != NULL) { *pValue = pair->value; diff --git a/src/vm/eeconfig.h b/src/vm/eeconfig.h index 9df3715..cf46336 100644 --- a/src/vm/eeconfig.h +++ b/src/vm/eeconfig.h @@ -118,7 +118,6 @@ public: GC_NOTRIGGER; // MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; pEnd = &(pList->m_pElement); @@ -137,7 +136,6 @@ public: GC_NOTRIGGER; // MODE_ANY; FORBID_FAULT; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } CONTRACT_END; @@ -154,8 +152,7 @@ public: NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - // MODE_ANY; - SO_TOLERANT; + // MODE_ANY; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } CONTRACT_END; diff --git a/src/vm/eecontract.cpp b/src/vm/eecontract.cpp index 2d5212e..77c1f7e 100644 --- a/src/vm/eecontract.cpp +++ b/src/vm/eecontract.cpp @@ -29,7 +29,6 @@ void EEContract::DoChecks(UINT testmask, __in_z const char *szFunction, __in_z c SCAN_IGNORE_FAULT; // due to the contract checking logic itself. SCAN_IGNORE_TRIGGER; SCAN_IGNORE_LOCK; - SCAN_IGNORE_SO; // Many of the checks below result in calls to GetThread() // that work just fine if GetThread() returns NULL, so temporarily diff --git a/src/vm/eecontract.h b/src/vm/eecontract.h index fbe0d55..602522d 100644 --- a/src/vm/eecontract.h +++ b/src/vm/eecontract.h @@ -16,7 +16,6 @@ #define EECONTRACT_H_ #include "contract.h" -#include "stackprobe.h" // -------------------------------------------------------------------------------- // EECONTRACT is an extension of the lower level CONTRACT macros to include some @@ -109,7 +108,6 @@ class EEContract : public BaseContract THROWS; \ GC_TRIGGERS; \ MODE_PREEMPTIVE; \ - SO_INTOLERANT; \ INJECT_FAULT(COMPlusThrowOM();); \ #endif // EECONTRACT_H_ diff --git a/src/vm/eedbginterfaceimpl.cpp b/src/vm/eedbginterfaceimpl.cpp index cd59643..32da864 100644 --- a/src/vm/eedbginterfaceimpl.cpp +++ b/src/vm/eedbginterfaceimpl.cpp @@ -26,7 +26,6 @@ void EEDbgInterfaceImpl::Terminate(void) { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -83,7 +82,6 @@ Frame *EEDbgInterfaceImpl::GetFrame(CrawlFrame *pCF) { CONTRACT(Frame *) { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pCF)); @@ -101,7 +99,6 @@ bool EEDbgInterfaceImpl::InitRegDisplay(Thread* pThread, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pThread)); @@ -120,7 +117,6 @@ BOOL EEDbgInterfaceImpl::IsStringObject(Object* o) { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; PRECONDITION(CheckPointer(o)); @@ -134,7 +130,6 @@ BOOL EEDbgInterfaceImpl::IsTypedReference(MethodTable* pMT) { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; PRECONDITION(CheckPointer(pMT)); @@ -148,7 +143,6 @@ WCHAR* EEDbgInterfaceImpl::StringObjectGetBuffer(StringObject* so) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(so)); @@ -162,7 +156,6 @@ DWORD EEDbgInterfaceImpl::StringObjectGetStringLength(StringObject* so) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(so)); @@ -176,7 +169,6 @@ void* EEDbgInterfaceImpl::GetObjectFromHandle(OBJECTHANDLE handle) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -195,7 +187,6 @@ OBJECTHANDLE EEDbgInterfaceImpl::GetHandleFromObject(void *obj, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; // From CreateHandle GC_NOTRIGGER; PRECONDITION(CheckPointer(pAppDomain)); @@ -227,7 +218,6 @@ void EEDbgInterfaceImpl::DbgDestroyHandle(OBJECTHANDLE oh, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -273,7 +263,6 @@ bool EEDbgInterfaceImpl::IsThreadExceptionNull(Thread *pThread) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pThread)); @@ -312,7 +301,6 @@ bool EEDbgInterfaceImpl::StartSuspendForDebug(AppDomain *pAppDomain, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -330,7 +318,6 @@ bool EEDbgInterfaceImpl::SweepThreadsForDebug(bool forceSync) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; DISABLED(GC_TRIGGERS); // Called by unmanaged threads. } @@ -343,7 +330,6 @@ void EEDbgInterfaceImpl::ResumeFromDebug(AppDomain *pAppDomain) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -356,7 +342,6 @@ void EEDbgInterfaceImpl::MarkThreadForDebugSuspend(Thread* pRuntimeThread) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pRuntimeThread)); @@ -371,7 +356,6 @@ void EEDbgInterfaceImpl::MarkThreadForDebugStepping(Thread* pRuntimeThread, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pRuntimeThread)); @@ -386,7 +370,6 @@ void EEDbgInterfaceImpl::SetThreadFilterContext(Thread *thread, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(thread)); @@ -459,7 +442,6 @@ BOOL EEDbgInterfaceImpl::IsInPrologOrEpilog(const BYTE *address, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -493,7 +475,6 @@ void EEDbgInterfaceImpl::DetermineIfOffsetsInFilterOrHandler(const BYTE *functio { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -557,7 +538,6 @@ void EEDbgInterfaceImpl::GetMethodRegionInfo(const PCODE pStart, { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pCold)); @@ -661,7 +641,6 @@ void EEDbgInterfaceImpl::DisablePreemptiveGC(void) { CONTRACTL { - SO_INTOLERANT; NOTHROW; DISABLED(GC_TRIGGERS); // Disabled because disabled in RareDisablePreemptiveGC() } @@ -674,7 +653,6 @@ void EEDbgInterfaceImpl::EnablePreemptiveGC(void) { CONTRACTL { - SO_INTOLERANT; NOTHROW; DISABLED(GC_TRIGGERS); // Disabled because disabled in RareEnablePreemptiveGC() } @@ -687,7 +665,6 @@ bool EEDbgInterfaceImpl::IsPreemptiveGCDisabled(void) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; } @@ -750,7 +727,6 @@ ULONG EEDbgInterfaceImpl::MethodDescGetRVA(MethodDesc *pFD) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pFD)); @@ -1016,7 +992,6 @@ TypeHandle EEDbgInterfaceImpl::LoadPointerOrByrefType(CorElementType et, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_TRIGGERS; } @@ -1030,7 +1005,6 @@ TypeHandle EEDbgInterfaceImpl::LoadFnptrType(TypeHandle *inst, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_TRIGGERS; } @@ -1044,7 +1018,6 @@ TypeHandle EEDbgInterfaceImpl::LoadElementType(CorElementType et) { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_TRIGGERS; } @@ -1068,7 +1041,6 @@ HRESULT EEDbgInterfaceImpl::GetMethodImplProps(Module *pModule, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pModule)); @@ -1084,7 +1056,6 @@ HRESULT EEDbgInterfaceImpl::GetParentToken(Module *pModule, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pModule)); @@ -1098,7 +1069,6 @@ void EEDbgInterfaceImpl::MarkDebuggerAttached(void) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1112,7 +1082,6 @@ void EEDbgInterfaceImpl::MarkDebuggerUnattached(void) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1134,7 +1103,6 @@ HRESULT EEDbgInterfaceImpl::EnCApplyChanges(EditAndContinueModule *pModule, LOG((LF_ENC, LL_INFO100, "EncApplyChanges\n")); CONTRACTL { - SO_NOT_MAINLINE; DISABLED(THROWS); DISABLED(GC_TRIGGERS); PRECONDITION(CheckPointer(pModule)); @@ -1154,7 +1122,6 @@ void EEDbgInterfaceImpl::ResumeInUpdatedFunction(EditAndContinueModule *pModule, { CONTRACTL { - SO_NOT_MAINLINE; DISABLED(THROWS); DISABLED(GC_TRIGGERS); PRECONDITION(CheckPointer(pModule)); @@ -1173,8 +1140,6 @@ bool EEDbgInterfaceImpl::CrawlFrameIsGcSafe(CrawlFrame *pCF) { CONTRACTL { - SO_NOT_MAINLINE; - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pCF)); @@ -1188,7 +1153,6 @@ bool EEDbgInterfaceImpl::IsStub(const BYTE *ip) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1219,7 +1183,6 @@ bool EEDbgInterfaceImpl::TraceStub(const BYTE *ip, #ifndef DACCESS_COMPILE CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1238,7 +1201,6 @@ bool EEDbgInterfaceImpl::FollowTrace(TraceDestination *trace) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1255,7 +1217,6 @@ bool EEDbgInterfaceImpl::TraceFrame(Thread *thread, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; DISABLED(GC_TRIGGERS); // This is not a bug - the debugger can call this on an un-managed thread. PRECONDITION(CheckPointer(frame)); @@ -1289,7 +1250,6 @@ bool EEDbgInterfaceImpl::TraceManager(Thread *thread, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_TRIGGERS; PRECONDITION(CheckPointer(stubManager)); @@ -1332,7 +1292,6 @@ void EEDbgInterfaceImpl::EnableTraceCall(Thread *thread) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(thread)); @@ -1346,7 +1305,6 @@ void EEDbgInterfaceImpl::DisableTraceCall(Thread *thread) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(thread)); @@ -1376,7 +1334,6 @@ void EEDbgInterfaceImpl::GetRuntimeOffsets(SIZE_T *pTLSIndex, { CONTRACTL { - SO_INTOLERANT; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pTLSIndex)); @@ -1418,7 +1375,6 @@ void EEDbgInterfaceImpl::DebuggerModifyingLogSwitch (int iNewLevel, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_NOTRIGGER; } @@ -1438,7 +1394,6 @@ HRESULT EEDbgInterfaceImpl::SetIPFromSrcToDst(Thread *pThread, { CONTRACTL { - SO_NOT_MAINLINE; THROWS; GC_TRIGGERS; } @@ -1461,7 +1416,6 @@ void EEDbgInterfaceImpl::SetDebugState(Thread *pThread, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pThread)); @@ -1487,7 +1441,6 @@ void EEDbgInterfaceImpl::SetAllDebugState(Thread *et, { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -1512,7 +1465,6 @@ CorDebugUserState EEDbgInterfaceImpl::GetPartialUserState(Thread *pThread) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pThread)); diff --git a/src/vm/eedbginterfaceimpl.inl b/src/vm/eedbginterfaceimpl.inl index 3506a32..0b9306b 100644 --- a/src/vm/eedbginterfaceimpl.inl +++ b/src/vm/eedbginterfaceimpl.inl @@ -25,7 +25,6 @@ class EEToDebuggerExceptionInterfaceWrapper { THROWS; GC_TRIGGERS; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -52,7 +51,6 @@ class EEToDebuggerExceptionInterfaceWrapper { THROWS; GC_TRIGGERS; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/eehash.inl b/src/vm/eehash.inl index ba25fcb..4ed9fa2 100644 --- a/src/vm/eehash.inl +++ b/src/vm/eehash.inl @@ -442,7 +442,6 @@ BOOL EEHashTableBase::GetValue(KeyType pKey WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -494,7 +493,6 @@ FORCEINLINE BOOL EEHashTableBase::GetValueS #ifdef MODE_COOPERATIVE // This header file sees contract.h, not eecontract.h - what a kludge! MODE_COOPERATIVE; #endif - SO_TOLERANT; } CONTRACTL_END @@ -519,7 +517,6 @@ EEHashEntry_t *EEHashTableBase::FindItem(Ke WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -535,7 +532,6 @@ EEHashEntry_t *EEHashTableBase::FindItem(Ke WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -604,7 +600,6 @@ FORCEINLINE EEHashEntry_t *EEHashTableBase: #ifdef MODE_COOPERATIVE // This header file sees contract.h, not eecontract.h - what a kludge! MODE_COOPERATIVE; #endif - SO_TOLERANT; } CONTRACTL_END diff --git a/src/vm/eepolicy.cpp b/src/vm/eepolicy.cpp index 4cd4d0a..62e47b1 100644 --- a/src/vm/eepolicy.cpp +++ b/src/vm/eepolicy.cpp @@ -380,7 +380,6 @@ EPolicyAction EEPolicy::GetActionOnFailureNoHostNotification(EClrFailure failure { CONTRACTL { - SO_TOLERANT; MODE_ANY; GC_NOTRIGGER; NOTHROW; @@ -399,7 +398,6 @@ EPolicyAction EEPolicy::GetActionOnFailure(EClrFailure failure) { CONTRACTL { - SO_TOLERANT; MODE_ANY; GC_NOTRIGGER; NOTHROW; @@ -423,7 +421,6 @@ void EEPolicy::NotifyHostOnTimeout(EClrOperation operation, EPolicyAction action THROWS; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -437,7 +434,6 @@ void EEPolicy::NotifyHostOnDefaultAction(EClrOperation operation, EPolicyAction NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -445,8 +441,6 @@ void EEPolicy::NotifyHostOnDefaultAction(EClrOperation operation, EPolicyAction void SafeExitProcess(UINT exitCode, BOOL fAbort = FALSE, ShutdownCompleteAction sca = SCA_ExitProcessWhenShutdownComplete) { - // The process is shutting down. No need to check SO contract. - SO_NOT_MAINLINE_FUNCTION; STRESS_LOG2(LF_SYNC, LL_INFO10, "SafeExitProcess: exitCode = %d, fAbort = %d\n", exitCode, fAbort); CONTRACTL { @@ -654,7 +648,6 @@ EPolicyAction EEPolicy::DetermineResourceConstraintAction(Thread *pThread) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -735,60 +728,6 @@ void EEPolicy::HandleOutOfMemory() PerformResourceConstraintAction(pThread, action, HOST_E_EXITPROCESS_OUTOFMEMORY, TRUE); } -#ifdef FEATURE_STACK_PROBE -//--------------------------------------------------------------------------------------- -// -// IsSOTolerant - Is the current thread in SO Tolerant region? -// -// Arguments: -// pLimitFrame: the limit of search for frames -// -// Return Value: -// TRUE if in SO tolerant region. -// FALSE if in SO intolerant region. -// -// Note: -// We walk our frame chain to decide. If HelperMethodFrame is seen first, we are in tolerant -// region. If EnterSOIntolerantCodeFrame is seen first, we are in intolerant region. -// -BOOL Thread::IsSOTolerant(void * pLimitFrame) -{ - LIMITED_METHOD_CONTRACT; - - Frame *pFrame = GetFrame(); - void* pSOIntolerantMarker = ClrFlsGetValue(TlsIdx_SOIntolerantTransitionHandler); - if (pSOIntolerantMarker == FRAME_TOP) - { - // We have not set a marker for intolerant transition yet. - return TRUE; - } - while (pFrame != FRAME_TOP && pFrame < pLimitFrame) - { - Frame::ETransitionType type = pFrame->GetTransitionType(); - if (pFrame > pSOIntolerantMarker) - { - return FALSE; - } - else if (type == Frame::TT_M2U || type == Frame::TT_InternalCall || - // We can not call HelperMethodFrame::GetFunction on SO since the call - // may need to call into host. This is why we check for TT_InternalCall first. - pFrame->GetFunction() != NULL) - { - return TRUE; - } - pFrame = pFrame->Next(); - } - - if (pFrame == FRAME_TOP) - // We walked to the end of chain, but the thread has one IntolerantMarker on stack decided from - // the check above while loop. - return FALSE; - else - return TRUE; -} - -#endif - //--------------------------------------------------------------------------------------- // // EEPolicy::HandleStackOverflow - Handle stack overflow according to policy @@ -813,8 +752,7 @@ BOOL Thread::IsSOTolerant(void * pLimitFrame) // 3. If stack overflows in SO intolerant region, the process is killed as soon as the exception is seen by our vector handler, or // our managed exception handler. // -// If SO Probing code is disabled (by FEATURE_STACK_PROBE not defined) then the process -// is terminated if there is StackOverflow as all clr code will be considered SO Intolerant. +// The process is terminated if there is StackOverflow as all clr code is considered SO Intolerant. void EEPolicy::HandleStackOverflow(StackOverflowDetector detector, void * pLimitFrame) { WRAPPER_NO_CONTRACT; @@ -834,118 +772,14 @@ void EEPolicy::HandleStackOverflow(StackOverflowDetector detector, void * pLimit return; } -#ifdef FEATURE_STACK_PROBE - - // We only process SO once at - // 1. VectoredExceptionHandler if SO in mscorwks - // 2. managed exception handler - // 3. SO_Tolerant transition handler - if (pThread->HasThreadStateNC(Thread::TSNC_SOWorkNeeded) && - detector != SOD_UnmanagedFrameHandler) - { - return; - } -#endif - -#ifdef FEATURE_STACK_PROBE - BOOL fInSoTolerant = pThread->IsSOTolerant(pLimitFrame); -#else - BOOL fInSoTolerant = false; -#endif - EXCEPTION_POINTERS exceptionInfo; GetCurrentExceptionPointers(&exceptionInfo); _ASSERTE(exceptionInfo.ExceptionRecord); -#ifdef FEATURE_STACK_PROBE - DWORD exceptionCode = exceptionInfo.ExceptionRecord->ExceptionCode; - - AppDomain *pCurrentDomain = ::GetAppDomain(); - BOOL fInDefaultDomain = (pCurrentDomain == SystemDomain::System()->DefaultDomain()); - BOOL fInCLR = IsIPInModule(g_pMSCorEE, (PCODE)GetIP(exceptionInfo.ContextRecord)); - - if (exceptionCode == EXCEPTION_SOFTSO) - { - // Our probe detects a thread does not have enough stack. But we have not trashed the process - // state yet. - fInSoTolerant = TRUE; - } - else - { - _ASSERTE (exceptionCode == STATUS_STACK_OVERFLOW); - - switch (detector) - { - case SOD_ManagedFrameHandler: - if (!pThread->PreemptiveGCDisabled() && !fInCLR && fInSoTolerant) - { - // Managed exception handler detects SO, but the thread is in preemptive GC mode, - // and the IP is outside CLR. This means we are inside a PINVOKE call. - fInSoTolerant = FALSE; - } - break; - - case SOD_UnmanagedFrameHandler: - break; - - case SOD_SOIntolerantTransitor: - fInSoTolerant = FALSE; - break; - - case SOD_SOTolerantTransitor: - if (!fInCLR) - { - // If SO happens outside of CLR, and it is not detected by managed frame handler, - // it is fatal - fInSoTolerant = FALSE; - } - break; - - default: - _ASSERTE(!"should not get here"); - } - - if (fInDefaultDomain) - { - // StackOverflow in default domain is fatal - fInSoTolerant = FALSE; - } - } - -#endif // FEATURE_STACK_PROBE - - ProcessSOEventForHost(&exceptionInfo, fInSoTolerant); + ProcessSOEventForHost(&exceptionInfo, false /* fInSoTolerant */); -#ifdef FEATURE_STACK_PROBE - if (!CLRHosted() || GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) != eRudeUnloadAppDomain) - { - // For security reason, it is not safe to continue execution if stack overflow happens - // unless a host tells us to do something different. - EEPolicy::HandleFatalStackOverflow(&exceptionInfo); - } -#endif - - if (!fInSoTolerant) - { - EEPolicy::HandleFatalStackOverflow(&exceptionInfo); - } -#ifdef FEATURE_STACK_PROBE - else - { - // EnableADUnloadWorker is SO_Intolerant. - // But here we know that if we have only one page, we will only update states of the Domain. - CONTRACT_VIOLATION(SOToleranceViolation); - - pThread->PrepareThreadForSOWork(); - - pThread->MarkThreadForAbort( - (Thread::ThreadAbortRequester)(Thread::TAR_Thread|Thread::TAR_StackOverflow), - EEPolicy::TA_Rude); - - pThread->SetSOWorkNeeded(); - } -#endif + EEPolicy::HandleFatalStackOverflow(&exceptionInfo); } @@ -963,72 +797,6 @@ static EXCEPTION_RECORD g_SOExceptionRecord = { EXCEPTION_POINTERS g_SOExceptionPointers = {&g_SOExceptionRecord, NULL}; -#ifdef FEATURE_STACK_PROBE -// This function may be called on a thread before debugger is notified of the thread, like in -// ManagedThreadBase_DispatchMiddle. Currently we can not notify managed debugger, because -// RS requires that notification is sent first. -void EEPolicy::HandleSoftStackOverflow(BOOL fSkipDebugger) -{ - WRAPPER_NO_CONTRACT; - - // If we trigger a SO while handling the soft stack overflow, - // we'll rip the process - BEGIN_SO_INTOLERANT_CODE_NOPROBE; - - AppDomain *pCurrentDomain = ::GetAppDomain(); - - if (GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) != eRudeUnloadAppDomain || - pCurrentDomain == SystemDomain::System()->DefaultDomain()) - { - // We may not be able to build a context on stack - ProcessSOEventForHost(NULL, FALSE); - - - EEPolicy::HandleFatalStackOverflow(&g_SOExceptionPointers, fSkipDebugger); - } - //else if (pCurrentDomain == SystemDomain::System()->DefaultDomain()) - //{ - // We hit soft SO in Default domain, but default domain can not be unloaded. - // Soft SO can happen in default domain, eg. GetResourceString, or EnsureGrantSetSerialized. - // So the caller is going to throw a managed exception. - // RaiseException(EXCEPTION_SOFTSO, 0, 0, NULL); - //} - else - { - Thread* pThread = GetThread(); - - // We are leaving VM boundary, either entering managed code, or entering - // non-VM unmanaged code. - // We should not throw internal C++ exception. Instead we throw an exception - // with EXCEPTION_SOFTSO code. - RaiseException(EXCEPTION_SOFTSO, 0, 0, NULL); - } - - END_SO_INTOLERANT_CODE_NOPROBE; - -} - -void EEPolicy::HandleStackOverflowAfterCatch() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - MODE_ANY; - } - CONTRACTL_END; - -#ifdef STACK_GUARDS_DEBUG - BaseStackGuard::RestoreCurrentGuard(FALSE); -#endif - Thread *pThread = GetThread(); - pThread->RestoreGuardPage(); - pThread->FinishSOWork(); -} -#endif - - //--------------------------------------------------------------------------------------- // HandleExitProcess is used to shutdown the runtime, based on policy previously set, // then to exit the process. Note, however, that the process will not exit if @@ -1055,7 +823,6 @@ StackWalkAction LogCallstackForLogCallback( { THROWS; GC_TRIGGERS; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1355,7 +1122,7 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE { // This is fatal error. We do not care about SO mode any more. // All of the code from here on out is robust to any failures in any API's that are called. - CONTRACT_VIOLATION(GCViolation | ModeViolation | SOToleranceViolation | FaultNotFatal | TakesLockViolation); + CONTRACT_VIOLATION(GCViolation | ModeViolation | FaultNotFatal | TakesLockViolation); WRAPPER_NO_CONTRACT; @@ -1468,7 +1235,7 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalError(UINT exitCode, UINT_PTR addres { // This is fatal error. We do not care about SO mode any more. // All of the code from here on out is robust to any failures in any API's that are called. - CONTRACT_VIOLATION(GCViolation | ModeViolation | SOToleranceViolation | FaultNotFatal | TakesLockViolation); + CONTRACT_VIOLATION(GCViolation | ModeViolation | FaultNotFatal | TakesLockViolation); // Setting g_fFatalErrorOccuredOnGCThread allows code to avoid attempting to make GC mode transitions which could diff --git a/src/vm/eetoprofinterfaceimpl.cpp b/src/vm/eetoprofinterfaceimpl.cpp index 63003ca..1b06eae 100644 --- a/src/vm/eetoprofinterfaceimpl.cpp +++ b/src/vm/eetoprofinterfaceimpl.cpp @@ -50,7 +50,6 @@ // If you use MODE_ANY, you must comment why you don't want an exact mode. // CAN_TAKE_LOCK // ASSERT_NO_EE_LOCKS_HELD() -// SO_NOT_MAINLINE // Note that the preferred contracts in this file are DIFFERENT than the preferred // contracts for proftoeeinterfaceimpl.cpp. // @@ -142,9 +141,8 @@ enum ClrToProfEntrypointFlags return S_OK; \ } -// Least common denominator for the callback wrappers. Logs, removes stack -// guard (REMOVE_STACK_GUARD_FOR_PROFILER_CALL), records in EE Thread object that -// we're in a callback, and asserts that we're allowed to issue callbacks for the +// Least common denominator for the callback wrappers. Logs, records in EE Thread object +// that we're in a callback, and asserts that we're allowed to issue callbacks for the // specified ThreadID (i.e., no ThreadDestroyed callback has been issued for the // ThreadID). // @@ -153,7 +151,6 @@ enum ClrToProfEntrypointFlags CHECK_PROFILER_STATUS(ee2pFlags); \ LOG(logParams); \ _ASSERTE(m_pCallback2 != NULL); \ - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; \ /* Normally, set COR_PRF_CALLBACKSTATE_INCALLBACK | */ \ /* COR_PRF_CALLBACKSTATE_IN_TRIGGERS_SCOPE in the callback state, but omit */ \ /* COR_PRF_CALLBACKSTATE_IN_TRIGGERS_SCOPE if we're in a GC_NOTRIGGERS callback */ \ @@ -247,7 +244,6 @@ static HRESULT CoCreateProfiler( // which takes locks. CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; _ASSERTE(pClsid != NULL); @@ -630,17 +626,12 @@ HRESULT EEToProfInterfaceImpl::CreateProfiler( CAN_TAKE_LOCK; MODE_PREEMPTIVE; - SO_NOT_MAINLINE; } CONTRACTL_END; // Always called before Thread created. _ASSERTE(GetThreadNULLOk() == NULL); - // We'll be calling into the profiler to create its ICorProfilerCallback* - // implementation - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; - // Try and CoCreate the registered profiler ReleaseHolder pCallback2; HModuleHolder hmodProfilerDLL; @@ -914,7 +905,6 @@ EEToProfInterfaceImpl::~EEToProfInterfaceImpl() { if (m_pCallback2 != NULL) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; m_pCallback2->Release(); m_pCallback2 = NULL; } @@ -923,49 +913,42 @@ EEToProfInterfaceImpl::~EEToProfInterfaceImpl() if (fIsV4Profiler) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; m_pCallback3->Release(); m_pCallback3 = NULL; } if (m_pCallback4 != NULL) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; m_pCallback4->Release(); m_pCallback4 = NULL; } if (m_pCallback5 != NULL) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; m_pCallback5->Release(); m_pCallback5 = NULL; } if (m_pCallback6 != NULL) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; m_pCallback6->Release(); m_pCallback6 = NULL; } if (m_pCallback7 != NULL) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; m_pCallback7->Release(); m_pCallback7 = NULL; } if (m_pCallback8 != NULL) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; m_pCallback8->Release(); m_pCallback8 = NULL; } if (m_pCallback9 != NULL) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; m_pCallback9->Release(); m_pCallback9 = NULL; } @@ -1153,7 +1136,6 @@ UINT_PTR EEToProfInterfaceImpl::EEFunctionIDMapper(FunctionID funcId, BOOL * pbH // ListLockEntry typically held during this callback (thanks to // MethodTable::DoRunClassInitThrowing). - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1522,7 +1504,6 @@ HRESULT EEToProfInterfaceImpl::AllocByClass(ObjectID objId, ClassID clsId, void { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -2228,7 +2209,6 @@ HRESULT EEToProfInterfaceImpl::SetEventMask(DWORD dwEventMask, DWORD dwEventMask MODE_ANY; EE_THREAD_NOT_REQUIRED; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2557,7 +2537,6 @@ HRESULT EEToProfInterfaceImpl::SetEnterLeaveFunctionHooks(FunctionEnter * pFuncE MODE_ANY; EE_THREAD_NOT_REQUIRED; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2615,7 +2594,6 @@ HRESULT EEToProfInterfaceImpl::SetEnterLeaveFunctionHooks2(FunctionEnter2 * pFun MODE_ANY; EE_THREAD_NOT_REQUIRED; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2674,7 +2652,6 @@ HRESULT EEToProfInterfaceImpl::SetEnterLeaveFunctionHooks3(FunctionEnter3 * pFun MODE_ANY; EE_THREAD_NOT_REQUIRED; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2735,7 +2712,6 @@ HRESULT EEToProfInterfaceImpl::SetEnterLeaveFunctionHooks3WithInfo(FunctionEnter MODE_ANY; EE_THREAD_NOT_REQUIRED; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2811,7 +2787,6 @@ HRESULT EEToProfInterfaceImpl::Initialize() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2854,7 +2829,6 @@ HRESULT EEToProfInterfaceImpl::InitializeForAttach(void * pvClientData, UINT cbC // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2913,7 +2887,6 @@ HRESULT EEToProfInterfaceImpl::ProfilerAttachComplete() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2977,7 +2950,6 @@ HRESULT EEToProfInterfaceImpl::ThreadCreated(ThreadID threadId) // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3021,7 +2993,6 @@ HRESULT EEToProfInterfaceImpl::ThreadDestroyed(ThreadID threadId) // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3092,7 +3063,6 @@ HRESULT EEToProfInterfaceImpl::ThreadAssignedToOSThread(ThreadID managedThreadId // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3138,7 +3108,6 @@ HRESULT EEToProfInterfaceImpl::ThreadNameChanged(ThreadID managedThreadId, // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3181,7 +3150,6 @@ HRESULT EEToProfInterfaceImpl::Shutdown() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3227,7 +3195,6 @@ HRESULT EEToProfInterfaceImpl::JITCompilationFinished(FunctionID functionId, // The JIT / MethodDesc code likely hold locks while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3267,7 +3234,6 @@ HRESULT EEToProfInterfaceImpl::JITCompilationStarted(FunctionID functionId, // The JIT / MethodDesc code likely hold locks while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3299,7 +3265,6 @@ HRESULT EEToProfInterfaceImpl::DynamicMethodUnloaded(FunctionID functionId) GC_TRIGGERS; MODE_COOPERATIVE; // RuntimeMethodHandle::Destroy (the caller) moves from QCALL to GCX_COOP CAN_TAKE_LOCK; - SO_TOLERANT; } CONTRACTL_END; @@ -3336,7 +3301,6 @@ HRESULT EEToProfInterfaceImpl::DynamicMethodJITCompilationFinished(FunctionID fu // The JIT / MethodDesc code likely hold locks while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3374,7 +3338,6 @@ HRESULT EEToProfInterfaceImpl::DynamicMethodJITCompilationStarted(FunctionID fun // The JIT / MethodDesc code likely hold locks while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3423,7 +3386,6 @@ HRESULT EEToProfInterfaceImpl::JITCachedFunctionSearchStarted( // The JIT / MethodDesc code likely hold locks while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3462,7 +3424,6 @@ HRESULT EEToProfInterfaceImpl::JITCachedFunctionSearchFinished( // The JIT / MethodDesc code likely hold locks while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3512,7 +3473,6 @@ HRESULT EEToProfInterfaceImpl::JITInlining( // The JIT / MethodDesc code likely hold locks while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3554,7 +3514,6 @@ HRESULT EEToProfInterfaceImpl::ReJITCompilationStarted( // The JIT / MethodDesc code likely hold locks while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3604,7 +3563,6 @@ HRESULT EEToProfInterfaceImpl::GetReJITParameters( // The ReJIT code holds a lock while this callback is made - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3648,7 +3606,6 @@ HRESULT EEToProfInterfaceImpl::ReJITCompilationFinished( // ReJit holds a lock as well as possibly others... - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3692,7 +3649,6 @@ HRESULT EEToProfInterfaceImpl::ReJITError( // Yay! CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3737,7 +3693,6 @@ HRESULT EEToProfInterfaceImpl::ModuleLoadStarted(ModuleID moduleId) // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3778,7 +3733,6 @@ HRESULT EEToProfInterfaceImpl::ModuleLoadFinished( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3819,7 +3773,6 @@ HRESULT EEToProfInterfaceImpl::ModuleUnloadStarted( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3860,7 +3813,6 @@ HRESULT EEToProfInterfaceImpl::ModuleUnloadFinished( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3899,7 +3851,6 @@ HRESULT EEToProfInterfaceImpl::ModuleAttachedToAssembly( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3935,7 +3886,6 @@ HRESULT EEToProfInterfaceImpl::ModuleInMemorySymbolsUpdated(ModuleID moduleId) // Yay! CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3981,7 +3931,6 @@ HRESULT EEToProfInterfaceImpl::ClassLoadStarted( // UnresolvedClassLock typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4021,7 +3970,6 @@ HRESULT EEToProfInterfaceImpl::ClassLoadFinished( // UnresolvedClassLock typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4064,7 +4012,6 @@ HRESULT EEToProfInterfaceImpl::ClassUnloadStarted( // exception is thrown, and EEClass::Destruct is called from the catch clause // inside ClassLoader::CreateTypeHandleForTypeDefThrowing. - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4104,7 +4051,6 @@ HRESULT EEToProfInterfaceImpl::ClassUnloadFinished( // Locks can be held when this is called. See comment in ClassUnloadStarted - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4148,7 +4094,6 @@ HRESULT EEToProfInterfaceImpl::AppDomainCreationStarted( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4189,7 +4134,6 @@ HRESULT EEToProfInterfaceImpl::AppDomainCreationFinished( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4229,7 +4173,6 @@ HRESULT EEToProfInterfaceImpl::AppDomainShutdownStarted( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4269,7 +4212,6 @@ HRESULT EEToProfInterfaceImpl::AppDomainShutdownFinished( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4315,7 +4257,6 @@ HRESULT EEToProfInterfaceImpl::AssemblyLoadStarted( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4357,7 +4298,6 @@ HRESULT EEToProfInterfaceImpl::AssemblyLoadFinished( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4397,7 +4337,6 @@ HRESULT EEToProfInterfaceImpl::AssemblyUnloadStarted( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4437,7 +4376,6 @@ HRESULT EEToProfInterfaceImpl::AssemblyUnloadFinished( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4482,7 +4420,6 @@ HRESULT EEToProfInterfaceImpl::UnmanagedToManagedTransition( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4522,7 +4459,6 @@ HRESULT EEToProfInterfaceImpl::ManagedToUnmanagedTransition( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4565,7 +4501,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionThrown( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4603,7 +4538,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionSearchFunctionEnter( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4640,7 +4574,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionSearchFunctionLeave() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4676,7 +4609,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionSearchFilterEnter(FunctionID functionId) // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4713,7 +4645,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionSearchFilterLeave() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4749,7 +4680,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionSearchCatcherFound(FunctionID functionId // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4798,7 +4728,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionUnwindFunctionEnter(FunctionID functionI // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4838,7 +4767,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionUnwindFunctionLeave() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4877,7 +4805,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionUnwindFinallyEnter(FunctionID functionId // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4917,7 +4844,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionUnwindFinallyLeave() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4956,7 +4882,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionCatcherEnter(FunctionID functionId, Obje // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4995,7 +4920,6 @@ HRESULT EEToProfInterfaceImpl::ExceptionCatcherLeave() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5041,7 +4965,6 @@ HRESULT EEToProfInterfaceImpl::COMClassicVTableCreated( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5083,7 +5006,6 @@ HRESULT EEToProfInterfaceImpl::COMClassicVTableDestroyed( // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5133,7 +5055,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeSuspendStarted( // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5172,7 +5093,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeSuspendFinished() // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5217,7 +5137,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeSuspendAborted() // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5256,7 +5175,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeResumeStarted() // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5291,7 +5209,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeResumeFinished() // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5327,7 +5244,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeThreadSuspended(ThreadID suspendedThreadId // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5357,7 +5273,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeThreadSuspended(ThreadID suspendedThreadId // Remaining essentials from our entrypoint macros with kEE2PNoTrigger flag SetCallbackStateFlagsHolder csf(COR_PRF_CALLBACKSTATE_INCALLBACK); - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; _ASSERTE(m_pCallback2 != NULL); { @@ -5425,7 +5340,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeThreadResumed(ThreadID resumedThreadId) // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5454,7 +5368,6 @@ HRESULT EEToProfInterfaceImpl::RuntimeThreadResumed(ThreadID resumedThreadId) // Remaining essentials from our entrypoint macros with kEE2PNoTrigger flag SetCallbackStateFlagsHolder csf(COR_PRF_CALLBACKSTATE_INCALLBACK); - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; _ASSERTE(m_pCallback2 != NULL); { @@ -5488,7 +5401,6 @@ HRESULT EEToProfInterfaceImpl::RemotingClientInvocationStarted() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5524,7 +5436,6 @@ HRESULT EEToProfInterfaceImpl::RemotingClientSendingMessage(GUID *pCookie, BOOL // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5560,7 +5471,6 @@ HRESULT EEToProfInterfaceImpl::RemotingClientReceivingReply(GUID * pCookie, BOOL // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5596,7 +5506,6 @@ HRESULT EEToProfInterfaceImpl::RemotingClientInvocationFinished() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5632,7 +5541,6 @@ HRESULT EEToProfInterfaceImpl::RemotingServerReceivingMessage(GUID *pCookie, BOO // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5668,7 +5576,6 @@ HRESULT EEToProfInterfaceImpl::RemotingServerInvocationStarted() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5704,7 +5611,6 @@ HRESULT EEToProfInterfaceImpl::RemotingServerInvocationReturned() // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5740,7 +5646,6 @@ HRESULT EEToProfInterfaceImpl::RemotingServerSendingReply(GUID *pCookie, BOOL fI // Yay! ASSERT_NO_EE_LOCKS_HELD(); - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5781,7 +5686,6 @@ HRESULT EEToProfInterfaceImpl::ObjectAllocated( // CrstAppDomainHandleTable can be held while this is called - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5818,7 +5722,6 @@ HRESULT EEToProfInterfaceImpl::MovedReferences(GCReferencesData *pData) // Thread store lock normally held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5921,7 +5824,6 @@ HRESULT EEToProfInterfaceImpl::NotifyAllocByClass(AllocByClassData *pData) // Thread store lock normally held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6014,7 +5916,6 @@ HRESULT EEToProfInterfaceImpl::ObjectReference(ObjectID objId, // Thread store lock normally held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6055,7 +5956,6 @@ HRESULT EEToProfInterfaceImpl::FinalizeableObjectQueued(BOOL isCritical, ObjectI // Thread store lock normally held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6092,7 +5992,6 @@ HRESULT EEToProfInterfaceImpl::RootReferences2(GCReferencesData *pData) // Thread store lock normally held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6157,7 +6056,6 @@ HRESULT EEToProfInterfaceImpl::ConditionalWeakTableElementReferences(GCReference // Thread store lock normally held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6217,7 +6115,6 @@ HRESULT EEToProfInterfaceImpl::HandleCreated(UINT_PTR handleId, ObjectID initial // CrstAppDomainHandleTable can be held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6255,7 +6152,6 @@ HRESULT EEToProfInterfaceImpl::HandleDestroyed(UINT_PTR handleId) // Thread store lock is typically held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6291,7 +6187,6 @@ HRESULT EEToProfInterfaceImpl::GarbageCollectionStarted(int cGenerations, BOOL g // Thread store lock normally held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6329,7 +6224,6 @@ HRESULT EEToProfInterfaceImpl::GarbageCollectionFinished() // Thread store lock normally held during this callback - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6367,7 +6261,6 @@ HRESULT EEToProfInterfaceImpl::ProfilerDetachSucceeded() // ProfilingAPIUtility::s_csStatus is held while this callback is issued. - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6405,7 +6298,6 @@ HRESULT EEToProfInterfaceImpl::GetAssemblyReferences(LPCWSTR wszAssemblyPath, IA // Yay! CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/eetoprofinterfaceimpl.inl b/src/vm/eetoprofinterfaceimpl.inl index b0fb41f..c504731 100644 --- a/src/vm/eetoprofinterfaceimpl.inl +++ b/src/vm/eetoprofinterfaceimpl.inl @@ -206,7 +206,6 @@ inline UINT_PTR EEToProfInterfaceImpl::LookupClientIDFromCache(FunctionID functi { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; diff --git a/src/vm/encee.cpp b/src/vm/encee.cpp index 86d9736..7291256 100644 --- a/src/vm/encee.cpp +++ b/src/vm/encee.cpp @@ -1366,7 +1366,6 @@ void EnCSyncBlockInfo::Cleanup() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/eventreporter.cpp b/src/vm/eventreporter.cpp index 5f0b2ca..53556b2 100644 --- a/src/vm/eventreporter.cpp +++ b/src/vm/eventreporter.cpp @@ -196,7 +196,6 @@ void EventReporter::AddDescription(__in WCHAR *pString) { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -220,7 +219,6 @@ void EventReporter::AddDescription(SString& s) { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -276,7 +274,6 @@ void EventReporter::BeginStackTrace() { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -370,7 +367,6 @@ void EventReporter::AddFailFastStackTrace(SString& s) { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -544,7 +540,6 @@ StackWalkAction LogCallstackForEventReporterCallback( { THROWS; GC_TRIGGERS; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index a37fa92..96f2ebe 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -256,7 +256,6 @@ ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::GetCurrentThreadsCallStac NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -296,7 +295,6 @@ ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::SaveCurrentStack(int skip NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -4409,7 +4407,6 @@ extern "C" MODE_ANY; CAN_TAKE_LOCK; STATIC_CONTRACT_FAULT; - SO_NOT_MAINLINE; } CONTRACTL_END; // Mark that we are the special ETWRundown thread. Currently all this does @@ -4983,7 +4980,6 @@ VOID ETW::CodeSymbolLog::EmitCodeSymbols(Module* pModule) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5067,7 +5063,6 @@ HRESULT ETW::CodeSymbolLog::GetInMemorySymbolsLength( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5150,7 +5145,6 @@ HRESULT ETW::CodeSymbolLog::ReadInMemorySymbols( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6246,7 +6240,6 @@ VOID ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio CONTRACTL { THROWS; GC_NOTRIGGER; - SO_NOT_MAINLINE; } CONTRACTL_END; Module *pModule = NULL; @@ -6647,7 +6640,6 @@ VOID ETW::MethodLog::SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWOR { THROWS; GC_NOTRIGGER; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index 34adc32..1791970 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -81,7 +81,6 @@ BOOL IsExceptionFromManagedCode(const EXCEPTION_RECORD * pExceptionRecord) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; PRECONDITION(CheckPointer(pExceptionRecord)); } CONTRACTL_END; @@ -375,7 +374,6 @@ HRESULT GetExceptionHResult(OBJECTREF throwable) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -402,7 +400,6 @@ DWORD GetExceptionXCode(OBJECTREF throwable) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -2766,14 +2763,7 @@ VOID DECLSPEC_NORETURN RaiseTheException(OBJECTREF throwable, BOOL rethrow // We should throw c++ exception instead. ThrowOutOfMemory(); } -#ifdef FEATURE_STACK_PROBE - else if (throwable == CLRException::GetPreallocatedStackOverflowException()) - { - ThrowStackOverflow(); - } -#else _ASSERTE(throwable != CLRException::GetPreallocatedStackOverflowException()); -#endif #ifdef FEATURE_CORRUPTING_EXCEPTIONS if (!g_pConfig->LegacyCorruptedStateExceptionsPolicy()) @@ -2984,58 +2974,12 @@ VOID DECLSPEC_NORETURN RaiseTheExceptionInternalOnly(OBJECTREF throwable, BOOL r RaiseException(code, flags, argCount, args); } - // Probe for sufficient stack. - PUSH_STACK_PROBE_FOR_THROW(pParam->pThread); - -#ifndef STACK_GUARDS_DEBUG // This needs to be both here and inside the handler below // enable preemptive mode before call into OS GCX_PREEMP_NO_DTOR(); // In non-debug, we can just raise the exception once we've probed. RaiseException(code, flags, argCount, args); - -#else - // In a debug build, we need to unwind our probe structure off the stack. - BaseStackGuard *pThrowGuard = NULL; - // Stach away the address of the guard we just pushed above in PUSH_STACK_PROBE_FOR_THROW - SAVE_ADDRESS_OF_STACK_PROBE_FOR_THROW(pThrowGuard); - - // Add the stack guard reference to the structure below so that it can be accessed within - // PAL_TRY as well - struct ParamInner - { - ULONG code; - ULONG flags; - ULONG argCount; - ULONG_PTR *args; - BaseStackGuard *pGuard; - } param; - param.code = code; - param.flags = flags; - param.argCount = argCount; - param.args = args; - param.pGuard = pThrowGuard; - - PAL_TRY(ParamInner *, pParam, ¶m) - { - // enable preemptive mode before call into OS - GCX_PREEMP_NO_DTOR(); - - RaiseException(pParam->code, pParam->flags, pParam->argCount, pParam->args); - - // We never return from RaiseException, so shouldn't have to call SetNoException. - // However, in the debugger we can, and if we don't call SetNoException we get - // a short-circuit return assert. - RESET_EXCEPTION_FROM_STACK_PROBE_FOR_THROW(pParam->pGuard); - } - PAL_FINALLY - { - // pop the guard that we pushed above in PUSH_STACK_PROBE_FOR_THROW - POP_STACK_PROBE_FOR_THROW(pThrowGuard); - } - PAL_ENDTRY -#endif } PAL_EXCEPT_FILTER (RaiseExceptionFilter) { @@ -3071,14 +3015,7 @@ static VOID DECLSPEC_NORETURN RealCOMPlusThrowWorker(OBJECTREF throwable, BOOL r // We should throw c++ exception instead. ThrowOutOfMemory(); } -#ifdef FEATURE_STACK_PROBE - else if (throwable == CLRException::GetPreallocatedStackOverflowException()) - { - ThrowStackOverflow(); - } -#else _ASSERTE(throwable != CLRException::GetPreallocatedStackOverflowException()); -#endif // TODO: Do we need to install COMPlusFrameHandler here? INSTALL_COMPLUS_EXCEPTION_HANDLER(); @@ -3171,18 +3108,6 @@ STRINGREF GetResourceStringFromManaged(STRINGREF key) gc.key = key; gc.ret = NULL; - // The standard probe isn't good enough here. It's possible that we only have ~14 pages of stack - // left. By the time we transition to the default domain and start fetching this resource string, - // another 12 page probe could fail. - // This failing probe would cause us to unload the default appdomain, which would cause us - // to take down the process. - - // Instead, let's probe for a lots more stack to make sure that doesn' happen. - - // We need to have enough stack to survive 2 more probes... the original entrypoint back - // into mscorwks after we go into managed code, and a "large" probe that protects the GC - - INTERIOR_STACK_PROBE_FOR(GetThread(), DEFAULT_ENTRY_PROBE_AMOUNT * 2); GCPROTECT_BEGIN(gc); MethodDescCallSite getResourceStringLocal(METHOD__ENVIRONMENT__GET_RESOURCE_STRING_LOCAL); @@ -3200,9 +3125,6 @@ STRINGREF GetResourceStringFromManaged(STRINGREF key) GCPROTECT_END(); - END_INTERIOR_STACK_PROBE; - - return gc.ret; } @@ -3264,7 +3186,6 @@ void FreeExceptionData(ExceptionData *pedata) { NOTHROW; GC_TRIGGERS; - SO_TOLERANT; } CONTRACTL_END; @@ -3556,7 +3477,6 @@ void StackTraceInfo::Init() GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -3577,7 +3497,6 @@ void StackTraceInfo::FreeStackTrace() GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -3760,13 +3679,9 @@ void UnwindFrameChain(Thread* pThread, LPVOID pvLimitSP) NOTHROW; DISABLED(GC_TRIGGERS); // some Frames' ExceptionUnwind methods trigger :( MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; - // @todo - Remove this and add a hard SO probe as can't throw from here. - CONTRACT_VIOLATION(SOToleranceViolation); - Frame* pFrame = pThread->m_pFrame; if (pFrame < pvLimitSP) { @@ -3846,7 +3761,6 @@ BOOL IsAsyncThreadException(OBJECTREF *pThrowable) { BOOL IsUncatchable(OBJECTREF *pThrowable) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -3879,7 +3793,7 @@ BOOL IsUncatchable(OBJECTREF *pThrowable) BOOL IsStackOverflowException(Thread* pThread, EXCEPTION_RECORD* pExceptionRecord) { - if (IsSOExceptionCode(pExceptionRecord->ExceptionCode)) + if (pExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW) { return true; } @@ -4415,7 +4329,6 @@ static SpinLock initLock; void DECLSPEC_NORETURN RaiseDeadLockException() { STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_SO_TOLERANT; // Disable the "initialization of static local vars is no thread safe" error #ifdef _MSC_VER @@ -4505,7 +4418,6 @@ LONG UserBreakpointFilter(EXCEPTION_POINTERS* pEP) GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -4579,7 +4491,6 @@ LONG DefaultCatchFilter(EXCEPTION_POINTERS *ep, PVOID pv) GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -5192,8 +5103,6 @@ LONG InternalUnhandledExceptionFilter( STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - // We don't need to be SO-robust for an unhandled exception - SO_NOT_MAINLINE_FUNCTION; LOG((LF_EH, LL_INFO100, "InternalUnhandledExceptionFilter: at sp %p.\n", GetCurrentSP())); @@ -5276,14 +5185,11 @@ LONG EntryPointFilter(PEXCEPTION_POINTERS pExceptionInfo, PVOID _pData) THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; LONG ret = -1; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return EXCEPTION_CONTINUE_SEARCH;); - // Invoke the UEF worker to perform unhandled exception processing ret = InternalUnhandledExceptionFilter_Worker (pExceptionInfo); @@ -5297,9 +5203,6 @@ LONG EntryPointFilter(PEXCEPTION_POINTERS pExceptionInfo, PVOID _pData) LOG((LF_EH, LL_INFO100, "EntryPointFilter: setting TSNC_ProcessedUnhandledException\n")); pThread->SetThreadStateNC(Thread::TSNC_ProcessedUnhandledException); } - - - END_SO_INTOLERANT_CODE; return ret; } @@ -5328,8 +5231,6 @@ LONG __stdcall COMUnhandledExceptionFilter( // EXCEPTION_CONTINUE_SEARCH or STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - // We don't need to be SO-robust for an unhandled exception - SO_NOT_MAINLINE_FUNCTION; LONG retVal = EXCEPTION_CONTINUE_SEARCH; @@ -6385,7 +6286,6 @@ LPVOID COMPlusCheckForAbort(UINT_PTR uTryCatchResumeAddress) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -6420,18 +6320,6 @@ LPVOID COMPlusCheckForAbort(UINT_PTR uTryCatchResumeAddress) // Question: Should we also check for (pThread->m_PreventAsync == 0) -#if !defined(WIN64EXCEPTIONS) && defined(FEATURE_STACK_PROBE) - // On Win64, this function is called by our exception handling code which has probed. - // But on X86, this is called from JIT code directly. We probe here so that - // we can restore the state of the thread below. - if (GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) == eRudeUnloadAppDomain) - { - // In case of SO, we will skip the managed code. - CONTRACT_VIOLATION(ThrowsViolation); - RetailStackProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), pThread); - } -#endif // !WIN64EXCEPTIONS && FEATURE_STACK_PROBE - pThread->SetThrowControlForThread(Thread::InducedThreadRedirectAtEndOfCatch); if (!pThread->ReadyForAbort()) { @@ -6509,7 +6397,6 @@ BOOL IsThreadHijackedForThreadStop(Thread* pThread, EXCEPTION_RECORD* pException GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -6551,7 +6438,6 @@ void AdjustContextForThreadStop(Thread* pThread, GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -6613,7 +6499,6 @@ CreateCOMPlusExceptionObject(Thread *pThread, EXCEPTION_RECORD *pExceptionRecord GC_TRIGGERS; MODE_COOPERATIVE; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -6643,12 +6528,6 @@ CreateCOMPlusExceptionObject(Thread *pThread, EXCEPTION_RECORD *pExceptionRecord { EX_TRY { - // We need to disable the backout stack validation at this point since CreateThrowable can - // take arbitrarily large amounts of stack for different exception types; however we know - // for a fact that we will never go through this code path if the exception is a stack - // overflow exception since we already handled that case above with the pre-allocated SO exception. - DISABLE_BACKOUT_STACK_VALIDATION; - FAULT_NOT_FATAL(); ThreadPreventAsyncHolder preventAsync; @@ -6851,7 +6730,6 @@ IsDebuggerFault(EXCEPTION_RECORD *pExceptionRecord, LIMITED_METHOD_CONTRACT; #ifdef DEBUGGING_SUPPORTED - SO_NOT_MAINLINE_FUNCTION; #ifdef _TARGET_ARM_ // On ARM we don't have any reliable hardware support for single stepping so it is emulated in software. @@ -7275,7 +7153,6 @@ bool ShouldHandleManagedFault( { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -7471,7 +7348,7 @@ LONG WINAPI CLRVectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) } #endif // defined(WIN64EXCEPTIONS) && defined(FEATURE_HIJACK) - if (IsSOExceptionCode(pExceptionInfo->ExceptionRecord->ExceptionCode)) + if (pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW) { // // Not an Out-of-memory situation, so no need for a forbid fault region here @@ -7481,18 +7358,6 @@ LONG WINAPI CLRVectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) LONG retVal = 0; -#ifdef FEATURE_STACK_PROBE - // See if we've got enough stack to handle this exception - - // There isn't much stack left to attempt to report an exception. Let's trigger a hard - // SO, so we clear the guard page and give us at least another page of stack to work with. - - if (pThread && !pThread->IsStackSpaceAvailable(ADJUST_PROBE(1))) - { - DontCallDirectlyForceStackOverflow(); - } -#endif // FEATURE_STACK_PROBE - // We can't probe here, because we won't return from the CLRVectoredExceptionHandlerPhase2 // on WIN64 // @@ -7614,8 +7479,6 @@ LONG WINAPI CLRVectoredExceptionHandlerPhase2(PEXCEPTION_POINTERS pExceptionInfo BOOL fExternalException = FALSE; - BEGIN_SO_INTOLERANT_CODE_NOPROBE; - { // ExecutionManager::IsManagedCode takes a spinlock. Since we're in the middle of throwing, // we'll allow the lock, even if a caller didn't expect it. @@ -7625,8 +7488,6 @@ LONG WINAPI CLRVectoredExceptionHandlerPhase2(PEXCEPTION_POINTERS pExceptionInfo !IsIPInModule(g_pMSCorEE, GetIP(pExceptionInfo->ContextRecord))); } - END_SO_INTOLERANT_CODE_NOPROBE; - if (fExternalException) { // The breakpoint was not ours. Someone else can handle it. (Or if not, we'll get it again as @@ -7793,7 +7654,7 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandlerPhase3(PEXCEPTION_POINTERS pExcepti PCODE ip = (PCODE)GetIP(pContext); if (IsIPInModule(g_pMSCorEE, ip) || IsIPInModule(GCHeapUtilities::GetGCModule(), ip)) { - CONTRACT_VIOLATION(ThrowsViolation|FaultViolation|SOToleranceViolation); + CONTRACT_VIOLATION(ThrowsViolation|FaultViolation); // // If you're debugging, set the debugger to catch first-chance AV's, then simply hit F5 or @@ -8390,7 +8251,6 @@ void UnwindAndContinueRethrowHelperInsideCatch(Frame* pEntryFrame, Exception* pE STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; Thread* pThread = GetThread(); @@ -8412,13 +8272,11 @@ void UnwindAndContinueRethrowHelperInsideCatch(Frame* pEntryFrame, Exception* pE if (!NingenEnabled()) { CONTRACT_VIOLATION(ThrowsViolation); - BEGIN_SO_INTOLERANT_CODE(pThread); // Call CLRException::GetThrowableFromException to force us to retrieve the THROWABLE // while we are still within the context of the catch block. This will help diagnose // cases where the last thrown object is NULL. OBJECTREF orThrowable = CLRException::GetThrowableFromException(pException); CONSISTENCY_CHECK(orThrowable != NULL); - END_SO_INTOLERANT_CODE; } #endif } @@ -8432,14 +8290,6 @@ VOID DECLSPEC_NORETURN UnwindAndContinueRethrowHelperAfterCatch(Frame* pEntryFra STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; - - // We really should probe before switching to cooperative mode, although there's no chance - // we'll SO in doing that as we've just caught an exception. We can't probe just - // yet though, because we want to avoid reprobing on an SO exception and we need to switch - // to cooperative to check the throwable for an SO as well as the pException object (as the - // pException could be a LastThrownObjectException.) Blech. - CONTRACT_VIOLATION(SOToleranceViolation); GCX_COOP(); @@ -8459,12 +8309,8 @@ VOID DECLSPEC_NORETURN UnwindAndContinueRethrowHelperAfterCatch(Frame* pEntryFra } else if (orThrowable->GetMethodTable() == g_pStackOverflowExceptionClass) { -#ifdef FEATURE_STACK_PROBE - EEPolicy::HandleSoftStackOverflow(); -#else /* The parameters of the function do not matter here */ EEPolicy::HandleStackOverflow(SOD_UnmanagedFrameHandler, NULL); -#endif } } @@ -8478,7 +8324,6 @@ void SaveCurrentExceptionInfo(PEXCEPTION_RECORD pRecord, PCONTEXT pContext) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -8493,10 +8338,10 @@ void SaveCurrentExceptionInfo(PEXCEPTION_RECORD pRecord, PCONTEXT pContext) if (CExecutionEngine::CheckThreadStateNoCreate(TlsIdx_PEXCEPTION_RECORD)) { BOOL fSave = TRUE; - if (!IsSOExceptionCode(pRecord->ExceptionCode)) + if (pRecord->ExceptionCode != STATUS_STACK_OVERFLOW) { DWORD dwLastExceptionCode = (DWORD)(SIZE_T) (ClrFlsGetValue(TlsIdx_EXCEPTION_CODE)); - if (IsSOExceptionCode(dwLastExceptionCode)) + if (dwLastExceptionCode == STATUS_STACK_OVERFLOW) { PEXCEPTION_RECORD lastRecord = static_cast (ClrFlsGetValue(TlsIdx_PEXCEPTION_RECORD)); @@ -8874,7 +8719,6 @@ BOOL IsException(MethodTable *pMT) { NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -8897,7 +8741,6 @@ BOOL ExceptionTypeOverridesStackTraceGetter(PTR_MethodTable pMT) THROWS; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -11063,7 +10906,6 @@ void EHWatsonBucketTracker::SaveIpForWatsonBucket( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(IsWatsonEnabled()); } CONTRACTL_END; @@ -11106,7 +10948,6 @@ PTR_VOID EHWatsonBucketTracker::RetrieveWatsonBuckets() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(IsWatsonEnabled()); } CONTRACTL_END; @@ -11130,7 +10971,6 @@ void EHWatsonBucketTracker::ClearWatsonBucketDetails() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(IsWatsonEnabled()); } CONTRACTL_END; @@ -11202,7 +11042,6 @@ PTR_ExInfo GetEHTrackerForException(OBJECTREF oThrowable, PTR_ExInfo pStartingEH GC_NOTRIGGER; MODE_COOPERATIVE; NOTHROW; - SO_TOLERANT; PRECONDITION(GetThread() != NULL); PRECONDITION(oThrowable != NULL); } @@ -11253,7 +11092,6 @@ BOOL CEHelper::IsProcessCorruptedStateException(DWORD dwExceptionCode, BOOL fChe NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -11501,7 +11339,6 @@ BOOL CEHelper::IsProcessCorruptedStateException(OBJECTREF oThrowable) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; PRECONDITION(oThrowable != NULL); } CONTRACTL_END; @@ -11549,7 +11386,6 @@ void CEHelper::SetupCorruptionSeverityForActiveExceptionInUnwindPass(Thread *pCu NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(!fIsFirstPass); // This method should only be called during an unwind PRECONDITION(pCurThread != NULL); } @@ -11891,7 +11727,6 @@ void CEHelper::MarkLastActiveExceptionCorruptionSeverityForReraiseReuse() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(GetThread() != NULL); } CONTRACTL_END; @@ -12789,7 +12624,6 @@ VOID DECLSPEC_NORETURN RealCOMPlusThrowOM() DISABLED(GC_NOTRIGGER); // Must sanitize first pass handling to enable this CANNOT_TAKE_LOCK; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -13236,44 +13070,6 @@ VOID DECLSPEC_NORETURN RealCOMPlusThrowHR(EXCEPINFO *pExcepInfo) #endif // FEATURE_COMINTEROP - -#ifdef FEATURE_STACK_PROBE -//========================================================================== -// Throw a StackOverflowError -//========================================================================== -VOID DECLSPEC_NORETURN RealCOMPlusThrowSO() -{ - CONTRACTL - { - // This should be throws... But it isn't because a SO doesn't technically - // fall into the same THROW/NOTHROW conventions as the rest of the contract - // infrastructure. - NOTHROW; - - DISABLED(GC_NOTRIGGER); // Must sanitize first pass handling to enable this - SO_TOLERANT; - MODE_ANY; - } - CONTRACTL_END; - - // We only use BreakOnSO if we are in debug mode, so we'll only checking if the - // _DEBUG flag is set. -#ifdef _DEBUG - static int breakOnSO = -1; - - if (breakOnSO == -1) - breakOnSO = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_BreakOnSO); - - if (breakOnSO != 0) - { - _ASSERTE(!"SO occurred"); - } -#endif - - ThrowStackOverflow(); -} -#endif - //========================================================================== // Throw an InvalidCastException //========================================================================== @@ -13317,7 +13113,6 @@ VOID CheckAndThrowSameTypeAndAssemblyInvalidCastException(TypeHandle thCastFrom, THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; Module *pModuleTypeFrom = thCastFrom.GetModule(); diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp index 8e6da16..b97717c 100644 --- a/src/vm/exceptionhandling.cpp +++ b/src/vm/exceptionhandling.cpp @@ -882,7 +882,7 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord // we don't handle the SO. if (!(dwExceptionFlags & EXCEPTION_UNWINDING)) { - if (IsSOExceptionCode(pExceptionRecord->ExceptionCode)) + if (pExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW) { // We don't need to unwind the frame chain here because we have backstop // personality routines at the U2M boundary to handle do that. They are @@ -896,15 +896,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord FastInterlockAnd (&pThread->m_fPreemptiveGCDisabled, 0); return ExceptionContinueSearch; } - else - { -#ifdef FEATURE_STACK_PROBE - if (GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) == eRudeUnloadAppDomain) - { - RetailStackProbe(static_cast(ADJUST_PROBE(BACKOUT_CODE_STACK_LIMIT)), pThread); - } -#endif - } } else { @@ -916,14 +907,12 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord // look at our saved exception code. exceptionCode = GetCurrentExceptionCode(); - if (IsSOExceptionCode(exceptionCode)) + if (exceptionCode == STATUS_STACK_OVERFLOW) { return ExceptionContinueSearch; } } - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - StackFrame sf((UINT_PTR)MemoryStackFp); @@ -986,15 +975,11 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord // It is a breakpoint; is it from the runtime or managed code? PCODE ip = GetIP(pContextRecord); // IP of the fault. - BOOL fExternalException = FALSE; - - BEGIN_SO_INTOLERANT_CODE_NOPROBE; + BOOL fExternalException; fExternalException = (!ExecutionManager::IsManagedCode(ip) && !IsIPInModule(g_pMSCorEE, ip)); - END_SO_INTOLERANT_CODE_NOPROBE; - if (fExternalException) { // The breakpoint was not ours. Someone else can handle it. (Or if not, we'll get it again as @@ -1246,7 +1231,7 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord // SO-tolerant mode before we do so. RestoreSOToleranceState(); #endif - RESET_CONTRACT_VIOLATION(); + ExceptionTracker::ResumeExecution(pContextRecord, NULL ); @@ -1264,8 +1249,6 @@ lExit: ; GCX_PREEMP_NO_DTOR(); } - END_CONTRACT_VIOLATION; - SetLastError(dwLastError); return returnDisposition; @@ -1287,7 +1270,6 @@ bool FixNonvolatileRegisters(UINT_PTR uOriginalSP, MODE_COOPERATIVE; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -2683,17 +2665,6 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( } -#ifdef FEATURE_STACK_PROBE - // Don't call a handler if we're within a certain distance of the end of the stack. Could end up here via probe, in - // which case guard page is intact, or via hard SO, in which case guard page won't be. So don't check for presence of - // guard page, just check for sufficient space on stack. - if ( IsStackOverflowException() - && !pThread->CanResetStackTo((void*)sf.SP)) - { - EH_LOG((LL_INFO100, " STACKOVERFLOW: IGNOREFRAME: stack frame too close to guard page: sf.SP: %p\n", sf.SP)); - } - else -#endif // FEATURE_STACK_PROBE { IJitManager* pJitMan = pcfThisFrame->GetJitManager(); const METHODTOKEN& MethToken = pcfThisFrame->GetMethodToken(); @@ -3275,24 +3246,6 @@ lExit: return ReturnStatus; } -// <64bit_And_Arm_Specific> - -// For funclets, add support for unwinding frame chain during SO. These definitions will be automatically picked up by -// BEGIN_SO_TOLERANT_CODE/END_SO_TOLERANT_CODE usage in ExceptionTracker::CallHandler below. -// -// This is required since funclet invocation is the only case of calling managed code from VM that is not wrapped by -// assembly helper with associated personality routine. The personality routine will invoke CleanupForSecondPass to -// release exception trackers and unwind frame chain. -// -// We need to do the same work as CleanupForSecondPass for funclet invocation in the face of SO. Thus, we redefine OPTIONAL_SO_CLEANUP_UNWIND -// below. This will perform frame chain unwind inside the "__finally" block that is part of the END_SO_TOLERANT_CODE macro only in the face -// of an SO. -// -// The second part of work, releasing exception trackers, is done inside the "__except" block also part of the END_SO_TOLERANT_CODE by invoking -// ClearExceptionStateAfterSO. -// -// - #undef OPTIONAL_SO_CLEANUP_UNWIND #define OPTIONAL_SO_CLEANUP_UNWIND(pThread, pFrame) if (pThread->GetFrame() < pFrame) { UnwindFrameChain(pThread, pFrame); } @@ -3374,15 +3327,6 @@ DWORD_PTR ExceptionTracker::CallHandler( throwable = PossiblyUnwrapThrowable(pThread->GetThrowable(), pMD->GetAssembly()); - // We probe for stack space before attempting to call a filter, finally, or catch clause. The path from - // here to the actual managed code is very short. We must probe, however, because the JIT does not generate a - // probe for us upon entry to the handler. This probe ensures we have enough stack space to actually make it - // into the managed code. - // - // Incase a SO happens, this macro will also unwind the frame chain before continuing to dispatch the SO - // upstack (look at the macro implementation for details). - BEGIN_SO_TOLERANT_CODE(pThread); - // Stores the current SP and BSP, which will be the caller SP and BSP for the funclet. // Note that we are making the assumption here that the SP and BSP don't change from this point // forward until we actually make the call to the funclet. If it's not the case then we will need @@ -3450,8 +3394,6 @@ DWORD_PTR ExceptionTracker::CallHandler( this->m_EHClauseInfo.SetManagedCodeEntered(FALSE); - END_SO_TOLERANT_CODE; - // The first parameter specifies whether we want to make callbacks before (true) or after (false) // calling the handler. MakeCallbacksRelatedToHandler(false, pThread, pMD, pEHClause, uHandlerStartPC, sf); @@ -3886,7 +3828,7 @@ ExceptionTracker* ExceptionTracker::GetOrCreateTracker( // // Thus, if we see that we are here for SO in the 2nd pass, then // we shouldn't attempt to create a throwable. - if ((!fIsFirstPass) && (IsSOExceptionCode(pExceptionRecord->ExceptionCode))) + if ((!fIsFirstPass) && (pExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW)) { fCreateThrowableForCurrentPass = false; } @@ -5636,7 +5578,6 @@ BOOL FirstCallToHandler ( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -5671,7 +5612,6 @@ NOT_WIN64_ARG(IN ULONG MemoryStackFp), GC_NOTRIGGER; NOTHROW; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -5684,8 +5624,6 @@ NOT_WIN64_ARG(IN ULONG MemoryStackFp), Thread* pThread = GetThread(); CONTEXT *pNewContext = NULL; - VALIDATE_BACKOUT_STACK_CONSUMPTION; - if (FirstCallToHandler(pDispatcherContext, &pNewContext)) { // @@ -5735,11 +5673,6 @@ FixContextHandler(IN PEXCEPTION_RECORD pExceptionRecord { CONTEXT* pNewContext = NULL; - VALIDATE_BACKOUT_STACK_CONSUMPTION; - - // Our backout validation should ensure that we don't SO here. - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - if (FirstCallToHandler(pDispatcherContext, &pNewContext)) { // @@ -5753,8 +5686,6 @@ FixContextHandler(IN PEXCEPTION_RECORD pExceptionRecord FixupDispatcherContext(pDispatcherContext, pNewContext, pContextRecord); - END_CONTRACT_VIOLATION; - // Returning ExceptionCollidedUnwind will cause the OS to take our new context record // and dispatcher context and restart the exception dispatching on this call frame, // which is exactly the behavior we want in order to restore our thread's unwindability @@ -5893,10 +5824,7 @@ UMThunkUnwindFrameChainHandler(IN PEXCEPTION_RECORD pExceptionRecord return ExceptionContinueSearch; } - bool fIsSO = - IsSOExceptionCode(pExceptionRecord->ExceptionCode); - - VALIDATE_BACKOUT_STACK_CONSUMPTION; + bool fIsSO = pExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW; if (IS_UNWINDING(pExceptionRecord->ExceptionFlags)) { @@ -5907,8 +5835,6 @@ UMThunkUnwindFrameChainHandler(IN PEXCEPTION_RECORD pExceptionRecord pThread->DisablePreemptiveGC(); } } - // The VALIDATE_BACKOUT_STACK_CONSUMPTION makes sure that this function does not use stack more than backout limit. - CONTRACT_VIOLATION(SOToleranceViolation); CleanUpForSecondPass(pThread, fIsSO, (void*)MemoryStackFp, (void*)MemoryStackFp); } @@ -5998,7 +5924,7 @@ CallDescrWorkerUnwindFrameChainHandler(IN PEXCEPTION_RECORD pExceptionReco Thread* pThread = GetThread(); _ASSERTE(pThread); - if (IsSOExceptionCode(pExceptionRecord->ExceptionCode)) + if (pExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW) { if (IS_UNWINDING(pExceptionRecord->ExceptionFlags)) { @@ -6017,10 +5943,6 @@ CallDescrWorkerUnwindFrameChainHandler(IN PEXCEPTION_RECORD pExceptionReco pContextRecord, pDispatcherContext); - // Our backout validation should ensure that we don't SO here. Add a - // backout validation here. - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - if (retVal == ExceptionContinueSearch) { @@ -6034,8 +5956,6 @@ CallDescrWorkerUnwindFrameChainHandler(IN PEXCEPTION_RECORD pExceptionReco GCX_PREEMP_NO_DTOR(); } - END_CONTRACT_VIOLATION; - return retVal; } @@ -6073,7 +5993,6 @@ FixRedirectContextHandler( GC_NOTRIGGER; NOTHROW; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -6083,8 +6002,6 @@ FixRedirectContextHandler( pContextRecord, pDispatcherContext->ContextRecord); - VALIDATE_BACKOUT_STACK_CONSUMPTION; - CONTEXT *pRedirectedContext = GetCONTEXTFromRedirectedStubStackFrame(pDispatcherContext); FixupDispatcherContext(pDispatcherContext, pRedirectedContext, pContextRecord); diff --git a/src/vm/exceptmacros.h b/src/vm/exceptmacros.h index 8e78fc42..9690155 100644 --- a/src/vm/exceptmacros.h +++ b/src/vm/exceptmacros.h @@ -119,12 +119,8 @@ class Frame; class Exception; VOID DECLSPEC_NORETURN RealCOMPlusThrowOM(); -VOID DECLSPEC_NORETURN RealCOMPlusThrowSO(); #include -#include "stackprobe.h" - - //========================================================================== // Macros to allow catching exceptions from within the EE. These are lightweight @@ -357,13 +353,7 @@ VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHar #define INSTALL_UNWIND_AND_CONTINUE_HANDLER \ INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE \ /* The purpose of the INSTALL_UNWIND_AND_CONTINUE_HANDLER is to translate an exception to a managed */ \ - /* exception before it hits managed code. The transition to SO_INTOLERANT code does not logically belong here. */ \ - /* However, we don't want to miss any probe points and the intersection between a probe point and installing */ \ - /* an INSTALL_UNWIND_AND_CONTINUE_HANDLER is very high. The probes are very cheap, so we can tolerate */ \ - /* those few places where we are probing and don't need to. */ \ - /* Ideally, we would instead have an encompassing ENTER_SO_INTOLERANT_CODE macro that would */ \ - /* include INSTALL_UNWIND_AND_CONTINUE_HANDLER */ \ - BEGIN_SO_INTOLERANT_CODE(GET_THREAD()); + /* exception before it hits managed code. */ // Optimized version for helper method frame. Avoids redundant GetThread() calls. #define INSTALL_UNWIND_AND_CONTINUE_HANDLER_FOR_HMF(pHelperFrame) \ @@ -374,8 +364,7 @@ VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHar SCAN_EHMARKER(); \ if (true) PAL_CPP_TRY { \ SCAN_EHMARKER_TRY(); \ - DEBUG_ASSURE_NO_RETURN_BEGIN(IUACH); \ - BEGIN_SO_INTOLERANT_CODE(GET_THREAD()); + DEBUG_ASSURE_NO_RETURN_BEGIN(IUACH); #define UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE \ DEBUG_ASSURE_NO_RETURN_END(IUACH) \ @@ -399,8 +388,7 @@ VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHar } \ #define UNINSTALL_UNWIND_AND_CONTINUE_HANDLER \ - END_SO_INTOLERANT_CODE; \ - UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE; \ + UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE; #endif // DACCESS_COMPILE || CROSSGEN_COMPILE @@ -444,9 +432,6 @@ extern DWORD g_ExceptionLine; #define COMPlusThrowHR if(THROWLOG() && 0) { } else RealCOMPlusThrowHR #define COMPlusThrowWin32 if(THROWLOG() && 0) { } else RealCOMPlusThrowWin32 #define COMPlusThrowOM if(THROWLOG() && 0) { } else RealCOMPlusThrowOM -#ifdef FEATURE_STACK_PROBE -#define COMPlusThrowSO if(THROWLOG() && 0) { } else RealCOMPlusThrowSO -#endif #define COMPlusThrowArithmetic if(THROWLOG() && 0) { } else RealCOMPlusThrowArithmetic #define COMPlusThrowArgumentNull if(THROWLOG() && 0) { } else RealCOMPlusThrowArgumentNull #define COMPlusThrowArgumentOutOfRange if(THROWLOG() && 0) { } else RealCOMPlusThrowArgumentOutOfRange @@ -469,9 +454,6 @@ extern DWORD g_ExceptionLine; #endif #define COMPlusThrowWin32 RealCOMPlusThrowWin32 #define COMPlusThrowOM RealCOMPlusThrowOM -#ifdef FEATURE_STACK_PROBE -#define COMPlusThrowSO RealCOMPlusThrowSO -#endif #define COMPlusThrowArithmetic RealCOMPlusThrowArithmetic #define COMPlusThrowArgumentNull RealCOMPlusThrowArgumentNull #define COMPlusThrowArgumentOutOfRange RealCOMPlusThrowArgumentOutOfRange @@ -523,14 +505,12 @@ void COMPlusCooperativeTransitionHandler(Frame* pFrame); { \ MAKE_CURRENT_THREAD_AVAILABLE(); \ BEGIN_GCX_ASSERT_PREEMP; \ - BEGIN_SO_INTOLERANT_CODE(CURRENT_THREAD); \ CoopTransitionHolder __CoopTransition(CURRENT_THREAD); \ DEBUG_ASSURE_NO_RETURN_BEGIN(COOP_TRANSITION) #define COOPERATIVE_TRANSITION_END() \ DEBUG_ASSURE_NO_RETURN_END(COOP_TRANSITION) \ __CoopTransition.SuppressRelease(); \ - END_SO_INTOLERANT_CODE; \ END_GCX_ASSERT_PREEMP; \ } diff --git a/src/vm/exinfo.cpp b/src/vm/exinfo.cpp index 1a73e25..ef42774 100644 --- a/src/vm/exinfo.cpp +++ b/src/vm/exinfo.cpp @@ -22,7 +22,6 @@ void ExInfo::DestroyExceptionHandle(void) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -47,7 +46,6 @@ void ExInfo::CopyAndClearSource(ExInfo *from) GC_NOTRIGGER; if (GetThread() != NULL) MODE_COOPERATIVE; else MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -92,7 +90,6 @@ void ExInfo::Init() GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; @@ -175,7 +172,6 @@ void ExInfo::UnwindExInfo(VOID* limit) NOTHROW; // This function does not throw. GC_NOTRIGGER; if (GetThread() != NULL) MODE_COOPERATIVE; else MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -292,7 +288,6 @@ void ExInfo::SetExceptionCode(const EXCEPTION_RECORD *pCER) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(pCER != NULL); m_ExceptionCode = pCER->ExceptionCode; diff --git a/src/vm/exstate.cpp b/src/vm/exstate.cpp index 0dc902a..addca63 100644 --- a/src/vm/exstate.cpp +++ b/src/vm/exstate.cpp @@ -151,7 +151,6 @@ OBJECTREF ThreadExceptionState::GetThrowable() MODE_COOPERATIVE; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -177,7 +176,6 @@ void ThreadExceptionState::SetThrowable(OBJECTREF throwable DEBUG_ARG(SetThrowab if ((throwable == NULL) || CLRException::IsPreallocatedExceptionObject(throwable)) NOTHROW; else THROWS; // From CreateHandle GC_NOTRIGGER; if (throwable == NULL) MODE_ANY; else MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -207,13 +205,9 @@ void ThreadExceptionState::SetThrowable(OBJECTREF throwable DEBUG_ARG(SetThrowab } else { - BEGIN_SO_INTOLERANT_CODE(GetThread()); - { - AppDomain* pDomain = GetMyThread()->GetDomain(); - PREFIX_ASSUME(pDomain != NULL); - hNewThrowable = pDomain->CreateHandle(throwable); - } - END_SO_INTOLERANT_CODE; + AppDomain* pDomain = GetMyThread()->GetDomain(); + PREFIX_ASSUME(pDomain != NULL); + hNewThrowable = pDomain->CreateHandle(throwable); } #ifdef WIN64EXCEPTIONS diff --git a/src/vm/extensibleclassfactory.cpp b/src/vm/extensibleclassfactory.cpp index 5ffb575..2b51650 100644 --- a/src/vm/extensibleclassfactory.cpp +++ b/src/vm/extensibleclassfactory.cpp @@ -31,7 +31,6 @@ static StackWalkAction FrameCallback(CrawlFrame *pCF, void *pData) THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pMD)); PRECONDITION(CheckPointer(pData, NULL_OK)); PRECONDITION(pMD->GetMethodTable() != NULL); diff --git a/src/vm/fcall.cpp b/src/vm/fcall.cpp index 68fc271..417cce7 100644 --- a/src/vm/fcall.cpp +++ b/src/vm/fcall.cpp @@ -23,7 +23,6 @@ NOINLINE LPVOID __FCThrow(LPVOID __me, RuntimeExceptionKind reKind, UINT resID, // that we won't trigger without having setup a frame. // STATIC_CONTRACT_TRIGGER STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; // function probes before it does any work // side effect the compiler can't remove if (FC_NO_TAILCALL != 1) @@ -67,7 +66,6 @@ NOINLINE LPVOID __FCThrowArgument(LPVOID __me, RuntimeExceptionKind reKind, LPCW // that we won't trigger without having setup a frame. // STATIC_CONTRACT_TRIGGER STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; // function probes before it does any work // side effect the compiler can't remove if (FC_NO_TAILCALL != 1) @@ -119,7 +117,6 @@ NOINLINE Object* FC_GCPoll(void* __me, Object* objToProtect) // This isn't strictly true... But the guarentee that we make here is // that we won't trigger without having setup a frame. UNCHECKED(GC_NOTRIGGER); - SO_TOLERANT; // function probes before it does any work } CONTRACTL_END; FC_CAN_TRIGGER_GC(); diff --git a/src/vm/fcall.h b/src/vm/fcall.h index 9fb7ba0..24b6f38 100644 --- a/src/vm/fcall.h +++ b/src/vm/fcall.h @@ -220,7 +220,6 @@ #include "gms.h" #include "runtimeexceptionkind.h" #include "debugreturn.h" -#include "stackprobe.h" //============================================================================================== // These macros defeat compiler optimizations that might mix nonvolatile @@ -583,8 +582,7 @@ LPVOID __FCThrowArgument(LPVOID me, enum RuntimeExceptionKind reKind, LPCWSTR ar #define HELPER_METHOD_FRAME_BEGIN_EX_NOTHROW(ret, helperFrame, gcpoll, allowGC, probeFailExpr) \ HELPER_METHOD_FRAME_BEGIN_EX_BODY(ret, helperFrame, gcpoll, allowGC) \ /* TODO TURN THIS ON!!! */ \ - /* gcpoll; */ \ - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GET_THREAD(), probeFailExpr); + /* gcpoll; */ // The while(__helperframe.RestoreState() needs a bit of explanation. @@ -615,7 +613,6 @@ LPVOID __FCThrowArgument(LPVOID me, enum RuntimeExceptionKind reKind, LPCWSTR ar HELPER_METHOD_FRAME_END_EX_BODY(gcpoll,allowGC); #define HELPER_METHOD_FRAME_END_EX_NOTHROW(gcpoll,allowGC) \ - END_SO_INTOLERANT_CODE; \ HELPER_METHOD_FRAME_END_EX_BODY(gcpoll,allowGC); #define HELPER_METHOD_FRAME_BEGIN_ATTRIB(attribs) \ @@ -869,8 +866,6 @@ private: { \ Thread *_pThread = GetThread(); \ Thread::ObjectRefFlush(_pThread); \ - /*_ASSERTE (_pThread->IsSOTolerant() ||*/ \ - /* _pThread->HasThreadStateNC(Thread::TSNC_DisableSOCheckInHCALL)); */ \ } \ FCallCheck __fCallCheck(__FILE__, __LINE__); \ FCALL_TRANSITION_BEGIN(); \ @@ -1378,8 +1373,7 @@ typedef UINT16 FC_UINT16_RET; #define FCALL_CHECK \ THROWS; \ DISABLED(GC_TRIGGERS); /* FCALLS with HELPER frames have issues with GC_TRIGGERS */ \ - MODE_COOPERATIVE; \ - SO_TOLERANT + MODE_COOPERATIVE; // // FCALL_CONTRACT should be the following shortcut: @@ -1389,7 +1383,6 @@ typedef UINT16 FC_UINT16_RET; // Since there is very little value in having runtime contracts in FCalls, FCALL_CONTRACT is defined as static contract only for performance reasons. // #define FCALL_CONTRACT \ - STATIC_CONTRACT_SO_TOLERANT; \ STATIC_CONTRACT_THROWS; \ /* FCALLS are a special case contract wise, they are "NOTRIGGER, unless you setup a frame" */ \ STATIC_CONTRACT_GC_NOTRIGGER; \ diff --git a/src/vm/field.cpp b/src/vm/field.cpp index 443ada6..8706ca3 100644 --- a/src/vm/field.cpp +++ b/src/vm/field.cpp @@ -143,7 +143,6 @@ TypeHandle FieldDesc::LookupFieldTypeHandle(ClassLoadLevel level, BOOL dropGener GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END @@ -169,15 +168,7 @@ TypeHandle FieldDesc::LookupFieldTypeHandle(ClassLoadLevel level, BOOL dropGener ); // == FailIfNotLoaded, can also assert that the thing is restored - TypeHandle th = NULL; - - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return NULL); - { - th = sig.GetLastTypeHandleThrowing(ClassLoader::DontLoadTypes, level, dropGenericArgumentLevel); - } - END_SO_INTOLERANT_CODE; - - return th; + return sig.GetLastTypeHandleThrowing(ClassLoader::DontLoadTypes, level, dropGenericArgumentLevel); } #else //simplified version TypeHandle FieldDesc::LookupFieldTypeHandle(ClassLoadLevel level, BOOL dropGenericArgumentLevel) @@ -209,7 +200,6 @@ void* FieldDesc::GetStaticAddress(void *base) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; // Needed by profiler and server GC } CONTRACTL_END; @@ -232,7 +222,6 @@ MethodTable * FieldDesc::GetExactDeclaringType(MethodTable * ownerOrSubType) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -260,7 +249,6 @@ PTR_VOID FieldDesc::GetStaticAddressHandle(PTR_VOID base) GC_NOTRIGGER; MODE_ANY; FORBID_FAULT; - SO_TOLERANT; PRECONDITION(IsStatic()); PRECONDITION(GetEnclosingMethodTable()->IsRestored_NoLogging()); } @@ -281,15 +269,9 @@ PTR_VOID FieldDesc::GetStaticAddressHandle(PTR_VOID base) PTR_VOID retVal = NULL; - // BEGIN_SO_INTOLERANT_CODE will throw if we don't have enough stack - // and GetStaticAddressHandle has no failure semantics, so we need - // to just do the SO policy (e.g. rip the appdomain or process). - CONTRACT_VIOLATION(ThrowsViolation) - #ifdef DACCESS_COMPILE DacNotImpl(); #else - BEGIN_SO_INTOLERANT_CODE(GetThread()); { GCX_COOP(); // This routine doesn't have a failure semantic - but Resolve*Field(...) does. @@ -297,7 +279,6 @@ PTR_VOID FieldDesc::GetStaticAddressHandle(PTR_VOID base) CONTRACT_VIOLATION(ThrowsViolation|FaultViolation|GCViolation); //B#25680 (Fix Enc violations) retVal = (void *)(pModule->ResolveOrAllocateField(NULL, pFD)); } - END_SO_INTOLERANT_CODE; #endif // !DACCESS_COMPILE return retVal; } @@ -465,9 +446,7 @@ PTR_VOID FieldDesc::GetAddressNoThrowNoGC(PTR_VOID o) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; PRECONDITION(!IsEnCNew()); - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -542,7 +521,6 @@ void *FieldDesc::GetAddressGuaranteedInHeap(void *o) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/field.h b/src/vm/field.h index eb304f2..ee54fc0 100644 --- a/src/vm/field.h +++ b/src/vm/field.h @@ -656,7 +656,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END @@ -706,7 +705,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END @@ -724,7 +722,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END diff --git a/src/vm/fieldmarshaler.cpp b/src/vm/fieldmarshaler.cpp index 57f41c3..5c6a7db 100644 --- a/src/vm/fieldmarshaler.cpp +++ b/src/vm/fieldmarshaler.cpp @@ -1196,7 +1196,6 @@ BOOL IsStructMarshalable(TypeHandle th) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(!th.IsNull()); } CONTRACTL_END; diff --git a/src/vm/fieldmarshaler.h b/src/vm/fieldmarshaler.h index 24b1021..55e7773 100644 --- a/src/vm/fieldmarshaler.h +++ b/src/vm/fieldmarshaler.h @@ -396,7 +396,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } CONTRACT_END; diff --git a/src/vm/fptrstubs.cpp b/src/vm/fptrstubs.cpp index 79660ec..202f9fc 100644 --- a/src/vm/fptrstubs.cpp +++ b/src/vm/fptrstubs.cpp @@ -65,7 +65,6 @@ PCODE FuncPtrStubs::GetFuncPtrStub(MethodDesc * pMD, PrecodeType type) { THROWS; GC_TRIGGERS; - SO_INTOLERANT; INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END diff --git a/src/vm/frames.cpp b/src/vm/frames.cpp index b387161..73c4d56 100644 --- a/src/vm/frames.cpp +++ b/src/vm/frames.cpp @@ -389,7 +389,6 @@ VOID Frame::Push() NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -403,7 +402,6 @@ VOID Frame::Push(Thread *pThread) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -439,7 +437,6 @@ VOID Frame::Pop() NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -453,7 +450,6 @@ VOID Frame::Pop(Thread *pThread) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -480,7 +476,6 @@ void Frame::PopIfChained() NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -618,7 +613,6 @@ MethodDesc* StubDispatchFrame::GetFunction() CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; MethodDesc * pMD = m_pMD; @@ -904,7 +898,6 @@ GCFrame::GCFrame(OBJECTREF *pObjRefs, UINT numObjRefs, BOOL maybeInterior) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -918,7 +911,6 @@ GCFrame::GCFrame(Thread *pThread, OBJECTREF *pObjRefs, UINT numObjRefs, BOOL may NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -932,7 +924,6 @@ void GCFrame::Init(Thread *pThread, OBJECTREF *pObjRefs, UINT numObjRefs, BOOL m NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -1603,7 +1594,6 @@ void HelperMethodFrame::Push() if (m_Attribs & FRAME_ATTR_NO_THREAD_ABORT) NOTHROW; else THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; // @@ -1636,7 +1626,6 @@ void HelperMethodFrame::Pop() if (m_Attribs & FRAME_ATTR_NO_THREAD_ABORT) NOTHROW; else THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; Thread * pThread = m_pThread; @@ -1661,7 +1650,6 @@ NOINLINE void HelperMethodFrame::PushSlowHelper() if (m_Attribs & FRAME_ATTR_NO_THREAD_ABORT) NOTHROW; else THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; if (!(m_Attribs & FRAME_ATTR_NO_THREAD_ABORT)) @@ -1680,7 +1668,6 @@ NOINLINE void HelperMethodFrame::PopSlowHelper() THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; m_pThread->HandleThreadAbort(); @@ -1738,7 +1725,6 @@ BOOL HelperMethodFrame::InsureInit(bool initialInit, CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; if ((hostCallPreference == AllowHostCalls) && !m_MachState.isValid()) { HOST_CALLS; } else { HOST_NOCALLS; } SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/vm/frames.h b/src/vm/frames.h index f8bd4be..8847641 100644 --- a/src/vm/frames.h +++ b/src/vm/frames.h @@ -1678,7 +1678,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; // Frame MethodDesc should be always updated in cooperative mode to avoid racing with GC stackwalk - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/gccover.cpp b/src/vm/gccover.cpp index 95e5d2a..d4f0bac 100644 --- a/src/vm/gccover.cpp +++ b/src/vm/gccover.cpp @@ -1281,8 +1281,6 @@ void RemoveGcCoverageInterrupt(TADDR instrPtr, BYTE * savedInstrPtr) BOOL OnGcCoverageInterrupt(PCONTEXT regs) { - SO_NOT_MAINLINE_FUNCTION; - // So that you can set counted breakpoint easily; GCcoverCount++; forceStack[0]= ®s; // This is so I can see it fastchecked diff --git a/src/vm/gcenv.ee.common.cpp b/src/vm/gcenv.ee.common.cpp index 8ce6709..6915ec8 100644 --- a/src/vm/gcenv.ee.common.cpp +++ b/src/vm/gcenv.ee.common.cpp @@ -176,7 +176,6 @@ void GcReportLoaderAllocator(promote_func* fn, ScanContext* sc, LoaderAllocator { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; diff --git a/src/vm/gchandleutilities.h b/src/vm/gchandleutilities.h index 8359db0..86227cd 100644 --- a/src/vm/gchandleutilities.h +++ b/src/vm/gchandleutilities.h @@ -267,7 +267,6 @@ inline void DestroyHandleCommon(OBJECTHANDLE handle, HandleType type) GC_NOTRIGGER; MODE_ANY; CAN_TAKE_LOCK; - SO_TOLERANT; } CONTRACTL_END; @@ -375,7 +374,6 @@ inline void DestroyWinRTWeakHandle(OBJECTHANDLE handle) GC_NOTRIGGER; MODE_ANY; CAN_TAKE_LOCK; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/gchelpers.cpp b/src/vm/gchelpers.cpp index 945ae60..a52e10b 100644 --- a/src/vm/gchelpers.cpp +++ b/src/vm/gchelpers.cpp @@ -233,9 +233,6 @@ inline Object* Alloc(size_t size, BOOL bFinalize, BOOL bContainsPointers ) Object *retVal = NULL; CheckObjectSize(size); - // We don't want to throw an SO during the GC, so make sure we have plenty - // of stack before calling in. - INTERIOR_STACK_PROBE_FOR(GetThread(), static_cast(DEFAULT_ENTRY_PROBE_AMOUNT * 1.5)); if (GCHeapUtilities::UseThreadAllocationContexts()) { gc_alloc_context *threadContext = GetThreadAllocContext(); @@ -256,7 +253,6 @@ inline Object* Alloc(size_t size, BOOL bFinalize, BOOL bContainsPointers ) ThrowOutOfMemory(); } - END_INTERIOR_STACK_PROBE; return retVal; } @@ -278,9 +274,6 @@ inline Object* AllocAlign8(size_t size, BOOL bFinalize, BOOL bContainsPointers, Object *retVal = NULL; CheckObjectSize(size); - // We don't want to throw an SO during the GC, so make sure we have plenty - // of stack before calling in. - INTERIOR_STACK_PROBE_FOR(GetThread(), static_cast(DEFAULT_ENTRY_PROBE_AMOUNT * 1.5)); if (GCHeapUtilities::UseThreadAllocationContexts()) { gc_alloc_context *threadContext = GetThreadAllocContext(); @@ -300,7 +293,6 @@ inline Object* AllocAlign8(size_t size, BOOL bFinalize, BOOL bContainsPointers, ThrowOutOfMemory(); } - END_INTERIOR_STACK_PROBE; return retVal; } #endif // FEATURE_64BIT_ALIGNMENT @@ -336,9 +328,6 @@ inline Object* AllocLHeap(size_t size, BOOL bFinalize, BOOL bContainsPointers ) Object *retVal = NULL; CheckObjectSize(size); - // We don't want to throw an SO during the GC, so make sure we have plenty - // of stack before calling in. - INTERIOR_STACK_PROBE_FOR(GetThread(), static_cast(DEFAULT_ENTRY_PROBE_AMOUNT * 1.5)); retVal = GCHeapUtilities::GetGCHeap()->AllocLHeap(size, flags); if (!retVal) @@ -346,7 +335,6 @@ inline Object* AllocLHeap(size_t size, BOOL bFinalize, BOOL bContainsPointers ) ThrowOutOfMemory(); } - END_INTERIOR_STACK_PROBE; return retVal; } @@ -682,11 +670,6 @@ OBJECTREF AllocateArrayEx(MethodTable *pArrayMT, INT32 *pArgs, DWORD dwNumArgs, } else { - // Since we're about to *really* recurse, probe for stack. - // @todo: is the default amount really correct? - _ASSERTE(GetThread()); - INTERIOR_STACK_PROBE(GetThread()); - TypeHandle subArrayType = pArrayMT->GetApproxArrayElementTypeHandle(); for (UINT32 i = 0; i < cElements; i++) { @@ -696,8 +679,6 @@ OBJECTREF AllocateArrayEx(MethodTable *pArrayMT, INT32 *pArgs, DWORD dwNumArgs, iholder.Release(); - END_INTERIOR_STACK_PROBE - orArray = (ArrayBase *) OBJECTREFToObject(outerArray); } } // GcStressPolicy::~InhibitHolder() @@ -913,13 +894,6 @@ OBJECTREF AllocatePrimitiveArray(CorElementType type, DWORD cElements) MODE_COOPERATIVE; // returns an objref without pinning it => cooperative } CONTRACTL_END; -#ifdef _DEBUG - // fastPrimitiveArrayAllocator is called by VM and managed code. If called from managed code, we - // make sure that the thread is in SOTolerantState. -#ifdef FEATURE_STACK_PROBE - Thread::DisableSOCheckInHCALL disableSOCheckInHCALL; -#endif // FEATURE_STACK_PROBE -#endif // _DEBUG return OBJECTREF( HCCALL2(fastPrimitiveArrayAllocator, type, cElements) ); } @@ -941,13 +915,6 @@ OBJECTREF AllocateObjectArray(DWORD cElements, TypeHandle ElementType) // typehandle for every object in the heap. TypeHandle ArrayType = ClassLoader::LoadArrayTypeThrowing(ElementType); -#ifdef _DEBUG - // fastObjectArrayAllocator is called by VM and managed code. If called from managed code, we - // make sure that the thread is in SOTolerantState. -#ifdef FEATURE_STACK_PROBE - Thread::DisableSOCheckInHCALL disableSOCheckInHCALL; -#endif // FEATURE_STACK_PROBE -#endif // _DEBUG return OBJECTREF( HCCALL2(fastObjectArrayAllocator, ArrayType.AsArray()->GetTemplateMethodTable(), cElements)); } @@ -959,13 +926,6 @@ STRINGREF AllocateString( DWORD cchStringLength ) MODE_COOPERATIVE; // returns an objref without pinning it => cooperative } CONTRACTL_END; -#ifdef _DEBUG - // fastStringAllocator is called by VM and managed code. If called from managed code, we - // make sure that the thread is in SOTolerantState. -#ifdef FEATURE_STACK_PROBE - Thread::DisableSOCheckInHCALL disableSOCheckInHCALL; -#endif // FEATURE_STACK_PROBE -#endif // _DEBUG return STRINGREF(HCCALL1(fastStringAllocator, cchStringLength)); } @@ -1479,7 +1439,6 @@ void ErectWriteBarrier(OBJECTREF *dst, OBJECTREF ref) STATIC_CONTRACT_MODE_COOPERATIVE; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; // if the dst is outside of the heap (unboxed value classes) then we // simply exit @@ -1520,7 +1479,6 @@ void ErectWriteBarrierForMT(MethodTable **dst, MethodTable *ref) STATIC_CONTRACT_MODE_COOPERATIVE; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; *dst = ref; diff --git a/src/vm/generics.cpp b/src/vm/generics.cpp index 773d863..4913651 100644 --- a/src/vm/generics.cpp +++ b/src/vm/generics.cpp @@ -19,7 +19,6 @@ #include "eeconfig.h" #include "generics.h" #include "genericdict.h" -#include "stackprobe.h" #include "typestring.h" #include "typekey.h" #include "dumpcommon.h" @@ -144,13 +143,6 @@ TypeHandle ClassLoader::LoadCanonicalGenericInstantiation(TypeKey *pTypeKey, ThrowHR(COR_E_OVERFLOW); TypeHandle ret = TypeHandle(); - DECLARE_INTERIOR_STACK_PROBE; -#ifndef DACCESS_COMPILE - if ((dwAllocSize/GetOsPageSize()+1) >= 2) - { - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD((10+dwAllocSize/GetOsPageSize()+1), NO_FORBIDGC_LOADER_USE_ThrowSO();); - } -#endif // DACCESS_COMPILE TypeHandle *repInst = (TypeHandle*) _alloca(dwAllocSize); for (DWORD i = 0; i < ntypars; i++) @@ -162,7 +154,6 @@ TypeHandle ClassLoader::LoadCanonicalGenericInstantiation(TypeKey *pTypeKey, TypeKey canonKey(pTypeKey->GetModule(), pTypeKey->GetTypeToken(), Instantiation(repInst, ntypars)); ret = ClassLoader::LoadConstructedTypeThrowing(&canonKey, fLoadTypes, level); - END_INTERIOR_STACK_PROBE; RETURN(ret); } @@ -968,7 +959,6 @@ BOOL GetExactInstantiationsOfMethodAndItsClassFromCallInformation( { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; PRECONDITION(CheckPointer(pRepMethod)); SUPPORTS_DAC; @@ -1007,7 +997,6 @@ BOOL GetExactInstantiationsOfMethodAndItsClassFromCallInformation( { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; PRECONDITION(CheckPointer(pRepMethod)); SUPPORTS_DAC; diff --git a/src/vm/hash.cpp b/src/vm/hash.cpp index 20eddfd..656622c 100644 --- a/src/vm/hash.cpp +++ b/src/vm/hash.cpp @@ -535,7 +535,6 @@ UPTR HashMap::LookupValue(UPTR key, UPTR value) { DISABLED(THROWS); // This is not a bug, we cannot decide, since the function ptr called may be either. DISABLED(GC_NOTRIGGER); // This is not a bug, we cannot decide, since the function ptr called may be either. - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/hosting.cpp b/src/vm/hosting.cpp index 035fff8..720a691 100644 --- a/src/vm/hosting.cpp +++ b/src/vm/hosting.cpp @@ -42,7 +42,6 @@ DEBUG_NOINLINE void AddHostCallsStaticMarker() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_CANNOT_TAKE_LOCK; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_HOST_CALLS; METHOD_CANNOT_BE_FOLDED_DEBUG; @@ -203,7 +202,6 @@ LPVOID EEVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, D { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -277,7 +275,6 @@ BOOL EEVirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) { { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -302,7 +299,6 @@ SIZE_T EEVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZ { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -319,7 +315,6 @@ BOOL EEVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWOR { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -335,11 +330,8 @@ HANDLE EEGetProcessHeap() // Note: this can be called a little early for real contracts, so we use static contracts instead. STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - { - return GetProcessHeap(); - } + return GetProcessHeap(); } #define GetProcessHeap() Dont_Use_GetProcessHeap() @@ -350,7 +342,6 @@ HANDLE EEHeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -372,7 +363,6 @@ BOOL EEHeapDestroy(HANDLE hHeap) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -400,7 +390,6 @@ BOOL EEHeapDestroy(HANDLE hHeap) LPVOID EEHeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_SO_INTOLERANT; #ifdef FAILPOINTS_ENABLED if (RFS_HashStack ()) @@ -442,7 +431,6 @@ LPVOID EEHeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes) LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; #ifdef _DEBUG // Check whether (indispensable) implicit casting in ClrAllocInProcessHeapBootstrap is safe. @@ -451,12 +439,6 @@ LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes) static HANDLE ProcessHeap = NULL; - // We need to guarentee a very small stack consumption in allocating. And we can't allow - // an SO to happen while calling into the host. This will force a hard SO which is OK because - // we shouldn't ever get this close inside the EE in SO-intolerant code, so this should - // only fail if we call directly in from outside the EE, such as the JIT. - MINIMAL_STACK_PROBE_CHECK_THREAD(GetThread()); - if (ProcessHeap == NULL) ProcessHeap = EEGetProcessHeap(); @@ -468,11 +450,6 @@ BOOL EEHeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - - // @todo - Need a backout validation here. - CONTRACT_VIOLATION(SOToleranceViolation); - BOOL retVal = FALSE; @@ -509,7 +486,6 @@ BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -519,10 +495,6 @@ BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem) static FastFreeInProcessHeapFunc pFunc = EEHeapFreeInProcessHeap; #endif - // Take a look at comment in EEHeapFree and EEHeapAllocInProcessHeap, obviously someone - // needs to take a little time to think more about this code. - //CONTRACT_VIOLATION(SOToleranceViolation); - static HANDLE ProcessHeap = NULL; if (ProcessHeap == NULL) @@ -602,7 +574,6 @@ DWORD EESleepEx(DWORD dwMilliseconds, BOOL bAlertable) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -627,7 +598,6 @@ BOOL __SwitchToThread (DWORD dwSleepMSec, DWORD dwSwitchCount) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -643,7 +613,6 @@ BOOL __DangerousSwitchToThread (DWORD dwSleepMSec, DWORD dwSwitchCount, BOOL goT NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(dwSleepMSec < 10000 || GetThread() == NULL || !GetThread()->PreemptiveGCDisabled()); } CONTRACTL_END; @@ -759,12 +728,9 @@ void EEDeleteCriticalSection(CRITSEC_COOKIE cookie) { NOTHROW; WRAPPER(GC_NOTRIGGER); - SO_TOLERANT; } CONTRACTL_END; - VALIDATE_BACKOUT_STACK_CONSUMPTION; - Crst *pCrst = CookieToCrst(cookie); _ASSERTE(pCrst); @@ -782,7 +748,6 @@ DEBUG_NOINLINE void EEEnterCriticalSection(CRITSEC_COOKIE cookie) { { WRAPPER(THROWS); WRAPPER(GC_TRIGGERS); - SO_INTOLERANT; } CONTRACTL_END; @@ -800,7 +765,6 @@ DEBUG_NOINLINE void EELeaveCriticalSection(CRITSEC_COOKIE cookie) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; } CONTRACTL_END; @@ -818,7 +782,6 @@ LPVOID EETlsGetValue(DWORD slot) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; // // @todo: we don't want TlsGetValue to throw, but CheckThreadState throws right now. Either modify @@ -840,7 +803,6 @@ BOOL EETlsCheckValue(DWORD slot, LPVOID * pValue) STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; // // @todo: we don't want TlsGetValue to throw, but CheckThreadState throws right now. Either modify @@ -865,7 +827,6 @@ VOID EETlsSetValue(DWORD slot, LPVOID pData) STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; void **pTlsData = CExecutionEngine::CheckThreadState(slot); diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp index f9e7c2b..45ac527 100644 --- a/src/vm/i386/cgenx86.cpp +++ b/src/vm/i386/cgenx86.cpp @@ -105,9 +105,6 @@ void GetSpecificCpuInfo(CORINFO_CPU * cpuInfo) _ASSERTE(tempVal.dwCPUType); #ifdef _DEBUG - { - SO_NOT_MAINLINE_REGION(); - /* Set Family+Model+Stepping string (eg., x690 for Banias, or xF30 for P4 Prescott) * instead of Family only */ @@ -120,15 +117,11 @@ void GetSpecificCpuInfo(CORINFO_CPU * cpuInfo) 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 - { - SO_NOT_MAINLINE_REGION(); - /* Set the 32-bit feature mask */ @@ -139,7 +132,6 @@ void GetSpecificCpuInfo(CORINFO_CPU * cpuInfo) { tempVal.dwFeatures = configCpuFeatures; } - } #endif val = *cpuInfo = tempVal; @@ -910,7 +902,6 @@ WORD GetUnpatchedCodeData(LPCBYTE pAddr) GC_NOTRIGGER; PRECONDITION(CORDebuggerAttached()); PRECONDITION(CheckPointer(pAddr)); - SO_TOLERANT; } CONTRACT_END; // Ordering is because x86 is little-endien. @@ -1480,7 +1471,6 @@ BOOL DoesSlotCallPrestub(PCODE pCode) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(pCode != NULL); PRECONDITION(pCode != GetPreStubEntryPoint()); } CONTRACTL_END; diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp index 97b4087..c837b55 100644 --- a/src/vm/i386/excepx86.cpp +++ b/src/vm/i386/excepx86.cpp @@ -475,10 +475,6 @@ EXCEPTION_DISPOSITION COMPlusAfterUnwind( LOG((LF_EH, LL_INFO1000, "COMPlusAfterUnwind: going to: pFunc:%#X, pStack:%#X\n", tct.pFunc, tct.pStack)); - // TODO: UnwindFrames ends up calling into StackWalkFrames which is SO_INTOLERANT - // as is UnwindFrames, etc... Should we make COMPlusAfterUnwind SO_INTOLERANT??? - ANNOTATION_VIOLATION(SOToleranceViolation); - UnwindFrames(pThread, &tct); #ifdef DEBUGGING_SUPPORTED @@ -649,7 +645,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc. STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_TOLERANT; #ifdef _DEBUG static int breakOnFirstPass = -1; @@ -1079,7 +1074,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc. #ifdef FEATURE_CORRUPTING_EXCEPTIONS { - BEGIN_SO_INTOLERANT_CODE(GetThread()); // Setup the state in current exception tracker indicating the corruption severity // of the active exception. CEHelper::SetupCorruptionSeverityForActiveException(bRethrownException, bNestedException, @@ -1088,8 +1082,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc. // Failfast if exception indicates corrupted process state if (pExInfo->GetCorruptionSeverity() == ProcessCorrupting) EEPOLICY_HANDLE_FATAL_ERROR(exceptionCode); - - END_SO_INTOLERANT_CODE; } #endif // FEATURE_CORRUPTING_EXCEPTIONS @@ -1146,10 +1138,7 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc. if (bRethrownException || bNestedException) { _ASSERTE(pExInfo->m_pPrevNestedInfo != NULL); - - BEGIN_SO_INTOLERANT_CODE(GetThread()); SetStateForWatsonBucketing(bRethrownException, pExInfo->GetPreviousExceptionTracker()->GetThrowableAsHandle()); - END_SO_INTOLERANT_CODE; } #ifdef DEBUGGING_SUPPORTED @@ -1708,7 +1697,7 @@ EXCEPTION_HANDLER_IMPL(COMPlusFrameHandler) Thread *pThread = GetThread(); if ((pExceptionRecord->ExceptionFlags & (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND)) == 0) { - if (IsSOExceptionCode(pExceptionRecord->ExceptionCode)) + if (pExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW) { EEPolicy::HandleStackOverflow(SOD_ManagedFrameHandler, (void*)pEstablisherFrame); @@ -1736,15 +1725,6 @@ EXCEPTION_HANDLER_IMPL(COMPlusFrameHandler) return ExceptionContinueSearch; } - else - { -#ifdef FEATURE_STACK_PROBE - if (GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) == eRudeUnloadAppDomain) - { - RetailStackProbe(static_cast(ADJUST_PROBE(BACKOUT_CODE_STACK_LIMIT)), pThread); - } -#endif - } } else { @@ -1758,7 +1738,7 @@ EXCEPTION_HANDLER_IMPL(COMPlusFrameHandler) exceptionCode = GetCurrentExceptionCode(); } - if (IsSOExceptionCode(exceptionCode)) + if (exceptionCode == STATUS_STACK_OVERFLOW) { // We saved the context during the first pass in case the stack overflow exception is // unhandled and Watson dump code needs it. Now we are in the second pass, therefore @@ -1799,9 +1779,6 @@ EXCEPTION_HANDLER_IMPL(COMPlusFrameHandler) } } - // . We need to probe here, but can't introduce destructors etc. - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - if (pExceptionRecord->ExceptionFlags & (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND)) { retVal = CPFH_UnwindHandler(pExceptionRecord, @@ -1823,8 +1800,6 @@ EXCEPTION_HANDLER_IMPL(COMPlusFrameHandler) } - END_CONTRACT_VIOLATION; - return retVal; } // COMPlusFrameHandler() @@ -1839,7 +1814,6 @@ NOINLINE LPVOID COMPlusEndCatchWorker(Thread * pThread) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_INTOLERANT; LOG((LF_EH, LL_INFO1000, "COMPlusPEndCatch:called with " "pThread:0x%x\n",pThread)); @@ -1850,9 +1824,6 @@ NOINLINE LPVOID COMPlusEndCatchWorker(Thread * pThread) void* esp = NULL; - // @todo . We need to probe in the EH code, but can't introduce destructors etc. - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - // Notify the profiler that the catcher has finished running // IL stubs don't contain catch blocks so inability to perform this check does not matter. // if (!pFunc->IsILStub()) @@ -1905,8 +1876,6 @@ NOINLINE LPVOID COMPlusEndCatchWorker(Thread * pThread) pThread->SyncManagedExceptionState(fIsDebuggerHelperThread); LOG((LF_EH, LL_INFO1000, "COMPlusPEndCatch: esp=%p\n", esp)); - - END_CONTRACT_VIOLATION; return esp; } @@ -1929,7 +1898,6 @@ LPVOID STDCALL COMPlusEndCatch(LPVOID ebp, DWORD ebx, DWORD edi, DWORD esi, LPVO STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_INTOLERANT; ETW::ExceptionLog::ExceptionCatchEnd(); ETW::ExceptionLog::ExceptionThrownEnd(); @@ -2066,7 +2034,6 @@ VOID UnwindExceptionTrackerAndResumeInInterceptionFrame(ExInfo* pExInfo, EHConte STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(pExInfo && context); @@ -2088,7 +2055,6 @@ BOOL PopNestedExceptionRecords(LPVOID pTargetSP, BOOL bCheckForUnknownHandlers) // No CONTRACT here, because we can't run the risk of it pushing any SEH into the current method. STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; PEXCEPTION_REGISTRATION_RECORD pEHR = GetCurrentSEHRecord(); @@ -3301,7 +3267,6 @@ int CallJitEHFilterWorker(size_t *pShadowSP, EHContext *pContext) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_INTOLERANT; int retVal = EXCEPTION_CONTINUE_SEARCH; @@ -3554,8 +3519,6 @@ EXCEPTION_HANDLER_IMPL(UMThunkPrestubHandler) EXCEPTION_DISPOSITION retval = ExceptionContinueSearch; - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - // We must forward to the COMPlusFrameHandler. This will unwind the Frame Chain up to here, and also leave the // preemptive GC mode set correctly. retval = EXCEPTION_HANDLER_FWD(COMPlusFrameHandler); @@ -3582,8 +3545,6 @@ EXCEPTION_HANDLER_IMPL(UMThunkPrestubHandler) pFrame->Pop(pThread); } - END_CONTRACT_VIOLATION; - return retval; } diff --git a/src/vm/i386/gmsx86.cpp b/src/vm/i386/gmsx86.cpp index 53bd23f..94843b0 100644 --- a/src/vm/i386/gmsx86.cpp +++ b/src/vm/i386/gmsx86.cpp @@ -369,7 +369,6 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -1283,7 +1282,6 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/vm/i386/jitinterfacex86.cpp b/src/vm/i386/jitinterfacex86.cpp index 7be22f7..78401d8 100644 --- a/src/vm/i386/jitinterfacex86.cpp +++ b/src/vm/i386/jitinterfacex86.cpp @@ -68,7 +68,6 @@ extern "C" void STDCALL JIT_WriteBarrierReg_PostGrow();// JIThelp.asm/JIThelp.s #ifdef _DEBUG extern "C" void STDCALL WriteBarrierAssert(BYTE* ptr, Object* obj) { - STATIC_CONTRACT_SO_TOLERANT; WRAPPER_NO_CONTRACT; static BOOL fVerifyHeap = -1; @@ -103,7 +102,6 @@ extern "C" void STDCALL WriteBarrierAssert(BYTE* ptr, Object* obj) __declspec(naked) void F_CALL_CONV JIT_Stelem_Ref(PtrArray* array, unsigned idx, Object* val) { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; @@ -197,7 +195,6 @@ Epilog: extern "C" __declspec(naked) Object* F_CALL_CONV JIT_IsInstanceOfClass(MethodTable *pMT, Object *pObject) { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; @@ -256,7 +253,6 @@ extern "C" __declspec(naked) Object* F_CALL_CONV JIT_IsInstanceOfClass(MethodTab extern "C" __declspec(naked) Object* F_CALL_CONV JIT_ChkCastClass(MethodTable *pMT, Object *pObject) { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; @@ -296,7 +292,6 @@ extern "C" __declspec(naked) Object* F_CALL_CONV JIT_ChkCastClass(MethodTable *p extern "C" __declspec(naked) Object* F_CALL_CONV JIT_ChkCastClassSpecial(MethodTable *pMT, Object *pObject) { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; @@ -378,7 +373,6 @@ void STDCALL JIT_TailCallHelper(Thread * pThread) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; pThread->UnhijackThread(); @@ -783,7 +777,6 @@ HCIMPL2_RAW(Object*, UnframedAllocateObjectArray, MethodTable *pArrayMT, DWORD c THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; return OBJECTREFToObject(AllocateArrayEx(pArrayMT, @@ -804,7 +797,6 @@ HCIMPL2_RAW(Object*, UnframedAllocatePrimitiveArray, CorElementType type, DWORD THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; return OBJECTREFToObject( AllocatePrimitiveArray(type, cElements, FALSE) ); diff --git a/src/vm/ibclogger.cpp b/src/vm/ibclogger.cpp index a780754..991f936 100644 --- a/src/vm/ibclogger.cpp +++ b/src/vm/ibclogger.cpp @@ -141,7 +141,6 @@ void IBCLogger::LogAccessThreadSafeHelperStatic(const void * p, pfnIBCAccessCall void IBCLogger::LogAccessThreadSafeHelper(const void * p, pfnIBCAccessCallback callback) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; CONTRACT_VIOLATION( HostViolation ); /* For the Global Class we may see p == NULL */ @@ -183,7 +182,6 @@ CrstStatic* IBCLogger::GetSync() THROWS; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -258,7 +256,6 @@ static const int c_minCountIncr = 8; ThreadLocalIBCInfo::ThreadLocalIBCInfo() { LIMITED_METHOD_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; m_fCallbackFailed = false; m_fProcessingDelayedList = false; @@ -290,7 +287,6 @@ void ThreadLocalIBCInfo::DeleteDelayedCallbacks() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -318,7 +314,6 @@ void ThreadLocalIBCInfo::FlushDelayedCallbacks() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -338,7 +333,6 @@ DelayCallbackTable * ThreadLocalIBCInfo::GetPtrDelayList() THROWS; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -357,7 +351,6 @@ int ThreadLocalIBCInfo::ProcessDelayedCallbacks() THROWS; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -430,7 +423,6 @@ void ThreadLocalIBCInfo::CallbackHelper(const void * p, pfnIBCAccessCallback cal GC_NOTRIGGER; MODE_ANY; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -506,7 +498,6 @@ void IBCLogger::LogMethodAccessHelper(const MethodDesc* pMD, ULONG flagNum) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; @@ -592,7 +583,6 @@ void IBCLogger::LogMethodAccessWrapper(IBCLogger* pLogger, const void * pValue1, void IBCLogger::LogMethodDescAccessHelper(const MethodDesc *pMD) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogMethodAccessHelper(pMD, ReadMethodDesc); } @@ -600,7 +590,6 @@ void IBCLogger::LogMethodDescAccessHelper(const MethodDesc *pMD) void IBCLogger::LogMethodDescWriteAccessHelper(MethodDesc *pMD) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogMethodAccessHelper(pMD, ReadMethodDesc); LogMethodAccessHelper(pMD, WriteMethodDesc); @@ -609,7 +598,6 @@ void IBCLogger::LogMethodDescWriteAccessHelper(MethodDesc *pMD) void IBCLogger::LogMethodPrecodeAccessHelper(MethodDesc *pMD) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogMethodAccessHelper(pMD, ReadMethodPrecode); } @@ -617,7 +605,6 @@ void IBCLogger::LogMethodPrecodeAccessHelper(MethodDesc *pMD) void IBCLogger::LogMethodPrecodeWriteAccessHelper(MethodDesc *pMD) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogMethodAccessHelper(pMD, ReadMethodPrecode); LogMethodAccessHelper(pMD, WriteMethodPrecode); @@ -631,7 +618,6 @@ void IBCLogger::LogMethodCodeAccessHelper(MethodDesc *pMD) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; @@ -647,7 +633,6 @@ void IBCLogger::LogNDirectCodeAccessHelper(MethodDesc *pMD) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; @@ -661,7 +646,6 @@ void IBCLogger::LogNDirectCodeAccessHelper(MethodDesc *pMD) void IBCLogger::LogMethodGCInfoAccessHelper(MethodDesc *pMD) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; _ASSERTE(InstrEnabled()); @@ -673,7 +657,6 @@ void IBCLogger::LogMethodGCInfoAccessHelper(MethodDesc *pMD) void IBCLogger::LogMethodTableAccessHelper(MethodTable const * pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(pMT, ReadMethodTable); } @@ -682,7 +665,6 @@ void IBCLogger::LogMethodTableAccessHelper(MethodTable const * pMT) void IBCLogger::LogTypeMethodTableAccessHelper(const TypeHandle *th) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(*th, ReadMethodTable); } @@ -691,7 +673,6 @@ void IBCLogger::LogTypeMethodTableAccessHelper(const TypeHandle *th) void IBCLogger::LogTypeMethodTableWriteableAccessHelper(const TypeHandle *th) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(*th, ReadTypeDesc); LogTypeAccessHelper(*th, WriteTypeDesc); @@ -705,7 +686,6 @@ void IBCLogger::LogTypeAccessHelper(TypeHandle th, ULONG flagNum) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; @@ -790,7 +770,6 @@ void IBCLogger::LogTypeAccessWrapper(IBCLogger* pLogger, const void * pValue, co { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -801,7 +780,6 @@ void IBCLogger::LogTypeAccessWrapper(IBCLogger* pLogger, const void * pValue, co void IBCLogger::LogMethodTableWriteableDataAccessHelper(MethodTable const * pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(pMT, ReadMethodTable); LogTypeAccessHelper(pMT, ReadMethodTableWriteableData); @@ -811,7 +789,6 @@ void IBCLogger::LogMethodTableWriteableDataAccessHelper(MethodTable const * pMT) void IBCLogger::LogMethodTableWriteableDataWriteAccessHelper(MethodTable *pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(pMT, ReadMethodTable); LogTypeAccessHelper(pMT, WriteMethodTableWriteableData); @@ -820,7 +797,6 @@ void IBCLogger::LogMethodTableWriteableDataWriteAccessHelper(MethodTable *pMT) void IBCLogger::LogMethodTableNonVirtualSlotsAccessHelper(MethodTable const * pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(pMT, ReadMethodTable); LogTypeAccessHelper(pMT, ReadNonVirtualSlots); @@ -830,7 +806,6 @@ void IBCLogger::LogMethodTableNonVirtualSlotsAccessHelper(MethodTable const * pM void IBCLogger::LogEEClassAndMethodTableAccessHelper(MethodTable * pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; if (pMT == NULL) return; @@ -849,7 +824,6 @@ void IBCLogger::LogEEClassAndMethodTableAccessHelper(MethodTable * pMT) void IBCLogger::LogEEClassCOWTableAccessHelper(MethodTable * pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; if (pMT == NULL) return; @@ -869,7 +843,6 @@ void IBCLogger::LogEEClassCOWTableAccessHelper(MethodTable * pMT) void IBCLogger::LogFieldDescsAccessHelper(FieldDesc * pFD) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; MethodTable * pMT = pFD->GetApproxEnclosingMethodTable_NoLogging(); @@ -886,7 +859,6 @@ void IBCLogger::LogFieldDescsAccessHelper(FieldDesc * pFD) void IBCLogger::LogDispatchMapAccessHelper(MethodTable *pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(pMT, ReadMethodTable); LogTypeAccessHelper(pMT, ReadDispatchMap); @@ -895,7 +867,6 @@ void IBCLogger::LogDispatchMapAccessHelper(MethodTable *pMT) void IBCLogger::LogDispatchTableAccessHelper(MethodTable *pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(pMT, ReadMethodTable); LogTypeAccessHelper(pMT, ReadDispatchMap); @@ -905,7 +876,6 @@ void IBCLogger::LogDispatchTableAccessHelper(MethodTable *pMT) void IBCLogger::LogDispatchTableSlotAccessHelper(DispatchSlot *pDS) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; if (pDS->IsNull()) return; @@ -919,7 +889,6 @@ void IBCLogger::LogDispatchTableSlotAccessHelper(DispatchSlot *pDS) void IBCLogger::LogFieldMarshalersReadAccessHelper(MethodTable * pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; if (pMT == NULL) return; @@ -939,7 +908,6 @@ void IBCLogger::LogFieldMarshalersReadAccessHelper(MethodTable * pMT) void IBCLogger::LogCCtorInfoReadAccessHelper(MethodTable *pMT) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(pMT, ReadCCtorInfo); } @@ -947,7 +915,6 @@ void IBCLogger::LogCCtorInfoReadAccessHelper(MethodTable *pMT) void IBCLogger::LogTypeHashTableAccessHelper(const TypeHandle *th) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; LogTypeAccessHelper(*th, ReadTypeHashTable); } @@ -960,7 +927,6 @@ void IBCLogger::LogClassHashTableAccessHelper(EEClassHashEntry *pEntry) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; @@ -1017,7 +983,6 @@ void IBCLogger::LogMetaDataAccessHelper(const void * addr) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; @@ -1050,7 +1015,6 @@ void IBCLogger::LogMetaDataSearchAccessHelper(const void * result) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; @@ -1083,7 +1047,6 @@ void IBCLogger::LogCerMethodListReadAccessHelper(MethodDesc *pMD) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; @@ -1094,7 +1057,6 @@ void IBCLogger::LogCerMethodListReadAccessHelper(MethodDesc *pMD) void IBCLogger::LogRidMapAccessHelper( RidMapLogData data ) { WRAPPER_NO_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; data.First()->LogTokenAccess( data.Second(), RidMap ); } @@ -1107,7 +1069,6 @@ void IBCLogger::LogRVADataAccessHelper(FieldDesc *pFD) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; PRECONDITION(g_IBCLogger.InstrEnabled()); } CONTRACTL_END; diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp index c70154d..5c00056 100644 --- a/src/vm/interoputil.cpp +++ b/src/vm/interoputil.cpp @@ -1418,13 +1418,10 @@ void SafeRelease_OnException(IUnknown* pUnk, RCW* pRCW { NOTHROW; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; #ifndef CROSSGEN_COMPILE - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return;) - #ifdef MDA_SUPPORTED // Report the exception that was thrown. if (pProbe) @@ -1435,8 +1432,6 @@ void SafeRelease_OnException(IUnknown* pUnk, RCW* pRCW LogInterop(W("An exception occurred during release")); LogInteropLeak(pUnk); #endif // FEATURE_COMINTEROP - - END_SO_INTOLERANT_CODE; #endif // CROSSGEN_COMPILE } @@ -1450,7 +1445,6 @@ ULONG SafeReleasePreemp(IUnknown * pUnk, RCW * pRCW) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk, NULL_OK)); } CONTRACTL_END; @@ -1524,7 +1518,6 @@ ULONG SafeRelease(IUnknown* pUnk, RCW* pRCW) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk, NULL_OK)); } CONTRACTL_END; @@ -1647,7 +1640,6 @@ BOOL IsComObjectClass(TypeHandle type) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -1676,7 +1668,6 @@ ReadBestFitCustomAttribute(MethodDesc* pMD, BOOL* BestFit, BOOL* ThrowOnUnmappab { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1698,7 +1689,6 @@ ReadBestFitCustomAttribute(IMDInternalImport* pInternalImport, mdTypeDef cl, BOO NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pInternalImport)); } CONTRACTL_END; @@ -1952,7 +1942,6 @@ HRESULT SafeQueryInterface(IUnknown* pUnk, REFIID riid, IUnknown** pResUnk) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(pUnk); _ASSERTE(pResUnk); @@ -1964,7 +1953,6 @@ HRESULT SafeQueryInterface(IUnknown* pUnk, REFIID riid, IUnknown** pResUnk) GCX_PREEMP_NO_DTOR_HAVE_THREAD(pThread); BEGIN_CONTRACT_VIOLATION(ThrowsViolation); // message pump could happen, so arbitrary managed code could run - BEGIN_SO_TOLERANT_CODE(pThread); struct Param { HRESULT * const hr; IUnknown** const pUnk; REFIID riid; IUnknown*** const pResUnk; } param = { &hr, &pUnk, riid, &pResUnk }; #define PAL_TRY_ARG(argName) (*(pParam->argName)) @@ -1986,7 +1974,6 @@ HRESULT SafeQueryInterface(IUnknown* pUnk, REFIID riid, IUnknown** pResUnk) #undef PAL_TRY_ARG #undef PAL_TRY_REFARG - END_SO_TOLERANT_CODE; END_CONTRACT_VIOLATION; LOG((LF_INTEROP, LL_EVERYTHING, hr == S_OK ? "QI Succeeded\n" : "QI Failed\n")); @@ -2013,7 +2000,6 @@ HRESULT SafeQueryInterfacePreemp(IUnknown* pUnk, REFIID riid, IUnknown** pResUnk STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_PREEMPTIVE; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(pUnk); _ASSERTE(pResUnk); @@ -2023,7 +2009,6 @@ HRESULT SafeQueryInterfacePreemp(IUnknown* pUnk, REFIID riid, IUnknown** pResUnk HRESULT hr = E_FAIL; BEGIN_CONTRACT_VIOLATION(ThrowsViolation); // message pump could happen, so arbitrary managed code could run - BEGIN_SO_TOLERANT_CODE(pThread); struct Param { HRESULT * const hr; IUnknown** const pUnk; REFIID riid; IUnknown*** const pResUnk; } param = { &hr, &pUnk, riid, &pResUnk }; #define PAL_TRY_ARG(argName) (*(pParam->argName)) @@ -2045,10 +2030,8 @@ HRESULT SafeQueryInterfacePreemp(IUnknown* pUnk, REFIID riid, IUnknown** pResUnk #undef PAL_TRY_ARG #undef PAL_TRY_REFARG - END_SO_TOLERANT_CODE; END_CONTRACT_VIOLATION; - LOG((LF_INTEROP, LL_EVERYTHING, hr == S_OK ? "QI Succeeded\n" : "QI Failed\n")); // Ensure if the QI returned ok that it actually set a pointer. @@ -2297,7 +2280,6 @@ HRESULT EnsureComStartedNoThrow(BOOL fCoInitCurrentThread) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; PRECONDITION(g_fEEStarted); PRECONDITION(GetThread() != NULL); // Should always be inside BEGIN_EXTERNAL_ENTRYPOINT } @@ -2310,11 +2292,7 @@ HRESULT EnsureComStartedNoThrow(BOOL fCoInitCurrentThread) GCX_COOP(); EX_TRY { - BEGIN_SO_INTOLERANT_CODE(GetThread()); - EnsureComStarted(fCoInitCurrentThread); - - END_SO_INTOLERANT_CODE; } EX_CATCH_HRESULT(hr); } @@ -2377,7 +2355,6 @@ ULONG SafeAddRef(IUnknown* pUnk) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -2409,7 +2386,6 @@ ULONG SafeAddRefPreemp(IUnknown* pUnk) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -3963,7 +3939,6 @@ static HRESULT InvokeExHelper( STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_INTOLERANT; _ASSERTE(pDispEx != NULL); @@ -3992,8 +3967,6 @@ static HRESULT InvokeExHelper( PAL_TRY(Param *, pParam, ¶m) { - BEGIN_SO_TOLERANT_CODE(GetThread()); - pParam->hr = pParam->pDispEx->InvokeEx(pParam->MemberID, pParam->lcid, pParam->flags, @@ -4001,8 +3974,6 @@ static HRESULT InvokeExHelper( pParam->pVarResult, pParam->pExcepInfo, pParam->pspCaller); - - END_SO_TOLERANT_CODE; } PAL_EXCEPT_FILTER(CallOutFilter) { @@ -4027,7 +3998,6 @@ static HRESULT InvokeHelper( STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_INTOLERANT; _ASSERTE(pDisp != NULL); @@ -4060,8 +4030,6 @@ static HRESULT InvokeHelper( PAL_TRY(Param *, pParam, ¶m) { - BEGIN_SO_TOLERANT_CODE(GetThread()); - pParam->hr = pParam->pDisp->Invoke(pParam->MemberID, pParam->riid, pParam->lcid, @@ -4070,8 +4038,6 @@ static HRESULT InvokeHelper( pParam->pVarResult, pParam->pExcepInfo, pParam->piArgErr); - - END_SO_TOLERANT_CODE; } PAL_EXCEPT_FILTER(CallOutFilter) { @@ -6410,7 +6376,6 @@ VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg) GC_TRIGGERS; MODE_ANY; PRECONDITION(CheckPointer(pItf)); - SO_TOLERANT; } CONTRACTL_END; @@ -6444,7 +6409,6 @@ VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg) GC_NOTRIGGER; MODE_ANY; PRECONDITION(CheckPointer(pItf, NULL_OK)); - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/interoputil.inl b/src/vm/interoputil.inl index 80cd8f4..3a396c3 100644 --- a/src/vm/interoputil.inl +++ b/src/vm/interoputil.inl @@ -14,7 +14,6 @@ inline BOOL ComInterfaceSlotIs(IUnknown* pUnk, int slot, LPVOID pvFunction) GC_NOTRIGGER; FORBID_FAULT; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); } CONTRACTL_END; @@ -63,7 +62,6 @@ FORCEINLINE ComCallWrapper* MapIUnknownToWrapper(IUnknown* pUnk) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk, NULL_OK)); } CONTRACT_END; diff --git a/src/vm/interpreter.cpp b/src/vm/interpreter.cpp index bdadc32..2f27b62 100644 --- a/src/vm/interpreter.cpp +++ b/src/vm/interpreter.cpp @@ -3286,7 +3286,6 @@ void Interpreter::EndFilter() bool Interpreter::MethodHandlesException(OBJECTREF orThrowable) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -3538,7 +3537,6 @@ void Interpreter::BackwardsBranchActions(int offset) bool Interpreter::SearchForCoveringFinally() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_ANY; @@ -4055,7 +4053,6 @@ bool CorInfoTypeIsPointer(CorInfoType cit) void Interpreter::LdArg(int argNum) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -4067,7 +4064,6 @@ void Interpreter::LdArg(int argNum) void Interpreter::LdArgA(int argNum) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -4081,7 +4077,6 @@ void Interpreter::LdArgA(int argNum) void Interpreter::StArg(int argNum) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -4094,7 +4089,6 @@ void Interpreter::StArg(int argNum) void Interpreter::LdLocA(int locNum) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -4121,7 +4115,6 @@ void Interpreter::LdLocA(int locNum) void Interpreter::LdIcon(INT32 c) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -4135,7 +4128,6 @@ void Interpreter::LdIcon(INT32 c) void Interpreter::LdR4con(INT32 c) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -4149,7 +4141,6 @@ void Interpreter::LdR4con(INT32 c) void Interpreter::LdLcon(INT64 c) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -4163,7 +4154,6 @@ void Interpreter::LdLcon(INT64 c) void Interpreter::LdR8con(INT64 c) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -4177,7 +4167,6 @@ void Interpreter::LdR8con(INT64 c) void Interpreter::LdNull() { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -4272,7 +4261,6 @@ template void Interpreter::BinaryArithOp() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -4531,7 +4519,6 @@ template void Interpreter::BinaryArithOvfOp() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -4746,7 +4733,6 @@ template void Interpreter::BinaryArithOvfOpWork(T val1, T val2) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -4789,7 +4775,6 @@ template void Interpreter::BinaryIntOp() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -4939,7 +4924,6 @@ template void Interpreter::ShiftOp() { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -5032,7 +5016,6 @@ void Interpreter::ShiftOpWork(unsigned op1idx, CorInfoType cit2) void Interpreter::Neg() { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -5075,7 +5058,6 @@ void Interpreter::Neg() void Interpreter::Not() { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -5111,7 +5093,6 @@ template void Interpreter::ConvOvf() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5337,7 +5316,6 @@ template void Interpreter::ConvOvfUn() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5433,7 +5411,6 @@ void Interpreter::ConvOvfUn() void Interpreter::LdObj() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5479,7 +5456,6 @@ void Interpreter::LdObj() void Interpreter::LdObjValueClassWork(CORINFO_CLASS_HANDLE valueClsHnd, unsigned ind, void* src) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5510,7 +5486,6 @@ void Interpreter::LdObjValueClassWork(CORINFO_CLASS_HANDLE valueClsHnd, unsigned CORINFO_CLASS_HANDLE Interpreter::GetTypeFromToken(BYTE* codePtr, CorInfoTokenKind tokKind InterpTracingArg(ResolveTokenKind rtk)) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5535,7 +5510,6 @@ bool Interpreter::IsValidPointerType(CorInfoType cit) void Interpreter::CpObj() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5590,7 +5564,6 @@ void Interpreter::CpObj() void Interpreter::StObj() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5714,7 +5687,6 @@ void Interpreter::StObj() void Interpreter::InitObj() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5767,7 +5739,6 @@ void Interpreter::InitObj() void Interpreter::LdStr() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -5787,14 +5758,12 @@ void Interpreter::NewObj() { #if INTERP_DYNAMIC_CONTRACTS CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; } CONTRACTL_END; #else // Dynamic contract occupies too much stack. - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; @@ -5968,7 +5937,6 @@ void Interpreter::NewObj() void Interpreter::NewArr() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6040,7 +6008,6 @@ void Interpreter::NewArr() void Interpreter::IsInst() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6074,7 +6041,6 @@ void Interpreter::IsInst() void Interpreter::CastClass() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6111,7 +6077,6 @@ void Interpreter::CastClass() void Interpreter::LocAlloc() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6153,7 +6118,6 @@ void Interpreter::LocAlloc() void Interpreter::MkRefany() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6198,7 +6162,6 @@ void Interpreter::MkRefany() void Interpreter::RefanyType() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6248,7 +6211,6 @@ OBJECTREF Interpreter::TypeHandleToTypeRef(TypeHandle* pth) CorInfoType Interpreter::GetTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6262,7 +6224,6 @@ CorInfoType Interpreter::GetTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE clsH void Interpreter::RefanyVal() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6294,7 +6255,6 @@ void Interpreter::RefanyVal() void Interpreter::CkFinite() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6326,7 +6286,6 @@ void Interpreter::CkFinite() void Interpreter::LdToken() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6378,7 +6337,6 @@ void Interpreter::LdToken() void Interpreter::LdFtn() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6424,7 +6382,6 @@ void Interpreter::LdFtn() void Interpreter::LdVirtFtn() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6483,7 +6440,6 @@ void Interpreter::LdVirtFtn() void Interpreter::Sizeof() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6648,7 +6604,6 @@ template void Interpreter::CompareOp() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -6666,7 +6621,6 @@ template INT32 Interpreter::CompareOpRes(unsigned op1idx) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7154,7 +7108,6 @@ template void Interpreter::BrOnComparison() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7200,7 +7153,6 @@ void Interpreter::BrOnComparison() void Interpreter::LdFld(FieldDesc* fldIn) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7432,7 +7384,6 @@ void Interpreter::LdFld(FieldDesc* fldIn) void Interpreter::LdFldA() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7485,7 +7436,6 @@ void Interpreter::LdFldA() void Interpreter::StFld() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7642,7 +7592,6 @@ void Interpreter::StFld() bool Interpreter::StaticFldAddrWork(CORINFO_ACCESS_FLAGS accessFlgs, /*out (byref)*/void** pStaticFieldAddr, /*out*/InterpreterType* pit, /*out*/UINT* pFldSize, /*out*/bool* pManagedMem) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7713,7 +7662,6 @@ bool Interpreter::StaticFldAddrWork(CORINFO_ACCESS_FLAGS accessFlgs, /*out (byre void Interpreter::LdSFld() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7817,7 +7765,6 @@ void Interpreter::EnsureClassInit(MethodTable* pMT) void Interpreter::LdSFldA() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7850,7 +7797,6 @@ void Interpreter::LdSFldA() void Interpreter::StSFld() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7917,7 +7863,6 @@ template void Interpreter::LdElemWithType() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -7989,7 +7934,6 @@ template void Interpreter::StElemWithType() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8069,7 +8013,6 @@ template void Interpreter::LdElem() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8195,7 +8138,6 @@ void Interpreter::LdElem() void Interpreter::StElem() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8337,7 +8279,6 @@ void Interpreter::StElem() void Interpreter::InitBlk() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8388,7 +8329,6 @@ void Interpreter::InitBlk() void Interpreter::CpBlk() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8446,7 +8386,6 @@ void Interpreter::CpBlk() void Interpreter::Box() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8514,7 +8453,6 @@ void Interpreter::Box() void Interpreter::BoxStructRefAt(unsigned ind, CORINFO_CLASS_HANDLE valCls) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8551,7 +8489,6 @@ void Interpreter::BoxStructRefAt(unsigned ind, CORINFO_CLASS_HANDLE valCls) void Interpreter::Unbox() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8646,7 +8583,6 @@ void Interpreter::Unbox() void Interpreter::Throw() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8683,7 +8619,6 @@ void Interpreter::Throw() void Interpreter::Rethrow() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8696,7 +8631,6 @@ void Interpreter::Rethrow() void Interpreter::UnboxAny() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8823,7 +8757,6 @@ void Interpreter::UnboxAny() void Interpreter::LdLen() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -8852,14 +8785,12 @@ void Interpreter::DoCall(bool virtualCall) { #if INTERP_DYNAMIC_CONTRACTS CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; } CONTRACTL_END; #else // Dynamic contract occupies too much stack. - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; @@ -8915,14 +8846,12 @@ void Interpreter::DoCallWork(bool virtualCall, void* thisArg, CORINFO_RESOLVED_T { #if INTERP_DYNAMIC_CONTRACTS CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; } CONTRACTL_END; #else // Dynamic contract occupies too much stack. - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; @@ -10020,14 +9949,12 @@ void Interpreter::CallI() { #if INTERP_DYNAMIC_CONTRACTS CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; } CONTRACTL_END; #else // Dynamic contract occupies too much stack. - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; @@ -10418,7 +10345,6 @@ void Interpreter::CallI() bool Interpreter::IsDeadSimpleGetter(CEEInfo* info, MethodDesc* pMD, size_t* offsetOfLd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_ANY; @@ -10492,7 +10418,6 @@ bool Interpreter::IsDeadSimpleGetter(CEEInfo* info, MethodDesc* pMD, size_t* off void Interpreter::DoStringLength() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10532,7 +10457,6 @@ void Interpreter::DoStringLength() void Interpreter::DoStringGetChar() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10593,7 +10517,6 @@ void Interpreter::DoStringGetChar() void Interpreter::DoGetTypeFromHandle() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10621,7 +10544,6 @@ void Interpreter::DoGetTypeFromHandle() void Interpreter::DoByReferenceCtor() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10657,7 +10579,6 @@ void Interpreter::DoByReferenceCtor() void Interpreter::DoByReferenceValue() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10691,7 +10612,6 @@ void Interpreter::DoByReferenceValue() void Interpreter::DoSIMDHwAccelerated() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10710,7 +10630,6 @@ void Interpreter::DoSIMDHwAccelerated() void Interpreter::RecordConstrainedCall() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10795,7 +10714,6 @@ void Interpreter::VerificationError(const char* msg) void Interpreter::ThrowDivideByZero() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10807,7 +10725,6 @@ void Interpreter::ThrowDivideByZero() void Interpreter::ThrowSysArithException() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10821,7 +10738,6 @@ void Interpreter::ThrowSysArithException() void Interpreter::ThrowNullPointerException() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10833,7 +10749,6 @@ void Interpreter::ThrowNullPointerException() void Interpreter::ThrowOverflowException() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10845,7 +10760,6 @@ void Interpreter::ThrowOverflowException() void Interpreter::ThrowArrayBoundsException() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10857,7 +10771,6 @@ void Interpreter::ThrowArrayBoundsException() void Interpreter::ThrowInvalidCastException() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10869,7 +10782,6 @@ void Interpreter::ThrowInvalidCastException() void Interpreter::ThrowStackOverflow() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -10899,7 +10811,6 @@ Interpreter::AddrToMDMap* Interpreter::GetAddrToMdMap() { #if 0 CONTRACTL { - SO_TOLERANT; THROWS; GC_NOTRIGGER; } CONTRACTL_END; @@ -10916,7 +10827,6 @@ void Interpreter::RecordInterpreterStubForMethodDesc(CORINFO_METHOD_HANDLE md, v { #if 0 CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; @@ -10935,7 +10845,6 @@ void Interpreter::RecordInterpreterStubForMethodDesc(CORINFO_METHOD_HANDLE md, v MethodDesc* Interpreter::InterpretationStubToMethodInfo(PCODE addr) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; @@ -10961,7 +10870,6 @@ Interpreter::MethodHandleToInterpMethInfoPtrMap* Interpreter::GetMethodHandleToI { #if 0 CONTRACTL { - SO_TOLERANT; THROWS; GC_NOTRIGGER; } CONTRACTL_END; @@ -10978,7 +10886,6 @@ InterpreterMethodInfo* Interpreter::RecordInterpreterMethodInfoForMethodHandle(C { #if 0 CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; @@ -11013,7 +10920,6 @@ InterpreterMethodInfo* Interpreter::RecordInterpreterMethodInfoForMethodHandle(C InterpreterMethodInfo* Interpreter::MethodHandleToInterpreterMethInfoPtr(CORINFO_METHOD_HANDLE md) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_TRIGGERS; } CONTRACTL_END; @@ -11545,7 +11451,6 @@ static const char* CorInfoTypeNames[] = { const char* eeGetMethodFullName(CEEInfo* info, CORINFO_METHOD_HANDLE hnd, const char** clsName) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_ANY; diff --git a/src/vm/interpreter.hpp b/src/vm/interpreter.hpp index 49f419d..c87dc91 100644 --- a/src/vm/interpreter.hpp +++ b/src/vm/interpreter.hpp @@ -38,7 +38,6 @@ FILE* Interpreter::GetLogFile() inline void Interpreter::LdFromMemAddr(void* addr, InterpreterType tp) { CONTRACTL { - SO_TOLERANT; THROWS; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -113,7 +112,6 @@ inline void Interpreter::LdFromMemAddr(void* addr, InterpreterType tp) inline void Interpreter::LdLoc(int locNum) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -136,7 +134,6 @@ inline void Interpreter::LdLoc(int locNum) void Interpreter::StLoc(int locNum) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; @@ -217,7 +214,6 @@ void Interpreter::StLoc(int locNum) void Interpreter::StToLocalMemAddr(void* addr, InterpreterType tp) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_COOPERATIVE; diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp index d0e0b44..ea1d2da 100644 --- a/src/vm/jithelpers.cpp +++ b/src/vm/jithelpers.cpp @@ -39,7 +39,6 @@ #include "ecall.h" #include "generics.h" #include "typestring.h" -#include "stackprobe.h" #include "typedesc.h" #include "genericdict.h" #include "array.h" @@ -2180,7 +2179,6 @@ TypeHandle::CastResult ArrayIsInstanceOfNoGC(Object *pObject, TypeHandle toTypeH NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pObject)); PRECONDITION(pObject->GetMethodTable()->IsArray()); PRECONDITION(toTypeHnd.IsArray()); @@ -2233,7 +2231,6 @@ TypeHandle::CastResult ArrayObjSupportsBizarreInterfaceNoGC(Object *pObject, Met NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pObject)); PRECONDITION(pObject->GetMethodTable()->IsArray()); PRECONDITION(pInterfaceMT->IsInterface()); @@ -2265,7 +2262,6 @@ TypeHandle::CastResult STDCALL ObjIsInstanceOfNoGC(Object *pObject, TypeHandle t NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pObject)); } CONTRACTL_END; @@ -2915,7 +2911,6 @@ HCIMPL1_RAW(StringObject*, UnframedAllocateString, DWORD stringLength) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; STRINGREF result; @@ -4806,9 +4801,6 @@ HCIMPL1(void, IL_Throw, Object* obj) { FCALL_CONTRACT; - // This "violation" isn't a really a violation. - // We are calling a assembly helper that can't have an SO Tolerance contract - CONTRACT_VIOLATION(SOToleranceViolation); /* Make no assumptions about the current machine state */ ResetCurrentContext(); @@ -5180,7 +5172,6 @@ void DoJITFailFast () MODE_ANY; WRAPPER(GC_TRIGGERS); WRAPPER(THROWS); - SO_NOT_MAINLINE; // If process is coming down, SO probe is not going to do much good } CONTRACTL_END; LOG((LF_ALWAYS, LL_FATALERROR, "Unsafe buffer security check failure: Buffer overrun detected")); @@ -5390,7 +5381,6 @@ extern "C" void * _ReturnAddress(void); HCIMPL0(void, JIT_DbgIsJustMyCode) { FCALL_CONTRACT; - SO_NOT_MAINLINE_FUNCTION; // We need to get both the ip of the managed function this probe is in // (which will be our return address) and the frame pointer for that @@ -5716,7 +5706,6 @@ Thread * __stdcall JIT_InitPInvokeFrame(InlinedCallFrame *pFrame, PTR_VOID StubS { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_TRIGGERS; } CONTRACTL_END; @@ -5901,7 +5890,6 @@ void F_CALL_VA_CONV JIT_TailCall(PCODE copyArgs, PCODE target, ...) // Can't have a regular contract because we would never pop it // We only throw a stack overflow if needed, and we can't handle // a GC because the incoming parameters are totally unprotected. - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_COOPERATIVE @@ -6144,7 +6132,6 @@ void WriteJitHelperCountToSTRESSLOG() { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index d05a040..def08c6 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -40,7 +40,6 @@ #include "ecall.h" #include "generics.h" #include "typestring.h" -#include "stackprobe.h" #include "typedesc.h" #include "genericdict.h" #include "array.h" @@ -212,7 +211,6 @@ inline static void GetTypeContext(CORINFO_CONTEXT_HANDLE context, SigTypeContext { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; PRECONDITION(context != NULL); } @@ -374,7 +372,6 @@ void CheckForEquivalenceAndLoadTypeBeforeCodeIsRun(Module *pModule, mdToken toke { THROWS; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; @@ -566,7 +563,6 @@ CEEInfo::ConvToJitSig( CORINFO_CLASS_HANDLE CEEInfo::getTokenTypeAsHandle (CORINFO_RESOLVED_TOKEN * pResolvedToken) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -605,7 +601,6 @@ size_t CEEInfo::findNameOfToken ( size_t FQNameCapacity) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -634,7 +629,6 @@ size_t CEEInfo::findNameOfToken ( CorInfoCanSkipVerificationResult CEEInfo::canSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -731,7 +725,6 @@ CorInfoCanSkipVerificationResult CEEInfo::canSkipVerification( CORINFO_MODULE_HANDLE moduleHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -747,7 +740,6 @@ BOOL CEEInfo::isValidToken ( mdToken metaTOK) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -780,7 +772,6 @@ BOOL CEEInfo::isValidStringRef ( mdToken metaTOK) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -895,7 +886,6 @@ size_t CEEInfo::findNameOfToken (Module* module, CorInfoHelpFunc CEEInfo::getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -951,7 +941,6 @@ static DECLSPEC_NORETURN void ThrowBadTokenException(CORINFO_RESOLVED_TOKEN * pR void CEEInfo::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -1236,7 +1225,6 @@ bool isValidTokenForTryResolveToken(CEEInfo* info, CORINFO_RESOLVED_TOKEN* resol CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1286,7 +1274,6 @@ LONG TryResolveTokenFilter(struct _EXCEPTION_POINTERS* exceptionPointers, void* CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1309,7 +1296,6 @@ LONG TryResolveTokenFilter(struct _EXCEPTION_POINTERS* exceptionPointers, void* bool CEEInfo::tryResolveToken(CORINFO_RESOLVED_TOKEN* resolvedToken) { // No dynamic contract here because SEH is used - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_PREEMPTIVE; @@ -1512,7 +1498,6 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, ) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -1764,7 +1749,6 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, bool CEEInfo::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -1788,7 +1772,6 @@ CEEInfo::findCallSiteSig( CORINFO_SIG_INFO * sigRet) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -1870,7 +1853,6 @@ CEEInfo::findSig( CORINFO_SIG_INFO * sigRet) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -1918,7 +1900,6 @@ CEEInfo::getClassSize( CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -1946,7 +1927,6 @@ CEEInfo::getHeapClassSize( CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -1978,7 +1958,6 @@ CEEInfo::getHeapClassSize( BOOL CEEInfo::canAllocateOnStack(CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -2009,7 +1988,6 @@ BOOL CEEInfo::canAllocateOnStack(CORINFO_CLASS_HANDLE clsHnd) unsigned CEEInfo::getClassAlignmentRequirement(CORINFO_CLASS_HANDLE type, BOOL fDoubleAlignHint) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -2103,7 +2081,6 @@ CORINFO_FIELD_HANDLE CEEInfo::getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -2128,7 +2105,6 @@ mdMethodDef CEEInfo::getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -2160,7 +2136,6 @@ BOOL CEEInfo::checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, BOOL fOptional) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -2240,7 +2215,6 @@ static unsigned ComputeGCLayout(MethodTable * pMT, BYTE* gcPtrs) unsigned CEEInfo::getClassGClayout (CORINFO_CLASS_HANDLE clsHnd, BYTE* gcPtrs) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -2333,7 +2307,6 @@ bool CEEInfo::getSystemVAmd64PassStructInRegisterDescriptor( /*OUT*/ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -2428,7 +2401,6 @@ bool CEEInfo::getSystemVAmd64PassStructInRegisterDescriptor( unsigned CEEInfo::getClassNumInstanceFields (CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -2459,7 +2431,6 @@ unsigned CEEInfo::getClassNumInstanceFields (CORINFO_CLASS_HANDLE clsHnd) CorInfoType CEEInfo::asCorInfoType (CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -2481,7 +2452,6 @@ CorInfoType CEEInfo::asCorInfoType (CORINFO_CLASS_HANDLE clsHnd) CORINFO_LOOKUP_KIND CEEInfo::getLocationOfThisType(CORINFO_METHOD_HANDLE context) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -2536,7 +2506,6 @@ CORINFO_METHOD_HANDLE CEEInfo::GetDelegateCtor( DelegateCtorArgs *pCtorData) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -2577,7 +2546,6 @@ CORINFO_METHOD_HANDLE CEEInfo::GetDelegateCtor( void CEEInfo::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -2608,7 +2576,6 @@ void CEEInfo::embedGenericHandle( CORINFO_GENERICHANDLE_RESULT *pResult) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -3565,7 +3532,6 @@ NoSpecialCase: const char* CEEInfo::getClassName (CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -3603,7 +3569,6 @@ const char* CEEInfo::getClassName (CORINFO_CLASS_HANDLE clsHnd) const char* CEEInfo::getHelperName (CorInfoHelpFunc ftnNum) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3639,7 +3604,6 @@ int CEEInfo::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf, BOOL fAssembly) { CONTRACTL { - SO_TOLERANT; MODE_PREEMPTIVE; THROWS; GC_TRIGGERS; @@ -3674,7 +3638,6 @@ int CEEInfo::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf, CORINFO_MODULE_HANDLE CEEInfo::getClassModule(CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3697,7 +3660,6 @@ CORINFO_MODULE_HANDLE CEEInfo::getClassModule(CORINFO_CLASS_HANDLE clsHnd) CORINFO_ASSEMBLY_HANDLE CEEInfo::getModuleAssembly(CORINFO_MODULE_HANDLE modHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3718,7 +3680,6 @@ CORINFO_ASSEMBLY_HANDLE CEEInfo::getModuleAssembly(CORINFO_MODULE_HANDLE modHnd) const char* CEEInfo::getAssemblyName(CORINFO_ASSEMBLY_HANDLE asmHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -3737,7 +3698,6 @@ const char* CEEInfo::getAssemblyName(CORINFO_ASSEMBLY_HANDLE asmHnd) void* CEEInfo::LongLifetimeMalloc(size_t sz) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3756,7 +3716,6 @@ void* CEEInfo::LongLifetimeMalloc(size_t sz) void CEEInfo::LongLifetimeFree(void* obj) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3771,7 +3730,6 @@ void CEEInfo::LongLifetimeFree(void* obj) size_t CEEInfo::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE clsHnd, CORINFO_MODULE_HANDLE *pModuleHandle, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3804,7 +3762,6 @@ size_t CEEInfo::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE clsHnd, CORINFO_ BOOL CEEInfo::isValueClass(CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3836,7 +3793,6 @@ BOOL CEEInfo::isValueClass(CORINFO_CLASS_HANDLE clsHnd) CorInfoInlineTypeCheck CEEInfo::canInlineTypeCheck(CORINFO_CLASS_HANDLE clsHnd, CorInfoInlineTypeCheckSource source) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3871,7 +3827,6 @@ CorInfoInlineTypeCheck CEEInfo::canInlineTypeCheck(CORINFO_CLASS_HANDLE clsHnd, BOOL CEEInfo::canInlineTypeCheckWithObjectVTable (CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -3928,7 +3883,6 @@ BOOL CEEInfo::canInlineTypeCheckWithObjectVTable (CORINFO_CLASS_HANDLE clsHnd) DWORD CEEInfo::getClassAttribs (CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -3952,7 +3906,6 @@ DWORD CEEInfo::getClassAttribs (CORINFO_CLASS_HANDLE clsHnd) BOOL CEEInfo::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4092,7 +4045,6 @@ CorInfoInitClassResult CEEInfo::initClass( BOOL speculative) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4279,7 +4231,6 @@ exit: ; void CEEInfo::classMustBeLoadedBeforeCodeIsRun (CORINFO_CLASS_HANDLE typeToLoadHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -4299,7 +4250,6 @@ void CEEInfo::classMustBeLoadedBeforeCodeIsRun (CORINFO_CLASS_HANDLE typeToLoadH void CEEInfo::methodMustBeLoadedBeforeCodeIsRun (CORINFO_METHOD_HANDLE methHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -4319,7 +4269,6 @@ void CEEInfo::methodMustBeLoadedBeforeCodeIsRun (CORINFO_METHOD_HANDLE methHnd) CORINFO_METHOD_HANDLE CEEInfo::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE methHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4342,7 +4291,6 @@ CORINFO_METHOD_HANDLE CEEInfo::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE m CORINFO_CLASS_HANDLE CEEInfo::getBuiltinClass(CorInfoClassId classId) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4395,7 +4343,6 @@ CorInfoType CEEInfo::getTypeForPrimitiveValueClass( CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4482,7 +4429,6 @@ CorInfoType CEEInfo::getTypeForPrimitiveNumericClass( CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -4543,7 +4489,6 @@ CorInfoType CEEInfo::getTypeForPrimitiveNumericClass( void CEEInfo::getGSCookie(GSCookie * pCookieVal, GSCookie ** ppCookieVal) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4573,7 +4518,6 @@ BOOL CEEInfo::canCast( CORINFO_CLASS_HANDLE parent) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4597,7 +4541,6 @@ BOOL CEEInfo::areTypesEquivalent( CORINFO_CLASS_HANDLE cls2) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4622,7 +4565,6 @@ TypeCompareState CEEInfo::compareTypesForCast( CORINFO_CLASS_HANDLE toClass) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4714,7 +4656,6 @@ TypeCompareState CEEInfo::compareTypesForEquality( CORINFO_CLASS_HANDLE cls2) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4771,7 +4712,6 @@ CORINFO_CLASS_HANDLE CEEInfo::mergeClasses( CORINFO_CLASS_HANDLE cls2) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4843,7 +4783,6 @@ CORINFO_CLASS_HANDLE CEEInfo::getParentType( CORINFO_CLASS_HANDLE cls) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4891,7 +4830,6 @@ CorInfoType CEEInfo::getChildType ( ) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4940,7 +4878,6 @@ CorInfoType CEEInfo::getChildType ( BOOL CEEInfo::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4963,7 +4900,6 @@ BOOL CEEInfo::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls) BOOL CEEInfo::isSDArray(CORINFO_CLASS_HANDLE cls) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -4995,7 +4931,6 @@ BOOL CEEInfo::isSDArray(CORINFO_CLASS_HANDLE cls) unsigned CEEInfo::getArrayRank(CORINFO_CLASS_HANDLE cls) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -5033,7 +4968,6 @@ void * CEEInfo::getArrayInitializationData( ) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -5076,7 +5010,6 @@ CorInfoIsAccessAllowedResult CEEInfo::canAccessClass( ) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -5178,7 +5111,6 @@ void CEEInfo::getCallInfo( CORINFO_CALL_INFO *pResult /*out */) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -5851,7 +5783,6 @@ BOOL CEEInfo::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, void CEEInfo::ThrowExceptionForHelper(const CORINFO_HELPER_DESC * throwHelper) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -5896,7 +5827,6 @@ void CEEInfo::ThrowExceptionForHelper(const CORINFO_HELPER_DESC * throwHelper) BOOL CEEInfo::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -5921,7 +5851,6 @@ unsigned CEEInfo::getClassDomainID (CORINFO_CLASS_HANDLE clsHnd, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -5993,7 +5922,6 @@ bool __stdcall TrackAllocationsEnabled() CorInfoHelpFunc CEEInfo::getNewHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool * pHasSideEffects) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6132,7 +6060,6 @@ CorInfoHelpFunc CEEInfo::getNewHelperStatic(MethodTable * pMT, bool * pHasSideEf CorInfoHelpFunc CEEInfo::getNewArrHelper (CORINFO_CLASS_HANDLE arrayClsHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6220,7 +6147,6 @@ CorInfoHelpFunc CEEInfo::getNewArrHelperStatic(TypeHandle clsHnd) CorInfoHelpFunc CEEInfo::getCastingHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool fThrowing) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6339,7 +6265,6 @@ CorInfoHelpFunc CEEInfo::getCastingHelperStatic(TypeHandle clsHnd, bool fThrowin CorInfoHelpFunc CEEInfo::getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -6422,7 +6347,6 @@ CORINFO_CLASS_HANDLE CEEInfo::getTypeForBox(CORINFO_CLASS_HANDLE cls) CorInfoHelpFunc CEEInfo::getBoxHelper(CORINFO_CLASS_HANDLE clsHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6459,7 +6383,6 @@ CorInfoHelpFunc CEEInfo::getBoxHelper(CORINFO_CLASS_HANDLE clsHnd) CorInfoHelpFunc CEEInfo::getSecurityPrologHelper(CORINFO_METHOD_HANDLE ftn) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6495,7 +6418,6 @@ CORINFO_VARARGS_HANDLE CEEInfo::getVarArgsHandle(CORINFO_SIG_INFO *sig, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6527,7 +6449,6 @@ bool CEEInfo::canGetVarArgsHandle(CORINFO_SIG_INFO *sig) unsigned CEEInfo::getMethodHash (CORINFO_METHOD_HANDLE ftnHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6550,7 +6471,6 @@ unsigned CEEInfo::getMethodHash (CORINFO_METHOD_HANDLE ftnHnd) const char* CEEInfo::getMethodName (CORINFO_METHOD_HANDLE ftnHnd, const char** scopeName) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6629,7 +6549,6 @@ const char* CEEInfo::getMethodName (CORINFO_METHOD_HANDLE ftnHnd, const char** s const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, const char** className, const char** namespaceName, const char **enclosingClassName) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6684,7 +6603,6 @@ const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, con const char* CEEInfo::getClassNameFromMetadata(CORINFO_CLASS_HANDLE cls, const char** namespaceName) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6715,7 +6633,6 @@ const char* CEEInfo::getClassNameFromMetadata(CORINFO_CLASS_HANDLE cls, const ch CORINFO_CLASS_HANDLE CEEInfo::getTypeInstantiationArgument(CORINFO_CLASS_HANDLE cls, unsigned index) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6739,7 +6656,6 @@ CORINFO_CLASS_HANDLE CEEInfo::getTypeInstantiationArgument(CORINFO_CLASS_HANDLE DWORD CEEInfo::getMethodAttribs (CORINFO_METHOD_HANDLE ftn) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -6879,7 +6795,6 @@ void CEEInfo::setMethodAttribs ( CorInfoMethodRuntimeFlags attribs) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -7715,7 +7630,6 @@ CEEInfo::getMethodInfo( CORINFO_METHOD_INFO * methInfo) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -7818,7 +7732,6 @@ CorInfoInline CEEInfo::canInline (CORINFO_METHOD_HANDLE hCaller, DWORD* pRestrictions) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -8065,7 +7978,6 @@ void CEEInfo::reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd, { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_SO_TOLERANT; JIT_TO_EE_TRANSITION(); @@ -8209,7 +8121,6 @@ void CEEInfo::initConstraintsForVerification(CORINFO_METHOD_HANDLE hMethod, BOOL *pfHasCircularMethodConstraints) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -8242,7 +8153,6 @@ CorInfoInstantiationVerification CEEInfo::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE hMethod) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -8287,7 +8197,6 @@ bool CEEInfo::canTailCall (CORINFO_METHOD_HANDLE hCaller, bool fIsTailPrefix) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -8390,7 +8299,6 @@ void CEEInfo::reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd, { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_SO_TOLERANT; JIT_TO_EE_TRANSITION(); @@ -8543,7 +8451,6 @@ void CEEInfo::getEHinfo( CORINFO_EH_CLAUSE* clause) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -8575,7 +8482,6 @@ CEEInfo::getMethodSig( CORINFO_CLASS_HANDLE owner) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -8651,7 +8557,6 @@ CEEInfo::getMethodClass( CORINFO_METHOD_HANDLE methodHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -8693,7 +8598,6 @@ CEEInfo::getMethodClass( CORINFO_MODULE_HANDLE CEEInfo::getMethodModule (CORINFO_METHOD_HANDLE methodHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -8726,7 +8630,6 @@ CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd, bool * pMustExpand) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -8802,7 +8705,6 @@ CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd, bool CEEInfo::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -8841,7 +8743,6 @@ void CEEInfo::getMethodVTableOffset (CORINFO_METHOD_HANDLE methodHnd, bool * isRelative) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -9030,7 +8931,6 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethod(CORINFO_METHOD_HANDLE method CORINFO_CONTEXT_HANDLE ownerType) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9053,7 +8953,6 @@ CORINFO_METHOD_HANDLE CEEInfo::getUnboxedEntry( bool* requiresInstMethodTableArg) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9098,7 +8997,6 @@ void CEEInfo::expandRawHandleIntrinsic( CORINFO_CLASS_HANDLE CEEInfo::getDefaultEqualityComparerClass(CORINFO_CLASS_HANDLE elemType) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9118,7 +9016,6 @@ CORINFO_CLASS_HANDLE CEEInfo::getDefaultEqualityComparerClass(CORINFO_CLASS_HAND CORINFO_CLASS_HANDLE CEEInfo::getDefaultEqualityComparerClassHelper(CORINFO_CLASS_HANDLE elemType) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9202,7 +9099,6 @@ void CEEInfo::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftnHnd, CORINFO_ACCESS_FLAGS accessFlags) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9261,7 +9157,6 @@ void CEEInfo::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP * pResult) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9292,7 +9187,6 @@ void CEEInfo::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, const char* CEEInfo::getFieldName (CORINFO_FIELD_HANDLE fieldHnd, const char** scopeName) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9334,7 +9228,6 @@ const char* CEEInfo::getFieldName (CORINFO_FIELD_HANDLE fieldHnd, const char** s CORINFO_CLASS_HANDLE CEEInfo::getFieldClass (CORINFO_FIELD_HANDLE fieldHnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -9364,7 +9257,6 @@ CorInfoType CEEInfo::getFieldType (CORINFO_FIELD_HANDLE fieldHnd, CORINFO_CLASS_HANDLE owner) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9443,7 +9335,6 @@ CorInfoType CEEInfo::getFieldTypeInternal (CORINFO_FIELD_HANDLE fieldHnd, unsigned CEEInfo::getFieldOffset (CORINFO_FIELD_HANDLE fieldHnd) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9481,7 +9372,6 @@ unsigned CEEInfo::getFieldOffset (CORINFO_FIELD_HANDLE fieldHnd) bool CEEInfo::isWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9517,7 +9407,6 @@ bool CEEInfo::isWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field) DWORD CEEInfo::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE fieldHnd, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9546,7 +9435,6 @@ DWORD CEEInfo::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE fieldHnd, void ** void *CEEInfo::allocateArray(ULONG cBytes) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9566,7 +9454,6 @@ void *CEEInfo::allocateArray(ULONG cBytes) void CEEInfo::freeArray(void *array) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9584,7 +9471,6 @@ void CEEInfo::getBoundaries(CORINFO_METHOD_HANDLE ftn, ICorDebugInfo::BoundaryTypes *implicitBoundaries) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9613,7 +9499,6 @@ void CEEInfo::getVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDebugInfo:: bool *extendOthers) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9643,7 +9528,6 @@ void CEEInfo::getVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDebugInfo:: CORINFO_ARG_LIST_HANDLE CEEInfo::getArgNext(CORINFO_ARG_LIST_HANDLE args) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9673,7 +9557,6 @@ CorInfoTypeWithMod CEEInfo::getArgType ( ) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9770,7 +9653,6 @@ CORINFO_CLASS_HANDLE CEEInfo::getArgClass ( ) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9816,7 +9698,6 @@ CORINFO_CLASS_HANDLE CEEInfo::getArgClass ( CorInfoType CEEInfo::getHFAType(CORINFO_CLASS_HANDLE hClass) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9841,7 +9722,6 @@ CorInfoType CEEInfo::getHFAType(CORINFO_CLASS_HANDLE hClass) CorInfoUnmanagedCallConv CEEInfo::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9903,7 +9783,6 @@ BOOL NDirectMethodDesc::ComputeMarshalingRequired() BOOL CEEInfo::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -9981,7 +9860,6 @@ BOOL CEEInfo::satisfiesMethodConstraints( CORINFO_METHOD_HANDLE method) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -10017,7 +9895,6 @@ BOOL CEEInfo::isCompatibleDelegate( BOOL* pfIsOpenDelegate) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -10058,7 +9935,6 @@ void* CEEInfo::getPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -10082,7 +9958,6 @@ void* CEEInfo::getAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10125,7 +10000,6 @@ CORINFO_JUST_MY_CODE_HANDLE CEEInfo::getJustMyCodeHandle( CORINFO_JUST_MY_CODE_HANDLE**ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10175,7 +10049,6 @@ void InlinedCallFrame::GetEEInfo(CORINFO_EE_INFO::InlinedCallFrameInfo *pInfo) void CEEInfo::getEEInfo(CORINFO_EE_INFO *pEEInfoOut) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -10242,7 +10115,6 @@ void CEEInfo::getEEInfo(CORINFO_EE_INFO *pEEInfoOut) LPCWSTR CEEInfo::getJitTimeLogFilename() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -10263,7 +10135,6 @@ LPCWSTR CEEInfo::getJitTimeLogFilename() DWORD CEEInfo::getThreadTLSIndex(void **ppIndirection) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -10280,7 +10151,6 @@ DWORD CEEInfo::getThreadTLSIndex(void **ppIndirection) const void * CEEInfo::getInlinedCallFrameVptr(void **ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10307,7 +10177,6 @@ const void * CEEInfo::getInlinedCallFrameVptr(void **ppIndirection) LONG * CEEInfo::getAddrOfCaptureThreadGlobal(void **ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10332,7 +10201,6 @@ LONG * CEEInfo::getAddrOfCaptureThreadGlobal(void **ppIndirection) HRESULT CEEInfo::GetErrorHRESULT(struct _EXCEPTION_POINTERS *pExceptionPointers) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_TRIGGERS; MODE_ANY; @@ -10363,7 +10231,6 @@ HRESULT CEEInfo::GetErrorHRESULT(struct _EXCEPTION_POINTERS *pExceptionPointers) ULONG CEEInfo::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -10404,7 +10271,6 @@ ULONG CEEInfo::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG LONG EEFilterException(struct _EXCEPTION_POINTERS *pExceptionPointers, void *unused) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; @@ -10413,8 +10279,6 @@ LONG EEFilterException(struct _EXCEPTION_POINTERS *pExceptionPointers, void *unu JIT_TO_EE_TRANSITION_LEAF(); - VALIDATE_BACKOUT_STACK_CONSUMPTION; - unsigned code = pExceptionPointers->ExceptionRecord->ExceptionCode; #ifdef _DEBUG @@ -10499,7 +10363,6 @@ int CEEInfo::FilterException(struct _EXCEPTION_POINTERS *pExceptionPointers) void CEEInfo::HandleException(struct _EXCEPTION_POINTERS *pExceptionPointers) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; @@ -10581,7 +10444,6 @@ void CEEInfo::ThrowExceptionForJitResult( HRESULT result) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -10600,7 +10462,6 @@ CORINFO_MODULE_HANDLE CEEInfo::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10622,7 +10483,6 @@ CORINFO_CLASS_HANDLE CEEInfo::embedClassHandle(CORINFO_CLASS_HANDLE handle, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10643,7 +10503,6 @@ CORINFO_FIELD_HANDLE CEEInfo::embedFieldHandle(CORINFO_FIELD_HANDLE handle, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10664,7 +10523,6 @@ CORINFO_METHOD_HANDLE CEEInfo::embedMethodHandle(CORINFO_METHOD_HANDLE handle, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10693,7 +10551,6 @@ void CEEInfo::setJitFlags(const CORJIT_FLAGS& jitFlags) DWORD CEEInfo::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10736,7 +10593,6 @@ bool CEEInfo::runWithErrorTrap(void (*function)(void*), void* param) // No dynamic contract here because SEH is used STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_PREEMPTIVE; // NOTE: the lack of JIT/EE transition markers in this method is intentional. Any @@ -10788,7 +10644,6 @@ bool CEEInfo::runWithErrorTrap(void (*function)(void*), void* param) IEEMemoryManager* CEEInfo::getMemoryManager() { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -10808,7 +10663,6 @@ IEEMemoryManager* CEEInfo::getMemoryManager() /*********************************************************************/ int CEEInfo::doAssert(const char* szFile, int iLine, const char* szExpr) { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_PREEMPTIVE; @@ -10839,7 +10693,6 @@ int CEEInfo::doAssert(const char* szFile, int iLine, const char* szExpr) void CEEInfo::reportFatalError(CorJitResult result) { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_PREEMPTIVE; @@ -10854,7 +10707,6 @@ void CEEInfo::reportFatalError(CorJitResult result) BOOL CEEInfo::logMsg(unsigned level, const char* fmt, va_list args) { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_PREEMPTIVE; @@ -10891,7 +10743,6 @@ void* CEEJitInfo::getHelperFtn(CorInfoHelpFunc ftnNum, /* IN */ void ** ppIndirection) /* OUT */ { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -11018,7 +10869,6 @@ void CEEJitInfo::GetProfilingHandle(BOOL *pbHookFunction, BOOL *pbIndirectedHandles) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11092,7 +10942,6 @@ void CEEJitInfo::setBoundaries(CORINFO_METHOD_HANDLE ftn, ULONG32 cMap, ICorDebugInfo::OffsetMapping *pMap) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11111,7 +10960,6 @@ void CEEJitInfo::setBoundaries(CORINFO_METHOD_HANDLE ftn, ULONG32 cMap, void CEEJitInfo::setVars(CORINFO_METHOD_HANDLE ftn, ULONG32 cVars, ICorDebugInfo::NativeVarInfo *vars) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11130,7 +10978,6 @@ void CEEJitInfo::setVars(CORINFO_METHOD_HANDLE ftn, ULONG32 cVars, ICorDebugInfo void CEEJitInfo::CompressDebugInfo() { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11206,7 +11053,6 @@ void CEEJitInfo::reserveUnwindInfo(BOOL isFunclet, BOOL isColdCode, ULONG unwind { #ifdef WIN64EXCEPTIONS CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -11268,7 +11114,6 @@ void CEEJitInfo::allocUnwindInfo ( { #ifdef WIN64EXCEPTIONS CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11436,7 +11281,6 @@ void CEEJitInfo::recordRelocation(void * location, INT32 addlDelta) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11632,7 +11476,6 @@ void CEEJitInfo::recordRelocation(void * location, WORD CEEJitInfo::getRelocTypeHint(void * target) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11654,7 +11497,6 @@ WORD CEEJitInfo::getRelocTypeHint(void * target) void CEEJitInfo::getModuleNativeEntryPointRange(void** pStart, void** pEnd) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; @@ -11702,7 +11544,6 @@ InfoAccessType CEEJitInfo::constructStringLiteral(CORINFO_MODULE_HANDLE scopeHnd void **ppValue) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11732,7 +11573,6 @@ InfoAccessType CEEJitInfo::constructStringLiteral(CORINFO_MODULE_HANDLE scopeHnd InfoAccessType CEEJitInfo::emptyStringLiteral(void ** ppValue) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11758,7 +11598,6 @@ void* CEEJitInfo::getFieldAddress(CORINFO_FIELD_HANDLE fieldHnd, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11813,7 +11652,6 @@ CORINFO_CLASS_HANDLE CEEJitInfo::getStaticFieldCurrentClass(CORINFO_FIELD_HANDLE bool* pIsSpeculative) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11911,7 +11749,6 @@ void* CEEJitInfo::getMethodSync(CORINFO_METHOD_HANDLE ftnHnd, void **ppIndirection) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -11938,7 +11775,6 @@ HRESULT CEEJitInfo::allocBBProfileBuffer ( ) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -12005,7 +11841,6 @@ void CEEJitInfo::allocMem ( ) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -12106,7 +11941,6 @@ void CEEJitInfo::allocMem ( void * CEEJitInfo::allocGCInfo (size_t size) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -12144,7 +11978,6 @@ void CEEJitInfo::setEHcount ( unsigned cEH) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -12171,7 +12004,6 @@ void CEEJitInfo::setEHinfo ( const CORINFO_EH_CLAUSE* clause) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -12221,7 +12053,6 @@ void CEEJitInfo::getEHinfo( CORINFO_EH_CLAUSE* clause) /* OUT */ { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -12258,7 +12089,6 @@ static CorJitResult CompileMethodWithEtwWrapper(EEJitManager *jitMgr, STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_PREEMPTIVE; - STATIC_CONTRACT_SO_INTOLERANT; SString namespaceOrClassName, methodName, methodSignature; // Fire an ETW event to mark the beginning of JIT'ing @@ -12286,22 +12116,16 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr, STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_PREEMPTIVE; - STATIC_CONTRACT_SO_INTOLERANT; CorJitResult ret = CORJIT_SKIPPED; // Note that CORJIT_SKIPPED is an error exit status code - comp->setJitFlags(jitFlags); #ifdef FEATURE_STACK_SAMPLING - // SO_INTOLERANT due to init affecting global state. static ConfigDWORD s_stackSamplingEnabled; bool samplingEnabled = (s_stackSamplingEnabled.val(CLRConfig::UNSUPPORTED_StackSamplingEnabled) != 0); #endif - BEGIN_SO_TOLERANT_CODE(GetThread()); - - #if defined(ALLOW_SXS_JIT) && !defined(CROSSGEN_COMPILE) if (FAILED(ret) && jitMgr->m_alternateJit #ifdef FEATURE_STACK_SAMPLING @@ -12420,8 +12244,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr, } #endif - END_SO_TOLERANT_CODE; - return ret; } @@ -12716,7 +12538,6 @@ void ThrowExceptionForJit(HRESULT res) { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -13891,7 +13712,6 @@ void* CEEInfo::getTailCallCopyArgsThunk(CORINFO_SIG_INFO *pSig, CorInfoHelperTailCallSpecialHandling flags) { CONTRACTL { - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -14003,7 +13823,6 @@ void* CEEInfo::getFieldAddress(CORINFO_FIELD_HANDLE fieldHnd, void **ppIndirection) { CONTRACTL{ - SO_TOLERANT; THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; @@ -14172,7 +13991,6 @@ void EECodeInfo::Init(PCODE codeAddress) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; Init(codeAddress, ExecutionManager::GetScanFlags()); @@ -14183,7 +14001,6 @@ void EECodeInfo::Init(PCODE codeAddress, ExecutionManager::ScanFlag scanFlag) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; m_codeAddress = codeAddress; diff --git a/src/vm/jitinterface.h b/src/vm/jitinterface.h index 82bf31b..c47123d 100644 --- a/src/vm/jitinterface.h +++ b/src/vm/jitinterface.h @@ -1333,7 +1333,6 @@ public: void ResetForJitRetry() { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; diff --git a/src/vm/listlock.h b/src/vm/listlock.h index db953c8..8b35670 100644 --- a/src/vm/listlock.h +++ b/src/vm/listlock.h @@ -427,7 +427,6 @@ class ListLockBase BOOL HasLock() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return(m_Crst.OwnedByCurrentThread()); } #endif diff --git a/src/vm/loaderallocator.cpp b/src/vm/loaderallocator.cpp index 21c6f27..a54b093 100644 --- a/src/vm/loaderallocator.cpp +++ b/src/vm/loaderallocator.cpp @@ -202,7 +202,6 @@ BOOL LoaderAllocator::CheckAddReference_Unlocked(LoaderAllocator *pOtherLA) CONTRACTL { THROWS; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -237,7 +236,6 @@ BOOL LoaderAllocator::EnsureReference(LoaderAllocator *pOtherLA) CONTRACTL { THROWS; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -263,7 +261,6 @@ BOOL LoaderAllocator::EnsureInstantiation(Module *pDefiningModule, Instantiation CONTRACTL { THROWS; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -363,7 +360,6 @@ LoaderAllocator * LoaderAllocator::GCLoaderAllocators_RemoveAssemblies(AppDomain THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_INTOLERANT; } CONTRACTL_END; // List of LoaderAllocators being deleted @@ -530,7 +526,6 @@ void LoaderAllocator::GCLoaderAllocators(LoaderAllocator* pOriginalLoaderAllocat THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -877,7 +872,6 @@ OBJECTREF LoaderAllocator::GetHandleValue(LOADERHANDLE handle) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -1327,7 +1321,6 @@ void LoaderAllocator::Terminate() NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; if (m_fTerminated) @@ -1566,7 +1559,6 @@ DispatchToken LoaderAllocator::TryLookupDispatchToken(UINT32 typeId, UINT32 slot NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; #ifdef FAT_DISPATCH_TOKENS @@ -1580,14 +1572,12 @@ DispatchToken LoaderAllocator::TryLookupDispatchToken(UINT32 typeId, UINT32 slot // exceptions and just return an invalid token, since this is EX_TRY { - BEGIN_SO_INTOLERANT_CODE(GetThread()); SimpleReadLockHolder rlock(m_pFatTokenSetLock); if (m_pFatTokenSet != NULL) { DispatchTokenFat key(typeId, slotNumber); pFat = m_pFatTokenSet->Lookup(&key); } - END_SO_INTOLERANT_CODE; } EX_CATCH { @@ -1951,7 +1941,6 @@ void AssemblyLoaderAllocator::ReleaseManagedAssemblyLoadContext() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; diff --git a/src/vm/managedmdimport.cpp b/src/vm/managedmdimport.cpp index e780275..e709575 100644 --- a/src/vm/managedmdimport.cpp +++ b/src/vm/managedmdimport.cpp @@ -92,8 +92,6 @@ MDImpl4(Object *, MetaDataImport::GetDefaultValue, mdToken tk, INT64* pDefaultVa HRESULT hr = S_OK; Object *pRetVal = NULL; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException)); - IMDInternalImport *_pScope = pScope; MDDefaultValue value; @@ -123,8 +121,6 @@ MDImpl4(Object *, MetaDataImport::GetDefaultValue, mdToken tk, INT64* pDefaultVa *pCorElementType = (UINT32)value.m_bType; *pLength = (INT32)value.m_cbSize; ErrExit: - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrow(kBadImageFormatException); @@ -141,12 +137,9 @@ MDImpl3(void, MetaDataImport::GetCustomAttributeProps, mdCustomAttribute cv, mdT HRESULT hr = S_OK; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); IfFailGo(_pScope->GetCustomAttributeProps(cv, ptkType)); IfFailGo(_pScope->GetCustomAttributeAsBlob(cv, (const void **)&ppBlob->m_array, (ULONG *)&ppBlob->m_count)); ErrExit: - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -249,7 +242,6 @@ MDImpl3(void, MetaDataImport::GetClassLayout, mdTypeDef td, DWORD* pdwPackSize, HRESULT hr = S_OK; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); { IMDInternalImport *_pScope = pScope; @@ -276,8 +268,6 @@ MDImpl3(void, MetaDataImport::GetClassLayout, mdTypeDef td, DWORD* pdwPackSize, } } ErrExit: - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -294,7 +284,6 @@ MDImpl3(FC_BOOL_RET, MetaDataImport::GetFieldOffset, mdTypeDef td, mdFieldDef ta MD_CLASS_LAYOUT layout; BOOL retVal = FALSE; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException)); IfFailGo(_pScope->GetClassLayoutInit(td, &layout)); ULONG cFieldOffset; @@ -314,8 +303,6 @@ MDImpl3(FC_BOOL_RET, MetaDataImport::GetFieldOffset, mdTypeDef td, mdFieldDef ta } } ErrExit: - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrow(kBadImageFormatException); @@ -332,10 +319,7 @@ MDImpl3(void, MetaDataImport::GetUserString, mdToken tk, LPCSTR* pszName, ULONG* IMDInternalImport *_pScope = pScope; BOOL bHasExtendedChars; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetUserString(tk, pCount, &bHasExtendedChars, (LPCWSTR *)pszName); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -350,7 +334,6 @@ MDImpl2(void, MetaDataImport::GetName, mdToken tk, LPCSTR* pszName) HRESULT hr = S_OK; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); if (TypeFromToken(tk) == mdtMethodDef) { hr = _pScope->GetNameOfMethodDef(tk, pszName); @@ -386,7 +369,6 @@ MDImpl2(void, MetaDataImport::GetName, mdToken tk, LPCSTR* pszName) { hr = E_FAIL; } - END_SO_INTOLERANT_CODE; if (FAILED(hr)) { @@ -403,9 +385,7 @@ MDImpl2(void, MetaDataImport::GetNamespace, mdToken tk, LPCSTR* pszName) IMDInternalImport *_pScope = pScope; LPCSTR szName = NULL; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetNameOfTypeDef(tk, &szName, pszName); - END_SO_INTOLERANT_CODE; if (FAILED(hr)) { @@ -422,10 +402,7 @@ MDImpl2(void, MetaDataImport::GetGenericParamProps, mdToken tk, DWORD* pAttribut HRESULT hr; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetGenericParamProps(tk, NULL, pAttributes, NULL, NULL, NULL); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -440,10 +417,7 @@ MDImpl3(void, MetaDataImport::GetEventProps, mdToken tk, LPCSTR* pszName, INT32 HRESULT hr; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetEventProps(tk, pszName, (DWORD*)pdwEventFlags, NULL); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -459,7 +433,6 @@ MDImpl4(void, MetaDataImport::GetPinvokeMap, mdToken tk, DWORD* pMappingFlags, L IMDInternalImport *_pScope = pScope; mdModule tkModule; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetPinvokeMap(tk, pMappingFlags, pszImportName, &tkModule); if (FAILED(hr)) { @@ -472,7 +445,6 @@ MDImpl4(void, MetaDataImport::GetPinvokeMap, mdToken tk, DWORD* pMappingFlags, L { hr = _pScope->GetModuleRefProps(tkModule, pszImportDll); } - END_SO_INTOLERANT_CODE; if (FAILED(hr)) { @@ -489,8 +461,6 @@ MDImpl3(void, MetaDataImport::GetParamDefProps, mdToken tk, INT32* pSequence, IN IMDInternalImport *_pScope = pScope; USHORT usSequence = 0; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); - // Is this a valid token? if (_pScope->IsValidToken((mdParamDef)tk)) { @@ -503,7 +473,6 @@ MDImpl3(void, MetaDataImport::GetParamDefProps, mdToken tk, INT32* pSequence, IN hr = COR_E_BADIMAGEFORMAT; } *pSequence = (INT32) usSequence; - END_SO_INTOLERANT_CODE; if (FAILED(hr)) { @@ -519,10 +488,7 @@ MDImpl2(void, MetaDataImport::GetFieldDefProps, mdToken tk, INT32 *pdwFieldFlags HRESULT hr; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetFieldDefProps(tk, (DWORD *)pdwFieldFlags); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -537,10 +503,7 @@ MDImpl4(void, MetaDataImport::GetPropertyProps, mdToken tk, LPCSTR* pszName, INT HRESULT hr; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetPropertyProps(tk, pszName, (DWORD*)pdwPropertyFlags, (PCCOR_SIGNATURE*)&ppValue->m_array, (ULONG*)&ppValue->m_count); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -555,7 +518,6 @@ MDImpl2(void, MetaDataImport::GetFieldMarshal, mdToken tk, ConstArray* ppValue) HRESULT hr; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetFieldMarshal(tk, (PCCOR_SIGNATURE *)&ppValue->m_array, (ULONG *)&ppValue->m_count); if (hr == CLDB_E_RECORD_NOTFOUND) { @@ -563,7 +525,6 @@ MDImpl2(void, MetaDataImport::GetFieldMarshal, mdToken tk, ConstArray* ppValue) ppValue->m_count = 0; hr = S_OK; } - END_SO_INTOLERANT_CODE; if (FAILED(hr)) { @@ -579,10 +540,7 @@ MDImpl2(void, MetaDataImport::GetSigOfMethodDef, mdToken tk, ConstArray* ppValue HRESULT hr; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE(GetThread()) hr = _pScope->GetSigOfMethodDef(tk, (ULONG*)&ppValue->m_count, (PCCOR_SIGNATURE *)&ppValue->m_array); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -597,10 +555,7 @@ MDImpl2(void, MetaDataImport::GetSignatureFromToken, mdToken tk, ConstArray* ppV HRESULT hr; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetSigFromToken(tk, (ULONG*)&ppValue->m_count, (PCCOR_SIGNATURE *)&(ppValue->m_array)); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -615,10 +570,7 @@ MDImpl2(void, MetaDataImport::GetSigOfFieldDef, mdToken tk, ConstArray* ppValue) HRESULT hr; IMDInternalImport *_pScope = pScope; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetSigOfFieldDef(tk, (ULONG*)&ppValue->m_count, (PCCOR_SIGNATURE *)&ppValue->m_array); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -632,8 +584,6 @@ MDImpl2(void, MetaDataImport::GetParentToken, mdToken tk, mdToken* ptk) HRESULT hr; IMDInternalImport *_pScope = pScope; - - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); switch (TypeFromToken(tk)) { @@ -666,8 +616,6 @@ MDImpl2(void, MetaDataImport::GetParentToken, mdToken tk, mdToken* ptk) break; } - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -682,11 +630,8 @@ MDImpl1(void, MetaDataImport::GetScopeProps, GUID* pmvid) HRESULT hr; LPCSTR szName; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); IMDInternalImport *_pScope = pScope; hr = _pScope->GetScopeProps(&szName, pmvid); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); @@ -705,10 +650,7 @@ MDImpl2(void, MetaDataImport::GetMemberRefProps, IMDInternalImport *_pScope = pScope; LPCSTR szName_Ignore; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrowVoid(kStackOverflowException)); hr = _pScope->GetNameAndSigOfMemberRef(mr, (PCCOR_SIGNATURE*)&ppvSigBlob->m_array, (ULONG*)&ppvSigBlob->m_count, &szName_Ignore); - END_SO_INTOLERANT_CODE; - if (FAILED(hr)) { FCThrowVoid(kBadImageFormatException); diff --git a/src/vm/marshalnative.cpp b/src/vm/marshalnative.cpp index 95ff460..6e71c08 100644 --- a/src/vm/marshalnative.cpp +++ b/src/vm/marshalnative.cpp @@ -771,7 +771,6 @@ FCIMPL1(int, MarshalNative::GetHRForException, Object* eUNSAFE) NOTHROW; // Used by reverse COM IL stubs, so we must not throw exceptions back to COM DISABLED(GC_TRIGGERS); // FCALLS with HELPER frames have issues with GC_TRIGGERS MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; int retVal = 0; @@ -791,7 +790,6 @@ FCIMPL1(int, MarshalNative::GetHRForException_WinRT, Object* eUNSAFE) NOTHROW; // Used by reverse COM IL stubs, so we must not throw exceptions back to COM DISABLED(GC_TRIGGERS); // FCALLS with HELPER frames have issues with GC_TRIGGERS MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; int retVal = 0; diff --git a/src/vm/mda.h b/src/vm/mda.h index c711e8a..d473cb6 100644 --- a/src/vm/mda.h +++ b/src/vm/mda.h @@ -1185,7 +1185,7 @@ private: // Assistant Definitions private: // void DefineSchema() { WRAPPER_NO_CONTRACT; m_tos = m_schemaRootFactory.Create(); } - void DefineSchemaEnd() { CONTRACTL {NOTHROW; GC_NOTRIGGER; SO_TOLERANT; MODE_ANY; PRECONDITION(m_stack.GetDepth() == 0); } CONTRACTL_END; } + void DefineSchemaEnd() { CONTRACTL {NOTHROW; GC_NOTRIGGER; MODE_ANY; PRECONDITION(m_stack.GetDepth() == 0); } CONTRACTL_END; } void AddElement(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; Push(CreateDeclDef(name, &m_elementFactory)); Push(m_complexTypeFactory.Create()); } void AddElementRefType(MdaElemDeclDef name, MdaElemDeclDef type) { WRAPPER_NO_CONTRACT; AddTerminal(CreateDeclDef(name, &m_elementRefTypeFactory)->InitRef(GetDef(type))); } void AddElementAny(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; AddTerminal(CreateDeclDef(name, &m_elementAnyFactory)); } diff --git a/src/vm/mdaassistants.cpp b/src/vm/mdaassistants.cpp index eb9a448..4b9a7a9 100644 --- a/src/vm/mdaassistants.cpp +++ b/src/vm/mdaassistants.cpp @@ -32,9 +32,6 @@ //// -// Why is ANYTHING in here marked SO_TOLERANT?? Presumably some of them are called from managed code???? - - // // MdaFramework // @@ -45,7 +42,6 @@ void MdaFramework::DumpDiagnostics() THROWS; GC_TRIGGERS; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -83,7 +79,6 @@ void MdaFramework::Initialize(MdaXmlElement* pXmlInput) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -129,12 +124,9 @@ void TriggerGCForMDAInternal() NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return); - EX_TRY { GCHeapUtilities::GetGCHeap()->GarbageCollect(); @@ -158,8 +150,6 @@ void TriggerGCForMDAInternal() // Caller cannot take exceptions. } EX_END_CATCH(SwallowAllExceptions); - - END_SO_INTOLERANT_CODE; } // @@ -187,7 +177,6 @@ void MdaCallbackOnCollectedDelegate::ReportViolation(MethodDesc* pMD) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -212,7 +201,6 @@ void MdaCallbackOnCollectedDelegate::AddToList(UMEntryThunk* pEntryThunk) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; PRECONDITION(CheckPointer(pEntryThunk)); } CONTRACTL_END; @@ -242,7 +230,6 @@ void MdaCallbackOnCollectedDelegate::ReplaceEntry(int index, UMEntryThunk* pET) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; PRECONDITION((index >= 0) && (index < m_size)); PRECONDITION(CheckPointer(m_pList)); } @@ -272,7 +259,6 @@ void MdaInvalidMemberDeclaration::ReportViolation(ComCallMethodDesc *pCMD, OBJEC NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -333,7 +319,6 @@ void MdaExceptionSwallowedOnCallFromCom::ReportViolation(MethodDesc *pMD, OBJECT NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -377,7 +362,6 @@ void MdaInvalidVariant::ReportViolation() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -398,7 +382,6 @@ void MdaInvalidIUnknown::ReportViolation() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -419,7 +402,6 @@ void MdaContextSwitchDeadlock::ReportDeadlock(LPVOID Origin, LPVOID Destination) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -451,7 +433,6 @@ void MdaRaceOnRCWCleanup::ReportViolation() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -472,7 +453,6 @@ void MdaFailedQI::ReportAdditionalInfo(HRESULT hr, RCW* pRCW, GUID iid, MethodTa THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -545,7 +525,6 @@ HRESULT MdaFailedQIAssistantCallback(LPVOID pData) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pData)); } CONTRACTL_END; @@ -583,7 +562,6 @@ void MdaDisconnectedContext::ReportViolationDisconnected(LPVOID context, HRESULT THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -606,7 +584,6 @@ void MdaDisconnectedContext::ReportViolationCleanup(LPVOID context1, LPVOID cont NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -641,7 +618,6 @@ void MdaInvalidApartmentStateChange::ReportViolation(Thread* pThread, Thread::Ap NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -692,18 +668,13 @@ void MdaDllMainReturnsFalse::ReportError() THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return); - MdaXmlElement* pXml; MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml); msg.SendMessagef(MDARC_DLLMAIN_RETURNS_FALSE); - - END_SO_INTOLERANT_CODE; } // @@ -716,7 +687,6 @@ void MdaOverlappedFreeError::ReportError(LPVOID pOverlapped) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -749,7 +719,6 @@ Return Flags Mda_##Name Args { \ THROWS; \ GC_TRIGGERS; \ - SO_TOLERANT; \ MODE_ANY; \ } \ CONTRACTL_END; \ @@ -779,8 +748,6 @@ void MdaInvalidOverlappedToPinvoke::Initialize(MdaXmlElement* pXmlInput) } CONTRACTL_END; -// TODO: CONTRACT_VIOLATION(SOToleranceViolation); - m_entries = PInvokeTable; m_entryCount = sizeof(PInvokeTable) / sizeof(pinvoke_entry); m_bJustMyCode = pXmlInput->GetAttributeValueAsBool(MdaAttrDecl(JustMyCode)); @@ -793,7 +760,6 @@ BOOL MdaInvalidOverlappedToPinvoke::InitializeModuleFunctions(HINSTANCE hmod) THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -802,8 +768,6 @@ BOOL MdaInvalidOverlappedToPinvoke::InitializeModuleFunctions(HINSTANCE hmod) BOOL bFoundSomething = FALSE; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return FALSE); - SString moduleNameFullPath, moduleName; ClrGetModuleFileNameNoThrow(hmod,moduleNameFullPath); // Strip any path info @@ -829,8 +793,6 @@ BOOL MdaInvalidOverlappedToPinvoke::InitializeModuleFunctions(HINSTANCE hmod) } } - END_SO_INTOLERANT_CODE; - return bFoundSomething; } @@ -841,7 +803,6 @@ LPVOID MdaInvalidOverlappedToPinvoke::CheckOverlappedPointer(UINT index, LPVOID THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -858,10 +819,6 @@ LPVOID MdaInvalidOverlappedToPinvoke::CheckOverlappedPointer(UINT index, LPVOID // Is the overlapped pointer in the gc heap? if (pOverlapped != NULL) { - // If a stack overflow occurs, we would just want to continue and - // return the function pointer as expected. - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return pEntry->m_realFunction); - BOOL fHeapPointer; { @@ -881,8 +838,6 @@ LPVOID MdaInvalidOverlappedToPinvoke::CheckOverlappedPointer(UINT index, LPVOID pEntry->m_functionName, pEntry->m_moduleName); } - - END_SO_INTOLERANT_CODE; } return pEntry->m_realFunction; @@ -904,7 +859,6 @@ LPVOID MdaInvalidOverlappedToPinvoke::Register(HINSTANCE hmod,LPVOID pvTarget) THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -956,7 +910,6 @@ BOOL MdaPInvokeLog::Filter(SString& sszDllName) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -984,7 +937,6 @@ void MdaPInvokeLog::LogPInvoke(NDirectMethodDesc* pMD, HINSTANCE hMod) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1040,7 +992,6 @@ void MdaPInvokeStackImbalance::CheckStack(StackImbalanceCookie *pSICookie, DWORD THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -1099,8 +1050,6 @@ void MdaPInvokeStackImbalance::CheckStack(StackImbalanceCookie *pSICookie, DWORD if (!bStackImbalance) return; - BEGIN_SO_INTOLERANT_CODE(GetThread()); - MdaXmlElement* pXml; MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml); MdaXmlElement* pMethod = pXml->AddChild(MdaElemDecl(Method)); @@ -1108,8 +1057,6 @@ void MdaPInvokeStackImbalance::CheckStack(StackImbalanceCookie *pSICookie, DWORD StackSString sszMethodName; msg.SendMessagef(MDARC_PINVOKE_SIGNATURE_MISMATCH, AsMdaAssistant()->ToString(sszMethodName, pSICookie->m_pMD).GetUnicode()); - - END_SO_INTOLERANT_CODE; } #endif @@ -1124,7 +1071,6 @@ void MdaJitCompilationStart::Initialize(MdaXmlElement* pXmlInput) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1146,7 +1092,6 @@ void MdaJitCompilationStart::NowCompiling(MethodDesc* pMD) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1172,7 +1117,6 @@ void MdaLoadFromContext::NowLoading(IAssembly** ppIAssembly, StackCrawlMark *pCa THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1234,7 +1178,6 @@ void MdaBindingFailure::BindFailed(AssemblySpec *pSpec, OBJECTREF *pExceptionObj THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1339,7 +1282,6 @@ void MdaMemberInfoCacheCreation::MemberInfoCacheCreation() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1435,7 +1377,6 @@ void MdaInvalidGCHandleCookie::ReportError(LPVOID cookie) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1452,7 +1393,6 @@ void MdaStreamWriterBufferedDataLost::ReportError(SString text) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1473,7 +1413,6 @@ void MdaNotMarshalable::ReportViolation() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1494,7 +1433,6 @@ void MdaMarshalCleanupError::ReportErrorThreadCulture(OBJECTREF *pExceptionObj) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1522,7 +1460,6 @@ void MdaMarshalCleanupError::ReportErrorSafeHandleRelease(OBJECTREF *pExceptionO NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1550,7 +1487,6 @@ void MdaMarshalCleanupError::ReportErrorSafeHandleProp(OBJECTREF *pExceptionObj) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1578,7 +1514,6 @@ void MdaMarshalCleanupError::ReportErrorCustomMarshalerCleanup(TypeHandle typeCu NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1614,7 +1549,6 @@ void MdaMarshaling::Initialize(MdaXmlElement* pXmlInput) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1637,7 +1571,6 @@ void MdaMarshaling::ReportFieldMarshal(FieldMarshaler* pFM) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; PRECONDITION(CheckPointer(pFM)); } CONTRACTL_END; @@ -1671,7 +1604,6 @@ void MdaMarshaling::GetManagedSideForField(SString& strManagedMarshalType, Field THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1718,7 +1650,6 @@ void MdaMarshaling::GetUnmanagedSideForField(SString& strUnmanagedMarshalType, F THROWS; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1733,7 +1664,6 @@ void MdaMarshaling::GetManagedSideForMethod(SString& strManagedMarshalType, Modu THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1768,7 +1698,6 @@ void MdaMarshaling::GetUnmanagedSideForMethod(SString& strNativeMarshalType, Mar THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1782,7 +1711,6 @@ BOOL MdaMarshaling::CheckForPrimitiveType(CorElementType elemType, SString& strP THROWS; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -1854,13 +1782,9 @@ void MdaLoaderLock::ReportViolation(HINSTANCE hInst) NOTHROW; GC_TRIGGERS; MODE_ANY; - // Called from SO_TOLERANT CODE - SO_TOLERANT; } CONTRACTL_END; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return); - EX_TRY { MdaXmlElement* pXml; @@ -1887,8 +1811,6 @@ void MdaLoaderLock::ReportViolation(HINSTANCE hInst) // Caller cannot take exceptions. } EX_END_CATCH(SwallowAllExceptions); - - END_SO_INTOLERANT_CODE; } @@ -1902,12 +1824,9 @@ void MdaReentrancy::ReportViolation() NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return); - EX_TRY { MdaXmlElement* pXml; @@ -1920,8 +1839,6 @@ void MdaReentrancy::ReportViolation() // Caller cannot take exceptions. } EX_END_CATCH(SwallowAllExceptions); - - END_SO_INTOLERANT_CODE; } // @@ -1934,7 +1851,6 @@ void MdaAsynchronousThreadAbort::ReportViolation(Thread *pCallingThread, Thread NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1966,7 +1882,6 @@ void MdaDangerousThreadingAPI::ReportViolation(__in_z WCHAR *apiName) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -1988,7 +1903,6 @@ void MdaReportAvOnComRelease::ReportHandledException(RCW* pRCW) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2024,7 +1938,6 @@ void MdaInvalidFunctionPointerInDelegate::ReportViolation(LPVOID pFunc) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2045,7 +1958,6 @@ void MdaDirtyCastAndCallOnInterface::ReportViolation(IUnknown* pUnk) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2065,7 +1977,6 @@ void MdaFatalExecutionEngineError::ReportFEEE(TADDR addrOfError, HRESULT hrError NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2096,7 +2007,6 @@ void MdaInvalidCERCall::ReportViolation(MethodDesc* pCallerMD, MethodDesc *pCall THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2122,7 +2032,6 @@ void MdaVirtualCERCall::ReportViolation(MethodDesc* pCallerMD, MethodDesc *pCall THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2148,7 +2057,6 @@ void MdaOpenGenericCERCall::ReportViolation(MethodDesc* pMD) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2172,7 +2080,6 @@ void MdaIllegalPrepareConstrainedRegion::ReportViolation(MethodDesc* pMD, DWORD THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2196,7 +2103,6 @@ void MdaReleaseHandleFailed::ReportViolation(TypeHandle th, LPVOID lpvHandle) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2226,7 +2132,6 @@ void MdaNonComVisibleBaseClass::ReportViolation(MethodTable *pMT, BOOL fForIDisp THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -2270,7 +2175,6 @@ void MdaXmlValidationError::ReportError(MdaSchema::ValidationResult* pValidation GC_TRIGGERS; MODE_ANY; DEBUG_ONLY; - SO_NOT_MAINLINE; } CONTRACTL_END; PRECONDITION(CheckPointer(pValidationResult->m_pViolatingElement)); @@ -2298,7 +2202,6 @@ void MdaInvalidConfigFile::ReportError(MdaElemDeclDef configFile) GC_TRIGGERS; MODE_ANY; DEBUG_ONLY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2322,7 +2225,6 @@ void MdaDateTimeInvalidLocalFormat::ReportError() GC_TRIGGERS; MODE_ANY; DEBUG_ONLY; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/memberload.cpp b/src/vm/memberload.cpp index da026b1..03081e3 100644 --- a/src/vm/memberload.cpp +++ b/src/vm/memberload.cpp @@ -37,7 +37,6 @@ #include "dllimportcallback.h" #include "listlock.h" #include "methodimpl.h" -#include "stackprobe.h" #include "encee.h" #include "comsynchronizable.h" #include "customattribute.h" diff --git a/src/vm/method.cpp b/src/vm/method.cpp index 00df9d2..69849f3 100644 --- a/src/vm/method.cpp +++ b/src/vm/method.cpp @@ -214,7 +214,6 @@ BaseDomain *MethodDesc::GetDomain() GC_NOTRIGGER; FORBID_FAULT; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END @@ -257,7 +256,6 @@ LPCUTF8 MethodDesc::GetName() if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; // MethodImpl::FindMethodDesc can throw. GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; }CONTRACTL_END; @@ -277,17 +275,12 @@ LPCUTF8 MethodDesc::GetName() { // Get the metadata string name for this method LPCUTF8 result = NULL; - - // This probes only if we have a thread, in which case it is OK to throw the SO. - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(COMPlusThrowSO()); - + if (FAILED(GetMDImport()->GetNameOfMethodDef(GetMemberDef(), &result))) { result = NULL; } - - END_SO_INTOLERANT_CODE; - + return(result); } } @@ -435,7 +428,6 @@ void MethodDesc::GetSig(PCCOR_SIGNATURE *ppSig, DWORD *pcSig) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -479,7 +471,6 @@ void MethodDesc::GetSigFromMetadata(IMDInternalImport * importer, NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -530,7 +521,6 @@ PCODE MethodDesc::GetMethodEntryPoint() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -562,7 +552,6 @@ TADDR MethodDesc::GetAddrOfSlot() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -724,7 +713,6 @@ DWORD MethodDesc::GetNumGenericMethodArgs() NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -747,7 +735,6 @@ MethodTable * MethodDesc::GetExactDeclaringType(MethodTable * ownerOrSubType) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1129,7 +1116,6 @@ ULONG MethodDesc::GetRVA() NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -1239,7 +1225,6 @@ MetaSig::RETURNTYPE MethodDesc::ReturnsObject( if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END @@ -1389,7 +1374,6 @@ DWORD MethodDesc::GetAttrs() const NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END @@ -1437,7 +1421,6 @@ Module* MethodDesc::GetZapModule() NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -1496,7 +1479,6 @@ Module *MethodDesc::GetModule() const STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; SUPPORTS_DAC; g_IBCLogger.LogMethodDescAccess(this); @@ -1511,7 +1493,6 @@ Module *MethodDesc::GetModule_NoLogging() const STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; SUPPORTS_DAC; MethodTable* pMT = GetMethodDescChunk()->GetMethodTable(); @@ -1792,7 +1773,6 @@ MethodDesc* MethodDesc::StripMethodInstantiation() NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL)); } CONTRACT_END @@ -2295,7 +2275,6 @@ BOOL MethodDesc::IsPointingToPrestub() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -4028,7 +4007,6 @@ MethodDesc* MethodDesc::GetMethodDescFromStubAddr(PCODE addr, BOOL fSpeculative { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; } CONTRACT_END; @@ -4074,7 +4052,6 @@ TADDR MethodDesc::GetFixupList() //******************************************************************************* BOOL MethodDesc::IsRestored_NoLogging() { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; @@ -4105,7 +4082,6 @@ BOOL MethodDesc::IsRestored_NoLogging() BOOL MethodDesc::IsRestored() { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; @@ -4621,7 +4597,6 @@ PCODE MethodDesc::GetTemporaryEntryPoint() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -5606,7 +5581,6 @@ void MethodDesc::WalkValueTypeParameters(MethodTable *pMT, WalkValueTypeParamete { THROWS; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; @@ -5672,7 +5646,6 @@ static void CheckForEquivalenceAndLoadType(Module *pModule, mdToken token, Modul { THROWS; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; diff --git a/src/vm/method.hpp b/src/vm/method.hpp index 92a91c8..35261eb 100644 --- a/src/vm/method.hpp +++ b/src/vm/method.hpp @@ -833,7 +833,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3693,7 +3692,6 @@ inline BOOL MethodDesc::SanityCheck() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } diff --git a/src/vm/method.inl b/src/vm/method.inl index f72d42f..6b0d8d3 100644 --- a/src/vm/method.inl +++ b/src/vm/method.inl @@ -69,7 +69,6 @@ inline PTR_LCGMethodResolver DynamicMethodDesc::GetLCGMethodResolver() GC_NOTRIGGER; NOTHROW; PRECONDITION(IsLCGMethod()); - SO_TOLERANT; } CONTRACTL_END; @@ -84,7 +83,6 @@ inline PTR_ILStubResolver DynamicMethodDesc::GetILStubResolver() GC_NOTRIGGER; NOTHROW; PRECONDITION(IsILStub()); - SO_TOLERANT; } CONTRACTL_END; @@ -99,7 +97,6 @@ inline PTR_DynamicMethodDesc MethodDesc::AsDynamicMethodDesc() GC_NOTRIGGER; NOTHROW; PRECONDITION(IsDynamicMethod()); - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp index ab42626..e354dfd 100644 --- a/src/vm/methodtable.cpp +++ b/src/vm/methodtable.cpp @@ -38,7 +38,6 @@ #include "listlock.h" #include "methodimpl.h" #include "guidfromname.h" -#include "stackprobe.h" #include "encee.h" #include "encee.h" #include "comsynchronizable.h" @@ -1335,7 +1334,6 @@ BOOL MethodTable::IsEquivalentTo_Worker(MethodTable *pOtherMT COMMA_INDEBUG(Type THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; // we are called from MethodTable::CanCastToClass } CONTRACTL_END; @@ -1364,13 +1362,7 @@ BOOL MethodTable::IsEquivalentTo_Worker(MethodTable *pOtherMT COMMA_INDEBUG(Type return (GetApproxArrayElementTypeHandle().IsEquivalentTo(pOtherMT->GetApproxArrayElementTypeHandle() COMMA_INDEBUG(&newVisited))); } - BOOL bResult = FALSE; - - BEGIN_SO_INTOLERANT_CODE(GetThread()); - bResult = IsEquivalentTo_WorkerInner(pOtherMT COMMA_INDEBUG(&newVisited)); - END_SO_INTOLERANT_CODE; - - return bResult; + return IsEquivalentTo_WorkerInner(pOtherMT COMMA_INDEBUG(&newVisited)); } //========================================================================================== @@ -1382,7 +1374,6 @@ BOOL MethodTable::IsEquivalentTo_WorkerInner(MethodTable *pOtherMT COMMA_INDEBUG THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; LOADS_TYPE(CLASS_DEPENDENCIES_LOADED); } CONTRACTL_END; @@ -1666,7 +1657,6 @@ BOOL MethodTable::CanCastToNonVariantInterface(MethodTable *pTargetMT) GC_NOTRIGGER; MODE_ANY; INSTANCE_CHECK; - SO_TOLERANT; PRECONDITION(CheckPointer(pTargetMT)); PRECONDITION(pTargetMT->IsInterface()); PRECONDITION(!pTargetMT->HasVariance()); @@ -1691,7 +1681,6 @@ TypeHandle::CastResult MethodTable::CanCastToInterfaceNoGC(MethodTable *pTargetM GC_NOTRIGGER; MODE_ANY; INSTANCE_CHECK; - SO_TOLERANT; PRECONDITION(CheckPointer(pTargetMT)); PRECONDITION(pTargetMT->IsInterface()); PRECONDITION(IsRestored_NoLogging()); @@ -1718,7 +1707,6 @@ TypeHandle::CastResult MethodTable::CanCastToClassNoGC(MethodTable *pTargetMT) GC_NOTRIGGER; MODE_ANY; INSTANCE_CHECK; - SO_TOLERANT; PRECONDITION(CheckPointer(pTargetMT)); PRECONDITION(!pTargetMT->IsArray()); PRECONDITION(!pTargetMT->IsInterface()); @@ -1762,7 +1750,6 @@ MethodTable::IsExternallyVisible() THROWS; MODE_ANY; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; @@ -2023,7 +2010,6 @@ BOOL MethodTable::ImplementsEquivalentInterface(MethodTable *pInterface) { THROWS; GC_TRIGGERS; - SO_TOLERANT; PRECONDITION(pInterface->IsInterface()); // class we are looking up should be an interface } CONTRACTL_END; @@ -2285,7 +2271,6 @@ bool MethodTable::ClassifyEightBytesWithManagedLayout(SystemVStructRegisterPassi { THROWS; GC_TRIGGERS; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -2568,7 +2553,6 @@ bool MethodTable::ClassifyEightBytesWithNativeLayout(SystemVStructRegisterPassin { THROWS; GC_TRIGGERS; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3377,7 +3361,6 @@ void MethodTable::DoRunClassInitThrowing() THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -3391,7 +3374,6 @@ void MethodTable::DoRunClassInitThrowing() Thread *pThread; pThread = GetThread(); _ASSERTE(pThread); - INTERIOR_STACK_PROBE_FOR(pThread, 8); AppDomain *pDomain = GetAppDomain(); @@ -3667,7 +3649,6 @@ void MethodTable::DoRunClassInitThrowing() g_IBCLogger.LogMethodTableAccess(this); Exit: ; - END_INTERIOR_STACK_PROBE; } //========================================================================================== @@ -3677,14 +3658,12 @@ void MethodTable::CheckRunClassInitThrowing() { THROWS; GC_TRIGGERS; - SO_TOLERANT; INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(IsFullyLoaded()); } CONTRACTL_END; { // Debug-only code causes SO volation, so add exception. - CONTRACT_VIOLATION(SOToleranceViolation); CONSISTENCY_CHECK(CheckActivated()); } @@ -3718,7 +3697,6 @@ void MethodTable::CheckRunClassInitAsIfConstructingThrowing() { THROWS; GC_TRIGGERS; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3816,7 +3794,6 @@ static void FastCallFinalize(Object *obj, PCODE funcPtr, BOOL fCriticalCall) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_INTOLERANT; BEGIN_CALL_TO_MANAGEDEX(fCriticalCall ? EEToManagedCriticalCall : EEToManagedDefault); @@ -5408,7 +5385,6 @@ static void CheckForEquivalenceAndFullyLoadType(Module *pModule, mdToken token, { THROWS; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; @@ -5594,7 +5570,6 @@ void MethodTable::DoFullyLoad(Generics::RecursionGraph * const pVisited, const } - BEGIN_SO_INTOLERANT_CODE(GetThread()); // First ensure that we're loaded to just below CLASS_DEPENDENCIES_LOADED ClassLoader::EnsureLoaded(this, (ClassLoadLevel) (level-1)); @@ -6008,9 +5983,6 @@ void MethodTable::DoFullyLoad(Generics::RecursionGraph * const pVisited, const _ASSERTE(th.IsTypeDesc() && th.IsArray()); _ASSERTE(!(level == CLASS_LOADED && !th.IsFullyLoaded())); } - - END_SO_INTOLERANT_CODE; - #endif //!DACCESS_COMPILE } //MethodTable::DoFullyLoad @@ -7366,7 +7338,6 @@ BOOL MethodTable::FindDefaultInterfaceImplementation( DispatchSlot MethodTable::FindDispatchSlot(UINT32 typeID, UINT32 slotNumber, BOOL throwOnConflict) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; DispatchSlot implSlot(NULL); FindDispatchImpl(typeID, slotNumber, &implSlot, throwOnConflict); return implSlot; @@ -7379,7 +7350,6 @@ DispatchSlot MethodTable::FindDispatchSlot(DispatchToken tok, BOOL throwOnConfli { THROWS; GC_TRIGGERS; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -7463,7 +7433,6 @@ UINT32 MethodTable::LookupTypeID() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -7592,7 +7561,6 @@ MethodDesc * MethodTable::GetIntroducingMethodDesc(DWORD slotNumber) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -7958,7 +7926,6 @@ MethodDesc* MethodTable::GetMethodDescForSlotAddress(PCODE addr, BOOL fSpeculati { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL, NULL_NOT_OK)); POSTCONDITION(RETVAL->m_pDebugMethodTable.IsNull() || // We must be in BuildMethdTableThrowing() RETVAL->SanityCheck()); @@ -8018,7 +7985,6 @@ BOOL MethodTable::ComputeContainsGenericVariables(Instantiation inst) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -8123,7 +8089,6 @@ MethodDesc * MethodTable::GetClassConstructor() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -8254,7 +8219,6 @@ MethodTable * MethodTable::GetMethodTableMatchingParentClass(MethodTable * pWhic { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(CheckPointer(pWhichParent)); PRECONDITION(IsRestored_NoLogging()); PRECONDITION(pWhichParent->IsRestored_NoLogging()); @@ -8311,7 +8275,6 @@ Instantiation MethodTable::GetInstantiationOfParentClass(MethodTable *pWhichPare CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(CheckPointer(pWhichParent)); PRECONDITION(IsRestored_NoLogging()); PRECONDITION(pWhichParent->IsRestored_NoLogging()); @@ -8891,7 +8854,6 @@ void MethodTable::CheckInitMethodDataCache() CONTRACTL { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; if (s_pMethodDataCache == NULL) { @@ -9425,9 +9387,6 @@ VOID MethodTable::EnsureInstanceActive() if (HasInstantiation()) { - // This is going to go recursive, so we need to use an interior stack probe - - INTERIOR_STACK_PROBE(GetThread()); { Instantiation inst = GetInstantiation(); for (DWORD i = 0; i < inst.GetNumArgs(); i++) @@ -9439,7 +9398,6 @@ VOID MethodTable::EnsureInstanceActive() } } } - END_INTERIOR_STACK_PROBE; } } @@ -9648,7 +9606,6 @@ PCODE MethodTable::GetRestoredSlot(DWORD slotNumber) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -9689,7 +9646,6 @@ MethodTable * MethodTable::GetRestoredSlotMT(DWORD slotNumber) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -9730,7 +9686,6 @@ MethodDesc * MethodTable::GetParallelMethodDesc(MethodDesc * pDefMD) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h index 20fc5e0..5842b53 100644 --- a/src/vm/methodtable.h +++ b/src/vm/methodtable.h @@ -1394,7 +1394,6 @@ public: PCODE GetSlot(UINT32 slotNumber) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; CONSISTENCY_CHECK(slotNumber < GetNumVtableSlots()); TADDR pSlot = GetSlotPtrRaw(slotNumber); @@ -1428,7 +1427,6 @@ public: TADDR GetSlotPtrRaw(UINT32 slotNum) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; CONSISTENCY_CHECK(slotNum < GetNumVtableSlots()); if (slotNum < GetNumVirtuals()) @@ -1458,7 +1456,6 @@ public: TADDR GetSlotPtr(UINT32 slotNum) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // Slots in NGened images are relative pointers CONSISTENCY_CHECK(!IsZapped()); @@ -1968,7 +1965,6 @@ public: // See JIT_IsInstanceOfInterface inline BOOL InstanceRequiresNonTrivialInterfaceCast() { - STATIC_CONTRACT_SO_TOLERANT; LIMITED_METHOD_CONTRACT; return GetFlag(enum_flag_NonTrivialInterfaceCast); @@ -4069,7 +4065,6 @@ public: inline DPTR(TYPE) GETTER() \ { \ LIMITED_METHOD_CONTRACT; \ - STATIC_CONTRACT_SO_TOLERANT; \ _ASSERTE(Has##NAME()); \ return dac_cast(dac_cast(this) + GetOffsetOfOptionalMember(OptionalMember_##NAME)); \ } diff --git a/src/vm/methodtable.inl b/src/vm/methodtable.inl index 70b31c0..ef30252 100644 --- a/src/vm/methodtable.inl +++ b/src/vm/methodtable.inl @@ -598,7 +598,6 @@ inline MethodDesc* MethodTable::GetMethodDescForSlot(DWORD slot) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1545,7 +1544,6 @@ inline BOOL MethodTable::UnBoxInto(void *dest, OBJECTREF src) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -1571,7 +1569,6 @@ inline BOOL MethodTable::UnBoxIntoArg(ArgDestination *argDest, OBJECTREF src) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -1597,7 +1594,6 @@ inline void MethodTable::UnBoxIntoUnchecked(void *dest, OBJECTREF src) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -1624,7 +1620,6 @@ __forceinline TypeHandle::CastResult MethodTable::CanCastToClassOrInterfaceNoGC( GC_NOTRIGGER; MODE_ANY; INSTANCE_CHECK; - SO_TOLERANT; PRECONDITION(CheckPointer(pTargetMT)); PRECONDITION(!pTargetMT->IsArray()); } @@ -1665,7 +1660,6 @@ FORCEINLINE PTR_Module MethodTable::GetGenericsStaticsModuleAndID(DWORD * pID) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -1741,7 +1735,6 @@ FORCEINLINE BOOL MethodTable::ImplementsInterfaceInline(MethodTable *pInterface) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(pInterface->IsInterface()); // class we are looking up should be an interface } CONTRACTL_END; diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index f9a28fb..ab9e1c5 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -502,8 +502,6 @@ MethodTableBuilder::ExpandApproxInheritedInterfaces( { STANDARD_VM_CONTRACT; - INTERIOR_STACK_PROBE(GetThread()); - // Expand interfaces in superclasses first. Interfaces inherited from parents // must have identical indexes as in the parent. bmtRTType * pParentOfParent = pParentType->GetParentType(); @@ -550,8 +548,6 @@ MethodTableBuilder::ExpandApproxInheritedInterfaces( // Restore parent's substitution pParentType->SetSubstitution(parentSubstitution); - - END_INTERIOR_STACK_PROBE; } // MethodTableBuilder::ExpandApproxInheritedInterfaces //******************************************************************************* @@ -1324,10 +1320,6 @@ MethodTableBuilder::BuildMethodTableThrowing( bmtInternal->pType = new (GetStackingAllocator()) bmtMDType(pParent, pModule, cl, bmtGenericsInfo->typeContext); - // put the interior stack probe after all the stack-allocted goop above. We check compare our this pointer to the SP on - // the dtor to determine if we are being called on an EH path or not. - INTERIOR_STACK_PROBE_FOR(GetThread(), 8); - // If not NULL, it means there are some by-value fields, and this contains an entry for each inst #ifdef _DEBUG @@ -2101,8 +2093,6 @@ MethodTableBuilder::BuildMethodTableThrowing( _ASSERTE(pComputedPZM == Module::GetPreferredZapModuleForMethodTable(pMT)); #endif // FEATURE_PREJIT - END_INTERIOR_STACK_PROBE; - return GetHalfBakedMethodTable(); } // MethodTableBuilder::BuildMethodTableThrowing #ifdef _PREFAST_ @@ -11885,7 +11875,6 @@ ClassLoader::CreateTypeHandleForTypeDefThrowing( MethodTable * pMT = NULL; Thread * pThread = GetThread(); - BEGIN_SO_INTOLERANT_CODE_FOR(pThread, DefaultEntryProbeAmount() * 2) MethodTable * pParentMethodTable = NULL; SigPointer parentInst; @@ -12205,6 +12194,5 @@ ClassLoader::CreateTypeHandleForTypeDefThrowing( parentInst, (WORD)cInterfaces); - END_SO_INTOLERANT_CODE; RETURN(TypeHandle(pMT)); } // ClassLoader::CreateTypeHandleForTypeDefThrowing diff --git a/src/vm/mlinfo.cpp b/src/vm/mlinfo.cpp index 32f77cd..e007891 100644 --- a/src/vm/mlinfo.cpp +++ b/src/vm/mlinfo.cpp @@ -3058,7 +3058,6 @@ ILMarshaler* CreateILMarshaler(MarshalInfo::MarshalType mtype, NDirectStubLinker { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/nativeoverlapped.h b/src/vm/nativeoverlapped.h index e1ffb88..e1bfd08 100644 --- a/src/vm/nativeoverlapped.h +++ b/src/vm/nativeoverlapped.h @@ -44,8 +44,7 @@ public: static OverlappedDataObject* GetOverlapped(LPOVERLAPPED nativeOverlapped) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - + _ASSERTE (nativeOverlapped != NULL); return (OverlappedDataObject*)OBJECTREFToObject(ObjectFromHandle(((NATIVEOVERLAPPED_AND_HANDLE*)nativeOverlapped)->m_handle)); } @@ -54,7 +53,6 @@ public: static OverlappedDataObject* GetOverlappedForTracing(LPOVERLAPPED nativeOverlapped) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(nativeOverlapped != NULL); return *(OverlappedDataObject**)(((NATIVEOVERLAPPED_AND_HANDLE*)nativeOverlapped)->m_handle); diff --git a/src/vm/notifyexternals.cpp b/src/vm/notifyexternals.cpp index df1cce4..b6e7fbb 100644 --- a/src/vm/notifyexternals.cpp +++ b/src/vm/notifyexternals.cpp @@ -26,7 +26,6 @@ BOOL ShouldCheckLoaderLock(BOOL fForMDA /*= TRUE*/) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/object.cpp b/src/vm/object.cpp index 87a0cf9..e008486 100644 --- a/src/vm/object.cpp +++ b/src/vm/object.cpp @@ -53,7 +53,6 @@ INT32 Object::GetHashCodeEx() MODE_COOPERATIVE; THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END @@ -146,7 +145,6 @@ TypeHandle Object::GetTrueTypeHandle() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -308,7 +306,6 @@ void Object::DEBUG_SetAppDomain(AppDomain *pDomain) } CONTRACTL_END; - /*_ASSERTE(GetThread()->IsSOTolerant());*/ SetAppDomain(pDomain); } #endif @@ -319,7 +316,6 @@ void Object::SetAppDomain(AppDomain *pDomain) { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pDomain)); } @@ -351,7 +347,6 @@ BOOL Object::SetAppDomainNoThrow() { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; } CONTRACTL_END; @@ -377,7 +372,6 @@ AppDomain *Object::GetAppDomain() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -451,7 +445,6 @@ void Object::SetOffsetObjectRef(DWORD dwOffset, size_t dwValue) STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_TOLERANT; OBJECTREF* location; OBJECTREF o; @@ -1062,7 +1055,6 @@ BOOL StringObject::CaseInsensitiveCompHelper(__in_ecount(aLength) WCHAR *strACha PRECONDITION(CheckPointer(strAChars)); PRECONDITION(CheckPointer(strBChars)); PRECONDITION(CheckPointer(result)); - SO_TOLERANT; } CONTRACTL_END; WCHAR *strAStart = strAChars; @@ -1213,7 +1205,6 @@ BOOL StringObject::ValidateHighChars() ==============================================================================*/ BOOL StringObject::HasTrailByte() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; SyncBlock * pSyncBlock = PassiveGetSyncBlock(); if(pSyncBlock != NULL) @@ -1238,7 +1229,6 @@ BOOL StringObject::GetTrailByte(BYTE *bTrailByte) { { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1282,8 +1272,6 @@ OBJECTREF::OBJECTREF() STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_VIOLATION(SOToleranceViolation); - m_asObj = (Object*)POISONC; Thread::ObjectRefNew(this); } @@ -1298,8 +1286,6 @@ OBJECTREF::OBJECTREF(const OBJECTREF & objref) STATIC_CONTRACT_MODE_COOPERATIVE; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_VIOLATION(SOToleranceViolation); - VALIDATEOBJECT(objref.m_asObj); // !!! If this assert is fired, there are two possibilities: @@ -1333,8 +1319,6 @@ OBJECTREF::OBJECTREF(TADDR nul) STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_VIOLATION(SOToleranceViolation); - //_ASSERTE(nul == 0); m_asObj = (Object*)nul; if( m_asObj != NULL) @@ -1587,7 +1571,6 @@ void* __cdecl GCSafeMemCpy(void * dest, const void * src, size_t len) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; if (!(((*(BYTE**)&dest) < g_lowest_address ) || ((*(BYTE**)&dest) >= g_highest_address))) @@ -1821,7 +1804,6 @@ BOOL Nullable::IsNullableForTypeHelper(MethodTable* nullableMT, MethodTable* par { THROWS; GC_TRIGGERS; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1908,7 +1890,6 @@ BOOL Nullable::UnBox(void* destPtr, OBJECTREF boxedVal, MethodTable* destMT) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; Nullable* dest = (Nullable*) destPtr; @@ -1966,7 +1947,6 @@ BOOL Nullable::UnBoxNoGC(void* destPtr, OBJECTREF boxedVal, MethodTable* destMT) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; Nullable* dest = (Nullable*) destPtr; @@ -2015,7 +1995,6 @@ BOOL Nullable::UnBoxIntoArgNoGC(ArgDestination *argDest, OBJECTREF boxedVal, Met NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -2072,7 +2051,6 @@ void Nullable::UnBoxNoCheck(void* destPtr, OBJECTREF boxedVal, MethodTable* dest NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; Nullable* dest = (Nullable*) destPtr; @@ -2175,7 +2153,6 @@ void ExceptionObject::SetStackTrace(StackTraceArray const & stackTrace, PTRARRAY GC_NOTRIGGER; NOTHROW; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -2196,7 +2173,6 @@ void ExceptionObject::SetNullStackTrace() GC_NOTRIGGER; NOTHROW; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -2221,7 +2197,6 @@ void ExceptionObject::GetStackTrace(StackTraceArray & stackTrace, PTRARRAYREF * GC_NOTRIGGER; NOTHROW; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/object.h b/src/vm/object.h index dd943ee..54ccd4c 100644 --- a/src/vm/object.h +++ b/src/vm/object.h @@ -785,7 +785,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -1141,7 +1140,6 @@ protected: NOTHROW; MODE_COOPERATIVE; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1161,7 +1159,6 @@ public: NOTHROW; MODE_COOPERATIVE; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1176,7 +1173,6 @@ public: NOTHROW; MODE_COOPERATIVE; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1190,7 +1186,6 @@ public: NOTHROW; MODE_COOPERATIVE; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -2262,7 +2257,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; diff --git a/src/vm/object.inl b/src/vm/object.inl index c9b7abd..9652909 100644 --- a/src/vm/object.inl +++ b/src/vm/object.inl @@ -119,7 +119,6 @@ inline void Object::EnumMemoryRegions(void) FORCEINLINE bool Object::TryEnterObjMonitorSpinHelper() { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -162,7 +161,6 @@ inline /* static */ TypeHandle ArrayBase::GetTypeHandle(MethodTable * pMT) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -182,9 +180,6 @@ inline /* static */ TypeHandle ArrayBase::GetTypeHandle(MethodTable * pMT) // if we have allocated an array object of type T then the ArrayTypeDesc // for T[] is available and restored - // @todo This should be turned into a probe with a hard SO when we have one - // See also: ArrayBase::SetArrayMethodTable, ArrayBase::SetArrayMethodTableForLargeObject and MethodTable::DoFullyLoad - CONTRACT_VIOLATION(SOToleranceViolation); // == FailIfNotLoadedOrNotRestored TypeHandle arrayType = ClassLoader::LoadArrayTypeThrowing(pMT->GetApproxArrayElementTypeHandle(), kind, rank, ClassLoader::DontLoadTypes); CONSISTENCY_CHECK(!arrayType.IsNull()); @@ -275,7 +270,6 @@ inline /* static */ unsigned ArrayBase::GetLowerBoundsOffset(MethodTable* pMT) // type is stored in the array or not inline TypeHandle ArrayBase::GetArrayElementTypeHandle() const { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; @@ -329,7 +323,6 @@ inline TypeHandle Object::GetTypeHandle() NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -348,7 +341,6 @@ inline TypeHandle Object::GetGCSafeTypeHandle() const { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/olecontexthelpers.cpp b/src/vm/olecontexthelpers.cpp index 43dc318..3e40528 100644 --- a/src/vm/olecontexthelpers.cpp +++ b/src/vm/olecontexthelpers.cpp @@ -83,7 +83,6 @@ LPVOID GetCurrentCtxCookie() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } CONTRACT_END; @@ -113,7 +112,6 @@ HRESULT GetCurrentThreadTypeNT5(THDTYPE* pType) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pType)); } CONTRACTL_END; diff --git a/src/vm/olevariant.cpp b/src/vm/olevariant.cpp index c1b047c..887d452 100644 --- a/src/vm/olevariant.cpp +++ b/src/vm/olevariant.cpp @@ -1112,12 +1112,9 @@ void VariantData::NewVariant(VariantData * const& dest, const CVTypes type, INT6 void SafeVariantClearHelper(_Inout_ VARIANT* pVar) { - STATIC_CONTRACT_SO_INTOLERANT; WRAPPER_NO_CONTRACT; - BEGIN_SO_TOLERANT_CODE(GetThread()); VariantClear(pVar); - END_SO_TOLERANT_CODE; } class OutOfMemoryException; diff --git a/src/vm/packedfields.inl b/src/vm/packedfields.inl index 1c1a043..5ceb552 100644 --- a/src/vm/packedfields.inl +++ b/src/vm/packedfields.inl @@ -99,7 +99,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -196,7 +195,6 @@ public: GC_NOTRIGGER; MODE_ANY; SUPPORTS_DAC; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp index cd18037..9f3c358 100644 --- a/src/vm/pefile.cpp +++ b/src/vm/pefile.cpp @@ -553,7 +553,6 @@ CHECK PEFile::CheckLoaded(BOOL bAllowNativeSkip/*=TRUE*/) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACT_CHECK_END; @@ -791,7 +790,6 @@ void PEFile::ConvertMetadataToRWForEnC() { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1099,7 +1097,6 @@ LPCWSTR CorCompileGetRuntimeDllName(CorCompileRuntimeDlls id) THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1124,7 +1121,6 @@ extern HMODULE CorCompileGetRuntimeDll(CorCompileRuntimeDlls id) THROWS; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; diff --git a/src/vm/pefile.inl b/src/vm/pefile.inl index 38b155f..75f8793 100644 --- a/src/vm/pefile.inl +++ b/src/vm/pefile.inl @@ -198,7 +198,6 @@ inline const SString &PEFile::GetPath() NOTHROW; CANNOT_TAKE_LOCK; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -404,7 +403,6 @@ inline IMDInternalImport *PEFile::GetMDImportWithRef() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_INTOLERANT; } CONTRACT_END; */ @@ -421,7 +419,6 @@ inline IMDInternalImport *PEFile::GetMDImportWithRef() WRAPPER(GC_TRIGGERS); MODE_ANY; CAN_TAKE_LOCK; - SO_INTOLERANT; } CONTRACTL_END; @@ -664,7 +661,6 @@ inline void PEFile::MarkNativeImageInvalidIfOwned() inline BOOL PEFile::IsILOnly() { - STATIC_CONTRACT_SO_TOLERANT; WRAPPER_NO_CONTRACT; SUPPORTS_DAC; @@ -685,8 +681,6 @@ inline BOOL PEFile::IsILOnly() { BOOL retVal = FALSE; - BEGIN_SO_INTOLERANT_CODE(GetThread()); - //don't want to touch the IL image unless we already have ReleaseHolder pNativeImage = GetNativeImageWithRef(); if (pNativeImage) @@ -694,8 +688,6 @@ inline BOOL PEFile::IsILOnly() retVal = pNativeImage->IsNativeILILOnly(); } - END_SO_INTOLERANT_CODE; - return retVal; } #endif // DACCESS_COMPILE @@ -1079,7 +1071,6 @@ inline BOOL PEFile::IsPtrInILImage(PTR_CVOID data) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -1117,7 +1108,6 @@ inline BOOL PEFile::HasNativeImage() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -1138,7 +1128,6 @@ inline BOOL PEFile::HasNativeOrReadyToRunImage() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -1170,7 +1159,6 @@ inline BOOL PEFile::IsLoaded(BOOL bAllowNative/*=TRUE*/) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1201,7 +1189,6 @@ inline PTR_PEImageLayout PEFile::GetLoadedNative() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } @@ -1230,7 +1217,6 @@ inline PEImage *PEFile::GetPersistentNativeImage() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -1267,7 +1253,6 @@ inline BOOL PEFile::HasNativeImageMetadata() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACT_END; diff --git a/src/vm/peimage.cpp b/src/vm/peimage.cpp index 8385408..7d08e46 100644 --- a/src/vm/peimage.cpp +++ b/src/vm/peimage.cpp @@ -41,7 +41,6 @@ void PEImage::Startup() THROWS; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; POSTCONDITION(CheckStartup()); INJECT_FAULT(COMPlusThrowOM();); } @@ -50,8 +49,6 @@ void PEImage::Startup() if (CheckStartup()) RETURN; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(COMPlusThrowSO()); - s_hashLock.Init(CrstPEImage, (CrstFlags)(CRST_REENTRANCY|CRST_TAKEN_DURING_SHUTDOWN)); LockOwner lock = { &s_hashLock, IsOwnerOfCrst }; s_Images = ::new PtrHashMap; @@ -68,7 +65,6 @@ void PEImage::Startup() #else // FEATURE_USE_LCID g_lcid = NULL; // invariant #endif //FEATURE_USE_LCID - END_SO_INTOLERANT_CODE; RETURN; } @@ -994,7 +990,6 @@ PTR_PEImageLayout PEImage::GetLayout(DWORD imageLayoutMask,DWORD flags) PTR_PEImageLayout pRetVal; #ifndef DACCESS_COMPILE - BEGIN_SO_INTOLERANT_CODE(GetThread()); // First attempt to find an existing layout matching imageLayoutMask. If that fails, // and the caller has asked us to create layouts if needed, then try again passing // the create flag to GetLayoutInternal. We need this to be synchronized, but the common @@ -1010,8 +1005,7 @@ PTR_PEImageLayout PEImage::GetLayout(DWORD imageLayoutMask,DWORD flags) SimpleWriteLockHolder lock(m_pLayoutLock); pRetVal = GetLayoutInternal(imageLayoutMask,flags); } - END_SO_INTOLERANT_CODE; - + return pRetVal; #else @@ -1475,7 +1469,6 @@ BOOL PEImage::IsPtrInImage(PTR_CVOID data) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/vm/peimage.inl b/src/vm/peimage.inl index 2e7fd73..156dae6 100644 --- a/src/vm/peimage.inl +++ b/src/vm/peimage.inl @@ -29,7 +29,6 @@ inline ULONG PEImage::AddRef() inline const SString &PEImage::GetPath() { LIMITED_METHOD_DAC_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return m_path; } @@ -37,7 +36,6 @@ inline const SString &PEImage::GetPath() inline void PEImage::SetModuleFileNameHintForDAC() { LIMITED_METHOD_DAC_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; // Grab module name only for triage dumps where full paths are excluded // because may contain PII data. diff --git a/src/vm/peimagelayout.inl b/src/vm/peimagelayout.inl index f9a5215..5153d14 100644 --- a/src/vm/peimagelayout.inl +++ b/src/vm/peimagelayout.inl @@ -106,7 +106,6 @@ inline BOOL PEImageLayout::CompareBase(UPTR base, UPTR mapping) { PRECONDITION(CheckPointer((PEImageLayout *)mapping)); PRECONDITION(CheckPointer((PEImageLayout *)(base<<1),NULL_OK)); - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_ANY; diff --git a/src/vm/precode.cpp b/src/vm/precode.cpp index 649fd1d..f0e005a 100644 --- a/src/vm/precode.cpp +++ b/src/vm/precode.cpp @@ -110,7 +110,6 @@ MethodDesc* Precode::GetMethodDesc(BOOL fSpeculative /*= FALSE*/) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -167,7 +166,6 @@ BOOL Precode::IsCorrectMethodDesc(MethodDesc * pMD) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -198,7 +196,6 @@ BOOL Precode::IsPointingToPrestub(PCODE target) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -234,7 +231,6 @@ PCODE Precode::TryToSkipFixupPrecode(PCODE addr) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; PCODE pTarget = NULL; diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index 5c08bec..f1d4851 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -280,7 +280,6 @@ void DACNotifyCompilationFinished(MethodDesc *methodDesc, PCODE pCode) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_PREEMPTIVE; } CONTRACTL_END; diff --git a/src/vm/profattach.cpp b/src/vm/profattach.cpp index 52c8caf..9064fd9 100644 --- a/src/vm/profattach.cpp +++ b/src/vm/profattach.cpp @@ -62,7 +62,6 @@ HRESULT ProfilingAPIAttachDetach::OverlappedResultHolder::Initialize() { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1161,7 +1160,6 @@ HRESULT CLRProfilingImpl::AttachProfiler(DWORD dwProfileeProcessID, GC_TRIGGERS; MODE_PREEMPTIVE; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/profattachclient.cpp b/src/vm/profattachclient.cpp index a389ec3..4537017 100644 --- a/src/vm/profattachclient.cpp +++ b/src/vm/profattachclient.cpp @@ -62,10 +62,6 @@ extern "C" HRESULT STDMETHODCALLTYPE AttachProfiler( GC_TRIGGERS; MODE_PREEMPTIVE; CAN_TAKE_LOCK; - - // This is the entrypoint into the EE by a trigger process. As such, this - // is profiling-specific and not considered mainline EE code. - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/profilingenumerators.cpp b/src/vm/profilingenumerators.cpp index 14305bd..0b41bff 100644 --- a/src/vm/profilingenumerators.cpp +++ b/src/vm/profilingenumerators.cpp @@ -45,7 +45,6 @@ BOOL ProfilerFunctionEnum::Init(BOOL fWithReJITIDs) // reader lock to prevent things from changing while reading... CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; EEJitManager::CodeHeapIterator heapIterator; @@ -166,8 +165,6 @@ HRESULT IterateAppDomains(CallbackObject * callbackObj, MODE_ANY; CAN_TAKE_LOCK; // (See comments in code:ProfToEEInterfaceImpl::EnumModules for info about contracts.) - - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -475,7 +472,6 @@ HRESULT ProfilerModuleEnum::Init() CAN_TAKE_LOCK; // (See comments in code:ProfToEEInterfaceImpl::EnumModules for info about contracts.) - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -533,7 +529,6 @@ HRESULT IterateAppDomainContainingModule::AddAppDomainContainingModule(AppDomain GC_TRIGGERS; MODE_ANY; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -571,7 +566,6 @@ HRESULT IterateAppDomainContainingModule::PopulateArray() GC_TRIGGERS; MODE_ANY; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -600,7 +594,6 @@ HRESULT ProfilerThreadEnum::Init() GC_NOTRIGGER; MODE_ANY; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/profilingenumerators.h b/src/vm/profilingenumerators.h index 479345c..e10d5e6 100644 --- a/src/vm/profilingenumerators.h +++ b/src/vm/profilingenumerators.h @@ -318,7 +318,6 @@ ProfilerEnum< EnumInterface, Element >::GetCount(ULONG* count) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -363,7 +362,6 @@ ProfilerEnum< EnumInterface, Element >::Skip(ULONG count) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -403,7 +401,6 @@ ProfilerEnum< EnumInterface, Element >::Reset() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -436,7 +433,6 @@ ProfilerEnum< EnumInterface, Element >::Clone(EnumInterface** pInterface) GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/profilinghelper.cpp b/src/vm/profilinghelper.cpp index 8452eb8..ba410b1 100644 --- a/src/vm/profilinghelper.cpp +++ b/src/vm/profilinghelper.cpp @@ -165,7 +165,6 @@ BOOL CORProfilerBypassSecurityChecks() NOTHROW; GC_NOTRIGGER; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/profilinghelper.inl b/src/vm/profilinghelper.inl index b195a31..5fda04c 100644 --- a/src/vm/profilinghelper.inl +++ b/src/vm/profilinghelper.inl @@ -38,7 +38,6 @@ FORCEINLINE SetCallbackStateFlagsHolder::~SetCallbackStateFlagsHolder() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -112,7 +111,6 @@ inline void ProfilingAPIUtility::LogNoInterfaceError(REFIID iidRequested, LPCWST { THROWS; GC_TRIGGERS; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -236,7 +234,6 @@ FORCEINLINE void ProfilingAPIUtility::IncEvacuationCounter(Thread * pThread) FORBID_FAULT; MODE_ANY; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -263,7 +260,6 @@ FORCEINLINE void ProfilingAPIUtility::DecEvacuationCounter(Thread * pThread) FORBID_FAULT; MODE_ANY; CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp index 0438bd0..f1cf224 100644 --- a/src/vm/proftoeeinterfaceimpl.cpp +++ b/src/vm/proftoeeinterfaceimpl.cpp @@ -45,7 +45,6 @@ // GC_NOTRIGGER // MODE_ANY // CANNOT_TAKE_LOCK -// SO_NOT_MAINLINE // (EE_THREAD_(NOT)_REQUIRED are unenforced and are thus optional. If you wish // to specify these, EE_THREAD_NOT_REQUIRED is preferred.) // Note that the preferred contracts in this file are DIFFERENT than the preferred @@ -331,7 +330,6 @@ static ClassID NonGenericTypeHandleToClassID(TypeHandle th) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -510,7 +508,6 @@ void * STDMETHODCALLTYPE ModuleILHeap::Alloc(ULONG cb) // Yay! MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1106,7 +1103,6 @@ bool HeapWalkHelper(Object * pBO, void * pvContext) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1273,7 +1269,6 @@ void ScanRootsHelper(Object* pObj, Object ** ppRoot, ScanContext *pSC, uint32_t { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1467,7 +1462,6 @@ HRESULT ProfToEEInterfaceImpl::SetEventMask(DWORD dwEventMask) CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1500,7 +1494,6 @@ HRESULT ProfToEEInterfaceImpl::SetEventMask2(DWORD dwEventsLow, DWORD dwEventsHi CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1535,7 +1528,6 @@ HRESULT ProfToEEInterfaceImpl::GetHandleFromThread(ThreadID threadId, HANDLE *ph // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1582,7 +1574,6 @@ HRESULT ProfToEEInterfaceImpl::GetObjectSize(ObjectID objectId, ULONG *pcSize) // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1647,7 +1638,6 @@ HRESULT ProfToEEInterfaceImpl::GetObjectSize2(ObjectID objectId, SIZE_T *pcSize) // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1710,7 +1700,6 @@ HRESULT ProfToEEInterfaceImpl::IsArrayClass( // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1833,7 +1822,6 @@ HRESULT ProfToEEInterfaceImpl::GetThreadInfo(ThreadID threadId, DWORD *pdwWin32T // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1875,7 +1863,6 @@ HRESULT ProfToEEInterfaceImpl::GetCurrentThreadID(ThreadID *pThreadId) // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -1927,7 +1914,6 @@ HRESULT GetFunctionInfoInternal(LPCBYTE ip, EECodeInfo * pCodeInfo) CAN_TAKE_LOCK; CANNOT_RETAKE_LOCK; - SO_NOT_MAINLINE; // If this is called asynchronously (from a hijacked thread, as with F1), it must not re-enter the // host (SQL). Corners will be cut to ensure this is the case @@ -1976,7 +1962,6 @@ HRESULT GetFunctionFromIPInternal(LPCBYTE ip, EECodeInfo * pCodeInfo, BOOL failO MODE_ANY; EE_THREAD_NOT_REQUIRED; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2027,7 +2012,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromIP(LPCBYTE ip, FunctionID * pFunct // this function was called. CANNOT_RETAKE_LOCK; - SO_NOT_MAINLINE; // If this is called asynchronously (from a hijacked thread, as with F1), it must not re-enter the // host (SQL). Corners will be cut to ensure this is the case @@ -2089,7 +2073,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromIP2(LPCBYTE ip, FunctionID * pFunc // Grabbing the rejitid requires entering the rejit manager's hash table & lock, CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2154,7 +2137,6 @@ HRESULT ProfToEEInterfaceImpl::GetTokenAndMetaDataFromFunction( // PEFile::GetRWImporter and GetReadablePublicMetaDataInterface take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2256,7 +2238,6 @@ HRESULT GetCodeInfoFromCodeStart( // appropriate jit manager. CAN_TAKE_LOCK; - SO_NOT_MAINLINE; // If this is called asynchronously (from a hijacked thread, as with F1), it must not re-enter the // host (SQL). Corners will be cut to ensure this is the case @@ -2415,7 +2396,6 @@ HRESULT ProfToEEInterfaceImpl::GetCodeInfo(FunctionID functionId, LPCBYTE * pSta // (See locking contract comment in GetCodeInfoHelper.) CANNOT_RETAKE_LOCK; - SO_NOT_MAINLINE; // If this is called asynchronously (from a hijacked thread, as with F1), it must not re-enter the // host (SQL). Corners will be cut to ensure this is the case @@ -2502,7 +2482,6 @@ HRESULT ProfToEEInterfaceImpl::GetCodeInfo2(FunctionID functionId, // (See locking contract comment in GetCodeInfoHelper.) CANNOT_RETAKE_LOCK; - SO_NOT_MAINLINE; // If this is called asynchronously (from a hijacked thread, as with F1), it must not re-enter the // host (SQL). Corners will be cut to ensure this is the case @@ -2570,7 +2549,6 @@ HRESULT ProfToEEInterfaceImpl::GetCodeInfo3(FunctionID functionId, // We need to access the rejitmanager, which means taking locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pcCodeInfos, NULL_OK)); PRECONDITION(CheckPointer(codeInfos, NULL_OK)); @@ -2645,7 +2623,6 @@ HRESULT ProfToEEInterfaceImpl::GetEventMask(DWORD * pdwEvents) // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2683,7 +2660,6 @@ HRESULT ProfToEEInterfaceImpl::GetEventMask2(DWORD *pdwEventsLow, DWORD *pdwEven // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2710,7 +2686,6 @@ void ProfToEEInterfaceImpl::MethodTableCallback(void* context, void* objectUNSAF { NOTHROW; GC_NOTRIGGER; - SO_NOT_MAINLINE; MODE_ANY; } CONTRACTL_END; @@ -2749,7 +2724,6 @@ HRESULT ProfToEEInterfaceImpl::EnumModuleFrozenObjects(ModuleID moduleID, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2812,7 +2786,6 @@ HRESULT ProfToEEInterfaceImpl::GetArrayObjectInfo(ObjectID objectId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2877,7 +2850,6 @@ HRESULT ProfToEEInterfaceImpl::GetArrayObjectInfoHelper(Object * pObj, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -2940,7 +2912,6 @@ HRESULT ProfToEEInterfaceImpl::GetBoxClassLayout(ClassID classId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3002,7 +2973,6 @@ HRESULT ProfToEEInterfaceImpl::GetThreadAppDomain(ThreadID threadId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3078,7 +3048,6 @@ HRESULT ProfToEEInterfaceImpl::GetRVAStaticAddress(ClassID classId, // FieldDesc::GetStaticAddress takes a lock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3204,7 +3173,6 @@ HRESULT ProfToEEInterfaceImpl::GetAppDomainStaticAddress(ClassID classId, // FieldDesc::GetStaticAddress & FieldDesc::GetBaseInDomain take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3351,7 +3319,6 @@ HRESULT ProfToEEInterfaceImpl::GetThreadStaticAddress(ClassID classId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3428,7 +3395,6 @@ HRESULT ProfToEEInterfaceImpl::GetThreadStaticAddress2(ClassID classId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3559,7 +3525,6 @@ HRESULT ProfToEEInterfaceImpl::GetContextStaticAddress(ClassID classId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3614,7 +3579,6 @@ HRESULT ProfToEEInterfaceImpl::GetAppDomainsContainingModule(ModuleID moduleId, // (See comment above GC_TRIGGERS.) CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3694,7 +3658,6 @@ HRESULT ProfToEEInterfaceImpl::GetStaticFieldInfo(ClassID classId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -3801,7 +3764,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassIDInfo2(ClassID classId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pParentClassId, NULL_OK)); PRECONDITION(CheckPointer(pModuleId, NULL_OK)); @@ -3972,7 +3934,6 @@ HRESULT ProfToEEInterfaceImpl::GetModuleInfo(ModuleID moduleId, // Yay! EE_THREAD_NOT_REQUIRED; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer((Module *)moduleId, NULL_OK)); PRECONDITION(CheckPointer(ppBaseLoadAddress, NULL_OK)); @@ -4119,7 +4080,6 @@ HRESULT ProfToEEInterfaceImpl::GetModuleInfo2(ModuleID moduleId, // Yay! EE_THREAD_NOT_REQUIRED; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer((Module *)moduleId, NULL_OK)); PRECONDITION(CheckPointer(ppBaseLoadAddress, NULL_OK)); @@ -4278,7 +4238,6 @@ HRESULT ProfToEEInterfaceImpl::GetModuleMetaData(ModuleID moduleId, // GetReadablePublicMetaDataInterface take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4368,7 +4327,6 @@ HRESULT ProfToEEInterfaceImpl::GetILFunctionBody(ModuleID moduleId, // PEFile::CheckLoaded & Module::GetDynamicIL both take a lock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4498,7 +4456,6 @@ HRESULT ProfToEEInterfaceImpl::GetILFunctionBodyAllocator(ModuleID modul // (see GC_TRIGGERS comment) CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4553,7 +4510,6 @@ HRESULT ProfToEEInterfaceImpl::SetILFunctionBody(ModuleID moduleId, // Module::SetDynamicIL & PEFile::CheckLoaded & PEFile::GetEmitter take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4624,7 +4580,6 @@ HRESULT ProfToEEInterfaceImpl::SetILInstrumentedCodeMap(FunctionID functionId, // Debugger::SetILInstrumentedCodeMap takes a lock when it calls Debugger::GetOrCreateMethodInfo CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4698,7 +4653,6 @@ HRESULT ProfToEEInterfaceImpl::ForceGC() // mother of all locks: the thread store lock. CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4790,7 +4744,6 @@ HRESULT ProfToEEInterfaceImpl::GetThreadContext(ThreadID threadId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4844,7 +4797,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassIDInfo(ClassID classId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -4944,7 +4896,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionInfo(FunctionID functionId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5025,7 +4976,6 @@ HRESULT ProfToEEInterfaceImpl::GetILToNativeMapping(FunctionID functionId, // Debugger::AcquireDebuggerLock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5062,7 +5012,6 @@ HRESULT ProfToEEInterfaceImpl::GetILToNativeMapping2(FunctionID functionId, // Debugger::AcquireDebuggerLock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5152,7 +5101,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassFromObject(ObjectID objectId, // Object::GetTypeHandle takes a lock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5207,7 +5155,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassFromToken(ModuleID moduleId, // ClassLoader::LoadTypeDefOrRefThrowing takes a lock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5304,7 +5251,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassFromTokenAndTypeArgs(ModuleID moduleID, // ClassLoader::LoadGenericInstantiationThrowing takes a lock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5443,7 +5389,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromToken(ModuleID moduleId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5535,7 +5480,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromTokenAndTypeArgs(ModuleID moduleID // MethodDesc::FindOrCreateAssociatedMethodDesc enters a Crst CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5649,7 +5593,6 @@ HRESULT ProfToEEInterfaceImpl::GetAppDomainInfo(AppDomainID appDomainId, // AppDomain::GetFriendlyNameForDebugger takes a lock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5762,7 +5705,6 @@ HRESULT ProfToEEInterfaceImpl::GetAssemblyInfo(AssemblyID assemblyId, // PEAssembly::GetSimpleName() enters a lock via use of the metadata interface CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5865,7 +5807,6 @@ HRESULT ProfToEEInterfaceImpl::SetEnterLeaveFunctionHooks(FunctionEnter * pFuncE CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5902,7 +5843,6 @@ HRESULT ProfToEEInterfaceImpl::SetEnterLeaveFunctionHooks2(FunctionEnter2 * pFun CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5940,7 +5880,6 @@ HRESULT ProfToEEInterfaceImpl::SetEnterLeaveFunctionHooks3(FunctionEnter3 * pFun CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -5981,7 +5920,6 @@ HRESULT ProfToEEInterfaceImpl::SetEnterLeaveFunctionHooks3WithInfo(FunctionEnter CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6020,7 +5958,6 @@ HRESULT ProfToEEInterfaceImpl::SetFunctionIDMapper(FunctionIDMapper *pFunc) // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6053,7 +5990,6 @@ HRESULT ProfToEEInterfaceImpl::SetFunctionIDMapper2(FunctionIDMapper2 *pFunc, vo // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6122,7 +6058,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionInfo2(FunctionID funcId, // this function was called. CANNOT_RETAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pClassId, NULL_OK)); PRECONDITION(CheckPointer(pModuleId, NULL_OK)); @@ -6342,7 +6277,6 @@ HRESULT ProfToEEInterfaceImpl::IsFunctionDynamic(FunctionID functionId, BOOL *is // this function was called. CANNOT_RETAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(isDynamic, NULL_OK)); } @@ -6418,7 +6352,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromIP3(LPCBYTE ip, FunctionID * pFunc // Grabbing the rejitid requires entering the rejit manager's hash table & lock, CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6500,7 +6433,6 @@ HRESULT ProfToEEInterfaceImpl::GetDynamicFunctionInfo(FunctionID functionId, // this function was called. CANNOT_RETAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pModuleId, NULL_OK)); PRECONDITION(CheckPointer(ppvSig, NULL_OK)); @@ -6628,7 +6560,6 @@ HRESULT ProfToEEInterfaceImpl::GetNativeCodeStartAddresses(FunctionID functionID EE_THREAD_NOT_REQUIRED; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pcCodeStartAddresses, NULL_OK)); PRECONDITION(CheckPointer(codeStartAddresses, NULL_OK)); @@ -6730,7 +6661,6 @@ HRESULT ProfToEEInterfaceImpl::GetILToNativeMapping3(UINT_PTR pNativeCodeStartAd MODE_ANY; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pcMap, NULL_OK)); PRECONDITION(CheckPointer(map, NULL_OK)); @@ -6796,7 +6726,6 @@ HRESULT ProfToEEInterfaceImpl::GetCodeInfo4(UINT_PTR pNativeCodeStartAddress, EE_THREAD_NOT_REQUIRED; CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pcCodeInfos, NULL_OK)); PRECONDITION(CheckPointer(codeInfos, NULL_OK)); @@ -6855,7 +6784,6 @@ HRESULT ProfToEEInterfaceImpl::GetStringLayout(ULONG *pBufferLengthOffset, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pBufferLengthOffset, NULL_OK)); PRECONDITION(CheckPointer(pStringLengthOffset, NULL_OK)); @@ -6903,7 +6831,6 @@ HRESULT ProfToEEInterfaceImpl::GetStringLayout2(ULONG *pStringLengthOffset, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pStringLengthOffset, NULL_OK)); PRECONDITION(CheckPointer(pBufferOffset, NULL_OK)); @@ -6953,7 +6880,6 @@ HRESULT ProfToEEInterfaceImpl::GetStringLayoutHelper(ULONG *pBufferLengthOffset, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pBufferLengthOffset, NULL_OK)); PRECONDITION(CheckPointer(pStringLengthOffset, NULL_OK)); @@ -7023,7 +6949,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassLayout(ClassID classID, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(rFieldOffset, NULL_OK)); PRECONDITION(CheckPointer(pcFieldOffset)); @@ -7176,7 +7101,6 @@ StackWalkAction ProfilerStackWalkCallback(CrawlFrame *pCf, PROFILER_STACK_WALK_D { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; // throw is RIGHT out... the throw at minimum allocates the thrown object which we *must* not do GC_NOTRIGGER; // the stack is not necessarily crawlable at this state !!!) we must not induce a GC } @@ -7723,7 +7647,6 @@ HRESULT ProfToEEInterfaceImpl::DoStackSnapshot(ThreadID thread, // this function was called. CANNOT_RETAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -8265,7 +8188,6 @@ HRESULT ProfToEEInterfaceImpl::GetGenerationBounds(ULONG cObjectRanges, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pcObjectRanges)); PRECONDITION(cObjectRanges <= 0 || ranges != NULL); @@ -8322,7 +8244,6 @@ HRESULT ProfToEEInterfaceImpl::GetNotifiedExceptionClauseInfo(COR_PRF_EX_CLAUSE_ // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pinfo)); } @@ -8396,7 +8317,6 @@ HRESULT ProfToEEInterfaceImpl::GetObjectGeneration(ObjectID objectId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(objectId != NULL); PRECONDITION(CheckPointer(range)); @@ -8464,7 +8384,6 @@ HRESULT ProfToEEInterfaceImpl::GetReJITIDs( // The rejit tables use a lock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(pcReJitIds, NULL_OK)); PRECONDITION(CheckPointer(reJitIds, NULL_OK)); @@ -8512,7 +8431,6 @@ HRESULT ProfToEEInterfaceImpl::RequestReJIT(ULONG cFunctions, // in // We need to suspend the runtime, this takes a lot of locks! CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(moduleIds, NULL_OK)); PRECONDITION(CheckPointer(methodIds, NULL_OK)); @@ -8568,7 +8486,6 @@ HRESULT ProfToEEInterfaceImpl::RequestRevert(ULONG cFunctions, // in // The rejit manager requires a lock to iterate through methods to revert CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(moduleIds, NULL_OK)); PRECONDITION(CheckPointer(methodIds, NULL_OK)); @@ -8625,7 +8542,6 @@ HRESULT ProfToEEInterfaceImpl::EnumJITedFunctions(ICorProfilerFunctionEnum ** pp // the JIT data structures. CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(ppEnum, NULL_OK)); @@ -8680,7 +8596,6 @@ HRESULT ProfToEEInterfaceImpl::EnumJITedFunctions2(ICorProfilerFunctionEnum ** p // Gathering RejitIDs also takes a lock. CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(ppEnum, NULL_OK)); @@ -8738,7 +8653,6 @@ HRESULT ProfToEEInterfaceImpl::EnumModules(ICorProfilerModuleEnum ** ppEnum) // (See comment above GC_TRIGGERS.) CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(ppEnum, NULL_OK)); @@ -8812,7 +8726,6 @@ HRESULT ProfToEEInterfaceImpl::GetRuntimeInformation(USHORT * pClrInstanceId, // Yay! CANNOT_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -8875,8 +8788,6 @@ HRESULT ProfToEEInterfaceImpl::RequestProfilerDetach(DWORD dwExpectedCompletionM // Crst is used in ProfilingAPIDetach::RequestProfilerDetach CAN_TAKE_LOCK; - - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -8951,7 +8862,6 @@ HRESULT ProfilingGetFunctionEnter3Info(FunctionID functionId, // ProfileArgIterator::ProfileArgIterator may take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9093,7 +9003,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionEnter3Info(FunctionID functionId, // ProfilingGetFunctionEnter3Info may take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9148,7 +9057,6 @@ HRESULT ProfilingGetFunctionLeave3Info(FunctionID functionId, // ProfileArgIterator::ProfileArgIterator may take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9253,7 +9161,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionLeave3Info(FunctionID functionId, // ProfilingGetFunctionLeave3Info may take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9306,7 +9213,6 @@ HRESULT ProfilingGetFunctionTailcall3Info(FunctionID functionId, // ProfileArgIterator::ProfileArgIterator may take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9387,7 +9293,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionTailcall3Info(FunctionID functionId, // ProfilingGetFunctionTailcall3Info may take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9424,7 +9329,6 @@ HRESULT ProfToEEInterfaceImpl::EnumThreads( // Need to acquire the thread store lock CAN_TAKE_LOCK; - SO_NOT_MAINLINE; PRECONDITION(CheckPointer(ppEnum, NULL_OK)); @@ -9486,7 +9390,6 @@ HRESULT ProfToEEInterfaceImpl::InitializeCurrentThread() // May take thread store lock and OS APIs may also take locks CAN_TAKE_LOCK; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9531,7 +9434,6 @@ HRESULT ProfToEEInterfaceImpl::EnumNgenModuleMethodsInliningThisMethod( NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_NOT_MAINLINE; CAN_TAKE_LOCK; PRECONDITION(CheckPointer(ppEnum)); } @@ -9619,7 +9521,6 @@ HRESULT ProfToEEInterfaceImpl::GetInMemorySymbolsLength( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9688,7 +9589,6 @@ HRESULT ProfToEEInterfaceImpl::ReadInMemorySymbols( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9763,7 +9663,6 @@ HRESULT ProfToEEInterfaceImpl::ApplyMetaData( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -9810,7 +9709,6 @@ void __stdcall ProfilerManagedToUnmanagedTransitionMD(MethodDesc *pMD, NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -9846,7 +9744,6 @@ void __stdcall ProfilerUnmanagedToManagedTransitionMD(MethodDesc *pMD, NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -10100,7 +9997,6 @@ HCIMPL2(EXTERN_C void, ProfileEnter, UINT_PTR clientData, void * platformSpecifi { FunctionIDOrClientID functionIDOrClientID; functionIDOrClientID.clientID = clientData; - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetEnter3WithInfoHook()( functionIDOrClientID, (COR_PRF_ELT_INFO)&eltInfo); @@ -10130,7 +10026,6 @@ HCIMPL2(EXTERN_C void, ProfileEnter, UINT_PTR clientData, void * platformSpecifi // if (CORProfilerELT2FastPathEnterEnabled()) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetEnter2Hook()( functionId, clientData, @@ -10187,7 +10082,6 @@ HCIMPL2(EXTERN_C void, ProfileEnter, UINT_PTR clientData, void * platformSpecifi HRESULT hr = ProfilingGetFunctionEnter3Info(functionId, (COR_PRF_ELT_INFO)&eltInfo, &frameInfo, &ulArgInfoSize, pArgumentInfo); _ASSERTE(hr == S_OK); - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetEnter2Hook()(functionId, clientData, frameInfo, pArgumentInfo); goto LExit; @@ -10212,7 +10106,6 @@ HCIMPL2(EXTERN_C void, ProfileEnter, UINT_PTR clientData, void * platformSpecifi // Everett ELT // { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetEnterHook()((FunctionID)clientData); } @@ -10276,7 +10169,6 @@ HCIMPL2(EXTERN_C void, ProfileLeave, UINT_PTR clientData, void * platformSpecifi { FunctionIDOrClientID functionIDOrClientID; functionIDOrClientID.clientID = clientData; - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetLeave3WithInfoHook()( functionIDOrClientID, (COR_PRF_ELT_INFO)&eltInfo); @@ -10306,7 +10198,6 @@ HCIMPL2(EXTERN_C void, ProfileLeave, UINT_PTR clientData, void * platformSpecifi // if (CORProfilerELT2FastPathLeaveEnabled()) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetLeave2Hook()( functionId, clientData, @@ -10324,7 +10215,6 @@ HCIMPL2(EXTERN_C void, ProfileLeave, UINT_PTR clientData, void * platformSpecifi HRESULT hr = ProfilingGetFunctionLeave3Info(functionId, (COR_PRF_ELT_INFO)&eltInfo, &frameInfo, &argumentRange); _ASSERTE(hr == S_OK); - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetLeave2Hook()(functionId, clientData, frameInfo, &argumentRange); goto LExit; } @@ -10347,7 +10237,6 @@ HCIMPL2(EXTERN_C void, ProfileLeave, UINT_PTR clientData, void * platformSpecifi // Everett ELT // { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetLeaveHook()((FunctionID)clientData); } @@ -10412,7 +10301,6 @@ HCIMPL2(EXTERN_C void, ProfileTailcall, UINT_PTR clientData, void * platformSpec { FunctionIDOrClientID functionIDOrClientID; functionIDOrClientID.clientID = clientData; - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetTailcall3WithInfoHook()( functionIDOrClientID, (COR_PRF_ELT_INFO)&eltInfo); @@ -10442,7 +10330,6 @@ HCIMPL2(EXTERN_C void, ProfileTailcall, UINT_PTR clientData, void * platformSpec // if (CORProfilerELT2FastPathTailcallEnabled()) { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetTailcall2Hook()( functionId, clientData, @@ -10458,7 +10345,6 @@ HCIMPL2(EXTERN_C void, ProfileTailcall, UINT_PTR clientData, void * platformSpec HRESULT hr = ProfilingGetFunctionTailcall3Info(functionId, (COR_PRF_ELT_INFO)&eltInfo, &frameInfo); _ASSERTE(hr == S_OK); - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; g_profControlBlock.pProfInterface->GetTailcall2Hook()(functionId, clientData, frameInfo); goto LExit; } @@ -10480,10 +10366,7 @@ HCIMPL2(EXTERN_C void, ProfileTailcall, UINT_PTR clientData, void * platformSpec // // Everett ELT // - { - REMOVE_STACK_GUARD_FOR_PROFILER_CALL; - g_profControlBlock.pProfInterface->GetTailcallHook()((FunctionID)clientData); - } + g_profControlBlock.pProfInterface->GetTailcallHook()((FunctionID)clientData); LExit: diff --git a/src/vm/proftoeeinterfaceimpl.inl b/src/vm/proftoeeinterfaceimpl.inl index a2334a2..376fad2 100644 --- a/src/vm/proftoeeinterfaceimpl.inl +++ b/src/vm/proftoeeinterfaceimpl.inl @@ -50,7 +50,6 @@ inline BOOL AreCallbackStateFlagsSet(DWORD dwFlags) MODE_ANY; CANNOT_TAKE_LOCK; EE_THREAD_NOT_REQUIRED; - SO_NOT_MAINLINE; } CONTRACTL_END; diff --git a/src/vm/qcall.h b/src/vm/qcall.h index ccf4c06..3ad328a 100644 --- a/src/vm/qcall.h +++ b/src/vm/qcall.h @@ -82,7 +82,7 @@ // // BOOL QCALLTYPE FooNative::Bar(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString) // { -// // All QCalls should have QCALL_CONTRACT. It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; SO_TOLERANT. +// // All QCalls should have QCALL_CONTRACT. It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE. // QCALL_CONTRACT; // // // Optionally, use QCALL_CHECK instead and the expanded form of the contract if you want to specify preconditions: @@ -132,20 +132,10 @@ UNINSTALL_UNWIND_AND_CONTINUE_HANDLER \ UNINSTALL_MANAGED_EXCEPTION_DISPATCHER -#define BEGIN_QCALL_SO_TOLERANT \ - INSTALL_MANAGED_EXCEPTION_DISPATCHER \ - INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE - -#define END_QCALL_SO_TOLERANT \ - UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE \ - UNINSTALL_MANAGED_EXCEPTION_DISPATCHER - - #define QCALL_CHECK \ THROWS; \ GC_TRIGGERS; \ MODE_PREEMPTIVE; \ - SO_TOLERANT; \ #define QCALL_CONTRACT CONTRACTL { QCALL_CHECK; } CONTRACTL_END; @@ -185,7 +175,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/readytoruninfo.cpp b/src/vm/readytoruninfo.cpp index 7c110c6..378ce2a 100644 --- a/src/vm/readytoruninfo.cpp +++ b/src/vm/readytoruninfo.cpp @@ -25,7 +25,6 @@ IMAGE_DATA_DIRECTORY * ReadyToRunInfo::FindSection(DWORD type) { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -49,7 +48,6 @@ MethodDesc * ReadyToRunInfo::GetMethodDescForEntryPoint(PCODE entryPoint) { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -73,7 +71,6 @@ BOOL ReadyToRunInfo::HasHashtableOfTypes() { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -87,7 +84,6 @@ BOOL ReadyToRunInfo::TryLookupTypeTokenFromName(NameHandle *pName, mdToken * pFo { GC_NOTRIGGER; NOTHROW; - SO_INTOLERANT; SUPPORTS_DAC; PRECONDITION(!m_availableTypesHashtable.IsNull()); } @@ -223,7 +219,6 @@ BOOL ReadyToRunInfo::GetTypeNameFromToken(IMDInternalImport * pImport, mdToken m { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; SUPPORTS_DAC; PRECONDITION(TypeFromToken(mdType) == mdtTypeDef || TypeFromToken(mdType) == mdtTypeRef || TypeFromToken(mdType) == mdtExportedType); } @@ -248,7 +243,6 @@ BOOL ReadyToRunInfo::GetEnclosingToken(IMDInternalImport * pImport, mdToken mdTy { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; SUPPORTS_DAC; PRECONDITION(TypeFromToken(mdType) == mdtTypeDef || TypeFromToken(mdType) == mdtTypeRef || TypeFromToken(mdType) == mdtExportedType); } @@ -277,7 +271,6 @@ BOOL ReadyToRunInfo::CompareTypeNameOfTokens(mdToken mdToken1, IMDInternalImport { GC_NOTRIGGER; NOTHROW; - SO_TOLERANT; SUPPORTS_DAC; PRECONDITION(TypeFromToken(mdToken1) == mdtTypeDef || TypeFromToken(mdToken1) == mdtTypeRef || TypeFromToken(mdToken1) == mdtExportedType); PRECONDITION(TypeFromToken(mdToken2) == mdtTypeDef || TypeFromToken(mdToken2) == mdtExportedType); diff --git a/src/vm/reflectioninvocation.cpp b/src/vm/reflectioninvocation.cpp index 7ff6ea6..7f3ad70 100644 --- a/src/vm/reflectioninvocation.cpp +++ b/src/vm/reflectioninvocation.cpp @@ -37,7 +37,6 @@ static TypeHandle NullableTypeOfByref(TypeHandle th) { { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -527,6 +526,7 @@ FCIMPL6(Object*, RuntimeTypeHandle::CreateInstance, ReflectClassBaseObject* refT } } DoneCreateInstance: + ; HELPER_METHOD_FRAME_END(); return OBJECTREFToObject(rv); } @@ -1040,10 +1040,6 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod, Thread * pThread = GET_THREAD(); - // Make sure we have enough room on the stack for this. Note that we will need the stack amount twice - once to build the stack - // and second time to actually make the call. - INTERIOR_STACK_PROBE_FOR(pThread, 1 + static_cast((2 * nAllocaSize) / GetOsPageSize()) + static_cast(HOLDER_CODE_NORMAL_STACK_LIMIT)); - LPBYTE pAlloc = (LPBYTE)_alloca(nAllocaSize); LPBYTE pTransitionBlock = pAlloc + TransitionBlock::GetNegSpaceSize(); @@ -1394,10 +1390,10 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod, if (pProtectValueClassFrame != NULL) pProtectValueClassFrame->Pop(pThread); - END_INTERIOR_STACK_PROBE; } Done: + ; HELPER_METHOD_FRAME_END(); return OBJECTREFToObject(gc.retVal); @@ -2189,14 +2185,9 @@ void ExecuteCodeWithGuaranteedCleanupHelper (ECWGC_GC *gc) } PAL_ENDTRY; -#ifdef FEATURE_STACK_PROBE - if (param.fStackOverflow) - COMPlusThrowSO(); -#else //This will not be set as clr to managed transition code will terminate the //process if there is an SO before SODetectionFilter() is called. _ASSERTE(!param.fStackOverflow); -#endif } // diff --git a/src/vm/runtimecallablewrapper.cpp b/src/vm/runtimecallablewrapper.cpp index 6280c2c..83f246e 100644 --- a/src/vm/runtimecallablewrapper.cpp +++ b/src/vm/runtimecallablewrapper.cpp @@ -4548,7 +4548,6 @@ TypeHandle::CastResult RCW::SupportsWinRTInteropInterfaceNoGC(MethodTable *pItfM NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/runtimecallablewrapper.h b/src/vm/runtimecallablewrapper.h index c88230d..6154a32 100644 --- a/src/vm/runtimecallablewrapper.h +++ b/src/vm/runtimecallablewrapper.h @@ -752,7 +752,6 @@ struct RCW NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; POSTCONDITION(CheckPointer(RETVAL)); } CONTRACT_END; @@ -1357,7 +1356,6 @@ public : { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACT_END; diff --git a/src/vm/runtimehandles.cpp b/src/vm/runtimehandles.cpp index b41026f..dda5d1d 100644 --- a/src/vm/runtimehandles.cpp +++ b/src/vm/runtimehandles.cpp @@ -19,7 +19,6 @@ #include "codeman.h" #include "corhlpr.h" #include "jitinterface.h" -#include "stackprobe.h" #include "eeconfig.h" #include "eehash.h" #include "interoputil.h" @@ -517,12 +516,8 @@ FCIMPL1(ReflectModuleBaseObject*, RuntimeTypeHandle::GetModule, ReflectClassBase if (refType == NULL) FCThrowRes(kArgumentNullException, W("Arg_InvalidHandle")); - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException)); - result = refType->GetType().GetModule(); - END_SO_INTOLERANT_CODE; - FC_RETURN_MODULE_OBJECT(result, refType); } FCIMPLEND @@ -1239,7 +1234,6 @@ FCIMPL1(ReflectClassBaseObject*, RuntimeTypeHandle::GetDeclaringType, ReflectCla MethodTable* pMT = NULL; mdTypeDef tkTypeDef = mdTokenNil; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException)); if (typeHandle.IsTypeDesc()) { if (typeHandle.IsGenericVariable()) { @@ -1323,8 +1317,6 @@ FCIMPL1(ReflectClassBaseObject*, RuntimeTypeHandle::GetDeclaringType, ReflectCla } Exit: - END_SO_INTOLERANT_CODE; - if (fThrowException) { FCThrowRes(reKind, argName); @@ -1785,11 +1777,7 @@ FCIMPL1(INT32, RuntimeMethodHandle::GetAttributes, MethodDesc *pMethod) { if (!pMethod) FCThrowRes(kArgumentNullException, W("Arg_InvalidHandle")); - INT32 retVal = 0; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException)); - retVal = (INT32)pMethod->GetAttrs(); - END_SO_INTOLERANT_CODE; - return retVal; + return (INT32)pMethod->GetAttrs(); } FCIMPLEND @@ -1808,13 +1796,7 @@ FCIMPL1(INT32, RuntimeMethodHandle::GetImplAttributes, ReflectMethodObject *pMet if (IsNilToken(pMethod->GetMemberDef())) return attributes; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException)); - { - attributes = (INT32)pMethod->GetImplAttrs(); - } - END_SO_INTOLERANT_CODE; - - return attributes; + return (INT32)pMethod->GetImplAttrs(); } FCIMPLEND @@ -2576,10 +2558,7 @@ FCIMPL1(FC_BOOL_RET, RuntimeMethodHandle::IsConstructor, MethodDesc *pMethod) } CONTRACTL_END; - BOOL ret = FALSE; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException)); - ret = (BOOL)pMethod->IsClassConstructorOrCtor(); - END_SO_INTOLERANT_CODE; + BOOL ret = (BOOL)pMethod->IsClassConstructorOrCtor(); FC_RETURN_BOOL(ret); } FCIMPLEND @@ -2667,11 +2646,7 @@ FCIMPL1(INT32, RuntimeFieldHandle::GetAttributes, FieldDesc *pField) { if (!pField) FCThrowRes(kArgumentNullException, W("Arg_InvalidHandle")); - INT32 ret = 0; - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException)); - ret = (INT32)pField->GetAttributes(); - END_SO_INTOLERANT_CODE; - return ret; + return (INT32)pField->GetAttributes(); } FCIMPLEND diff --git a/src/vm/safehandle.cpp b/src/vm/safehandle.cpp index 369fbb9..59d622a 100644 --- a/src/vm/safehandle.cpp +++ b/src/vm/safehandle.cpp @@ -247,7 +247,6 @@ void SafeHandle::SetHandle(LPVOID handle) THROWS; MODE_COOPERATIVE; INSTANCE_CHECK; - SO_TOLERANT; } CONTRACTL_END; _ASSERTE(IsFullyInitialized()); diff --git a/src/vm/sha1.cpp b/src/vm/sha1.cpp index 96517b5..6d0784e 100644 --- a/src/vm/sha1.cpp +++ b/src/vm/sha1.cpp @@ -201,7 +201,6 @@ void SHA1Hash::SHA1Init(SHA1_CTX *ctx) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; ctx->nbit_total[0] = ctx->nbit_total[1] = 0; @@ -235,7 +234,6 @@ void SHA1Hash::SHA1Update( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; const BYTE *fresh_data = msg; @@ -323,7 +321,6 @@ void SHA1Hash::SHA1Final( NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; DWORDC nbit0 = ctx->nbit_total[0]; @@ -368,7 +365,6 @@ SHA1Hash::SHA1Hash() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; m_fFinalized = FALSE; @@ -381,7 +377,6 @@ void SHA1Hash::AddData(BYTE *pbData, DWORD cbData) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; if (m_fFinalized) @@ -397,7 +392,6 @@ BYTE *SHA1Hash::GetHash() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; if (m_fFinalized) diff --git a/src/vm/siginfo.cpp b/src/vm/siginfo.cpp index 0a9599e..736e0c7 100644 --- a/src/vm/siginfo.cpp +++ b/src/vm/siginfo.cpp @@ -1090,9 +1090,6 @@ TypeHandle SigPointer::GetTypeHandleThrowing( } else { - // This function is recursive, so it must have an interior probe - INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(10, NO_FORBIDGC_LOADER_USE_ThrowSO();); - #ifdef _DEBUG_IMPL // This verifies that we won't try and load a type // if FORBIDGC_LOADER_USE_ENABLED is true. @@ -1351,10 +1348,6 @@ TypeHandle SigPointer::GetTypeHandleThrowing( if (!ClrSafeInt::multiply(ntypars, sizeof(TypeHandle), dwAllocaSize)) ThrowHR(COR_E_OVERFLOW); - if ((dwAllocaSize/GetOsPageSize()+1) >= 2) - { - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD((10+dwAllocaSize/GetOsPageSize()+1), NO_FORBIDGC_LOADER_USE_ThrowSO();); - } TypeHandle *thisinst = (TypeHandle*) _alloca(dwAllocaSize); // Finally we gather up the type arguments themselves, loading at the level specified for generic arguments @@ -1631,11 +1624,6 @@ TypeHandle SigPointer::GetTypeHandleThrowing( { ThrowHR(COR_E_OVERFLOW); } - - if ((cAllocaSize/GetOsPageSize()+1) >= 2) - { - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD((10+cAllocaSize/GetOsPageSize()+1), NO_FORBIDGC_LOADER_USE_ThrowSO();); - } TypeHandle *retAndArgTypes = (TypeHandle*) _alloca(cAllocaSize); bool fReturnTypeOrParameterNotLoaded = false; @@ -1711,7 +1699,6 @@ TypeHandle SigPointer::GetTypeHandleThrowing( THROW_BAD_FORMAT(BFA_BAD_COMPLUS_SIG, pOrigModule); } - END_INTERIOR_STACK_PROBE; } RETURN thRet; @@ -2389,7 +2376,6 @@ CorElementType SigPointer::PeekElemTypeNormalized(Module* pModule, const SigType if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -2399,7 +2385,6 @@ CorElementType SigPointer::PeekElemTypeNormalized(Module* pModule, const SigType if (type == ELEMENT_TYPE_VALUETYPE) { - BEGIN_SO_INTOLERANT_CODE(GetThread()); { // Everett C++ compiler can generate a TypeRef with RS=0 // without respective TypeDef for unmanaged valuetypes, @@ -2416,7 +2401,6 @@ CorElementType SigPointer::PeekElemTypeNormalized(Module* pModule, const SigType if (pthValueType != NULL) *pthValueType = th; } - END_SO_INTOLERANT_CODE; } return(type); @@ -2436,7 +2420,6 @@ SigPointer::PeekElemTypeClosed( GC_NOTRIGGER; FORBID_FAULT; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END @@ -2522,7 +2505,6 @@ mdTypeRef SigPointer::PeekValueTypeTokenClosed(Module *pModule, const SigTypeCon PRECONDITION(PeekElemTypeClosed(NULL, pTypeContext) == ELEMENT_TYPE_VALUETYPE); FORBID_FAULT; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END @@ -3063,7 +3045,6 @@ BOOL IsTypeDefExternallyVisible(mdToken tk, Module *pModule, DWORD dwAttrClass) NOTHROW; MODE_ANY; GC_NOTRIGGER; - SO_INTOLERANT; } CONTRACTL_END; diff --git a/src/vm/sourceline.cpp b/src/vm/sourceline.cpp index 63d2177..e38b2c4 100644 --- a/src/vm/sourceline.cpp +++ b/src/vm/sourceline.cpp @@ -40,20 +40,16 @@ public: THROWS; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; - BEGIN_SO_INTOLERANT_CODE(GetThread()); if ( (--m_nRefCount) == 0 ) delete this; - END_SO_INTOLERANT_CODE; - + return m_nRefCount; } HRESULT STDMETHODCALLTYPE QueryInterface( REFIID rid, void **ppUnk ) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; if ( ppUnk == NULL ) { return E_INVALIDARG; } @@ -80,7 +76,6 @@ public: BYTE data[]) // really a const struct _IMAGE_DEBUG_DIRECTORY * { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; return S_OK; } diff --git a/src/vm/spinlock.cpp b/src/vm/spinlock.cpp index 26bfddf..c41cd29 100644 --- a/src/vm/spinlock.cpp +++ b/src/vm/spinlock.cpp @@ -139,7 +139,6 @@ void SpinLock::GetLock(Thread* pThread) DISABLED(THROWS); // need to rewrite spin locks to no-throw. GC_NOTRIGGER; CAN_TAKE_LOCK; - SO_TOLERANT; } CONTRACTL_END; @@ -177,7 +176,6 @@ BOOL SpinLock::GetLockNoWait() NOTHROW; GC_NOTRIGGER; CAN_TAKE_LOCK; - SO_TOLERANT; } CONTRACTL_END; @@ -201,7 +199,6 @@ void SpinLock::FreeLock(Thread* pThread) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -237,7 +234,6 @@ SpinLock::SpinToAcquire() NOTHROW; GC_NOTRIGGER; CAN_TAKE_LOCK; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/stackingallocator.cpp b/src/vm/stackingallocator.cpp index 2a7c293..266105b 100644 --- a/src/vm/stackingallocator.cpp +++ b/src/vm/stackingallocator.cpp @@ -74,7 +74,6 @@ StackingAllocator::~StackingAllocator() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -104,7 +103,6 @@ void *StackingAllocator::GetCheckpoint() CONTRACTL { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; #ifdef _DEBUG @@ -223,7 +221,6 @@ void* StackingAllocator::UnsafeAllocSafeThrow(UINT32 Size) THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(m_CheckpointDepth > 0); POSTCONDITION(CheckPointer(RETVAL)); @@ -246,7 +243,6 @@ void *StackingAllocator::UnsafeAlloc(UINT32 Size) THROWS; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(m_CheckpointDepth > 0); POSTCONDITION(CheckPointer(RETVAL)); @@ -311,7 +307,6 @@ void * __cdecl operator new(size_t n, StackingAllocator * alloc) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; #ifdef _WIN64 // size_t's too big on 64-bit platforms so we check for overflow @@ -327,7 +322,6 @@ void * __cdecl operator new[](size_t n, StackingAllocator * alloc) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; #ifdef _WIN64 // size_t's too big on 64-bit platforms so we check for overflow @@ -347,7 +341,6 @@ void * __cdecl operator new(size_t n, StackingAllocator * alloc, const NoThrow&) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; #ifdef _WIN64 // size_t's too big on 64-bit platforms so we check for overflow @@ -361,7 +354,6 @@ void * __cdecl operator new[](size_t n, StackingAllocator * alloc, const NoThrow { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; #ifdef _WIN64 // size_t's too big on 64-bit platforms so we check for overflow diff --git a/src/vm/stackingallocator.h b/src/vm/stackingallocator.h index dcb1c5c..6d1b603 100644 --- a/src/vm/stackingallocator.h +++ b/src/vm/stackingallocator.h @@ -116,7 +116,6 @@ public: NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; INJECT_FAULT(CONTRACT_RETURN NULL;); PRECONDITION(m_CheckpointDepth > 0); POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); @@ -147,13 +146,7 @@ public: // Is the request too large for the current block? if (n > m_BytesLeft) { - bool allocatedNewBlock = false; - - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), RETURN NULL); - allocatedNewBlock = AllocNewBlockForBytes(n); - END_SO_INTOLERANT_CODE; - - if (!allocatedNewBlock) + if (!AllocNewBlockForBytes(n)) { RETURN NULL; } diff --git a/src/vm/stackprobe.cpp b/src/vm/stackprobe.cpp deleted file mode 100644 index 7e40ca8..0000000 --- a/src/vm/stackprobe.cpp +++ /dev/null @@ -1,1765 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// -//----------------------------------------------------------------------------- -// StackProbe.cpp -//----------------------------------------------------------------------------- - - -#include "common.h" -#include "stackprobe.h" - - -#ifdef FEATURE_STACK_PROBE - - -// SOTolerantBoundaryFilter is called when an exception in SO-tolerant code arrives -// at the boundary back into SO-intolerant code. -// -// If we are running in an environment where we must be hardened to SO, then we must -// catch the exception if there is not enough space to run our backout code (the stuff in the -// EX_CATCH clauses). We also cannot let a hard SO propogate into SO-intolerant code, because -// we rip the process if that happens (we have no way to tell that the SO is ok.) -int SOTolerantBoundaryFilter(EXCEPTION_POINTERS *pExceptionInfo, DWORD * pdwSOTolerantFlags) -{ - Thread *pThread = GetThread(); - _ASSERTE(pThread); - _ASSERTE(pdwSOTolerantFlags != NULL); - _ASSERTE(!((*pdwSOTolerantFlags) & BSTC_TRIGGERING_UNWIND_FOR_SO)); - - SaveCurrentExceptionInfo(pExceptionInfo->ExceptionRecord, pExceptionInfo->ContextRecord); - - NTSTATUS exceptionCode = pExceptionInfo->ExceptionRecord->ExceptionCode; - - // We must always handle a hard SO - if (IsSOExceptionCode(exceptionCode)) - { - if (exceptionCode == EXCEPTION_SOFTSO) - { - *pdwSOTolerantFlags |= BSTC_IS_SOFT_SO; - } - *pdwSOTolerantFlags |= BSTC_IS_SO; - - if (!CLRHosted() || pThread == NULL || GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) != eRudeUnloadAppDomain) - { - // For security reason, it is not safe to continue execution if stack overflow happens - // unless a host tells us to do something different. - EEPolicy::HandleFatalStackOverflow(pExceptionInfo); - } - - /* If there is a SO_INTOLERANT region above this */ - /* we should have processed it already in SOIntolerantTransitionHandler */ - EEPolicy::HandleStackOverflow(SOD_SOTolerantTransitor, FRAME_TOP); - - *pdwSOTolerantFlags |= BSTC_TRIGGERING_UNWIND_FOR_SO; - - return EXCEPTION_EXECUTE_HANDLER; - } - - // Make sure we have enough stack to run our backout code. If not, - // catch the exception. - if (! pThread->IsStackSpaceAvailable(ADJUST_PROBE(BACKOUT_CODE_STACK_LIMIT))) - { - *pdwSOTolerantFlags |= BSTC_TRIGGERING_UNWIND_FOR_SO; - return EXCEPTION_EXECUTE_HANDLER; - } - - - return EXCEPTION_CONTINUE_SEARCH; -} - -void SOTolerantCode_RecoverStack(DWORD dwFlags) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_TOLERANT; - } - CONTRACTL_END; - - Thread * pThread = GetThread(); - if (!(dwFlags & BSTC_IS_SOFT_SO)) - { - pThread->RestoreGuardPage(); - } - if (dwFlags & BSTC_IS_SO) - { - if (!pThread->PreemptiveGCDisabled()) - { - pThread->DisablePreemptiveGC(); - } - } - COMPlusThrowSO(); -} - -void SOTolerantCode_ExceptBody(DWORD * pdwFlags, Frame * pSafeForSOFrame) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - SO_TOLERANT; - } - CONTRACTL_END; - - // do nothing here. Get our stack back post-catch and then throw a new exception - *pdwFlags |= BSTC_RECOVER_STACK; - if (*pdwFlags & BSTC_IS_SO) - { - // If this assertion fires, then it means that we have not unwound the frame chain - Thread * pThread = GetThread(); - _ASSERTE(pSafeForSOFrame == pThread->GetFrame()); - pThread->ClearExceptionStateAfterSO(pSafeForSOFrame); - } -} - -// -// ReportStackOverflow is called when our probe infrastructure detects that there -// is insufficient stack to perform the operation. -// - -void ReportStackOverflow() -{ - WRAPPER_NO_CONTRACT; - - _ASSERTE(IsStackProbingEnabled()); - - Thread *pThread = GetThread(); - - if (pThread != NULL) - { - // We don't want an SO to happen while we are trying to throw this one. So check if there - // is enough space left to handle an exception (this translates to check that we have stack - // space left equivalent to the soft guard region). If not, then remove the guard page by - // forcing a hard SO. This effectively turns the SO into a boundary SO. - - // We should only ever get in this situation on a probe from managed code. From within the EE, - // we will never let our probe point get this close. Either way, we'd rip the process if a hard - // SO occurred. - - UINT_PTR stackGuarantee = pThread->GetStackGuarantee(); - - // We expect the stackGuarantee to be a multiple of the page size for - // the call to IsStackSpaceAvailable. - _ASSERTE(stackGuarantee%GetOsPageSize() == 0); - if (pThread->IsStackSpaceAvailable(static_cast(stackGuarantee)/GetOsPageSize())) - { - COMPlusThrowSO(); - } - - // If there isn't much stack left to attempt to report a soft stack overflow, let's trigger a hard - // SO, so we clear the guard page and give us at least another page of stack to work with. - - if (!pThread->IsStackSpaceAvailable(ADJUST_PROBE(1))) - { - DontCallDirectlyForceStackOverflow(); - } - } - - RaiseException(EXCEPTION_SOFTSO, 0, 0, NULL); -} - -void CheckForSOInSOIntolerantCode() -{ - Thread *pThread = GetThreadNULLOk(); - if (pThread == NULL) - { - return; - } - // We use the location of frames to decide SO mode. But during exception, - // we may not unwind some frames, for example: TPMethodFrame, therefore - // it is not safe to apply this check. - //_ASSERTE(!pThread->IsSOTolerant(FRAME_TOP)); - if (! pThread->IsSPBeyondLimit()) - { - return; - } - EEPolicy::HandleStackOverflow(SOD_SOIntolerantTransitor, FRAME_TOP); - _ASSERTE (!"Can not reach here"); -} - -//--------------------------------------------------------------------------------------- -// -// SetSOIntolerantTransitionMarker: Use the current frame as our marker for intolerant transition. -// -// Arguments: -// None. -// -// Return Value: -// None. -// -// Note: -// SO mode is determined by what is on stack. If we see our intolerant transtion first, we are in SO. -// Because compiler lays object in a function at random stack location, the address of our intolerant -// transition object SOIntolerantTransitionHandler may be before the HelperMethodFrame. Therefore, we -// can not use the address of the handlers. Instead we use the current top frame. -// -void SetSOIntolerantTransitionMarker() -{ - LIMITED_METHOD_CONTRACT; - - Thread *pThread = GetThreadNULLOk(); - if (pThread == NULL) - { - return; - } - Frame *pFrame = pThread->GetFrame(); - - // - // Check to see if the Frame chain is corrupt - // This can happen when unmanaged code calls back to managed code - // - if (pFrame != FRAME_TOP) - { - // SafeGetGCCookiePtr examines the value of the vtable pointer - // and makes sure that it is a legal Frame subtype. - // It returns NULL when we have an illegal (i.e. corrupt) vtable value. - // - if (!Frame::HasValidVTablePtr(pFrame)) - DoJITFailFast(); - } - - // We use pFrame - 1 as our marker so that IntolerantTransitionHandler is seen before - // a transition frame. - ClrFlsSetValue(TlsIdx_SOIntolerantTransitionHandler, (void*)(((size_t)pFrame)-1)); - - _ASSERTE(!pThread->IsSOTolerant(FRAME_TOP)); -} - -BOOL RetailStackProbeNoThrowNoThread(unsigned int n) -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - STATIC_CONTRACT_MODE_ANY; - - BEGIN_GETTHREAD_ALLOWED; - Thread *pThread = GetThread(); - - if (!pThread) - { - // we only probe on managed threads - return TRUE; - } - return RetailStackProbeNoThrow(n, pThread); - END_GETTHREAD_ALLOWED; -} - -// This functions are used by the stack probe infrastucture that is outside the VM -// tree. It needs to call into the VM code in order to probe properly. -void InitStackProbesRetail() -{ - LIMITED_METHOD_CONTRACT; - g_fpCheckForSOInSOIntolerantCode = CheckForSOInSOIntolerantCode; - g_fpSetSOIntolerantTransitionMarker = SetSOIntolerantTransitionMarker; - g_fpDoProbe = RetailStackProbeNoThrowNoThread; - g_fpHandleSoftStackOverflow = EEPolicy::HandleSoftStackOverflow; - - g_StackProbingEnabled = g_pConfig->ProbeForStackOverflow() != 0; -} - -// Shared by both the nothrow and throwing version. FORCEINLINE into both to avoid the call overhead. -FORCEINLINE BOOL RetailStackProbeHelper(unsigned int n, Thread *pThread) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - MODE_ANY; - } - CONTRACTL_END; - - UINT_PTR probeLimit; - - // @TODO - Need to devise a probe that doesn't require the thread object - if (pThread == NULL) - { - UINT_PTR stackLimit = (UINT_PTR)Thread::GetStackLowerBound(); - probeLimit = Thread::GetLastNormalStackAddress(stackLimit); - } - else - { - probeLimit = pThread->GetProbeLimit(); - } - UINT_PTR probeAddress = (UINT_PTR)(&pThread) - (n * GetOsPageSize()); - - // If the address we want to probe to is beyond the precalculated limit we fail - // Note that we don't check for stack probing being disabled. This is encoded in - // the value returned from GetProbeLimit, which will be 0 if probing is disabled. - if (probeAddress < probeLimit) - { -#if 0 - // @todo : remove this when iexplore, W3WP.EXE and friends allocate 512K instead - // of 256K for their stack. - if (((char *)(pThread->GetCachedStackBase()) - (char *)(pThread->GetCachedStackLimit())) < 0x41000) - { - return true; - } -#endif - return FALSE; - } - - return TRUE; -} - -BOOL RetailStackProbeNoThrowWorker(unsigned int n, Thread *pThread) -{ - WRAPPER_NO_CONTRACT; - return RetailStackProbeHelper(n, pThread); -} - -void RetailStackProbeWorker(unsigned int n, Thread *pThread) -{ - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - - if (RetailStackProbeHelper(n, pThread)) - { - return; - } - ReportStackOverflow(); -} - -void DefaultRetailStackProbeWorker(Thread *pThread) -{ - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - - if (RetailStackProbeHelper(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), pThread)) - { - return; - } - ReportStackOverflow(); -} - -#endif // FEATURE_STACK_PROBE - -#ifdef STACK_GUARDS_DEBUG - -DWORD g_InteriorProbeAmount = DEFAULT_INTERIOR_PROBE_AMOUNT; - -DWORD g_CurrentStackGuardTlsIdx = (DWORD) -1; -DWORD g_UniqueId = 0; - -// If this has a non-zero value, we'll mark only those pages whose probe line number matches. This allows us -// to turn protection on only for a specific probe so that can find multiple w/o having to rebuild. Otherwise -// can never get past that first AV in the debugger. -unsigned int g_ProtectStackPagesInDebuggerForProbeAtLine = 0; - -// These two are used to the amount probed for at a particular line number -unsigned int g_UpdateProbeAtLine = 0; -SString* g_pUpdateProbeAtLineInFile = NULL; -unsigned int g_UpdateProbeAtLineAmount = 0; - -// If this is TRUE, we'll break in the debugger if we try to probe during the handling of a -// probe-induced stack overflow. -BOOL g_BreakOnProbeDuringSO = FALSE; - -// If this is TRUE, probe cookie validation via assertion is enabled -// disable assertions on debug build. The stack consumption is different enough -// that we'll always be getting spurious failures. -BOOL g_probeAssertOnOverrun = FALSE; - -// SO logging pollutes the EH logging space and vice-versa. The SOLogger class -// allows us to turn SO logging on separately and only produce SO logging, or -// to allow both. -#undef LOG -#define LOG(x) s_SOLogger.LogSpew x - -class SOLogger { - - enum SOLogStyle { - SO_LOGGING_NONE, // No SO logging - SO_LOGGING_SEPARATE_LOG, // Log SO to separate file - SO_LOGGING_STANDARD_LOG // Log SO to standard log - }; - - SOLogStyle m_SOLogStyle; - FILE *m_SOLoggerFile; - -public: - SOLogger(); - ~SOLogger(); - - void Initialize(); - - void LogSpew(DWORD facility, DWORD level, const char *fmt, ... ); -}; - -static SOLogger s_SOLogger; - -SOLogger::SOLogger() - : m_SOLogStyle(SO_LOGGING_NONE), m_SOLoggerFile(NULL) -{ -} - -void SOLogger::Initialize() -{ - WRAPPER_NO_CONTRACT; - - DWORD SOLogger = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_SOLogger, SO_LOGGING_NONE); - if (SOLogger == SO_LOGGING_SEPARATE_LOG) - { - m_SOLogStyle = SO_LOGGING_SEPARATE_LOG; - int ec = fopen_s(&m_SOLoggerFile, "SOLogSpewFile.log", "w"); - _ASSERTE(SUCCEEDED(ec)); - } - else if (SOLogger == SO_LOGGING_STANDARD_LOG) - { - m_SOLogStyle = SO_LOGGING_STANDARD_LOG; - } - else if (SOLogger == SO_LOGGING_NONE) - { - m_SOLogStyle = SO_LOGGING_NONE; - } - else - { - _ASSERTE(!"Invalid SOLogger value"); - } -} - -SOLogger::~SOLogger() -{ - LIMITED_METHOD_CONTRACT; - if (m_SOLoggerFile != NULL) - { - fclose(m_SOLoggerFile); - } -} - -void SOLogger::LogSpew(DWORD facility, DWORD level, const char *fmt, ... ) -{ - STATIC_CONTRACT_WRAPPER; - - if (m_SOLogStyle == SO_LOGGING_NONE) - { - return; - } - - va_list args; - va_start(args, fmt); - if (m_SOLogStyle == SO_LOGGING_SEPARATE_LOG) - { - vfprintf(m_SOLoggerFile, fmt, args); - } - else if (LoggingEnabled()) - { - LogSpewValist (facility, level, fmt, args); - } - va_end(args); -} - -#define MORE_INFO_STRING \ - "\nPlease open a bug against the feature owner.\n" \ - "\nFor details about this feature, see, in a CLR enlistment, src\\ndp\\clr\\doc\\OtherDevDocs\\untriaged\\clrdev_web\\SO Guide for CLR Developers.doc\n" - - -// The following are used to support the SO-injection framework -HMODULE BaseStackGuard::m_hProbeCallBack = 0; -BaseStackGuard::ProbeCallbackType BaseStackGuard::m_pfnProbeCallback = NULL; - -// -// ShouldValidateSOToleranceOnThisThread determines if we should check for SO_Tolerance on this -// thread. -// -// If it is a thread we care about, then we will assert if it calls an SO-intolerant function -// outside of a probe -// -BOOL ShouldValidateSOToleranceOnThisThread() -{ - LIMITED_METHOD_CONTRACT; - - if (g_StackProbingEnabled == false || g_fEEShutDown == TRUE) - { - return FALSE; - } - - BEGIN_GETTHREAD_ALLOWED; - Thread *pThread = GetThread(); - if (pThread == NULL || ShouldProbeOnThisThread() == FALSE) - { - return FALSE; - } - - // We only want to probe on managed threads that have IL on the stack behind them. But - // there's not an easy way to check for that, so we use whether or not we own the thread and - // whether or not a stack guard is in place. - // - // If we don't own the thread, then just make sure that we didn't get here by leaving the EE and coming - // back in. (In which case we would have installed a probe and the GetCurrentStackGuard is non-NULL). - // We are only probing on managed threads, but we want to avoid asserting for cases where an unmanaged - // app starts the EE (thereby creating a managed thread), and runs completely unmanaged, but uses some of the CLR's - // infrastructure, such as Crsts. - if (pThread->DoWeOwn() == FALSE && pThread->GetCurrentStackGuard() == NULL) - { - return FALSE; - } - - if (! IsHandleNullUnchecked(pThread->GetThrowableAsHandle())) - { - return FALSE; - } - - return TRUE; - END_GETTHREAD_ALLOWED; -} - - -BOOL BaseStackGuard_RequiresNStackPages(BaseStackGuardGeneric *pGuard, unsigned int n, BOOL fThrowOnSO) -{ - return ((BaseStackGuard*)pGuard)->RequiresNStackPages(n, fThrowOnSO); -} - -void BaseStackGuard_CheckStack(BaseStackGuardGeneric *pGuard) -{ - WRAPPER_NO_CONTRACT; - ((BaseStackGuard*)pGuard)->CheckStack(); -} - -BOOL CheckNStackPagesAvailable(unsigned int n) -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - STATIC_CONTRACT_MODE_ANY; - - BEGIN_GETTHREAD_ALLOWED; - Thread *pThread = GetThread(); - - // If we don't have a managed thread object, we assume that we have the requested - // number of pages available. - if (!pThread) - return TRUE; - - _ASSERTE(FitsIn(n)); - return pThread->IsStackSpaceAvailable(static_cast(n)); - END_GETTHREAD_ALLOWED; -} - -void InitStackProbes() -{ - WRAPPER_NO_CONTRACT; - - g_CurrentStackGuardTlsIdx = TlsIdx_StackProbe; - - s_SOLogger.Initialize(); - - // If we're in a debugger, and if the config word below is set, then we'll go ahead and protect stack pages - // when we're run under a debugger. - //if (IsDebuggerPresent()) - //{ - if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SOEnableStackProtectionInDebugger) == 1) - { - g_ProtectStackPagesInDebugger = TRUE; - } - g_ProtectStackPagesInDebuggerForProbeAtLine = - CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SOEnableStackProtectionInDebuggerForProbeAtLine); - - g_UpdateProbeAtLine = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SOUpdateProbeAtLine); - g_UpdateProbeAtLineAmount = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SOUpdateProbeAtLineAmount); - LPWSTR wszUpdateProbeAtLineInFile = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SOUpdateProbeAtLineInFile); - g_pUpdateProbeAtLineInFile = new SString(wszUpdateProbeAtLineInFile); - g_pUpdateProbeAtLineInFile->Normalize(); - - if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SOBreakOnProbeDuringSO) == 1) - { - g_BreakOnProbeDuringSO = TRUE; - } - //} - - // Never let g_EntryPointProbeAmount get set to an invalid value of <= 0 to avoid races in places that might be - // about to probe as we set it. - BOOL entryPointProbeAmount = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_SOEntryPointProbe, g_EntryPointProbeAmount); - if (entryPointProbeAmount > 0) - { - g_EntryPointProbeAmount = entryPointProbeAmount; - } - - BOOL interiorProbeAmount = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_SOInteriorProbe, g_InteriorProbeAmount); - if (interiorProbeAmount > 0) - { - g_InteriorProbeAmount = interiorProbeAmount; - } - - BOOL enableBackoutStackValidation = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_SOEnableBackoutStackValidation, FALSE); - - g_EnableDefaultRWValidation = 1; - - BOOL enableDefaultRWValidation = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_SOEnableDefaultRWValidation, g_EnableDefaultRWValidation); - - - - // put this first because it will cause probe validation via contract otherwise - g_probeAssertOnOverrun = REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_SOProbeAssertOnOverrun, g_probeAssertOnOverrun); - - BaseStackGuard::InitProbeReportingToFaultInjectionFramework(); - - g_EnableBackoutStackValidation = enableBackoutStackValidation; - - g_EnableDefaultRWValidation = enableDefaultRWValidation; - - g_fpShouldValidateSOToleranceOnThisThread = ShouldValidateSOToleranceOnThisThread; - - g_fpRestoreCurrentStackGuard = BaseStackGuard::RestoreCurrentGuard; - g_fpHandleStackOverflowAfterCatch = EEPolicy::HandleStackOverflowAfterCatch; - - - g_fp_BaseStackGuard_RequiresNStackPages = BaseStackGuard_RequiresNStackPages; - g_fp_BaseStackGuard_CheckStack = BaseStackGuard_CheckStack; - - g_fpCheckNStackPagesAvailable = CheckNStackPagesAvailable; - - InitStackProbesRetail(); - -} - -void CloseSOTolerantViolationFile(); - -// -// This function is called when the EE is shutting down and we want to stop -// doing stack probing. Don't clear the g_CurrentStackGuardTlsIdx field though, -// because there may still be other threads in the process of probing and -// they'll AV if we pull the g_CurrentStackGuardTlsIdx out from under them. -void TerminateStackProbes() -{ - WRAPPER_NO_CONTRACT; - - - CloseSOTolerantViolationFile(); - - // Don't actually shut down the SO infrastructure. We've got multiple threads - // racing around in the runtime, and they can be left in an inconsisent state - // if we flip this off. - - return; -#if 0 - // Yank the stack guard on this thread - StackGuardDisabler __guardDisable; - __guardDisable.NeverRestoreGuard(); - - // Clear out the current guard in case we terminate and its cleanup code - // does not get to run. - BaseStackGuard::SetCurrentGuard(NULL); - - g_StackProbingEnabled = false; - g_EnableBackoutStackValidation = FALSE; - g_fpShouldValidateSOToleranceOnThisThread = NULL; -#endif -} - -//----------------------------------------------------------------------------- -// Error handling when we go past a stack guard. -// We have different messages to more aggressively diagnose the problem -//----------------------------------------------------------------------------- - -// Called by Check_Stack when we overwrite the cookie -void BaseStackGuard::HandleOverwrittenThisStackGuard(__in_z char *stackID) -{ - LIMITED_METHOD_CONTRACT; - - if (! g_probeAssertOnOverrun) - { - return; - } - - ClrDebugState *pState = GetClrDebugState(); - _ASSERTE(pState); - if (pState->IsSONotMainline()) - { - return; - } - - // This prevents infinite loops in this function if we call something that probes. - // Must do it after the check for pState->IsSONotMainline() to give the first invocation - // a chance to run. - SO_NOT_MAINLINE_FUNCTION; - - // This fires at a closing Check_Stack. - // The cookie set by Requires_?K_stack was overwritten. We detected that at - // the closing call to check_stack. - - // To fix, increase the guard size at the specified ip. - // - // A debugging trick: If you can set a breakpoint at the opening Requires_?K_Stack - // macro for this instance, you can step in and see where the cookie is actually - // placed. Then, place a breakpoint that triggers when (DWORD*) 0xYYYYYYYY changes. - // Continue execution. The breakpoint will fire exactly when the cookie is over-written. - char buff[1024]; - buff[0] = '\0'; - - sprintf_s(buff, COUNTOF(buff), - "STACK GUARD VIOLATION\n" - "The%s stack guard installed in %s at \"%s\" @ %d requested %d pages of stack.\n" - "\nIf this is easily reproduced, please rerun the test under the debugger with the\n" - "DWORD environment variable COMPlus_SOEnableStackProtectionInDebugger\n" - "set to 1. This will cause an AV at the point of overrun.\n" - "Attach the stack trace at that point to the bug in addition to this assert." - MORE_INFO_STRING, stackID ? stackID : "", - m_szFunction, m_szFile, m_lineNum, m_numPages); - - LOG((LF_EH, LL_INFO100000, "%s", buff)); - - DbgAssertDialog((char *)m_szFile, m_lineNum, buff); - -} - -void BaseStackGuard::HandleOverwrittenPreviousStackGuard(int probeShortFall, __in_z char *stackID) -{ - LIMITED_METHOD_CONTRACT; - - if (! g_probeAssertOnOverrun) - { - return; - } - - ClrDebugState *pState = GetClrDebugState(); - _ASSERTE(pState); - if (pState->IsSONotMainline()) - { - return; - } - - // This prevents infinite loops in this function if we call something that probes. - // Must do it after the check for pState->IsSONotMainline() to give the first invocation - // a chance to run. - SO_NOT_MAINLINE_FUNCTION; - - // This fires at an opening Requires_?K_Stack - // We detected that we were already passed our parent's stack guard. So this guard is - // ok, but our parent's guard is too small. Note that if this test was removed, - // the failure would be detected by our parent's closing Check_Stack. But if we detect it - // here, we have more information. - // - // We can see how many bytes short our parent is and adjust it properly. - char buff[2048]; - buff[0] = '\0'; - - // We don't come in here unless we have a previous guard. - _ASSERTE(m_pPrevGuard != NULL); - - sprintf_s(buff, COUNTOF(buff), - "STACK GUARD VIOLATION\n" - " The%s stack guard being installed in %s at \"%s\" @ %d is already in violation of the previous stack guard.\n" - " The previous guard was installed in %s at \"%s\" @ %d and requested %d pages of stack.\n" - "The stack requested by the previous guard is at least %d pages (%d bytes) short.\n" - MORE_INFO_STRING, stackID ? stackID : "", m_szFunction, m_szFile, m_lineNum, - m_pPrevGuard->m_szFunction, m_pPrevGuard->m_szFile, m_pPrevGuard->m_lineNum, m_pPrevGuard->m_numPages, - probeShortFall/GetOsPageSize() + (probeShortFall%GetOsPageSize() ? 1 : 0), probeShortFall); - - LOG((LF_EH, LL_INFO100000, "%s", buff)); - - DbgAssertDialog((char *)m_szFile, m_lineNum, buff); -} - -void BaseStackGuard::HandleOverwrittenCurrentStackGuard(void *pGuard, int shortFall, __in_z char *stackID) -{ - ( (BaseStackGuard *)pGuard)->HandleOverwrittenCurrentStackGuard(shortFall, stackID); -} - -void BaseStackGuard::HandleOverwrittenCurrentStackGuard(int probeShortFall, __in_z char *stackID) -{ - DEBUG_ONLY_FUNCTION; - - if (! g_probeAssertOnOverrun) - { - return; - } - - // This fires during probe invariant validation. - // We detected that our current stack was already past the current probe depth. Note that if this - // test were removed, the failure should be detected the current guard's closing Check_Stack. - // But if we detect it here, we have more information. - // - // We can see how many bytes short the guard is and adjust it properly. - char buff[2048]; - buff[0] = '\0'; - - sprintf_s(buff, COUNTOF(buff), - "STACK GUARD VIOLATION\n\n" - "The%s stack guard installed in %s at \"%s\" @ %d has been violated\n\n" - "The guard requested %d pages of stack and is at least %d pages (%d bytes) short.\n" - MORE_INFO_STRING, stackID ? stackID : "", m_szFunction, m_szFile, m_lineNum, m_numPages, - probeShortFall/GetOsPageSize() + (probeShortFall%GetOsPageSize() ? 1 : 0), probeShortFall); - - LOG((LF_EH, LL_INFO100000, buff)); - - DbgAssertDialog((char *)m_szFile, m_lineNum, buff); -} - -//----------------------------------------------------------------------------- -// Function to do the actual touching of memory during probing, so we can have -// a good approximation of the address we should be overflowing at. -//----------------------------------------------------------------------------- -static __declspec(noinline) void PlaceMarker(UINT_PTR *pMarker) -{ - LIMITED_METHOD_CONTRACT; - *pMarker = STACK_COOKIE_VALUE; -} - - -StackGuardDisabler::StackGuardDisabler() -{ - LIMITED_METHOD_CONTRACT; - BaseStackGuard *pGuard = BaseStackGuard::GetCurrentGuard(); - - if (pGuard == NULL || !BaseStackGuard::IsProbeGuard(pGuard) || !pGuard->Enabled()) - { - // If there's no guard or its a boundary guard, there's nothing to do - m_fDisabledGuard = FALSE; - return; - } - - // If the guard is currently enabled, then we'll need to change the page protection - pGuard->UndoPageProtectionInDebugger(); - pGuard->DisableGuard(); - m_fDisabledGuard = TRUE; -}// StackGuardDisabler - -void StackGuardDisabler::NeverRestoreGuard() -{ - m_fDisabledGuard = FALSE; -} - -StackGuardDisabler::~StackGuardDisabler() -{ - WRAPPER_NO_CONTRACT; - if (m_fDisabledGuard) - { - BaseStackGuard::RestoreCurrentGuard(TRUE); - } -}// ~StackProbeDisabler - -//----------------------------------------------------------------------------- -// BaseStackGuard::RestoreCurrentGuard -// -// Function to restore the current marker's cookie after an EH. -// -// During an exception, we cannot restore stack guard cookies as we unwind our stack guards -// because the stack has not been unwound and we might corrupt it. So we just pop off our -// guards as we go and deal with restoring the cookie after the exception. -// There are two cases: -// -// 1) the exception is caught outside the EE -// 2) the exception is caught in the EE -// -// Case 1: If we catch the exception outside the EE, then the boundary guard that we installed before -// leaving the EE will still be intact, so we have no work to do. -// -// Case 2: If we caught the exception in the EE, then on EX_END_CATCH, after we have unwound the stack, we need to -// restore the cookie for the topmost stack guard. That is what RestoreCurrentGuard does. -// -//----------------------------------------------------------------------------- -void BaseStackGuard::RestoreCurrentGuard(BOOL fWasDisabled) -{ - if (!IsStackProbingEnabled()) - { - // nothing to do - return; - } - - LPVOID pSP = (LPVOID)GetCurrentSP(); - BaseStackGuard *pGuard = GetCurrentGuard(); - - if (pGuard == NULL || !IsProbeGuard(pGuard)) - { - // If there's no guard or its a boundary guard, there's nothing to do - // Just set state to SO-tolerant and quit. - GetClrDebugState()->SetSOTolerance(); - return; - } - - if (reinterpret_cast(pGuard->m_pMarker) > pSP) - { - // We have caught an exception while processing an exception. So can't restore the marker and must - // wait until the catcher of the original exception handles it. - if (!IsBackoutCalledForEH((BYTE *)(pGuard), static_cast(pSP))) - { - // verfiy that really are processing an exception. We could have some false positives here, but in - // general this is a good check. - _ASSERTE(!"After an exception was caught, we couldn't restore the marker because it is greater than the SP\n" - "This should only happen if we caught a nested exception when already processing an exception, but" - " the distance between the SP and the probe does not indicate an exception is in flight."); - } - return; - } - - // Reset the SO-tolerance state - - // We should never get here with a guard beyond the current SP - _ASSERTE(reinterpret_cast(pGuard) > pSP); - - LOG((LF_EH, LL_INFO100000, "BSG::RSG: G: %p D: %d \n", pGuard, pGuard->m_depth)); - - // If we have EX_TRY {EX_TRY {...}EX_CATCH{...}EX_END_CATCH}EX_CATCH{...}EX_END_CATCH, - // the inner EX_END_CATCH will mark the current guard protected. When we reach the - // outer EX_END_CATCH, we will AV when placing marker. - pGuard->UndoPageProtectionInDebugger(); - if (fWasDisabled) - pGuard->EnableGuard(); - // Replace the marker for the current guard - PlaceMarker(pGuard->m_pMarker); - - // Protect marker page in debugger if we need it - pGuard->ProtectMarkerPageInDebugger(); - GetClrDebugState()->ResetSOTolerance(); - pGuard->m_fEHInProgress = FALSE; -} - -//----------------------------------------------------------------------------- -// This places a marker outside the bounds of a probe. We don't want to use -// PlaceMarker because that is how we detect if a proper SO was triggered (via -// StackProbeContainsIP -//----------------------------------------------------------------------------- -static __declspec(noinline) void PlaceMarkerBeyondProbe(UINT_PTR *pMarker) -{ - *pMarker = STACK_COOKIE_VALUE; -} - -//--------------------------------------------------------------------------------------------- -// Determine if we should check integrity of previous cookie. Only check if the previous was a probe guard. -//--------------------------------------------------------------------------------------------- -inline BOOL BaseStackGuard::ShouldCheckPreviousCookieIntegrity() -{ - WRAPPER_NO_CONTRACT; - if (m_pPrevGuard == NULL || - IsBoundaryGuard(m_pPrevGuard) || - m_pPrevGuard->m_pMarker==NULL || - m_pPrevGuard->m_fEHInProgress || - !m_pPrevGuard->Enabled()) - { - return FALSE; - } - return TRUE; -} - -//--------------------------------------------------------------------------------------------- -// Determine if we should check integrity of this cookie. -//--------------------------------------------------------------------------------------------- -inline BOOL BaseStackGuard::ShouldCheckThisCookieIntegrity() -{ - WRAPPER_NO_CONTRACT; - // We only need to check if this is a probe guard and it has a non-null marker. - // Anything else, we don't care about. - return IsProbeGuard(this) && m_pMarker != NULL && Enabled(); -} - -BOOL BaseStackGuard::RequiresNStackPages(unsigned int n, BOOL fThrowsOnSO) -{ - WRAPPER_NO_CONTRACT; - - return RequiresNStackPagesInternal(n, fThrowsOnSO); -} - -BOOL BaseStackGuard::RequiresNStackPagesThrowing(unsigned int n) -{ -// STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; - STATIC_CONTRACT_GC_NOTRIGGER; - - return RequiresNStackPagesInternal(n, TRUE); -} - -BOOL BaseStackGuard::RequiresNStackPagesNoThrow(unsigned int n) -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; - STATIC_CONTRACT_GC_NOTRIGGER; - - return RequiresNStackPagesInternal(n, FALSE); -} - -//----------------------------------------------------------------------------- -// Place guard in stack. -//----------------------------------------------------------------------------- -BOOL BaseStackGuard::RequiresNStackPagesInternal(unsigned int n, BOOL fThrowOnSO) -{ - CONTRACTL - { - DISABLED(THROWS); - GC_NOTRIGGER; - MODE_ANY; - SO_TOLERANT; - } - CONTRACTL_END; - - BOOL fRet; - - // Temporarily initialize the exception occurred flag - m_exceptionOccurred = FALSE; - - // Code below checks if there's a Thread, and exits immediately if not. - // So the rest of the function rightly assumes there is a Thread - BEGIN_GETTHREAD_ALLOWED; - - // only probe on managed threads. No thread, no probe. - if (! IsStackProbingEnabled() || GetThread() == NULL) - { - return TRUE; - } - - // Don't try to probe if we are checking backout and there are active backout markers on - // the stack to avoid collision - if (g_EnableBackoutStackValidation) - { - if ((!(GetClrDebugState()->GetStackMarkerStack().IsEmpty())) - && (!(GetClrDebugState()->GetStackMarkerStack().IsDisabled()))) - { - return TRUE; - } - } - - if (n <= 1) - { - // Our calculation below doesn't handle 1-page probes. - _ASSERTE(!"RequiresNStackPages called with a probe amount less than 2"); - } - - // Retrieve the current stack pointer which will be used to calculate the marker. - LPVOID pStack = (LPVOID)GetCurrentSP(); - - // Setup some helpful debugging information. Get our caller's ip. This is useful for debugging (so we can see - // when the previous guard was set). - m_UniqueId = g_UniqueId++; - m_numPages = n; - - // Get the address of the last few bytes on the penultimate page we probed for. This is slightly early than the probe point, - // but gives us more conservatism in our overrun checking. ("Last" here means the bytes with the smallest address.) - m_pMarker = ((UINT_PTR*)pStack) - (GetOsPageSize() / sizeof(UINT_PTR) * (n-1)); - m_pMarker = (UINT_PTR*)((UINT_PTR)m_pMarker & ~(GetOsPageSize() - 1)); - - // Grab the previous guard, if any, and update our depth. - m_pPrevGuard = GetCurrentGuard(); - - if (m_pPrevGuard == NULL) - { - m_depth = 0; - } - else - { - // If we've already got a probe in place that exceeds the reach of this one, then - // don't install this one. This avoids problems where we've installed an entry point - // probe and then called into a function that happens to do an interior probe. If we - // install the interior probe, then we effectively lose our deep entry point probe - // and end up with probe overrun violations. Check for it being a probe guard - // because boundary guards will always have 0 markers and we'd never probe - // after a boundary guard otherwise. - if (IsProbeGuard(m_pPrevGuard) && m_pPrevGuard->m_pMarker < m_pMarker) - { - return TRUE; - } - m_depth = m_pPrevGuard->m_depth + 1; - - // We need to undo the page protection that we setup when we put the previous guard in place so we don't - // trip over it with this guard. Also, track that we came next. - if (IsProbeGuard(m_pPrevGuard) && m_pPrevGuard->m_pMarker != NULL) - { - m_pPrevGuard->UndoPageProtectionInDebugger(); - m_pPrevGuard->m_szNextFunction = m_szFunction; - m_pPrevGuard->m_szNextFile = m_szFile; - m_pPrevGuard->m_nextLineNum = m_lineNum; - } - } - - if (ShouldCheckPreviousCookieIntegrity()) - { - UINT_PTR *approxSP = (UINT_PTR*)GetCurrentSP(); - if (approxSP <= m_pPrevGuard->m_pMarker) - { - UINT_PTR uProbeShortFall = (char*)m_pPrevGuard->m_pMarker - (char*)approxSP; - _ASSERTE(FitsIn(uProbeShortFall)); - HandleOverwrittenPreviousStackGuard(static_cast(uProbeShortFall), NULL); - } - } - - m_eInitialized = cPartialInit; - - fRet = DoProbe(m_numPages, fThrowOnSO); - END_GETTHREAD_ALLOWED; - return fRet; -} - -BOOL BaseStackGuard::DoProbe(unsigned int n, BOOL fThrowOnSO) -{ - CONTRACTL - { - DISABLED(THROWS); - MODE_ANY; - WRAPPER(GC_TRIGGERS); - SO_TOLERANT; - } - CONTRACTL_END; - - if (! IsStackProbingEnabled() || m_eInitialized != cPartialInit) - { - return TRUE; - } - - LOG((LF_EH, LL_INFO100000, "BSG::DP: %d pages, depth %d, probe 0x%p, fcn %s, prev 0x%p\n", - m_numPages, m_depth, this, this->m_szFunction, m_pPrevGuard)); - - // For cases where have a separate call to DoProbe, make sure the probe amounts match. - _ASSERTE(n == m_numPages); - - // We'll probe for 12 pages + 4 for cleanup.... we'll just put our marker at the 12 page point. - unsigned int nPagesToProbe = n + static_cast(ADJUST_PROBE(BACKOUT_CODE_STACK_LIMIT)); - - Thread *pThread = GetThread(); - - // We already checked in RequiresNPagesStack that we've got a thread. But ASSERT just to - // be sure. - _ASSERTE(pThread); - - // Check if we have enough space left in the stack - if (fThrowOnSO) - { - RetailStackProbe(nPagesToProbe, pThread); - } - else if (! RetailStackProbeNoThrow(nPagesToProbe, pThread)) - { - return FALSE; - } - - // The fault injection framework will tell us when it want to inject - // an SO. If it returns TRUE, then inject an SO depending on the fThrowOnSO flag - if (ReportProbeToFaultInjectionFramework() == TRUE) - { - if (fThrowOnSO) - { - COMPlusThrowSO(); - } - // return probe failure (ie SO) if not in a throwing probe - return FALSE; - } - - LOG((LF_EH, LL_INFO100000, "BSG::DP: pushing to 0x%p\n", m_pMarker)); - - // See if we're able to get a TLS slot to mark our guard page - HRESULT hr = PrepGuard(); - - // Since we can be here only with a valid managed thread object, - // it will already have its TLS setup. Thus, accessing TLS in PrepGuard - // call above shouldn't fail. - _ASSERTE(SUCCEEDED(hr)); - - // make sure the guard page is beyond the marker page, otherwise we could AV or when the guard - // page moves up, it could wipe out our debugger page protection - UINT_PTR *sp = (UINT_PTR*)GetCurrentSP(); - while (sp >= m_pMarker) - { - sp -= (GetOsPageSize() / sizeof(UINT_PTR)); - *sp = NULL; - } - - // Write the cookie onto the stack. - PlaceMarker(m_pMarker); - - // We'll protect the page where we put the marker if a debugger is attached. That way, you get an AV right away - // when you go past the guard when running under a debugger. - ProtectMarkerPageInDebugger(); - - // Mark that we're initialized (and didn't get interupted from an exception) - m_eInitialized = cInit; - - // Initialize the exception occurred flag - m_exceptionOccurred = TRUE; - - // setup flag to tell if we're unwinding due to an exception - m_fEHInProgress = FALSE; - - // By this point, everything is working, so go ahead and hook up. - SetCurrentGuard(this); - - return TRUE; -} - - -//----------------------------------------------------------------------------- -// PopGuardForEH -// -// If we are being popped during an EH unwind, our cookie is likely corrupt so we can't check it. -// So just pop ourselves off the stack and return. We will restore the markers -// after we've caught the exception. -// -// We also set the EHInProgress bit on the previous guard to indicate that the -// current guard was unwound during EH and couldn't restore the previous guard's -// cookie. -// -// Also need to clear the protection bit as go down because it will no -// longer be protected. -//----------------------------------------------------------------------------- -void BaseStackGuard::PopGuardForEH() -{ - LIMITED_METHOD_CONTRACT; - // If we've protected this page, undo the protection - UndoPageProtectionInDebugger(); - - if (m_pPrevGuard) - { - m_pPrevGuard->m_fEHInProgress = TRUE; - - // Indicate that we haven't reprotected the previous guard - m_pPrevGuard->m_fProtectedStackPage = FALSE; - } - // Mark it as unwound for EH. This is for debugging purposes only so we - // know how it was popped. - m_eInitialized = cEHUnwound; - SetCurrentGuard(m_pPrevGuard); -} - -//----------------------------------------------------------------------------- -// Check guard in stack -// This must be called 1:1 with RequiresNPagesStack, else: -// - the function's stack cookie isn't restored -// - the stack chain in TLS gets out of wack. -//----------------------------------------------------------------------------- -void BaseStackGuard::CheckStack() -{ - WRAPPER_NO_CONTRACT; - - if (! IsStackProbingEnabled() || m_eInitialized != cInit) - { - return; - } - - // If we are being popped during an EH unwind, our cookie is likely corrupt so we can't check it. - // So just pop ourselves off the stack and return. We will restore the markers - // after we've caught the exception. - if (DidExceptionOccur()) - { - // We may not be the topmost in the stack, but we'd better not be called when we've already - // unwound the stack past this guy. - _ASSERTE(GetCurrentGuard() <= this); - - // Make sure that if we didn't get to the END_SO_INTOLERANT_CODE that the stack usage - // indicates an exception. This is only a rough check - we might miss some cases where the - // stack grew a lot between construction and descrution of the guard. However, it will - // catch most short-circuits. - if (!IsBackoutCalledForEH((BYTE *)(this), static_cast((LPVOID)GetCurrentSP()))) - { - _ASSERTE(!"Short-circuit of END_SO_INTOLERANT_CODE detected. You cannot short-cirtuit return from an SO-intolerant region"); - } - - LOG((LF_EH, LL_INFO100000, "BSG::CS on EH path sp 0x %p popping probe 0x%p depth %d \n", GetCurrentSP(), this, m_depth)); - PopGuardForEH(); - return; - } - - LOG((LF_EH, LL_INFO100000, "BSG::CS checking probe 0x%p depth %d \n", this, m_depth)); - - // if we aren't being unwound during EH, then we shouldn't have our EHInProgress bit set. That - // means we caught the exception in the EE and didn't call RestoreGuard or we missed a SO-tolerant - // transition out of the EE and the exception occurred above us. - _ASSERTE(m_fEHInProgress == FALSE); - - // we should only ever be popping ourselves if we are not on the EH unwind path - _ASSERTE(GetCurrentGuard() == this); - - // Can have 0-sized probes for cases where have an entry that is small enough not to need a probe. But still - // need to put something in place for the boundary probe assertions to work properly. So just remove it and - // don't do any cookie checking. - if (m_numPages == 0) - { - // Just unhook our guard from the chain. We're done. 0-page probes don't have anything preceding them. - ResetCurrentGuard(m_pPrevGuard); - return; - } - - // We need to undo the page protection that we setup when we put the guard in place. - UndoPageProtectionInDebugger(); - - CheckMarkerIntegrity(); - - RestorePreviousGuard(); -} - -void BaseStackGuard::CheckMarkerIntegrity() -{ - LIMITED_METHOD_CONTRACT; - - if (m_pMarker == 0) - { - return; - } - - // Make sure our cookie is still on the stack where it belongs. - if (ShouldCheckThisCookieIntegrity() && IsMarkerOverrun(m_pMarker)) - { - HandleOverwrittenThisStackGuard(NULL); - } -} - - -void BaseStackGuard::RestorePreviousGuard() -{ - WRAPPER_NO_CONTRACT; - - if (! IsProbeGuard(m_pPrevGuard) || !m_pPrevGuard->Enabled()) - { - LOG((LF_EH, LL_INFO100000, "BSG::RPG depth %d, probe 0x%p, prev 0x%p not probe\n", - m_depth, this, m_pPrevGuard)); - // Unhook our guard from the chain. - ResetCurrentGuard(m_pPrevGuard); - return; - } - - if (m_pPrevGuard->m_fEHInProgress) - { - // If the marker was lost during exception processing, we cannot restore it and it will be restored on the catch. - // This can happen if we were partway through an EH unwind and then called something that probed. We'll have unwound our - // probe guards but won't have been able to put the cookie back, and we're still in that same position. - LOG((LF_EH, LL_INFO100000, "BSG::RPG depth %d, probe 0x%p, EH in progress, not resetting prev 0x%p\n", - m_depth, this, m_pPrevGuard)); - // Unhook our guard from the chain. - ResetCurrentGuard(m_pPrevGuard); - return; - } - - if (m_pPrevGuard->m_pMarker == NULL) - { - // Previous guard had no marker. - // We're done, so just unhook ourselves from the chain and leave. - ResetCurrentGuard(m_pPrevGuard); - } - - // Restore last cookie, so that our previous guard will be able to properly check whether it gets overwritten. Note: - // we don't restore the previous cookie if we overwrote it with this guard. Doing so, by definition, corrupts the - // stack. Its better to have the previous guard report the over-write. - PlaceMarker(m_pPrevGuard->m_pMarker); - LOG((LF_EH, LL_INFO100000, "BSG::RPG depth %d, probe 0x%p " - "for prev 0x%p at 0x%p in %s\n", - m_depth, this, m_pPrevGuard, m_pPrevGuard->m_pMarker, m_pPrevGuard->m_szFunction)); - // And, of course, restore the previous guard's page protection (if it had done any.) - if (m_pPrevGuard->m_fProtectedStackPage) - { - m_pPrevGuard->ProtectMarkerPageInDebugger(); - } - - // Mark it as unwound on normal path. This is for debugging purposes only so we - // know how it was popped. - m_eInitialized = cUnwound; - - // Unhook our guard from the chain. - ResetCurrentGuard(m_pPrevGuard); -} - -void BaseStackGuard::ProtectMarkerPageInDebugger(void *pGuard) -{ - ((BaseStackGuard *)pGuard)->ProtectMarkerPageInDebugger(); -} - -//----------------------------------------------------------------------------- -// Protect the page where we put the marker if a debugger is attached. That way, you get an AV right away -// when you go past the guard when running under a debugger. -//----------------------------------------------------------------------------- -void BaseStackGuard::ProtectMarkerPageInDebugger() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - MODE_ANY; - } - CONTRACTL_END; - - DEBUG_ONLY_FUNCTION; - - if (! (g_ProtectStackPagesInDebugger || g_ProtectStackPagesInDebuggerForProbeAtLine)) - { - return; - } - - DWORD flOldProtect; - - LOG((LF_EH, LL_INFO100000, "BSG::PMP: m_pMarker 0x%p, value 0x%p\n", m_pMarker, *m_pMarker)); - - // We cannot call into host for VirtualProtect. EEVirtualProtect will try to restore previous - // guard, but the location has been marked with PAGE_NOACCESS. -#undef VirtualProtect - BOOL fSuccess = ::VirtualProtect(m_pMarker, 1, PAGE_NOACCESS, &flOldProtect); - _ASSERTE(fSuccess); - -#define VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) \ - Dont_Use_VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) - - m_fProtectedStackPage = fSuccess; -} - - -void BaseStackGuard::UndoPageProtectionInDebugger(void *pGuard) -{ - ((BaseStackGuard *)pGuard)->UndoPageProtectionInDebugger(); -} - -//----------------------------------------------------------------------------- -// Remove page protection installed for this probe -//----------------------------------------------------------------------------- -void BaseStackGuard::UndoPageProtectionInDebugger() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - MODE_ANY; - } - CONTRACTL_END; - - DEBUG_ONLY_FUNCTION; - - if (!m_fProtectedStackPage) - { - return; - } - - _ASSERTE(IsProbeGuard()); - - DWORD flOldProtect; - // EEVirtualProtect installs a BoundaryStackGuard. To avoid recursion, we call - // into OS for VirtualProtect instead. -#undef VirtualProtect - BOOL fSuccess = ::VirtualProtect(m_pMarker, 1, PAGE_READWRITE, &flOldProtect); - _ASSERTE(fSuccess); - - LOG((LF_EH, LL_INFO100000, "BSG::UMP m_pMarker 0x%p\n", m_pMarker)); - // Frankly, if we had protected the stack page, then we shouldn't have gone past the guard, right? :) - _ASSERTE(!Enabled() || !IsMarkerOverrun(m_pMarker)); - -#define VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) \ - Dont_Use_VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) -} - -void BaseStackGuard::InitProbeReportingToFaultInjectionFramework() -{ - WRAPPER_NO_CONTRACT; - - if (! g_pConfig->ShouldInjectFault(INJECTFAULT_SO)) - { - return; - } - - m_hProbeCallBack = CLRLoadLibrary(MAKEDLLNAME_W(W("FaultHostingLayer"))); - if (!m_hProbeCallBack) { - fprintf(stderr, "StackProbing: Failed to load " MAKEDLLNAME_A("FaultHostingLayer") ". LastErr=%d\n", - GetLastError()); - return; - } - - m_pfnProbeCallback = (ProbeCallbackType)GetProcAddress(m_hProbeCallBack, "StackProbeCallback"); - if (!m_pfnProbeCallback) { - fprintf(stderr, "StackProbing: Couldn't find StackProbeCallback() in FaultHostingLayer\n"); - return; - } -} - -// The fault injection framework will return TRUE if we should -// inject an SO at the point of the current probe. -BOOL BaseStackGuard::ReportProbeToFaultInjectionFramework() -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - STATIC_CONTRACT_MODE_ANY; - - if (! g_pConfig->ShouldInjectFault(INJECTFAULT_SO) || ! m_pfnProbeCallback) - { - return FALSE; - } - - // FORBIDGC_LOADER_USE_ENABLED says we are only doing a minimal amount of work and will not - // update global state (just read it.) Code running in this state cannot tolerate a fault injection. - if (FORBIDGC_LOADER_USE_ENABLED()) - { - return FALSE; - } - - // For codepaths that are not mainline or are debug only, we don't care about fault injection because - // taking an SO here won't matter (or can't happen). However, we'd like to still probe on those paths - // just to give us more conservative probe coverage, so we still do the probe, just not the fault injection. - ClrDebugState *pDebugState = GetClrDebugState(); - if (pDebugState && pDebugState->IsSONotMainline() || pDebugState->IsDebugOnly()) - { - return FALSE; - } - - - // Faults injected into the default domain are process fatal. Probing is still going to occur - // but we never trigger fault injection. - { - //Attempting to figure out if we are in the default domain will trigger SO probes so - // we temporarily mark ourselves SONotMainline during the check to prevent recursive probes - SO_NOT_MAINLINE_REGION(); - Thread *pThread = GetThreadNULLOk(); - if (pThread && pThread->GetDomain(TRUE)->IsDefaultDomain()) - { - return FALSE; - } - } - - return m_pfnProbeCallback(m_lineNum, m_szFile); -} - -void BaseStackGuard::SetCurrentGuard(BaseStackGuard* pGuard) -{ - WRAPPER_NO_CONTRACT; - - ClrFlsSetValue(g_CurrentStackGuardTlsIdx, pGuard); - - Thread * pThread = GetThreadNULLOk(); - if (pThread) - { - // For faster access, store the guard in the thread object, if available - pThread->SetCurrentStackGuard(pGuard); - } -} - -// Reset the current guard state back to this one's -void BaseStackGuard::ResetCurrentGuard(BaseStackGuard* pGuard) -{ - WRAPPER_NO_CONTRACT; - - SetCurrentGuard(pGuard); -} - -// This puts a boundary probe in the list when we leave the EE -DEBUG_NOINLINE void BoundaryStackGuard::Push() -{ - SCAN_SCOPE_BEGIN; - ANNOTATION_FN_SO_TOLERANT; - - if (! IsStackProbingEnabled()) - { - return; - } - - - m_isBoundaryGuard = TRUE; - m_pPrevGuard = GetCurrentGuard(); - - if (m_pPrevGuard) - { - // @todo can remove the check for IsProbeGuard when have all the probes in place - if (IsProbeGuard(m_pPrevGuard)) - { - // ensure that the previous probe was sufficiently large - if (ShouldCheckPreviousCookieIntegrity()) - { - // Grab an approximation of our current stack pointer. - void *approxStackPointer = (LPVOID)GetCurrentSP(); - - if (((UINT_PTR*) approxStackPointer <= m_pPrevGuard->Marker())) - { - UINT_PTR uProbeShortFall = (char*)m_pPrevGuard->Marker() - (char*)this; - _ASSERTE(FitsIn(uProbeShortFall)); - HandleOverwrittenPreviousStackGuard(static_cast(uProbeShortFall), NULL); - } - } - m_pPrevGuard->UndoPageProtectionInDebugger(); // undo previuos guard's page protection - m_pPrevGuard->m_szNextFunction = m_szFunction; // track that we came next - m_pPrevGuard->m_szNextFile = m_szFile; - m_pPrevGuard->m_nextLineNum= m_lineNum; - } - m_depth = m_pPrevGuard->Depth(); // don't increment, but record so can transfer to next probe - } - LOG((LF_EH, LL_INFO100000, "BNSG::PS probe 0x%p, depth %d, prev 0x%p in %s\n", - this, m_depth, m_pPrevGuard, m_pPrevGuard ? m_pPrevGuard->FunctionName() : NULL)); - - // See if we're able to get a TLS slot to mark our guard page. If not, this will just be an unitialized - // guard. This generally happens in callbacks to the host before the EE infrastructure is set up on - // the thread, so there won't be interesting probes to protect anyway. - if (FAILED(PrepGuard())) - { - return; - } - - // Mark that we're initialized (and didn't get interupted from an exception) - m_eInitialized = cInit; - - // setup flag to tell if we're unwinding due to an exception - m_exceptionOccurred = TRUE; - - SetCurrentGuard(this); -} - - - -// Pop the boundary probe and reset the original probe's cookie when -// return into the EE -DEBUG_NOINLINE void BoundaryStackGuard::Pop() -{ - SCAN_SCOPE_END; - - if (! IsStackProbingEnabled() || m_eInitialized != cInit) - { - return; - } - - // If we are being popped during an EH unwind, we cannot restore the probe cookie because it will - // corrupt the stack. So just pop ourselves off the stack and return. We will restore the markers - // after we've caught the exception. - if (DidExceptionOccur()) - { - // We may not be the topmost in the stack, but we'd better not be called when we've already - // unwound the stack past this guy. - _ASSERTE(GetCurrentGuard() <= this); - - // Make sure that if we didn't get to the END_SO_TOLERANT_CODE that the stack usage - // indicates an exception. This is only a rough check - we might miss some cases where the - // stack grew a lot between construction and descrution of the guard. However, it will - // catch most short-circuits. - if (!IsBackoutCalledForEH((BYTE *)(this), static_cast((LPVOID)GetCurrentSP()))) - { - _ASSERTE(!"Short-circuit of END_SO_TOLERANT_CODE detected. You cannot short-cirtuit return from an SO-tolerant region"); - } - - LOG((LF_EH, LL_INFO100000, "BNSG::PP popping on EH path 0x%p depth %d \n", this, m_depth)); - PopGuardForEH(); - return; - } - - LOG((LF_EH, LL_INFO100000, "BNSG::PP 0x%p depth %d restoring CK at 0x%p " - " probe 0x%p in %s\n", - this, m_depth, (!IsProbeGuard(m_pPrevGuard) ? 0 : m_pPrevGuard->Marker()), - m_pPrevGuard, m_pPrevGuard ? m_pPrevGuard->FunctionName() : NULL)); - - // we should only ever be popping ourselves - _ASSERTE(GetCurrentGuard() == this); - - RestorePreviousGuard(); -} - - -// -// IsBackoutCalledForEH -// -// Uses heuristics to determines whether the backout code is being called on an EH path or -// not based on the original SP and the SP when the backout code is called. -// -// origSP: The SP when the mainline code was called. For example, the SP of a ctor or code in a try block -// -// backoutSP: The SP when the backout code is called. -// -// Returns: boolean indicating whether or not the backout code is being called on an EH path. -// -BOOL IsBackoutCalledForEH(BYTE *origSP, - BYTE *backoutSP) -{ - // We need to determine if we are being called in the normal or exception path. (Sure would be - // nice if the CRT would tell us.) We use the stack pointer to determine this. On the normal path - // the stack pointer should be not far from the this pointer, whereas on the exception path it - // will typically be a lot higher up the stack. We will make the following assumptions: - // - // 1) on EH path the OS has to push a context onto the stack. So the SP will be increased by - // at least the size of a context when calling a destructor through EH path. - // - // 2) the CRT will use minimal stack space to call a destructor. This is assumed to be less - // than the size of a context. - // - // Caveats: - // - // 1) If there is less than a context on the stack on the EH path, we will miss the fact that - // an exception occurred - // - // 2) If the CRT uses near the size of a context before calling the destructor in the normal case, - // we will assume we've got an exception and ASSERT. - // - // So if we arrive at our backout code and the SP is more than the size of a context beyond the original SP, - // we assume we are on an EH path. - // - return (origSP - sizeof(CONTEXT)) > backoutSP; - -} - - -DebugSOIntolerantTransitionHandlerBeginOnly::DebugSOIntolerantTransitionHandlerBeginOnly(EEThreadHandle thread) -{ - SCAN_SCOPE_BEGIN; - ANNOTATION_FN_SO_INTOLERANT; - - // save the SP so that we can check if the dtor is being called with a much bigger one - m_ctorSP = (char *)GetCurrentSP(); - m_clrDebugState = GetClrDebugState(); - m_prevSOTolerantState = m_clrDebugState->BeginSOIntolerant(); -} - -DebugSOIntolerantTransitionHandlerBeginOnly::~DebugSOIntolerantTransitionHandlerBeginOnly() -{ - SCAN_SCOPE_END; - - // A DebugSOIntolerantTransitionHandlerBeginOnly is instantiated only for cases where we will not see - // an exception. So the desctructor should never be called on an exception path. This will check if - // we are handling an exception and raise an assert if so. - - // - // We need to determine if we are being called in the normal or exception path. (Sure would be - // nice if the CRT would tell us.) We use the stack pointer to determine this. On the normal path - // the stack pointer should be not far from the this pointer, whereas on the exception path it - // will typically be a lot higher up the stack. We will make the following assumptions: - // - // 1) on EH path the OS has to push a context onto the stack. So the SP will be increased by - // at least the size of a context when calling a destructor through EH path. - // - // 2) the CRT will use minimal stack space to call a destructor. This is assumed to be less - // than the size of a context. - // - // Caveats: - // - // 1) If there is less than a context on the stack on the EH path, we will miss the fact that - // an exception occurred - // - // 2) If the CRT uses near the size of a context before calling the destructor in the normal case, - // we will assume we've got an exception and ASSERT. - // - // So if we arrive at our destructor and the SP is within the size of a context beyond the SP when - // we called the ctor, we assume we are on normal path. - if ((m_ctorSP - sizeof(CONTEXT)) > (LPVOID)GetCurrentSP()) - { - _ASSERTE(!"An exception cannot leak through a SO_INTOLERANT_CODE_NOTHROW boundary"); - } - - m_clrDebugState->SetSOTolerance(m_prevSOTolerantState); -} -#endif // STACK_GUARDS_DEBUG - -#if defined(FEATURE_STACK_PROBE) && defined(_DEBUG) - -#undef __STACKPROBE_inl__ - -#define INCLUDE_RETAIL_STACK_PROBE - -#include "stackprobe.inl" - -#endif // defined(FEATURE_STACK_PROBE) && defined(_DEBUG) - -#if 0 //FEATURE_FUSION_FAST_CLOSURE - was too buggy at the end of Dev10, not used since then. Delete it after Dev12 if it is still not fixed and used. - -#ifdef FEATURE_STACK_PROBE -// This is a helper that fusion (CFastAssemblyBindingClosure) uses to -// do an interior stack probe. -HRESULT InteriorStackProbeNothrowCheckThread() -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_MODE_ANY; - - HRESULT hr = S_OK; - INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(hr = E_OUTOFMEMORY;); - END_INTERIOR_STACK_PROBE; - - return hr; -} -#endif - -#endif //0 - FEATURE_FUSION_FAST_CLOSURE diff --git a/src/vm/stackprobe.h b/src/vm/stackprobe.h deleted file mode 100644 index 0bf08b7..0000000 --- a/src/vm/stackprobe.h +++ /dev/null @@ -1,991 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// -//----------------------------------------------------------------------------- -// Stack Probe Header -// Used to setup stack guards -//----------------------------------------------------------------------------- - -#ifndef __STACKPROBE_h__ -#define __STACKPROBE_h__ - -//----------------------------------------------------------------------------- -// Stack Guards. -// -// The idea is to force stack overflows to occur at convenient spots. -// * Fire at RequiresNPagesStack (beggining of func) if this functions locals -// cause overflow. Note that in a debug mode, initing the locals to garbage -// will cause the overflow before this macro is executed. -// -// * Fire at CheckStack (end of func) if either our nested function calls -// cause or use of _alloca cause the stack overflow. Note that this macro -// is debug only, so release builds won't catch on this -// -// Some comments: -// - Stack grows *down*, -// - Ideally, all funcs would have EBP frame and we'd use EBP instead of ESP, -// however, we use the 'this' ptr to get the stack ptr, since the guard -// is declared on the stack. -// -// Comments about inlining assembly w/ Macros: -// - Must use cstyle comments /* ... */ -// - No semi colons, need __asm keyword at the start of each line -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// *How* to use stack guards. -// -// See, in a CLR enlistment, src\ndp\clr\doc\OtherDevDocs\untriaged\clrdev_web\ -// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Stack guards have 3 compiler states: -//#define FEATURE_STACK_PROBE -// (All) All stack guard code is completely removed by the preprocessor if -// not defined. This is used for CoreCLR. -// -//#define STACK_GUARDS_DEBUG -// (DEBUG) Full stack guard debugging including cookies, tracking ips, and -// chaining. More heavy weight, recommended for a debug build only -// -//#define STACK_GUARDS_RELEASE -// (RELEASE) Light stack guard code. For golden builds. Forces Stack Overflow -// to happen at "convenient" times. No debugging help. -//----------------------------------------------------------------------------- - -#include "genericstackprobe.h" -#include "utilcode.h" - -/* defining VM_NO_SO_INFRASTRUCTURE_CODE for VM code - * This macro can be used to have code which will be present - * only for code inside VM directory when SO infrastructure code is not built. - * Eg. Currently it is used in macro EX_END_HOOK. - * For VM code EX_HOOK calls CLREXception::HandleState::SetupCatch(). - * When Stack guards are disabled we will tear down the process in - * CLREXception::HandleState::SetupCatch() if there is a StackOverflow. - * So we should not reach EX_END_HOOK when there is StackOverflow. - * This change cannot be done for all other code because - * CLREXception::HandleState::SetupCatch() is not called rather - * EXception::HandleState::SetupCatch() is called which is a nop. - */ - -#ifndef FEATURE_STACK_PROBE -#undef VM_NO_SO_INFRASTRUCTURE_CODE -#define VM_NO_SO_INFRASTRUCTURE_CODE(x) x -#endif - - -#ifdef FEATURE_STACK_PROBE - -#define DEFAULT_INTERIOR_PROBE_AMOUNT 4 - -#define MINIMUM_STACK_REQUIREMENT (0.25) - -BOOL IsBackoutCalledForEH(BYTE *origSP, BYTE *backoutSP); - -//============================================================================= -// Common code -//============================================================================= -// Release version of the probe function -BOOL RetailStackProbeNoThrow(unsigned int n, Thread *pThread); -BOOL RetailStackProbeNoThrowWorker(unsigned int n, Thread *pThread); -void RetailStackProbe(unsigned int n, Thread *pThread); -void RetailStackProbeWorker(unsigned int n, Thread *pThread); -void ReportStackOverflow(); - -// Retail stack probe with default amount is the most common stack probe. Create -// a dedicated method for it to reduce code size. -void DefaultRetailStackProbeWorker(Thread * pThread); - -void RetailStackProbe(unsigned int n); - -BOOL ShouldProbeOnThisThread(); - -int SOTolerantBoundaryFilter(EXCEPTION_POINTERS *pExceptionInfo, DWORD * pdwSOTolerantFlags); -void SOTolerantCode_RecoverStack(DWORD dwFlags); -void SOTolerantCode_ExceptBody(DWORD * pdwFlags, Frame * pSafeForSOFrame); - -#endif - -#if defined(FEATURE_STACK_PROBE) && !defined(DACCESS_COMPILE) - -inline bool IsStackProbingEnabled() -{ - LIMITED_METHOD_CONTRACT; - return g_StackProbingEnabled; -} - -//============================================================================= -// DEBUG -//============================================================================= -#if defined(STACK_GUARDS_DEBUG) - -#include "common.h" - -class BaseStackGuard; - -//----------------------------------------------------------------------------- -// Need to chain together stack guard address for nested functions -// Use a TLS slot to store the head of the chain -//----------------------------------------------------------------------------- -extern DWORD g_CurrentStackGuardTlsIdx; - -//----------------------------------------------------------------------------- -// Class -//----------------------------------------------------------------------------- - -// Base version - has no ctor/dtor, so we can use it with SEH -// -// *** Don't declare any members here. Put them in BaseStackGuardGeneric. -// We downcast directly from the base to the derived, using the knowledge -// that the base class and the derived class are identical for members. -// -class BaseStackGuard : public BaseStackGuardGeneric -{ -protected: - BaseStackGuard() - { - _ASSERTE(!"No default construction allowed"); - } - -public: - BaseStackGuard(const char *szFunction, const char *szFile, unsigned int lineNum) : - BaseStackGuardGeneric(szFunction, szFile, lineNum) - { - STATIC_CONTRACT_LEAF; - } - - UINT_PTR *Marker() { return m_pMarker; } - - unsigned int Depth() { return m_depth; } - - const char *FunctionName() { return m_szFunction; } - - BOOL IsProbeGuard() - { - return (m_isBoundaryGuard == FALSE); - } - - BOOL IsBoundaryGuard() - { - return (m_isBoundaryGuard == TRUE); - } - - inline BOOL ShouldCheckPreviousCookieIntegrity(); - inline BOOL ShouldCheckThisCookieIntegrity(); - - BOOL RequiresNStackPages(unsigned int n, BOOL fThrowOnSO = TRUE); - BOOL RequiresNStackPagesThrowing(unsigned int n); - BOOL RequiresNStackPagesNoThrow(unsigned int n); -private: - BOOL RequiresNStackPagesInternal(unsigned int n, BOOL fThrowOnSO = TRUE); -public: - BOOL DoProbe(unsigned int n, BOOL fThrowOnSO); - void CheckStack(); - - static void RestoreCurrentGuard(BOOL fWasDisabled = FALSE); - void PopGuardForEH(); - - // Different error messages for the different times we detemine there's a problem. - void HandleOverwrittenThisStackGuard(__in_z char *stackID); - void HandleOverwrittenPreviousStackGuard(int shortFall, __in_z char *stackID); - void HandleOverwrittenCurrentStackGuard(int shortFall, __in_z char *stackID); - static void HandleOverwrittenCurrentStackGuard(void *pGuard, int shortFall, __in_z char *stackID); - - void CheckMarkerIntegrity(); - void RestorePreviousGuard(); - void ProtectMarkerPageInDebugger(); - void UndoPageProtectionInDebugger(); - static void ProtectMarkerPageInDebugger(void *pGuard); - static void UndoPageProtectionInDebugger(void *pGuard); - - inline HRESULT PrepGuard() - { - WRAPPER_NO_CONTRACT; - - // See if it has already been prepped... - if (ClrFlsGetValue(g_CurrentStackGuardTlsIdx) != NULL) - return S_OK; - - // Let's see if we'll be able to put in a guard page - ClrFlsSetValue(g_CurrentStackGuardTlsIdx, -(void*)-1); - - if (ClrFlsGetValue(g_CurrentStackGuardTlsIdx) != (void*)-1) - return E_OUTOFMEMORY; - - return S_OK; - - } - - inline static BaseStackGuard* GetCurrentGuard() - { - WRAPPER_NO_CONTRACT; - if (g_CurrentStackGuardTlsIdx != -1) - return (BaseStackGuard*) ClrFlsGetValue(g_CurrentStackGuardTlsIdx); - else - return NULL; - } - - inline static BOOL IsGuard(BaseStackGuard *probe) - { - return (probe != NULL); - } - static void SetCurrentGuard(BaseStackGuard* pGuard); - static void ResetCurrentGuard(BaseStackGuard* pGuard); - - inline static BOOL IsProbeGuard(BaseStackGuard *probe) - { - LIMITED_METHOD_CONTRACT; - return (IsGuard(probe) != NULL && probe->IsProbeGuard()); - } - - inline static BOOL IsBoundaryGuard(BaseStackGuard *probe) - { - LIMITED_METHOD_CONTRACT; - return (IsGuard(probe) != NULL && probe->IsBoundaryGuard()); - } - - static void InitProbeReportingToFaultInjectionFramework(); - BOOL ReportProbeToFaultInjectionFramework(); - - static void Terminate(); - - - static HMODULE m_hProbeCallBack; - typedef BOOL (*ProbeCallbackType)(unsigned, const char *); - static ProbeCallbackType m_pfnProbeCallback; - -}; - - -// Derived version, add a dtor that automatically calls Check_Stack, move convenient, but can't use with SEH. -class AutoCleanupStackGuard : public BaseStackGuard -{ -protected: - AutoCleanupStackGuard() - { - _ASSERTE(!"No default construction allowed"); - } - -public: - DEBUG_NOINLINE AutoCleanupStackGuard(const char *szFunction, const char *szFile, unsigned int lineNum) : - BaseStackGuard(szFunction, szFile, lineNum) - { - SCAN_SCOPE_BEGIN; - // This CANNOT be a STATIC_CONTRACT_SO_INTOLERANT b/c that isn't - // really just a static contract, it is actually calls EnsureSOIntolerantOK - // as well. Instead we just use the annotation. - ANNOTATION_FN_SO_INTOLERANT; - } - - DEBUG_NOINLINE ~AutoCleanupStackGuard() - { - SCAN_SCOPE_END; - CheckStack(); - } -}; - -class DebugSOIntolerantTransitionHandlerBeginOnly -{ - BOOL m_prevSOTolerantState; - ClrDebugState* m_clrDebugState; - char *m_ctorSP; - - public: - DEBUG_NOINLINE DebugSOIntolerantTransitionHandlerBeginOnly(EEThreadHandle thread); - DEBUG_NOINLINE ~DebugSOIntolerantTransitionHandlerBeginOnly(); -}; - - - -extern DWORD g_InteriorProbeAmount; - -//============================================================================= -// Macros for transition into SO_INTOLERANT code -//============================================================================= - -FORCEINLINE DWORD DefaultEntryProbeAmount() { return g_EntryPointProbeAmount; } - -#define BEGIN_SO_INTOLERANT_CODE(pThread) \ - BEGIN_SO_INTOLERANT_CODE_FOR(pThread, g_EntryPointProbeAmount) \ - -#define BEGIN_SO_INTOLERANT_CODE_FOR(pThread, n) \ - { \ - /*_ASSERTE(pThread); */ \ - AutoCleanupStackGuard stack_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \ - stack_guard_XXX.RequiresNStackPagesThrowing(ADJUST_PROBE(n)); \ - /* work around unreachable code warning */ \ - if (true) \ - { \ - DebugSOIntolerantTransitionHandler __soIntolerantTransitionHandler; \ - ANNOTATION_SO_PROBE_BEGIN(DEFAULT_ENTRY_PROBE_AMOUNT); \ - /* work around unreachable code warning */ \ - if (true) \ - { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT) - -#define BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, ActionOnSO) \ - { \ - /*_ASSERTE(pThread || IsGCSpecialThread());*/ \ - AutoCleanupStackGuard stack_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \ - if (! stack_guard_XXX.RequiresNStackPagesNoThrow(ADJUST_PROBE(g_EntryPointProbeAmount)))\ - { \ - stack_guard_XXX.SetNoException(); \ - ActionOnSO; \ - } \ - /* work around unreachable code warning */ \ - else \ - { \ - DebugSOIntolerantTransitionHandler __soIntolerantTransitionHandler; \ - ANNOTATION_SO_PROBE_BEGIN(DEFAULT_ENTRY_PROBE_AMOUNT); \ - /* work around unreachable code warning */ \ - if (true) \ - { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT) - - -// This is defined just for using in the InternalSetupForComCall macro which -// doesn't have a corresponding end macro because no exception will pass through it -// It should not be used in any situation where an exception could pass through -// the transition. -#define SO_INTOLERANT_CODE_NOTHROW(pThread, ActionOnSO) \ - AutoCleanupStackGuard stack_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \ - if (! stack_guard_XXX.RequiresNStackPagesNoThrow(ADJUST_PROBE(g_EntryPointProbeAmount)))\ - { \ - ActionOnSO; \ - } \ - stack_guard_XXX.SetNoException(); \ - DebugSOIntolerantTransitionHandlerBeginOnly __soIntolerantTransitionHandler(pThread); \ - ANNOTATION_SO_PROBE_BEGIN(DEFAULT_ENTRY_PROBE_AMOUNT); - - -// For some codepaths used during the handling of an SO, we need to guarantee a -// minimal stack consumption to avoid an SO on that codepath. These are typically host -// APIS such as allocation. The host is going to use < 1/4 page, so make sure -// we have that amount before calling. Then use the BACKOUT_VALIDATION to ensure -// that we don't overrun it. We call ReportStackOverflow, which will generate a hard -// SO if we have less than a page left. - -#define MINIMAL_STACK_PROBE_CHECK_THREAD(pThread) \ - if (IsStackProbingEnabled()) \ - { \ - Thread *__pThread = pThread; \ - if (__pThread && ! __pThread->IsStackSpaceAvailable(MINIMUM_STACK_REQUIREMENT)) \ - { \ - ReportStackOverflow(); \ - } \ - } \ - CONTRACT_VIOLATION(SOToleranceViolation); - -// We don't use the DebugSOIntolerantTransitionHandler here because we don't need to transition into -// SO-intolerant code. We're already there. We also don't need to annotate as having probed, -// because this only matters for entry point functions. -// We have a way to separate the declaration from the actual probing for cases where need -// to do a test, such as IsGCThread(), to decide if should probe. -#define DECLARE_INTERIOR_STACK_PROBE \ - { \ - AutoCleanupStackGuard stack_guard_XXX(__FUNCTION__, __FILE__, __LINE__);\ - DEBUG_ASSURE_NO_RETURN_BEGIN(STACK_PROBE) - - -// A function containing an interior probe is implicilty SO-Intolerant because we -// assume that it is not behind a probe. So confirm that we are in the correct state. -#define DO_INTERIOR_STACK_PROBE_FOR(pThread, n) \ - _ASSERTE(pThread != NULL); \ - stack_guard_XXX.RequiresNStackPagesThrowing(ADJUST_PROBE(n)); \ - EnsureSOIntolerantOK(__FUNCTION__, __FILE__, __LINE__); - -#define DO_INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(n) \ - if (ShouldProbeOnThisThread()) \ - { \ - DO_INTERIOR_STACK_PROBE_FOR(GetThread(), g_InteriorProbeAmount); \ - } - -// A function containing an interior probe is implicilty SO-Intolerant because we -// assume that it is not behind a probe. So confirm that we are in the correct state. -#define DO_INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, n, actionOnSO) \ - _ASSERTE(pThread != NULL); \ - if (! stack_guard_XXX.RequiresNStackPagesNoThrow(ADJUST_PROBE(n))) \ - { \ - stack_guard_XXX.SetNoException(); \ - actionOnSO; \ - } \ - EnsureSOIntolerantOK(__FUNCTION__, __FILE__, __LINE__); - -#define DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(n, actionOnSO) \ - if (ShouldProbeOnThisThread()) \ - { \ - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW(GetThread(), n, actionOnSO); \ - } - - -#define INTERIOR_STACK_PROBE_FOR(pThread, n) \ - DECLARE_INTERIOR_STACK_PROBE; \ - DO_INTERIOR_STACK_PROBE_FOR(pThread, n) - -#define INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(n) \ - DECLARE_INTERIOR_STACK_PROBE; \ - DO_INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(n) - -#define INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, n, ActionOnSO) \ - DECLARE_INTERIOR_STACK_PROBE; \ - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, n, ActionOnSO) - -#define INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(n, ActionOnSO) \ - DECLARE_INTERIOR_STACK_PROBE; \ - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(n, ActionOnSO) - - -#define INTERIOR_STACK_PROBE(pThread) \ - INTERIOR_STACK_PROBE_FOR(pThread, g_InteriorProbeAmount) - -#define INTERIOR_STACK_PROBE_CHECK_THREAD \ - INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(g_InteriorProbeAmount) - -#define INTERIOR_STACK_PROBE_NOTHROW(pThread, ActionOnSO) \ - INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, g_InteriorProbeAmount, ActionOnSO) - -#define INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(ActionOnSO) \ - INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(g_InteriorProbeAmount, ActionOnSO) - - -#define END_INTERIOR_STACK_PROBE \ - DEBUG_ASSURE_NO_RETURN_END(STACK_PROBE) \ - stack_guard_XXX.SetNoException(); \ - } - -#define RETURN_FROM_INTERIOR_PROBE(x) \ - DEBUG_OK_TO_RETURN_BEGIN(STACK_PROBE) \ - stack_guard_XXX.SetNoException(); \ - RETURN(x); \ - DEBUG_OK_TO_RETURN_END(STACK_PROBE) - - -// This is used for EH code where we are about to throw. -// To avoid taking an SO during EH processing, want to include it in our probe limits -// So we will just do a big probe and then throw. -#define STACK_PROBE_FOR_THROW(pThread) \ - AutoCleanupStackGuard stack_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \ - if (pThread != NULL) \ - { \ - DO_INTERIOR_STACK_PROBE_FOR(pThread, ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT)); \ - } - -// This is used for throws where we cannot use a dtor-based probe. -#define PUSH_STACK_PROBE_FOR_THROW(pThread) \ - BaseStackGuard stack_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \ - stack_guard_XXX.RequiresNStackPagesThrowing(ADJUST_PROBE(g_EntryPointProbeAmount)); - -#define SAVE_ADDRESS_OF_STACK_PROBE_FOR_THROW(pGuard) \ - pGuard = &stack_guard_XXX; - -#define RESET_EXCEPTION_FROM_STACK_PROBE_FOR_THROW(pGuard) \ - pGuard->SetNoException (); - -#define POP_STACK_PROBE_FOR_THROW(pGuard) \ - pGuard->CheckStack(); - -//============================================================================= -// Macros for transition into SO_TOLERANT code -//============================================================================= -// @todo : put this assert in when all probes are in place. -// _ASSERTE(! pThread->IsSOTolerant()); - -//********************************************************************************* - -// A boundary stack guard is pushed onto the probe stack when we leave the EE and -// popped when we return. It is used for 1) restoring the original probe's cookie -// when we return, as managed code could trash it and 2) marking a boundary so that -// we know not to check for over-written probes before it when install a real probe. -// -class BoundaryStackGuard : public BaseStackGuard -{ -protected: - BoundaryStackGuard() - { - LIMITED_METHOD_CONTRACT; - - _ASSERTE(!"No default construction allowed"); - } - -public: - DEBUG_NOINLINE BoundaryStackGuard(const char *szFunction, const char *szFile, unsigned int lineNum) - : BaseStackGuard(szFunction, szFile, lineNum) - { - SCAN_SCOPE_BEGIN; - ANNOTATION_FN_SO_TOLERANT; - - m_isBoundaryGuard = TRUE; - } - - DEBUG_NOINLINE void Push(); - DEBUG_NOINLINE void Pop(); - - DEBUG_NOINLINE void SetNoExceptionNoPop() - { - SCAN_SCOPE_END; - SetNoException(); - } - -}; - -// Derived version, add a dtor that automatically calls Pop, more convenient, but can't use with SEH. -class AutoCleanupBoundaryStackGuard : public BoundaryStackGuard -{ -protected: - AutoCleanupBoundaryStackGuard() - { - _ASSERTE(!"No default construction allowed"); - } - -public: - DEBUG_NOINLINE AutoCleanupBoundaryStackGuard(const char *szFunction, const char *szFile, unsigned int lineNum) : - BoundaryStackGuard(szFunction, szFile, lineNum) - { - SCAN_SCOPE_BEGIN; - ANNOTATION_FN_SO_TOLERANT; - } - - DEBUG_NOINLINE ~AutoCleanupBoundaryStackGuard() - { - SCAN_SCOPE_END; - Pop(); - } -}; - - -class DebugSOTolerantTransitionHandler -{ - BOOL m_prevSOTolerantState; - ClrDebugState* m_clrDebugState; - - public: - void EnterSOTolerantCode(Thread *pThread); - void ReturnFromSOTolerantCode(); -}; - -class AutoCleanupDebugSOTolerantTransitionHandler : DebugSOTolerantTransitionHandler -{ - BOOL m_prevSOTolerantState; - ClrDebugState* m_clrDebugState; - - public: - DEBUG_NOINLINE AutoCleanupDebugSOTolerantTransitionHandler(Thread *pThread) - { - SCAN_SCOPE_BEGIN; - ANNOTATION_FN_SO_INTOLERANT; - - EnterSOTolerantCode(pThread); - } - DEBUG_NOINLINE ~AutoCleanupDebugSOTolerantTransitionHandler() - { - SCAN_SCOPE_END; - - ReturnFromSOTolerantCode(); - } -}; - - -// When we enter SO-tolerant code, we -// 1) probe to make sure that we will have enough stack to run our backout code. We don't -// need to check that the cookie was overrun because we only care that we had enough stack. -// But we do anyway, to pop off the guard.s -// The backout code infrastcture ensures that we stay below the BACKOUT_CODE_STACK_LIMIT. -// 2) Install a boundary guard, which will preserve our cookie and prevent spurious checks if -// we call back into the EE. -// 3) Formally transition into SO-tolerant code so that we can make sure we are probing if we call -// back into the EE. -// - -#undef OPTIONAL_SO_CLEANUP_UNWIND -#define OPTIONAL_SO_CLEANUP_UNWIND(pThread, pFrame) - -#define BSTC_RECOVER_STACK 0x1 -#define BSTC_IS_SO 0x2 -#define BSTC_IS_SOFT_SO 0x4 -#define BSTC_TRIGGERING_UNWIND_FOR_SO 0x8 - -#define BEGIN_SO_TOLERANT_CODE(pThread) \ - { /* add an outer scope so that we'll restore our state as soon as we return */ \ - Thread * const __pThread = pThread; \ - DWORD __dwFlags = 0; \ - Frame * __pSafeForSOFrame = __pThread ? __pThread->GetFrame() : NULL; \ - SCAN_BLOCKMARKER(); \ - SCAN_BLOCKMARKER_MARK(); \ - BoundaryStackGuard boundary_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \ - boundary_guard_XXX.Push(); \ - DebugSOTolerantTransitionHandler __soTolerantTransitionHandler; \ - __soTolerantTransitionHandler.EnterSOTolerantCode(__pThread); \ - __try \ - { \ - SCAN_EHMARKER(); \ - __try \ - { \ - SCAN_EHMARKER_TRY(); \ - DEBUG_ASSURE_NO_RETURN_BEGIN(STACK_PROBE) \ - __try \ - { - - -// We need to catch any hard SO that comes through in order to get our stack back and make sure that we can run our backout code. -// Also can't allow a hard SO to propogate into SO-intolerant code, as we can't tell where it came from and would have to rip the process. -// So install a filter and catch hard SO and rethrow a C++ SO. Note that we don't check the host policy here it only applies to exceptions -// that will leak back into managed code. -#define END_SO_TOLERANT_CODE \ - } \ - __finally \ - { \ - STATIC_CONTRACT_SO_TOLERANT; \ - if (__dwFlags & BSTC_TRIGGERING_UNWIND_FOR_SO) \ - { \ - OPTIONAL_SO_CLEANUP_UNWIND(__pThread, __pSafeForSOFrame) \ - } \ - } \ - DEBUG_ASSURE_NO_RETURN_END(STACK_PROBE) \ - boundary_guard_XXX.SetNoException(); \ - SCAN_EHMARKER_END_TRY(); \ - } \ - __except(SOTolerantBoundaryFilter(GetExceptionInformation(), &__dwFlags)) \ - { \ - SCAN_EHMARKER_CATCH(); \ - __soTolerantTransitionHandler.ReturnFromSOTolerantCode(); \ - SOTolerantCode_ExceptBody(&__dwFlags, __pSafeForSOFrame); \ - SCAN_EHMARKER_END_CATCH(); \ - } \ - /* This will correctly set the annotation back to SOIntolerant if needed */ \ - SCAN_BLOCKMARKER_USE(); \ - if (__dwFlags & BSTC_RECOVER_STACK) \ - { \ - SOTolerantCode_RecoverStack(__dwFlags); \ - } \ - } \ - __finally \ - { \ - __soTolerantTransitionHandler.ReturnFromSOTolerantCode(); \ - boundary_guard_XXX.Pop(); \ - } \ - /* This is actually attached to the SCAN_BLOCKMARKER_USE() in the try scope */ \ - /* but should hopefully chain the right annotations for a call to a __finally */ \ - SCAN_BLOCKMARKER_END_USE(); \ - } - -extern unsigned __int64 getTimeStamp(); - -INDEBUG(void AddHostCallsStaticMarker();) - -// This is used for calling into host -// We only need to install the boundary guard, and transition into SO-tolerant code. -#define BEGIN_SO_TOLERANT_CODE_CALLING_HOST(pThread) \ - { \ - ULONGLONG __entryTime = 0; \ - __int64 __entryTimeStamp = 0; \ - _ASSERTE(CanThisThreadCallIntoHost()); \ - _ASSERTE((pThread == NULL) || \ - (pThread->GetClrDebugState() == NULL) || \ - ((pThread->GetClrDebugState()->ViolationMask() & \ - (HostViolation|BadDebugState)) != 0) || \ - (pThread->GetClrDebugState()->IsHostCaller())); \ - INDEBUG(AddHostCallsStaticMarker();) \ - _ASSERTE(pThread == NULL || !pThread->IsInForbidSuspendRegion()); \ - { \ - AutoCleanupBoundaryStackGuard boundary_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \ - boundary_guard_XXX.Push(); \ - AutoCleanupDebugSOTolerantTransitionHandler __soTolerantTransitionHandler(pThread); \ - DEBUG_ASSURE_NO_RETURN_BEGIN(STACK_PROBE); \ - -#define END_SO_TOLERANT_CODE_CALLING_HOST \ - DEBUG_ASSURE_NO_RETURN_END(STACK_PROBE) \ - boundary_guard_XXX.SetNoExceptionNoPop(); \ - } \ - } - -//----------------------------------------------------------------------------- -// Startup & Shutdown stack guard subsystem -//----------------------------------------------------------------------------- -void InitStackProbes(); -void TerminateStackProbes(); - -#elif defined(STACK_GUARDS_RELEASE) -//============================================================================= -// Release - really streamlined, -//============================================================================= - -void InitStackProbesRetail(); -inline void InitStackProbes() -{ - InitStackProbesRetail(); -} - -inline void TerminateStackProbes() -{ - LIMITED_METHOD_CONTRACT; -} - - -//============================================================================= -// Macros for transition into SO_INTOLERANT code -//============================================================================= - -FORCEINLINE DWORD DefaultEntryProbeAmount() { return DEFAULT_ENTRY_PROBE_AMOUNT; } - -#define BEGIN_SO_INTOLERANT_CODE(pThread) \ -{ \ - if (IsStackProbingEnabled()) DefaultRetailStackProbeWorker(pThread); \ - /* match with the else used in other macros */ \ - if (true) { \ - SOIntolerantTransitionHandler __soIntolerantTransitionHandler; \ - /* work around unreachable code warning */ \ - if (true) { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT) - -#define BEGIN_SO_INTOLERANT_CODE_FOR(pThread, n) \ -{ \ - if (IsStackProbingEnabled()) RetailStackProbeWorker(ADJUST_PROBE(n), pThread); \ - /* match with the else used in other macros */ \ - if (true) { \ - SOIntolerantTransitionHandler __soIntolerantTransitionHandler; \ - /* work around unreachable code warning */ \ - if (true) { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT) - -#define BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, ActionOnSO) \ -{ \ - if (IsStackProbingEnabled() && !RetailStackProbeNoThrowWorker(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), pThread)) \ - { \ - ActionOnSO; \ - } else { \ - SOIntolerantTransitionHandler __soIntolerantTransitionHandler; \ - /* work around unreachable code warning */ \ - if (true) { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT) - - -// This is defined just for using in the InternalSetupForComCall macro which -// doesn't have a corresponding end macro because no exception will pass through it -// It should not be used in any situation where an exception could pass through -// the transition. -#define SO_INTOLERANT_CODE_NOTHROW(pThread, ActionOnSO) \ - if (IsStackProbingEnabled() && !RetailStackProbeNoThrowWorker(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), pThread)) \ - { \ - ActionOnSO; \ - } \ - -#define MINIMAL_STACK_PROBE_CHECK_THREAD(pThread) \ - if (IsStackProbingEnabled()) \ - { \ - Thread *__pThread = pThread; \ - if (__pThread && ! __pThread->IsStackSpaceAvailable(MINIMUM_STACK_REQUIREMENT)) \ - { \ - ReportStackOverflow(); \ - } \ - } - -#define DECLARE_INTERIOR_STACK_PROBE - - -#define DO_INTERIOR_STACK_PROBE_FOR(pThread, n) \ - if (IsStackProbingEnabled()) \ - { \ - RetailStackProbeWorker(ADJUST_PROBE(n), pThread); \ - } - -#define DO_INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(n) \ - if (IsStackProbingEnabled() && ShouldProbeOnThisThread()) \ - { \ - RetailStackProbeWorker(ADJUST_PROBE(n), GetThread()); \ - } - -#define DO_INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, n, ActionOnSO) \ - if (IsStackProbingEnabled()) \ - { \ - if (!RetailStackProbeNoThrowWorker(ADJUST_PROBE(n), pThread)) \ - { \ - ActionOnSO; \ - } \ - } - -#define DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(n, ActionOnSO) \ - if (IsStackProbingEnabled() && ShouldProbeOnThisThread()) \ - { \ - if (!RetailStackProbeNoThrowWorker(ADJUST_PROBE(n), GetThread())) \ - { \ - ActionOnSO; \ - } \ - } - - -#define INTERIOR_STACK_PROBE_FOR(pThread, n) \ - DECLARE_INTERIOR_STACK_PROBE; \ - DO_INTERIOR_STACK_PROBE_FOR(pThread, n) - -#define INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(n) \ - DECLARE_INTERIOR_STACK_PROBE; \ - DO_INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(n) - -#define INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, n, ActionOnSO) \ - DECLARE_INTERIOR_STACK_PROBE; \ - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, n, ActionOnSO) - -#define INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(n, ActionOnSO) \ - DECLARE_INTERIOR_STACK_PROBE; \ - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(n, ActionOnSO) - - -#define INTERIOR_STACK_PROBE(pThread) \ - INTERIOR_STACK_PROBE_FOR(pThread, DEFAULT_INTERIOR_PROBE_AMOUNT) - -#define INTERIOR_STACK_PROBE_CHECK_THREAD \ - INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(DEFAULT_INTERIOR_PROBE_AMOUNT) - -#define INTERIOR_STACK_PROBE_NOTHROW(pThread, ActionOnSO) \ - INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, DEFAULT_INTERIOR_PROBE_AMOUNT, ActionOnSO) - -#define INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(ActionOnSO) \ - INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(DEFAULT_INTERIOR_PROBE_AMOUNT, ActionOnSO) - - -#define END_INTERIOR_STACK_PROBE - -#define RETURN_FROM_INTERIOR_PROBE(x) RETURN(x) - - -// This is used for EH code where we are about to throw -// To avoid taking an SO during EH processing, want to include it in our probe limits -// So we will just do a big probe and then throw. -#define STACK_PROBE_FOR_THROW(pThread) \ - if (pThread != NULL) \ - { \ - RetailStackProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), pThread); \ - } \ - -#define PUSH_STACK_PROBE_FOR_THROW(pThread) \ - RetailStackProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), pThread); - -#define SAVE_ADDRESS_OF_STACK_PROBE_FOR_THROW(pGuard) - -#define POP_STACK_PROBE_FOR_THROW(pGuard) - - -//============================================================================= -// Macros for transition into SO_TOLERANT code -//============================================================================= - -#undef OPTIONAL_SO_CLEANUP_UNWIND -#define OPTIONAL_SO_CLEANUP_UNWIND(pThread, pFrame) - -#define BSTC_RECOVER_STACK 0x1 -#define BSTC_IS_SO 0x2 -#define BSTC_IS_SOFT_SO 0x4 -#define BSTC_TRIGGERING_UNWIND_FOR_SO 0x8 - - -#define BEGIN_SO_TOLERANT_CODE(pThread) \ -{ \ - Thread * __pThread = pThread; \ - DWORD __dwFlags = 0; \ - Frame * __pSafeForSOFrame = __pThread ? __pThread->GetFrame() : NULL; \ - SCAN_BLOCKMARKER(); \ - SCAN_BLOCKMARKER_MARK(); \ - SCAN_EHMARKER(); \ - __try \ - { \ - SCAN_EHMARKER_TRY() \ - __try \ - { - -// We need to catch any hard SO that comes through in order to get our stack back and make sure that we can run our backout code. -// Also can't allow a hard SO to propogate into SO-intolerant code, as we can't tell where it came from and would have to rip the process. -// So install a filter and catch hard SO and rethrow a C++ SO. -#define END_SO_TOLERANT_CODE \ - } \ - __finally \ - { \ - STATIC_CONTRACT_SO_TOLERANT; \ - if (__dwFlags & BSTC_TRIGGERING_UNWIND_FOR_SO) \ - { \ - OPTIONAL_SO_CLEANUP_UNWIND(__pThread, __pSafeForSOFrame) \ - } \ - } \ - SCAN_EHMARKER_END_TRY(); \ - } \ - __except(SOTolerantBoundaryFilter(GetExceptionInformation(), &__dwFlags)) \ - { \ - SCAN_EHMARKER_CATCH(); \ - SOTolerantCode_ExceptBody(&__dwFlags, __pSafeForSOFrame); \ - SCAN_EHMARKER_END_CATCH(); \ - } \ - SCAN_BLOCKMARKER_USE(); \ - if (__dwFlags & BSTC_RECOVER_STACK) \ - { \ - SOTolerantCode_RecoverStack(__dwFlags); \ - } \ - SCAN_BLOCKMARKER_END_USE(); \ -} - -#define BEGIN_SO_TOLERANT_CODE_CALLING_HOST(pThread) \ - { \ - -#define END_SO_TOLERANT_CODE_CALLING_HOST \ - } - -#endif - -#else // FEATURE_STACK_PROBE && !DACCESS_COMPILE - -inline void InitStackProbes() -{ - LIMITED_METHOD_CONTRACT; -} - -inline void TerminateStackProbes() -{ - LIMITED_METHOD_CONTRACT; -} - -#define BEGIN_SO_INTOLERANT_CODE(pThread) -#define BEGIN_SO_INTOLERANT_CODE_FOR(pThread, n) -#define BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, ActionOnSO) -#define SO_INTOLERANT_CODE_NOTHROW(pThread, ActionOnSO) -#define MINIMAL_STACK_PROBE_CHECK_THREAD(pThread) - -#define DECLARE_INTERIOR_STACK_PROBE - -#define DO_INTERIOR_STACK_PROBE_FOR(pThread, n) -#define DO_INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(n) -#define DO_INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, n, ActionOnSO) -#define DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(n, ActionOnSO) - -#define INTERIOR_STACK_PROBE_FOR(pThread, n) -#define INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(n) -#define INTERIOR_STACK_PROBE_FOR_NOTHROW(pThread, n, ActionOnSO) -#define INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(n, ActionOnSO) - -#define INTERIOR_STACK_PROBE(pThread) -#define INTERIOR_STACK_PROBE_CHECK_THREAD -#define INTERIOR_STACK_PROBE_NOTHROW(pThread, ActionOnSO) -#define INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(ActionOnSO) - -#define END_INTERIOR_STACK_PROBE -#define RETURN_FROM_INTERIOR_PROBE(x) RETURN(x) - -#define STACK_PROBE_FOR_THROW(pThread) -#define PUSH_STACK_PROBE_FOR_THROW(pThread) -#define SAVE_ADDRESS_OF_STACK_PROBE_FOR_THROW(pGuard) -#define POP_STACK_PROBE_FOR_THROW(pGuard) - -#define BEGIN_SO_TOLERANT_CODE(pThread) -#define END_SO_TOLERANT_CODE -#define RETURN_FROM_SO_TOLERANT_CODE_HAS_CATCH -#define BEGIN_SO_TOLERANT_CODE_CALLING_HOST(pThread) \ - _ASSERTE(CanThisThreadCallIntoHost()); - -#define END_SO_TOLERANT_CODE_CALLING_HOST - -#endif // FEATURE_STACK_PROBE && !DACCESS_COMPILE - -#endif // __STACKPROBE_h__ diff --git a/src/vm/stackprobe.inl b/src/vm/stackprobe.inl deleted file mode 100644 index de912ff..0000000 --- a/src/vm/stackprobe.inl +++ /dev/null @@ -1,135 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// - -// -// ==--== -// - -// -//----------------------------------------------------------------------------- -// Stack Probe Header for inline functions -// Used to setup stack guards -//----------------------------------------------------------------------------- -#ifndef __STACKPROBE_inl__ -#define __STACKPROBE_inl__ - -#include "stackprobe.h" -#include "common.h" - -#if defined(FEATURE_STACK_PROBE) && !defined(DACCESS_COMPILE) - -// want to inline in retail, but out of line into stackprobe.cpp in debug -#if !defined(_DEBUG) || defined(INCLUDE_RETAIL_STACK_PROBE) - -#ifndef _DEBUG -#define INLINE_NONDEBUG_ONLY FORCEINLINE -#else -#define INLINE_NONDEBUG_ONLY -#endif - -INLINE_NONDEBUG_ONLY BOOL ShouldProbeOnThisThread() -{ - // we only want to probe on user threads, not any of our special threads - return GetCurrentTaskType() == TT_USER; -} - -#if defined(_DEBUG) && defined(STACK_GUARDS_DEBUG) - -DEBUG_NOINLINE void DebugSOTolerantTransitionHandler::EnterSOTolerantCode(Thread *pThread) -{ - SCAN_SCOPE_BEGIN; - ANNOTATION_FN_SO_TOLERANT; - - if (pThread) - { - m_clrDebugState = pThread->GetClrDebugState(); - } - else - { - m_clrDebugState = GetClrDebugState(); - } - if (m_clrDebugState) - m_prevSOTolerantState = m_clrDebugState->BeginSOTolerant(); -} - -DEBUG_NOINLINE void DebugSOTolerantTransitionHandler::ReturnFromSOTolerantCode() -{ - SCAN_SCOPE_END; - - if (m_clrDebugState) - m_clrDebugState->SetSOTolerance(m_prevSOTolerantState); -} - -#endif - -// Keep the main body out of line to keep code size down. -NOINLINE BOOL RetailStackProbeNoThrowWorker(unsigned int n, Thread *pThread); -NOINLINE void RetailStackProbeWorker(unsigned int n, Thread *pThread); - -INLINE_NONDEBUG_ONLY -BOOL RetailStackProbeNoThrow(unsigned int n, Thread *pThread) -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - -#ifdef STACK_GUARDS_RELEASE - if(!IsStackProbingEnabled()) - { - return TRUE; - } -#endif - - return RetailStackProbeNoThrowWorker(n, pThread); -} - -INLINE_NONDEBUG_ONLY -void RetailStackProbe(unsigned int n, Thread *pThread) -{ - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - -#ifdef STACK_GUARDS_RELEASE - if(!IsStackProbingEnabled()) - { - return; - } -#endif - - if (RetailStackProbeNoThrowWorker(n, pThread)) - { - return; - } - ReportStackOverflow(); -} - -INLINE_NONDEBUG_ONLY -void RetailStackProbe(unsigned int n) -{ - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - -#ifdef STACK_GUARDS_RELEASE - if(!IsStackProbingEnabled()) - { - return; - } -#endif - - if (RetailStackProbeNoThrowWorker(n, GetThread())) - { - return; - } - ReportStackOverflow(); -} - -#endif -#endif - - -#endif // __STACKPROBE_inl__ diff --git a/src/vm/stacksampler.cpp b/src/vm/stacksampler.cpp index 1a6218a..e5b7473 100644 --- a/src/vm/stacksampler.cpp +++ b/src/vm/stacksampler.cpp @@ -227,7 +227,6 @@ StackWalkAction StackSampler::CrawlFrameVisitor(CrawlFrame* pCf, Thread* pMdThre { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -267,7 +266,6 @@ void StackSampler::ThreadProc() THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; } CONTRACTL_END; @@ -277,8 +275,6 @@ void StackSampler::ThreadProc() return; } - BEGIN_SO_INTOLERANT_CODE(m_pThread); - // User asked us to sample after certain time. m_pThread->UserSleep(m_nSampleAfter); @@ -322,8 +318,6 @@ void StackSampler::ThreadProc() // TODO: Measure time to JIT using CycleTimer and subtract from the time we sleep every time. m_pThread->UserSleep(m_nSampleEvery); } - - END_SO_INTOLERANT_CODE; } // Find the most frequent method in the samples and JIT them. diff --git a/src/vm/stackwalk.cpp b/src/vm/stackwalk.cpp index 1b1c2a2..97e83ee 100644 --- a/src/vm/stackwalk.cpp +++ b/src/vm/stackwalk.cpp @@ -13,7 +13,6 @@ #include "eetwain.h" #include "codeman.h" #include "eeconfig.h" -#include "stackprobe.h" #include "dbginterface.h" #include "generics.h" #ifdef FEATURE_INTERPRETER @@ -128,7 +127,6 @@ BOOL CrawlFrame::IsInCalleesFrames(LPVOID stackPointer) MethodDesc* CrawlFrame::GetFunction() { LIMITED_METHOD_DAC_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; if (pFunc != NULL) { return pFunc; @@ -519,7 +517,6 @@ void ExInfoWalker::WalkToManaged() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } @@ -558,7 +555,6 @@ UINT_PTR Thread::VirtualUnwindCallFrame(PREGDISPLAY pRD, EECodeInfo* pCodeInfo / GC_NOTRIGGER; PRECONDITION(GetControlPC(pRD) == GetIP(pRD->pCurrentContext)); - SO_TOLERANT; } CONTRACTL_END; @@ -598,7 +594,6 @@ PCODE Thread::VirtualUnwindCallFrame(T_CONTEXT* pContext, GC_NOTRIGGER; PRECONDITION(CheckPointer(pContext, NULL_NOT_OK)); PRECONDITION(CheckPointer(pContextPointers, NULL_OK)); - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -718,7 +713,6 @@ PCODE Thread::VirtualUnwindNonLeafCallFrame(T_CONTEXT* pContext, KNONVOLATILE_CO PRECONDITION(CheckPointer(pContext, NULL_NOT_OK)); PRECONDITION(CheckPointer(pContextPointers, NULL_OK)); PRECONDITION(CheckPointer(pFunctionEntry, NULL_OK)); - SO_TOLERANT; } CONTRACTL_END; @@ -763,7 +757,6 @@ UINT_PTR Thread::VirtualUnwindToFirstManagedCallFrame(T_CONTEXT* pContext) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -908,7 +901,6 @@ StackWalkAction Thread::StackWalkFramesEx( // that any C++ destructors pushed in this function will never execute, and it means that this function can // never have a dynamic contract. STATIC_CONTRACT_WRAPPER; - STATIC_CONTRACT_SO_INTOLERANT; SCAN_IGNORE_THROW; // see contract above SCAN_IGNORE_TRIGGER; // see contract above @@ -2787,7 +2779,6 @@ void StackFrameIterator::ProcessIp(PCODE Ip) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -3200,7 +3191,6 @@ void StackFrameIterator::PostProcessingForManagedFrames(void) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } @@ -3238,7 +3228,6 @@ void StackFrameIterator::PostProcessingForNoFrameTransition() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } diff --git a/src/vm/stdinterfaces.cpp b/src/vm/stdinterfaces.cpp index 619be14..285f65f 100644 --- a/src/vm/stdinterfaces.cpp +++ b/src/vm/stdinterfaces.cpp @@ -147,7 +147,6 @@ Unknown_QueryInterface_Internal(ComCallWrapper* pWrap, IUnknown* pUnk, REFIID ri NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(IsInProcCCWTearOff(pUnk)); PRECONDITION(CheckPointer(ppv, NULL_OK)); @@ -230,7 +229,6 @@ Unknown_AddRefInner_Internal(IUnknown* pUnk) GC_TRIGGERS; MODE_PREEMPTIVE; PRECONDITION(CheckPointer(pUnk)); - SO_TOLERANT; } CONTRACTL_END; @@ -255,7 +253,6 @@ Unknown_AddRef_Internal(IUnknown* pUnk) GC_TRIGGERS; MODE_PREEMPTIVE; PRECONDITION(CheckPointer(pUnk)); - SO_TOLERANT; } CONTRACTL_END; @@ -289,7 +286,6 @@ Unknown_ReleaseInner_Internal(IUnknown* pUnk) GC_TRIGGERS; MODE_PREEMPTIVE; PRECONDITION(CheckPointer(pUnk)); - SO_TOLERANT; } CONTRACTL_END; @@ -317,7 +313,6 @@ Unknown_Release_Internal(IUnknown* pUnk) GC_TRIGGERS; MODE_PREEMPTIVE; PRECONDITION(CheckPointer(pUnk)); - SO_TOLERANT; } CONTRACTL_END; @@ -359,7 +354,6 @@ Unknown_AddRefSpecial_Internal(IUnknown* pUnk) MODE_PREEMPTIVE; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(IsSimpleTearOff(pUnk)); - SO_TOLERANT; } CONTRACTL_END; @@ -380,7 +374,6 @@ Unknown_ReleaseSpecial_Internal(IUnknown* pUnk) MODE_PREEMPTIVE; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(IsSimpleTearOff(pUnk)); - SO_TOLERANT; } CONTRACTL_END; @@ -2821,7 +2814,6 @@ HRESULT __stdcall ICustomPropertyProvider_GetProperty(IUnknown *pPropertyProvide NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pPropertyProvider)); PRECONDITION(IsSimpleTearOff(pPropertyProvider)); PRECONDITION(CheckPointer(ppProperty, NULL_OK)); @@ -2901,7 +2893,6 @@ HRESULT __stdcall ICustomPropertyProvider_GetIndexedProperty(IUnknown *pProperty NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pPropertyProvider)); PRECONDITION(IsSimpleTearOff(pPropertyProvider)); PRECONDITION(CheckPointer(ppProperty, NULL_OK)); @@ -2980,7 +2971,6 @@ HRESULT __stdcall ICustomPropertyProvider_GetStringRepresentation(IUnknown *pPro NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pPropertyProvider)); PRECONDITION(IsSimpleTearOff(pPropertyProvider)); PRECONDITION(CheckPointer(phstrStringRepresentation, NULL_OK)); @@ -3044,7 +3034,6 @@ HRESULT __stdcall ICustomPropertyProvider_GetType(IUnknown *pPropertyProvider, NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pPropertyProvider)); PRECONDITION(IsSimpleTearOff(pPropertyProvider)); PRECONDITION(CheckPointer(pTypeIdentifier)); @@ -3096,7 +3085,6 @@ HRESULT __stdcall IStringable_ToString(IUnknown* pStringable, NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pStringable)); PRECONDITION(IsSimpleTearOff(pStringable)); PRECONDITION(CheckPointer(pResult, NULL_OK)); diff --git a/src/vm/stdinterfaces_wrapper.cpp b/src/vm/stdinterfaces_wrapper.cpp index e23922f..cf0b1e6 100644 --- a/src/vm/stdinterfaces_wrapper.cpp +++ b/src/vm/stdinterfaces_wrapper.cpp @@ -256,7 +256,6 @@ inline BOOL IsCurrentDomainValid(ComCallWrapper* pWrap, Thread* pThread) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(pWrap)); PRECONDITION(CheckPointer(pThread)); } @@ -275,7 +274,7 @@ inline BOOL IsCurrentDomainValid(ComCallWrapper* pWrap, Thread* pThread) BOOL IsCurrentDomainValid(ComCallWrapper* pWrap) { - CONTRACTL { NOTHROW; GC_TRIGGERS; MODE_ANY; SO_TOLERANT; } CONTRACTL_END; + CONTRACTL { NOTHROW; GC_TRIGGERS; MODE_ANY; } CONTRACTL_END; return IsCurrentDomainValid(pWrap, GetThread()); } @@ -312,7 +311,6 @@ VOID AppDomainDoCallBack(ComCallWrapper* pWrap, ADCallBackFcnType pTarget, LPVOI DISABLED(NOTHROW); GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pWrap)); PRECONDITION(CheckPointer(pTarget)); PRECONDITION(CheckPointer(pArgs)); @@ -356,7 +354,6 @@ VOID __stdcall Unknown_QueryInterface_CallBack(LPVOID ptr) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(ptr)); } CONTRACTL_END; @@ -383,7 +380,6 @@ HRESULT __stdcall Unknown_QueryInterface(IUnknown* pUnk, REFIID riid, void** ppv NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(ppv, NULL_OK)); } @@ -417,7 +413,6 @@ HRESULT __stdcall Unknown_QueryInterface_ICCW(IUnknown *pUnk, REFIID riid, void NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(ppv, NULL_OK)); } @@ -498,7 +493,7 @@ VOID __stdcall DirtyCast_Assert(IUnknown* pUnk) ULONG __stdcall Unknown_AddRef(IUnknown* pUnk) { // Ensure the Thread is available for contracts and other users of the Thread, but don't do any of - // the other "entering managed code" work like going to SO_INTOLERANT or checking for reentrancy. + // the other "entering managed code" work like checking for reentrancy. // We don't really need to "enter" the runtime to do an interlocked increment on a refcount, so // all of that stuff should be isolated to rare paths here. SetupThreadForComCall(-1); @@ -508,7 +503,7 @@ ULONG __stdcall Unknown_AddRef(IUnknown* pUnk) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - ENTRY_POINT; // implies SO_TOLERANT + ENTRY_POINT; } CONTRACTL_END; @@ -521,7 +516,7 @@ ULONG __stdcall Unknown_AddRef(IUnknown* pUnk) ULONG __stdcall Unknown_Release(IUnknown* pUnk) { // Ensure the Thread is available for contracts and other users of the Thread, but don't do any of - // the other "entering managed code" work like going to SO_INTOLERANT or checking for reentrancy. + // the other "entering managed code" work like checking for reentrancy. // We don't really need to "enter" the runtime to do an interlocked decrement on a refcount, so // all of that stuff should be isolated to rare paths here. SetupThreadForComCall(-1); @@ -531,7 +526,7 @@ ULONG __stdcall Unknown_Release(IUnknown* pUnk) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - ENTRY_POINT; // implies SO_TOLERANT + ENTRY_POINT; } CONTRACTL_END; @@ -544,7 +539,7 @@ ULONG __stdcall Unknown_Release(IUnknown* pUnk) ULONG __stdcall Unknown_AddRefInner(IUnknown* pUnk) { // Ensure the Thread is available for contracts and other users of the Thread, but don't do any of - // the other "entering managed code" work like going to SO_INTOLERANT or checking for reentrancy. + // the other "entering managed code" work like checking for reentrancy. // We don't really need to "enter" the runtime to do an interlocked increment on a refcount, so // all of that stuff should be isolated to rare paths here. SetupThreadForComCall(-1); @@ -554,7 +549,7 @@ ULONG __stdcall Unknown_AddRefInner(IUnknown* pUnk) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - ENTRY_POINT; // implies SO_TOLERANT + ENTRY_POINT; } CONTRACTL_END; @@ -567,7 +562,7 @@ ULONG __stdcall Unknown_AddRefInner(IUnknown* pUnk) ULONG __stdcall Unknown_ReleaseInner(IUnknown* pUnk) { // Ensure the Thread is available for contracts and other users of the Thread, but don't do any of - // the other "entering managed code" work like going to SO_INTOLERANT or checking for reentrancy. + // the other "entering managed code" work like checking for reentrancy. // We don't really need to "enter" the runtime to do an interlocked decrement on a refcount, so // all of that stuff should be isolated to rare paths here. SetupThreadForComCall(-1); @@ -577,7 +572,7 @@ ULONG __stdcall Unknown_ReleaseInner(IUnknown* pUnk) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - ENTRY_POINT; // implies SO_TOLERANT + ENTRY_POINT; } CONTRACTL_END; @@ -590,7 +585,7 @@ ULONG __stdcall Unknown_ReleaseInner(IUnknown* pUnk) ULONG __stdcall Unknown_AddRefSpecial(IUnknown* pUnk) { // Ensure the Thread is available for contracts and other users of the Thread, but don't do any of - // the other "entering managed code" work like going to SO_INTOLERANT or checking for reentrancy. + // the other "entering managed code" work like checking for reentrancy. // We don't really need to "enter" the runtime to do an interlocked increment on a refcount, so // all of that stuff should be isolated to rare paths here. SetupThreadForComCall(-1); @@ -600,7 +595,7 @@ ULONG __stdcall Unknown_AddRefSpecial(IUnknown* pUnk) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - ENTRY_POINT; // implies SO_TOLERANT + ENTRY_POINT; } CONTRACTL_END; @@ -613,7 +608,7 @@ ULONG __stdcall Unknown_AddRefSpecial(IUnknown* pUnk) ULONG __stdcall Unknown_ReleaseSpecial(IUnknown* pUnk) { // Ensure the Thread is available for contracts and other users of the Thread, but don't do any of - // the other "entering managed code" work like going to SO_INTOLERANT or checking for reentrancy. + // the other "entering managed code" work like checking for reentrancy. // We don't really need to "enter" the runtime to do an interlocked decrement on a refcount, so // all of that stuff should be isolated to rare paths here. SetupThreadForComCall(-1); @@ -623,7 +618,7 @@ ULONG __stdcall Unknown_ReleaseSpecial(IUnknown* pUnk) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - ENTRY_POINT; // implies SO_TOLERANT + ENTRY_POINT; } CONTRACTL_END; @@ -640,7 +635,6 @@ HRESULT __stdcall Unknown_QueryInterface_IErrorInfo(IUnknown* pUnk, REFIID riid, SetupForComCallHRNoCheckCanRunManagedCode(); WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; HRESULT hr = S_OK; if (!CanRunManagedCode(LoaderLockCheck::ForCorrectness)) @@ -672,7 +666,6 @@ ULONG __stdcall Unknown_ReleaseSpecial_IErrorInfo(IUnknown* pUnk) SetupForComCallDWORDNoCheckCanRunManagedCode(); WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // Address this violation in context of bug 27409 CONTRACT_VIOLATION(GCViolation); @@ -736,7 +729,6 @@ HRESULT __stdcall ClassInfo_GetClassInfo_Wrapper(IUnknown* pUnk, ITypeInfo** ppT NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(ppTI, NULL_OK)); } @@ -792,7 +784,6 @@ SupportsErroInfo_IntfSupportsErrorInfo_Wrapper(IUnknown* pUnk, REFIID riid) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); } CONTRACTL_END; @@ -845,7 +836,6 @@ HRESULT __stdcall ErrorInfo_GetDescription_Wrapper(IUnknown* pUnk, BSTR* pbstrDe NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(pbstrDescription, NULL_OK)); } @@ -896,7 +886,6 @@ HRESULT __stdcall ErrorInfo_GetGUID_Wrapper(IUnknown* pUnk, GUID* pguid) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(pguid, NULL_OK)); } @@ -947,7 +936,6 @@ HRESULT _stdcall ErrorInfo_GetHelpContext_Wrapper(IUnknown* pUnk, DWORD* pdwHelp NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(pdwHelpCtxt, NULL_OK)); } @@ -998,7 +986,6 @@ HRESULT __stdcall ErrorInfo_GetHelpFile_Wrapper(IUnknown* pUnk, BSTR* pbstrHelpF NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(pbstrHelpFile, NULL_OK)); } @@ -1049,7 +1036,6 @@ HRESULT __stdcall ErrorInfo_GetSource_Wrapper(IUnknown* pUnk, BSTR* pbstrSource) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(pbstrSource, NULL_OK)); } @@ -1108,7 +1094,6 @@ HRESULT __stdcall Dispatch_GetTypeInfoCount_Wrapper(IDispatch* pDisp, unsigned i NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pctinfo, NULL_OK)); } @@ -1161,7 +1146,6 @@ HRESULT __stdcall Dispatch_GetTypeInfo_Wrapper(IDispatch* pDisp, unsigned int it NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pptinfo, NULL_OK)); } @@ -1218,7 +1202,6 @@ HRESULT __stdcall Dispatch_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(rgszNames, NULL_OK)); PRECONDITION(CheckPointer(rgdispid, NULL_OK)); @@ -1265,7 +1248,6 @@ HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames_Wrapper(IDispatch* pDisp, R NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(rgszNames, NULL_OK)); PRECONDITION(CheckPointer(rgdispid, NULL_OK)); @@ -1323,15 +1305,6 @@ HRESULT __stdcall Dispatch_Invoke_Wrapper(IDispatch* pDisp, DISPID dispidMember, HRESULT hrRetVal = S_OK; #ifdef FEATURE_CORRUPTING_EXCEPTIONS - // SetupForComCallHR uses "SO_INTOLERANT_CODE_NOTHROW" to setup the SO-Intolerant transition - // for COM Interop. However, "SO_INTOLERANT_CODE_NOTHROW" expects that no exception can escape - // through this boundary but all it does is (in addition to checking that no exception has escaped it) - // do stack probing. - // - // However, Corrupting Exceptions [CE] can escape the COM Interop boundary. Thus, to address that scenario, - // we use the macro below that uses BEGIN_SO_INTOLERANT_CODE_NOTHROW to do the equivalent of - // SO_INTOLERANT_CODE_NOTHROW and yet allow for CEs to escape through. Since there will be a corresponding - // END_SO_INTOLERANT_CODE, the call is splitted into two parts: the Begin and End (see below). BeginSetupForComCallHRWithEscapingCorruptingExceptions(); #else // !FEATURE_CORRUPTING_EXCEPTIONS SetupForComCallHR(); @@ -1343,7 +1316,6 @@ HRESULT __stdcall Dispatch_Invoke_Wrapper(IDispatch* pDisp, DISPID dispidMember, THROWS; // Dispatch_Invoke_CallBack can throw GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pdispparams, NULL_OK)); PRECONDITION(CheckPointer(pvarResult, NULL_OK)); @@ -1399,7 +1371,6 @@ HRESULT __stdcall InternalDispatchImpl_Invoke_Wrapper(IDispatch* pDisp, DISPID d NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pdispparams, NULL_OK)); PRECONDITION(CheckPointer(pvarResult, NULL_OK)); @@ -1457,7 +1428,6 @@ HRESULT __stdcall DispatchEx_GetTypeInfoCount_Wrapper(IDispatchEx* pDisp, unsign NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pctinfo, NULL_OK)); } @@ -1510,7 +1480,6 @@ HRESULT __stdcall DispatchEx_GetTypeInfo_Wrapper(IDispatchEx* pDisp, unsigned in NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pptinfo, NULL_OK)); } @@ -1567,7 +1536,6 @@ HRESULT __stdcall DispatchEx_GetIDsOfNames_Wrapper(IDispatchEx* pDisp, REFIID ri NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(rgszNames, NULL_OK)); PRECONDITION(CheckPointer(rgdispid, NULL_OK)); @@ -1630,7 +1598,6 @@ HRESULT __stdcall DispatchEx_Invoke_Wrapper(IDispatchEx* pDisp, DISPID dispidMem NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pdispparams, NULL_OK)); PRECONDITION(CheckPointer(pvarResult, NULL_OK)); @@ -1685,7 +1652,6 @@ HRESULT __stdcall DispatchEx_DeleteMemberByDispID_Wrapper(IDispatchEx* pDisp, DI NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); } CONTRACTL_END; @@ -1736,7 +1702,6 @@ HRESULT __stdcall DispatchEx_DeleteMemberByName_Wrapper(IDispatchEx* pDisp, BSTR NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); } CONTRACTL_END; @@ -1787,7 +1752,6 @@ HRESULT __stdcall DispatchEx_GetMemberName_Wrapper(IDispatchEx* pDisp, DISPID id NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pbstrName, NULL_OK)); } @@ -1840,7 +1804,6 @@ HRESULT __stdcall DispatchEx_GetDispID_Wrapper(IDispatchEx* pDisp, BSTR bstrName NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pid, NULL_OK)); } @@ -1894,7 +1857,6 @@ HRESULT __stdcall DispatchEx_GetMemberProperties_Wrapper(IDispatchEx* pDisp, DIS NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pgrfdex, NULL_OK)); } @@ -1945,7 +1907,6 @@ HRESULT __stdcall DispatchEx_GetNameSpaceParent_Wrapper(IDispatchEx* pDisp, IUnk NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(ppunk, NULL_OK)); } @@ -1998,7 +1959,6 @@ HRESULT __stdcall DispatchEx_GetNextDispID_Wrapper(IDispatchEx* pDisp, DWORD grf NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pid, NULL_OK)); } @@ -2058,7 +2018,6 @@ HRESULT __stdcall DispatchEx_InvokeEx_Wrapper(IDispatchEx* pDisp, DISPID id, LCI NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pDisp)); PRECONDITION(CheckPointer(pdp, NULL_OK)); PRECONDITION(CheckPointer(pVarRes, NULL_OK)); @@ -2116,7 +2075,6 @@ HRESULT __stdcall Inspectable_GetIIDs_Wrapper(IInspectable *pInsp, ULONG *iidCou NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pInsp)); } CONTRACTL_END; @@ -2166,7 +2124,6 @@ HRESULT __stdcall Inspectable_GetRuntimeClassName_Wrapper(IInspectable *pInsp, H NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pInsp)); } CONTRACTL_END; @@ -2187,7 +2144,6 @@ HRESULT __stdcall Inspectable_GetTrustLevel_Wrapper(IInspectable *pInsp, TrustLe NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pInsp)); } CONTRACTL_END; @@ -2242,7 +2198,6 @@ HRESULT __stdcall WeakReferenceSource_GetWeakReference_Wrapper(IWeakReferenceSou NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pRefSrc)); } CONTRACTL_END; @@ -2304,7 +2259,6 @@ HRESULT __stdcall Marshal_GetUnmarshalClass_Wrapper(IMarshal* pMarsh, REFIID rii NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pMarsh)); PRECONDITION(CheckPointer(pv, NULL_OK)); PRECONDITION(CheckPointer(pvDestContext, NULL_OK)); @@ -2368,7 +2322,6 @@ HRESULT __stdcall Marshal_GetMarshalSizeMax_Wrapper(IMarshal* pMarsh, REFIID rii NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pMarsh)); PRECONDITION(CheckPointer(pv, NULL_OK)); PRECONDITION(CheckPointer(pvDestContext, NULL_OK)); @@ -2430,7 +2383,6 @@ HRESULT __stdcall Marshal_MarshalInterface_Wrapper(IMarshal* pMarsh, LPSTREAM pS NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pMarsh)); PRECONDITION(CheckPointer(pv, NULL_OK)); PRECONDITION(CheckPointer(pvDestContext, NULL_OK)); @@ -2486,7 +2438,6 @@ HRESULT __stdcall Marshal_UnmarshalInterface_Wrapper(IMarshal* pMarsh, LPSTREAM NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pMarsh)); PRECONDITION(CheckPointer(pStm, NULL_OK)); PRECONDITION(CheckPointer(ppvObj, NULL_OK)); @@ -2539,7 +2490,6 @@ HRESULT __stdcall Marshal_ReleaseMarshalData_Wrapper(IMarshal* pMarsh, LPSTREAM NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pMarsh)); PRECONDITION(CheckPointer(pStm, NULL_OK)); } @@ -2590,7 +2540,6 @@ HRESULT __stdcall Marshal_DisconnectObject_Wrapper(IMarshal* pMarsh, ULONG dwRes NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pMarsh)); } CONTRACTL_END; @@ -2643,7 +2592,6 @@ HRESULT __stdcall ConnectionPointContainer_EnumConnectionPoints_Wrapper(IUnknown NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(ppEnum, NULL_OK)); } @@ -2696,7 +2644,6 @@ HRESULT __stdcall ConnectionPointContainer_FindConnectionPoint_Wrapper(IUnknown* NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(ppCP, NULL_OK)); } @@ -2757,7 +2704,6 @@ HRESULT __stdcall ObjectSafety_GetInterfaceSafetyOptions_Wrapper(IUnknown* pUnk, NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); PRECONDITION(CheckPointer(pdwSupportedOptions, NULL_OK)); PRECONDITION(CheckPointer(pdwEnabledOptions, NULL_OK)); @@ -2816,7 +2762,6 @@ HRESULT __stdcall ObjectSafety_SetInterfaceSafetyOptions_Wrapper(IUnknown* pUnk, NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pUnk)); } CONTRACTL_END; @@ -2866,7 +2811,6 @@ HRESULT __stdcall ICustomPropertyProvider_GetProperty_Wrapper(IUnknown *pPropert NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pPropertyProvider)); } CONTRACTL_END; @@ -2918,7 +2862,6 @@ HRESULT __stdcall ICustomPropertyProvider_GetIndexedProperty_Wrapper(IUnknown *p NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pPropertyProvider)); } CONTRACTL_END; @@ -2964,7 +2907,6 @@ HRESULT __stdcall ICustomPropertyProvider_GetStringRepresentation_Wrapper(IUnkno NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pPropertyProvider)); } CONTRACTL_END; @@ -3009,7 +2951,6 @@ HRESULT __stdcall ICustomPropertyProvider_GetType_Wrapper(IUnknown *pPropertyPro NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pPropertyProvider)); } CONTRACTL_END; @@ -3054,7 +2995,6 @@ HRESULT __stdcall IStringable_ToString_Wrapper(IUnknown *pStringable, NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; PRECONDITION(CheckPointer(pStringable)); } CONTRACTL_END; @@ -3080,8 +3020,7 @@ ULONG __stdcall ICCW_AddRefFromJupiter_Wrapper(IUnknown *pUnk) // We do not need to hook with host here SetupForComCallDWORDNoHostNotif(); - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; + WRAPPER_NO_CONTRACT; return ICCW_AddRefFromJupiter(pUnk); } @@ -3091,8 +3030,7 @@ ULONG __stdcall ICCW_ReleaseFromJupiter_Wrapper(IUnknown *pUnk) // We do not need to hook with host here SetupForComCallDWORDNoHostNotif(); - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; + WRAPPER_NO_CONTRACT; return ICCW_ReleaseFromJupiter(pUnk); } @@ -3103,8 +3041,7 @@ HRESULT __stdcall ICCW_Peg_Wrapper(IUnknown *pUnk) // as we are most likely in the middle of a GC SetupForComCallHRNoHostNotifNoCheckCanRunManagedCode(); - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; + WRAPPER_NO_CONTRACT; return ICCW_Peg(pUnk); } @@ -3115,8 +3052,7 @@ HRESULT __stdcall ICCW_Unpeg_Wrapper(IUnknown *pUnk) // as we are most likely in the middle of a GC SetupForComCallHRNoHostNotifNoCheckCanRunManagedCode(); - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; + WRAPPER_NO_CONTRACT; return ICCW_Unpeg(pUnk); } diff --git a/src/vm/stubhelpers.cpp b/src/vm/stubhelpers.cpp index 456a367..72265b0 100644 --- a/src/vm/stubhelpers.cpp +++ b/src/vm/stubhelpers.cpp @@ -52,7 +52,6 @@ void StubHelpers::ValidateObjectInternal(Object *pObjUNSAFE, BOOL fValidateNextO NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -739,12 +738,12 @@ void QCALLTYPE StubHelpers::InterfaceMarshaler__ClearNative(IUnknown * pUnk) { QCALL_CONTRACT; - BEGIN_QCALL_SO_TOLERANT; + BEGIN_QCALL; ULONG cbRef = SafeReleasePreemp(pUnk); LogInteropRelease(pUnk, cbRef, "InterfaceMarshalerBase::ClearNative: In/Out release"); - END_QCALL_SO_TOLERANT; + END_QCALL; } #include diff --git a/src/vm/stublink.cpp b/src/vm/stublink.cpp index e41b853..963555c 100644 --- a/src/vm/stublink.cpp +++ b/src/vm/stublink.cpp @@ -132,7 +132,6 @@ FindStubFunctionEntry ( NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END @@ -345,7 +344,6 @@ StubLinker::StubLinker() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -391,7 +389,6 @@ VOID StubLinker::EmitBytes(const BYTE *pBytes, UINT numBytes) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -457,7 +454,6 @@ VOID StubLinker::Emit16(unsigned __int16 val) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -479,7 +475,6 @@ VOID StubLinker::Emit32(unsigned __int32 val) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -522,7 +517,6 @@ VOID StubLinker::EmitPtr(const VOID *val) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -547,7 +541,6 @@ CodeLabel* StubLinker::NewCodeLabel() { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -589,7 +582,6 @@ VOID StubLinker::EmitLabel(CodeLabel* pCodeLabel) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -614,7 +606,6 @@ CodeLabel* StubLinker::EmitNewCodeLabel() { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -633,7 +624,6 @@ VOID StubLinker::EmitPatchLabel() { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -655,7 +645,6 @@ UINT32 StubLinker::GetLabelOffset(CodeLabel *pLabel) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -674,7 +663,6 @@ CodeLabel* StubLinker::NewExternalCodeLabel(LPVOID pExternalAddress) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(CheckPointer(pExternalAddress)); } @@ -707,7 +695,6 @@ VOID StubLinker::EmitLabelRef(CodeLabel* target, const InstructionFormat & instr { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -739,7 +726,6 @@ CodeRun *StubLinker::GetLastCodeRunIfAny() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -782,7 +768,6 @@ VOID StubLinker::AppendCodeElement(CodeElement *pCodeElement) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -801,7 +786,6 @@ static BOOL LabelCanReach(LabelRef *pLabelRef) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -938,7 +922,6 @@ int StubLinker::CalculateSize(int* pGlobalSize) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1232,7 +1215,6 @@ VOID StubLinker::UnwindAllocStack (SHORT FrameSizeIncrement) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; if (! ClrSafeInt::addition(m_stackSize, FrameSizeIncrement, m_stackSize)) @@ -1280,7 +1262,6 @@ UNWIND_CODE *StubLinker::AllocUnwindInfo (UCHAR Op, UCHAR nExtraSlots /*= 0*/) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; _ASSERTE(Op < sizeof(UnwindOpExtraSlotTable)); diff --git a/src/vm/stublink.h b/src/vm/stublink.h index 41c11eb..23e5e1b 100644 --- a/src/vm/stublink.h +++ b/src/vm/stublink.h @@ -582,7 +582,6 @@ class Stub NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END diff --git a/src/vm/stubmgr.cpp b/src/vm/stubmgr.cpp index 9237eeb..17d262c 100644 --- a/src/vm/stubmgr.cpp +++ b/src/vm/stubmgr.cpp @@ -421,7 +421,6 @@ BOOL StubManager::CheckIsStub_Worker(PCODE stubStartAddress) NOTHROW; CAN_TAKE_LOCK; // CheckIsStub_Internal can enter SimpleRWLock GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -435,10 +434,6 @@ BOOL StubManager::CheckIsStub_Worker(PCODE stubStartAddress) return FALSE; } - CONTRACT_VIOLATION(SOToleranceViolation); - // @todo : this might not have a thread - // BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return FALSE); - struct Param { BOOL fIsStub; @@ -484,11 +479,9 @@ BOOL StubManager::CheckIsStub_Worker(PCODE stubStartAddress) #ifdef DACCESS_COMPILE PAL_ENDTRY #else - EX_END_CATCH(SwallowAllExceptions); -#endif + EX_END_CATCH(SwallowAllExceptions); +#endif - //END_SO_INTOLERANT_CODE; - return param.fIsStub; } @@ -1586,7 +1579,6 @@ RangeSectionStubManager::GetStubKind(PCODE stubStartAddress) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/stubmgr.h b/src/vm/stubmgr.h index fc77ca9..8087d8b 100644 --- a/src/vm/stubmgr.h +++ b/src/vm/stubmgr.h @@ -93,7 +93,6 @@ public: // The addr is in unmanaged code. Used for Step-in from managed to native. void InitForUnmanaged(PCODE addr) { - STATIC_CONTRACT_SO_TOLERANT; this->type = TRACE_UNMANAGED; this->address = addr; this->stubManager = NULL; @@ -102,7 +101,6 @@ public: // The addr is inside jitted code (eg, there's a JitManaged that will claim it) void InitForManaged(PCODE addr) { - STATIC_CONTRACT_SO_TOLERANT; this->type = TRACE_MANAGED; this->address = addr; this->stubManager = NULL; @@ -111,7 +109,6 @@ public: // Initialize for an unmanaged entry stub. void InitForUnmanagedStub(PCODE addr) { - STATIC_CONTRACT_SO_TOLERANT; this->type = TRACE_ENTRY_STUB; this->address = addr; this->stubManager = NULL; @@ -120,7 +117,6 @@ public: // Initialize for a stub. void InitForStub(PCODE addr) { - STATIC_CONTRACT_SO_TOLERANT; this->type = TRACE_STUB; this->address = addr; this->stubManager = NULL; @@ -136,7 +132,6 @@ public: // call pStubManager->TraceManager() to get the next TraceDestination. void InitForManagerPush(PCODE addr, StubManager * pStubManager) { - STATIC_CONTRACT_SO_TOLERANT; this->type = TRACE_MGR_PUSH; this->address = addr; this->stubManager = pStubManager; diff --git a/src/vm/syncblk.cpp b/src/vm/syncblk.cpp index 979fa16..30b2930 100644 --- a/src/vm/syncblk.cpp +++ b/src/vm/syncblk.cpp @@ -1862,7 +1862,6 @@ BOOL ObjHeader::TryEnterObjMonitor(INT32 timeOut) AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelperSpin(Thread* pCurThread) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -2089,7 +2088,6 @@ BOOL ObjHeader::GetThreadOwningMonitorLock(DWORD *pThreadId, DWORD *pAcquisition { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; #ifndef DACCESS_COMPILE if (!IsGCSpecialThread ()) {MODE_COOPERATIVE;} else {MODE_ANY;} #endif @@ -2290,7 +2288,6 @@ ADIndex ObjHeader::GetAppDomainIndex() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; ADIndex indx = GetRawAppDomainIndex(); @@ -2513,9 +2510,8 @@ BOOL ObjHeader::Validate (BOOL bVerifySyncBlkIndex) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_MODE_COOPERATIVE; - + DWORD bits = GetBits (); Object * obj = GetBaseObject (); BOOL bVerifyMore = g_pConfig->GetHeapVerifyLevel() & EEConfig::HEAPVERIFY_SYNCBLK; diff --git a/src/vm/syncblk.h b/src/vm/syncblk.h index 03f3e16..58eb286 100644 --- a/src/vm/syncblk.h +++ b/src/vm/syncblk.h @@ -968,7 +968,6 @@ class SyncBlock NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } diff --git a/src/vm/syncblk.inl b/src/vm/syncblk.inl index 617e240..f8f1746 100644 --- a/src/vm/syncblk.inl +++ b/src/vm/syncblk.inl @@ -471,7 +471,6 @@ FORCEINLINE void AwareLock::SpinWait(const YieldProcessorNormalizationInfo &norm FORCEINLINE bool AwareLock::TryEnterHelper(Thread* pCurThread) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -496,7 +495,6 @@ FORCEINLINE bool AwareLock::TryEnterHelper(Thread* pCurThread) FORCEINLINE AwareLock::EnterHelperResult AwareLock::TryEnterBeforeSpinLoopHelper(Thread *pCurThread) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -540,7 +538,6 @@ FORCEINLINE AwareLock::EnterHelperResult AwareLock::TryEnterBeforeSpinLoopHelper FORCEINLINE AwareLock::EnterHelperResult AwareLock::TryEnterInsideSpinLoopHelper(Thread *pCurThread) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -568,7 +565,6 @@ FORCEINLINE AwareLock::EnterHelperResult AwareLock::TryEnterInsideSpinLoopHelper FORCEINLINE bool AwareLock::TryEnterAfterSpinLoopHelper(Thread *pCurThread) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -592,7 +588,6 @@ FORCEINLINE bool AwareLock::TryEnterAfterSpinLoopHelper(Thread *pCurThread) FORCEINLINE AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelper(Thread* pCurThread) { CONTRACTL{ - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; @@ -676,7 +671,6 @@ FORCEINLINE AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelper(Thread FORCEINLINE AwareLock::LeaveHelperAction AwareLock::LeaveHelper(Thread* pCurThread) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -717,7 +711,6 @@ FORCEINLINE AwareLock::LeaveHelperAction AwareLock::LeaveHelper(Thread* pCurThre FORCEINLINE AwareLock::LeaveHelperAction ObjHeader::LeaveObjMonitorHelper(Thread* pCurThread) { CONTRACTL { - SO_TOLERANT; NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; diff --git a/src/vm/synch.cpp b/src/vm/synch.cpp index 7a081d2..13f6ff3 100644 --- a/src/vm/synch.cpp +++ b/src/vm/synch.cpp @@ -17,7 +17,6 @@ void CLREventBase::CreateAutoEvent (BOOL bInitialState // If TRUE, initial stat { THROWS; GC_NOTRIGGER; - SO_TOLERANT; // disallow creation of Crst before EE starts // Can not assert here. ASP.Net uses our Threadpool before EE is started. PRECONDITION((m_handle == INVALID_HANDLE_VALUE)); @@ -44,7 +43,6 @@ BOOL CLREventBase::CreateAutoEventNoThrow (BOOL bInitialState // If TRUE, initi { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; // disallow creation of Crst before EE starts // Can not assert here. ASP.Net uses our Threadpool before EE is started. PRECONDITION((m_handle == INVALID_HANDLE_VALUE)); @@ -71,7 +69,6 @@ void CLREventBase::CreateManualEvent (BOOL bInitialState // If TRUE, initial st { THROWS; GC_NOTRIGGER; - SO_TOLERANT; // disallow creation of Crst before EE starts // Can not assert here. ASP.Net uses our Threadpool before EE is started. PRECONDITION((m_handle == INVALID_HANDLE_VALUE)); @@ -95,7 +92,6 @@ BOOL CLREventBase::CreateManualEventNoThrow (BOOL bInitialState // If TRUE, ini { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; // disallow creation of Crst before EE starts // Can not assert here. ASP.Net uses our Threadpool before EE is started. PRECONDITION((m_handle == INVALID_HANDLE_VALUE)); @@ -315,7 +311,6 @@ void CLREventBase::CloseEvent() { NOTHROW; if (IsInDeadlockDetection()) {GC_TRIGGERS;} else {GC_NOTRIGGER;} - SO_TOLERANT; } CONTRACTL_END; @@ -340,7 +335,6 @@ BOOL CLREventBase::Set() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION((m_handle != INVALID_HANDLE_VALUE)); } CONTRACTL_END; @@ -360,7 +354,6 @@ BOOL CLREventBase::Reset() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION((m_handle != INVALID_HANDLE_VALUE)); } CONTRACTL_END; @@ -380,16 +373,14 @@ BOOL CLREventBase::Reset() static DWORD CLREventWaitHelper2(HANDLE handle, DWORD dwMilliseconds, BOOL alertable) { STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_SO_TOLERANT; - + return WaitForSingleObjectEx(handle,dwMilliseconds,alertable); } static DWORD CLREventWaitHelper(HANDLE handle, DWORD dwMilliseconds, BOOL alertable) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_SO_TOLERANT; - + struct Param { HANDLE handle; @@ -451,7 +442,6 @@ DWORD CLREventBase::WaitEx(DWORD dwMilliseconds, WaitMode mode, PendingSync *syn { DISABLED(GC_TRIGGERS); } - SO_TOLERANT; PRECONDITION(m_handle != INVALID_HANDLE_VALUE); // Handle has to be valid } CONTRACTL_END; @@ -471,11 +461,9 @@ DWORD CLREventBase::WaitEx(DWORD dwMilliseconds, WaitMode mode, PendingSync *syn { if (pThread && alertable) { DWORD dwRet = WAIT_FAILED; - BEGIN_SO_INTOLERANT_CODE_NOTHROW (pThread, return WAIT_FAILED;); dwRet = pThread->DoAppropriateWait(1, &m_handle, FALSE, dwMilliseconds, mode, syncState); - END_SO_INTOLERANT_CODE; return dwRet; } else { @@ -491,7 +479,6 @@ void CLRSemaphore::Create (DWORD dwInitial, DWORD dwMax) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(m_handle == INVALID_HANDLE_VALUE); } CONTRACTL_END; @@ -522,7 +509,6 @@ BOOL CLRSemaphore::Release(LONG lReleaseCount, LONG *lpPreviousCount) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(m_handle != INVALID_HANDLE_VALUE); } CONTRACTL_END; @@ -556,7 +542,6 @@ DWORD CLRSemaphore::Wait(DWORD dwMilliseconds, BOOL alertable) { DISABLED(GC_TRIGGERS); } - SO_TOLERANT; PRECONDITION(m_handle != INVALID_HANDLE_VALUE); // Invalid to have invalid handle } CONTRACTL_END; @@ -596,7 +581,6 @@ void CLRLifoSemaphore::Create(INT32 initialSignalCount, INT32 maximumSignalCount { THROWS; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -638,7 +622,6 @@ bool CLRLifoSemaphore::WaitForSignal(DWORD timeoutMs) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -750,7 +733,6 @@ bool CLRLifoSemaphore::Wait(DWORD timeoutMs, UINT32 spinCount, UINT32 processorC { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -925,7 +907,6 @@ void CLRLifoSemaphore::Release(INT32 releaseCount) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1005,7 +986,6 @@ void CLRMutex::Create(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwne { THROWS; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(m_handle == INVALID_HANDLE_VALUE && m_handle != NULL); } CONTRACTL_END; @@ -1034,7 +1014,6 @@ BOOL CLRMutex::Release() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(m_handle != INVALID_HANDLE_VALUE && m_handle != NULL); } CONTRACTL_END; diff --git a/src/vm/threadpoolrequest.cpp b/src/vm/threadpoolrequest.cpp index 7bfb413..f9576b7 100644 --- a/src/vm/threadpoolrequest.cpp +++ b/src/vm/threadpoolrequest.cpp @@ -226,7 +226,6 @@ bool PerAppDomainTPCountList::AreRequestsPendingInAnyAppDomains() NOTHROW; MODE_ANY; GC_NOTRIGGER; - SO_TOLERANT; //Its ok for tis function to fail. } CONTRACTL_END; @@ -729,7 +728,6 @@ void ManagedPerAppDomainTPCount::DispatchWorkItem(bool* foundWork, bool* wasNotR CONTRACTL_END; GCX_COOP(); - BEGIN_SO_INTOLERANT_CODE(pThread); // // NOTE: there is a potential race between the time we retrieve the app @@ -774,8 +772,6 @@ void ManagedPerAppDomainTPCount::DispatchWorkItem(bool* foundWork, bool* wasNotR // We should have released all locks. _ASSERTE(g_fEEShutDown || pThread->m_dwLockCount == 0 || pThread->m_fRudeAborted); - END_SO_INTOLERANT_CODE; - *foundWork = true; } else diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index cd405f1..c8ebceb 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -543,7 +543,6 @@ Thread* SetupThreadNoThrow(HRESULT *pHR) { CONTRACTL { NOTHROW; - SO_TOLERANT; if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);} } CONTRACTL_END; @@ -633,7 +632,6 @@ Thread* SetupThread(BOOL fInternal) CONTRACTL { THROWS; if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);} - SO_TOLERANT; } CONTRACTL_END; @@ -641,12 +639,6 @@ Thread* SetupThread(BOOL fInternal) if ((pThread = GetThread()) != NULL) return pThread; -#ifdef FEATURE_STACK_PROBE - RetailStackProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), NULL); -#endif //FEATURE_STACK_PROBE - - CONTRACT_VIOLATION(SOToleranceViolation); - // For interop debugging, we must mark that we're in a can't-stop region // b.c we may take Crsts here that may block the helper thread. // We're especially fragile here b/c we don't have a Thread object yet @@ -935,9 +927,6 @@ HRESULT Thread::DetachThread(BOOL fDLLThreadDetach) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - // @todo . We need to probe here, but can't introduce destructors etc. - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - // Clear any outstanding stale EH state that maybe still active on the thread. #ifdef WIN64EXCEPTIONS ExceptionTracker::PopTrackers((void*)-1); @@ -1008,8 +997,6 @@ HRESULT Thread::DetachThread(BOOL fDLLThreadDetach) ThreadStore::CheckForEEShutdown(); } - END_CONTRACT_VIOLATION; - HANDLE hThread = GetThreadHandle(); SetThreadHandle (SWITCHOUT_HANDLE_VALUE); while (m_dwThreadHandleBeingUsed > 0) @@ -1854,13 +1841,9 @@ BOOL Thread::HasStarted(BOOL bRequiresTSL) CONTRACTL { NOTHROW; DISABLED(GC_NOTRIGGER); - SO_TOLERANT; } CONTRACTL_END; - // @todo need a probe that tolerates not having a thread setup at all - CONTRACT_VIOLATION(SOToleranceViolation); - _ASSERTE(!m_fPreemptiveGCDisabled); // can't use PreemptiveGCDisabled() here // This is cheating a little. There is a pathway here from SetupThread, but only @@ -2736,17 +2719,11 @@ void Thread::BaseCoUninitialize() { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_SO_INTOLERANT; STATIC_CONTRACT_MODE_PREEMPTIVE; _ASSERTE(GetThread() == this); - BEGIN_SO_TOLERANT_CODE(this); - // BEGIN_SO_TOLERANT_CODE wraps a __try/__except around this call, so if the OS were to allow - // an exception to leak through to us, we'll catch it. ::CoUninitialize(); - END_SO_TOLERANT_CODE; - }// BaseCoUninitialize #ifdef FEATURE_COMINTEROP @@ -2754,16 +2731,13 @@ void Thread::BaseWinRTUninitialize() { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_SO_INTOLERANT; STATIC_CONTRACT_MODE_PREEMPTIVE; _ASSERTE(WinRTSupported()); _ASSERTE(GetThread() == this); _ASSERTE(IsWinRTInitialized()); - BEGIN_SO_TOLERANT_CODE(this); RoUninitialize(); - END_SO_TOLERANT_CODE; } #endif // FEATURE_COMINTEROP @@ -3311,7 +3285,6 @@ DWORD MsgWaitHelper(int numWaiters, HANDLE* phEvent, BOOL bWaitAll, DWORD millis // The true contract for GC trigger should be the following. But this puts a very strong restriction // on contract for functions that call EnablePreemptiveGC. //if (GetThread() && !ThreadStore::HoldingThreadStore(GetThread())) {GC_TRIGGERS;} else {GC_NOTRIGGER;} - STATIC_CONTRACT_SO_INTOLERANT; STATIC_CONTRACT_GC_TRIGGERS; DWORD flags = 0; @@ -3323,7 +3296,6 @@ DWORD MsgWaitHelper(int numWaiters, HANDLE* phEvent, BOOL bWaitAll, DWORD millis _ASSERTE (g_fEEShutDown); DWORD lastError = 0; - BEGIN_SO_TOLERANT_CODE(pThread); // If we're going to pump, we cannot use WAIT_ALL. That's because the wait would // only be satisfied if a message arrives while the handles are signalled. If we @@ -3371,9 +3343,6 @@ DWORD MsgWaitHelper(int numWaiters, HANDLE* phEvent, BOOL bWaitAll, DWORD millis lastError = ::GetLastError(); - END_SO_TOLERANT_CODE; - - // END_SO_TOLERANT_CODE overwrites lasterror. Let's reset it. ::SetLastError(lastError); return dwReturn; @@ -3381,23 +3350,6 @@ DWORD MsgWaitHelper(int numWaiters, HANDLE* phEvent, BOOL bWaitAll, DWORD millis #endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT -DWORD WaitForMultipleObjectsEx_SO_TOLERANT (DWORD nCount, HANDLE *lpHandles, BOOL bWaitAll,DWORD dwMilliseconds, BOOL bAlertable) -{ - STATIC_CONTRACT_SO_INTOLERANT; - - DWORD dwRet = WAIT_FAILED; - DWORD lastError = 0; - - BEGIN_SO_TOLERANT_CODE (GetThread ()); - dwRet = ::WaitForMultipleObjectsEx (nCount, lpHandles, bWaitAll, dwMilliseconds, bAlertable); - lastError = ::GetLastError(); - END_SO_TOLERANT_CODE; - - // END_SO_TOLERANT_CODE overwrites lasterror. Let's reset it. - ::SetLastError(lastError); - return dwRet; -} - //-------------------------------------------------------------------- // Do appropriate wait based on apartment state (STA or MTA) DWORD Thread::DoAppropriateAptStateWait(int numWaiters, HANDLE* pHandles, BOOL bWaitAll, @@ -3406,7 +3358,6 @@ DWORD Thread::DoAppropriateAptStateWait(int numWaiters, HANDLE* pHandles, BOOL b CONTRACTL { THROWS; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; @@ -3423,7 +3374,7 @@ DWORD Thread::DoAppropriateAptStateWait(int numWaiters, HANDLE* pHandles, BOOL b } #endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT - return WaitForMultipleObjectsEx_SO_TOLERANT(numWaiters, pHandles, bWaitAll, timeout, alertable); + return WaitForMultipleObjectsEx(numWaiters, pHandles, bWaitAll, timeout, alertable); } // A helper called by our two flavors of DoAppropriateWaitWorker @@ -4214,7 +4165,6 @@ void WINAPI Thread::UserInterruptAPC(ULONG_PTR data) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -4450,7 +4400,6 @@ void Thread::SetLastThrownObject(OBJECTREF throwable, BOOL isUnhandled) if ((throwable == NULL) || CLRException::IsPreallocatedExceptionObject(throwable)) NOTHROW; else THROWS; // From CreateHandle GC_NOTRIGGER; if (throwable == NULL) MODE_ANY; else MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -4489,11 +4438,7 @@ void Thread::SetLastThrownObject(OBJECTREF throwable, BOOL isUnhandled) } else { - BEGIN_SO_INTOLERANT_CODE(GetThread()); - { - m_LastThrownObjectHandle = GetDomain()->CreateHandle(throwable); - } - END_SO_INTOLERANT_CODE; + m_LastThrownObjectHandle = GetDomain()->CreateHandle(throwable); } _ASSERTE(m_LastThrownObjectHandle != NULL); @@ -4512,7 +4457,6 @@ void Thread::SetSOForLastThrownObject() NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -4536,7 +4480,6 @@ OBJECTREF Thread::SafeSetLastThrownObject(OBJECTREF throwable) NOTHROW; GC_NOTRIGGER; if (throwable == NULL) MODE_ANY; else MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -4574,7 +4517,6 @@ OBJECTREF Thread::SafeSetThrowables(OBJECTREF throwable DEBUG_ARG(ThreadExceptio NOTHROW; GC_NOTRIGGER; if (throwable == NULL) MODE_ANY; else MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -4652,7 +4594,6 @@ void Thread::SetLastThrownObjectHandle(OBJECTHANDLE h) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -4676,7 +4617,6 @@ void Thread::SafeUpdateLastThrownObject(void) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -5035,7 +4975,6 @@ Thread::ApartmentState Thread::GetFinalApartment() NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -5797,7 +5736,6 @@ Thread *ThreadStore::GetAllThreadList(Thread *cursor, ULONG mask, ULONG bits) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; SUPPORTS_DAC; @@ -5827,7 +5765,6 @@ Thread *ThreadStore::GetThreadList(Thread *cursor) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; SUPPORTS_DAC; @@ -5848,7 +5785,6 @@ Thread::ThreadState Thread::GetSnapshotState() CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -6073,14 +6009,11 @@ void Thread::HandleThreadInterrupt (BOOL fWaitForADUnload) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_SO_TOLERANT; // If we're waiting for shutdown, we don't want to abort/interrupt this thread if (HasThreadStateNC(Thread::TSNC_BlockedForShutdown)) return; - BEGIN_SO_INTOLERANT_CODE(this); - if ((m_UserInterrupt & TI_Abort) != 0) { // If the thread is waiting for AD unload to finish, and the thread is interrupted, @@ -6094,7 +6027,6 @@ void Thread::HandleThreadInterrupt (BOOL fWaitForADUnload) COMPlusThrow(kThreadInterruptedException); } - END_SO_INTOLERANT_CODE; } #ifdef _DEBUG @@ -6104,7 +6036,6 @@ void CleanStackForFastGCStress () CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -6121,25 +6052,15 @@ void CleanStackForFastGCStress () void Thread::ObjectRefFlush(Thread* thread) { + // this is debug only code, so no need to validate + STATIC_CONTRACT_NOTHROW; + STATIC_CONTRACT_GC_NOTRIGGER; + STATIC_CONTRACT_ENTRY_POINT; - BEGIN_PRESERVE_LAST_ERROR; - - // The constructor and destructor of AutoCleanupSONotMainlineHolder (allocated by SO_NOT_MAINLINE_FUNCTION below) - // may trash the last error, so we need to save and restore last error here. Also, we need to add a scope here - // because we can't let the destructor run after we call SetLastError(). - { - // this is debug only code, so no need to validate - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_ENTRY_POINT; - - _ASSERTE(thread->PreemptiveGCDisabled()); // Should have been in managed code - memset(thread->dangerousObjRefs, 0, sizeof(thread->dangerousObjRefs)); - thread->m_allObjRefEntriesBad = FALSE; - CLEANSTACKFORFASTGCSTRESS (); - } - - END_PRESERVE_LAST_ERROR; + _ASSERTE(thread->PreemptiveGCDisabled()); // Should have been in managed code + memset(thread->dangerousObjRefs, 0, sizeof(thread->dangerousObjRefs)); + thread->m_allObjRefEntriesBad = FALSE; + CLEANSTACKFORFASTGCSTRESS (); } #endif @@ -6410,7 +6331,6 @@ BOOL Thread::UniqueStack(void* stackStart) { NOTHROW; GC_NOTRIGGER; - SO_NOT_MAINLINE; } CONTRACTL_END; @@ -6540,7 +6460,6 @@ void * Thread::GetStackLowerBound() // Called during fiber switch. Can not have non-static contract. STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; #ifndef FEATURE_PAL MEMORY_BASIC_INFORMATION lowerBoundMemInfo; @@ -6577,7 +6496,6 @@ void *Thread::GetStackUpperBound() // Called during fiber switch. Can not have non-static contract. STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; return ClrTeb::GetStackBase(); } @@ -6588,7 +6506,6 @@ BOOL Thread::SetStackLimits(SetStackLimitScope scope) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -6659,7 +6576,6 @@ HRESULT Thread::CLRSetThreadStackGuarantee(SetThreadStackGuaranteeScope fScope) { WRAPPER(NOTHROW); GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -6738,7 +6654,6 @@ UINT_PTR Thread::GetLastNormalStackAddress(UINT_PTR StackLimit) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -6824,7 +6739,6 @@ static void DebugLogStackRegionMBIs(UINT_PTR uLowAddress, UINT_PTR uHighAddress) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -6870,7 +6784,6 @@ void Thread::DebugLogStackMBIs() { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -6954,7 +6867,6 @@ BOOL Thread::DoesRegionContainGuardPage(UINT_PTR uLowAddress, UINT_PTR uHighAddr { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -7015,7 +6927,6 @@ BOOL Thread::DetermineIfGuardPagePresent() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -7060,101 +6971,6 @@ UINT_PTR Thread::GetLastNormalStackAddress() } -#ifdef FEATURE_STACK_PROBE -/* - * CanResetStackTo - * - * Given a target stack pointer, this function will tell us whether or not we could restore the guard page if we - * unwound the stack that far. - * - * Parameters: - * stackPointer -- stack pointer that we want to try to reset the thread's stack up to. - * - * Returns: - * TRUE if there's enough room to reset the stack, false otherwise. - */ -BOOL Thread::CanResetStackTo(LPCVOID stackPointer) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - } - CONTRACTL_END; - - // How much space between the given stack pointer and the first guard page? - // - // This must be signed since the stack pointer might be in the guard region, - // which is at a lower address than GetLastNormalStackAddress will return. - INT_PTR iStackSpaceLeft = (INT_PTR)stackPointer - GetLastNormalStackAddress(); - - // We need to have enough space to call back into the EE from the handler, so we use the twice the entry point amount. - // We need enough to do work and enough that partway through that work we won't probe and COMPlusThrowSO. - - const INT_PTR iStackSizeThreshold = (ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT * 2) * GetOsPageSize()); - - if (iStackSpaceLeft > iStackSizeThreshold) - { - return TRUE; - } - else - { - return FALSE; - } -} - -/* - * IsStackSpaceAvailable - * - * Given a number of stack pages, this function will tell us whether or not we have that much space - * before the top of the stack. If we are in the guard region we must be already handling an SO, - * so we report how much space is left in the guard region - * - * Parameters: - * numPages -- the number of pages that we need. This can be a fractional amount. - * - * Returns: - * TRUE if there's that many pages of stack available - */ -BOOL Thread::IsStackSpaceAvailable(float numPages) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - } - CONTRACTL_END; - - // How much space between the current stack pointer and the first guard page? - // - // This must be signed since the stack pointer might be in the guard region, - // which is at a lower address than GetLastNormalStackAddress will return. - float iStackSpaceLeft = static_cast((INT_PTR)GetCurrentSP() - (INT_PTR)GetLastNormalStackAddress()); - - // If we have access to the stack guarantee (either in the guard region or we've tripped the guard page), then - // use that. - if ((iStackSpaceLeft/GetOsPageSize()) < numPages && !DetermineIfGuardPagePresent()) - { - UINT_PTR stackGuarantee = GetStackGuarantee(); - // GetLastNormalStackAddress actually returns the 2nd to last stack page on the stack. We'll add that to our available - // amount of stack, in addition to any sort of stack guarantee we might have. - // - // All these values are OS supplied, and will never overflow. (If they do, that means the stack is on the order - // over GB, which isn't possible. - iStackSpaceLeft += stackGuarantee + GetOsPageSize(); - } - if ((iStackSpaceLeft/GetOsPageSize()) < numPages) - { - return FALSE; - } - - return TRUE; -} - -#endif // FEATURE_STACK_PROBE - /* * GetStackGuarantee * @@ -7206,7 +7022,6 @@ BOOL Thread::MarkPageAsGuard(UINT_PTR uGuardPageBase) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -7252,14 +7067,10 @@ VOID Thread::RestoreGuardPage() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; - // Need a hard SO probe here. - CONTRACT_VIOLATION(SOToleranceViolation); - BOOL bStackGuarded = DetermineIfGuardPagePresent(); // If the guard page is still there, then just return. @@ -8015,11 +7826,6 @@ static void ManagedThreadBase_DispatchMiddle(ManagedThreadCallState *pCallState) STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_SO_TOLERANT; - - // We have the probe outside the EX_TRY below since corresponding EX_CATCH - // also invokes SO_INTOLERANT code. - BEGIN_SO_INTOLERANT_CODE(GetThread()); EX_TRY_CPP_ONLY { @@ -8091,8 +7897,6 @@ static void ManagedThreadBase_DispatchMiddle(ManagedThreadCallState *pCallState) } } EX_END_CATCH(SwallowAllExceptions); - - END_SO_INTOLERANT_CODE; } /* @@ -8130,7 +7934,6 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO } LONG ret = -1; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return EXCEPTION_CONTINUE_SEARCH;); // This will invoke the swallowing filter. If that returns EXCEPTION_CONTINUE_SEARCH, // it will trigger unhandled exception processing. @@ -8227,8 +8030,6 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO } } - - END_SO_INTOLERANT_CODE; return ret; } @@ -8682,7 +8483,6 @@ BOOL ThreadStore::HoldingThreadStore(Thread *pThread) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -8749,7 +8549,6 @@ INT32 Thread::ResetManagedThreadObjectInCoopMode(INT32 nPriority) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -8770,7 +8569,6 @@ BOOL Thread::IsRealThreadPoolResetNeeded() NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -8794,7 +8592,7 @@ void Thread::InternalReset(BOOL fNotFinalizerThread, BOOL fThreadObjectResetNeed { CONTRACTL { NOTHROW; - if(!fNotFinalizerThread || fThreadObjectResetNeeded) {GC_TRIGGERS;SO_INTOLERANT;} else {GC_NOTRIGGER;SO_TOLERANT;} + if(!fNotFinalizerThread || fThreadObjectResetNeeded) {GC_TRIGGERS;} else {GC_NOTRIGGER;} } CONTRACTL_END; @@ -8847,11 +8645,9 @@ HRESULT Thread::Abort () { NOTHROW; if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);} - SO_TOLERANT; } CONTRACTL_END; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW;); EX_TRY { UserAbort(TAR_Thread, EEPolicy::TA_Safe, INFINITE, Thread::UAC_Host); @@ -8860,7 +8656,6 @@ HRESULT Thread::Abort () { } EX_END_CATCH(SwallowAllExceptions); - END_SO_INTOLERANT_CODE; return S_OK; } @@ -8871,12 +8666,9 @@ HRESULT Thread::RudeAbort() { NOTHROW; if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);} - SO_TOLERANT; } CONTRACTL_END; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - EX_TRY { UserAbort(TAR_Thread, EEPolicy::TA_Rude, INFINITE, Thread::UAC_Host); @@ -8886,8 +8678,6 @@ HRESULT Thread::RudeAbort() } EX_END_CATCH(SwallowAllExceptions); - END_SO_INTOLERANT_CODE; - return S_OK; } @@ -8896,7 +8686,6 @@ HRESULT Thread::NeedsPriorityScheduling(BOOL *pbNeedsPriorityScheduling) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -8988,13 +8777,10 @@ void Thread::SetupThreadForHost() { THROWS; GC_TRIGGERS; - SO_TOLERANT; } CONTRACTL_END; _ASSERTE (GetThread() == this); - CONTRACT_VIOLATION(SOToleranceViolation); - } @@ -9002,7 +8788,6 @@ ETaskType GetCurrentTaskType() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; ETaskType TaskType = TT_UNKNOWN; size_t type = (size_t)ClrFlsGetValue (TlsIdx_ThreadType); diff --git a/src/vm/threads.h b/src/vm/threads.h index b4e3b9d..61d92e2 100644 --- a/src/vm/threads.h +++ b/src/vm/threads.h @@ -1564,25 +1564,6 @@ public: return (m_State & TS_Detached); } -#ifdef FEATURE_STACK_PROBE -//--------------------------------------------------------------------------------------- -// -// IsSOTolerant - Is the current thread in SO Tolerant region? -// -// Arguments: -// pLimitFrame: the limit of search for frames -// -// Return Value: -// TRUE if in SO tolerant region. -// FALSE if in SO intolerant region. -// -// Note: -// We walk our frame chain to decide. If HelperMethodFrame is seen first, we are in tolerant -// region. If EnterSOIntolerantCodeFrame is seen first, we are in intolerant region. -// - BOOL IsSOTolerant(void * pLimitFrame); -#endif - #ifdef _DEBUG class DisableSOCheckInHCALL { @@ -1790,7 +1771,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } @@ -1817,7 +1797,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } @@ -2529,7 +2508,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -2651,7 +2629,6 @@ public: DWORD GetThreadId() { - STATIC_CONTRACT_SO_TOLERANT; LIMITED_METHOD_DAC_CONTRACT; _ASSERTE(m_ThreadId != UNINITIALIZED_THREADID); return m_ThreadId; @@ -3455,7 +3432,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3511,16 +3487,6 @@ public: // stack overflow exception. BOOL DetermineIfGuardPagePresent(); -#ifdef FEATURE_STACK_PROBE - // CanResetStackTo will return TRUE if the given stack pointer is far enough away from the guard page to proper - // restore the guard page with RestoreGuardPage. - BOOL CanResetStackTo(LPCVOID stackPointer); - - // IsStackSpaceAvailable will return true if there are the given number of stack pages available on the stack. - BOOL IsStackSpaceAvailable(float numPages); - -#endif - // Returns the amount of stack available after an SO but before the OS rips the process. static UINT_PTR GetStackGuarantee(); @@ -4623,27 +4589,6 @@ public: #endif // defined(GCCOVER_TOLERATE_SPURIOUS_AV) #endif // HAVE_GCCOVER -#if defined(_DEBUG) && defined(FEATURE_STACK_PROBE) - class ::BaseStackGuard; -private: - // This field is used for debugging purposes to allow easy access to the stack guard - // chain and also in SO-tolerance checking to quickly determine if a guard is in place. - BaseStackGuard *m_pCurrentStackGuard; - -public: - BaseStackGuard *GetCurrentStackGuard() - { - LIMITED_METHOD_CONTRACT; - return m_pCurrentStackGuard; - } - - void SetCurrentStackGuard(BaseStackGuard *pGuard) - { - LIMITED_METHOD_CONTRACT; - m_pCurrentStackGuard = pGuard; - } -#endif - private: BOOL m_fCompletionPortDrained; public: @@ -5398,7 +5343,6 @@ private: { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -6607,29 +6551,6 @@ class GCForbidLoaderUseHolder #endif // _DEBUG_IMPL #endif // DACCESS_COMPILE -#ifdef FEATURE_STACK_PROBE -#ifdef _DEBUG_IMPL -inline void NO_FORBIDGC_LOADER_USE_ThrowSO() -{ - WRAPPER_NO_CONTRACT; - if (FORBIDGC_LOADER_USE_ENABLED()) - { - //if you hitting this assert maybe a failure was injected at the place - // it won't occur in a real-world scenario, see VSW 397871 - // then again maybe it 's a bug at the place FORBIDGC_LOADER_USE_ENABLED was set - _ASSERTE(!"Unexpected SO, please read the comment"); - } - else - COMPlusThrowSO(); -} -#else -inline void NO_FORBIDGC_LOADER_USE_ThrowSO() -{ - COMPlusThrowSO(); -} -#endif -#endif - // There is an MDA which can detect illegal reentrancy into the CLR. For instance, if you call managed // code from a native vectored exception handler, this might cause a reverse PInvoke to occur. But if the // exception was triggered from code that was executing in cooperative GC mode, we now have GC holes and diff --git a/src/vm/threads.inl b/src/vm/threads.inl index 2da3c1a..df50a51 100644 --- a/src/vm/threads.inl +++ b/src/vm/threads.inl @@ -82,7 +82,6 @@ inline void Thread::SetKickOffDomainId(ADID ad) CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -95,7 +94,6 @@ inline ADID Thread::GetKickOffDomainId() CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -108,7 +106,6 @@ inline OBJECTHANDLE Thread::GetThreadCurrNotification() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; SUPPORTS_DAC; @@ -123,7 +120,6 @@ inline void Thread::SetThreadCurrNotification(OBJECTHANDLE handle) { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -137,7 +133,6 @@ inline void Thread::ClearThreadCurrNotification() { CONTRACTL { - SO_NOT_MAINLINE; NOTHROW; GC_NOTRIGGER; } @@ -152,7 +147,6 @@ inline OBJECTREF Thread::GetExposedObjectRaw() CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -163,14 +157,7 @@ inline OBJECTREF Thread::GetExposedObjectRaw() inline void Thread::FinishSOWork() { WRAPPER_NO_CONTRACT; -#ifdef FEATURE_STACK_PROBE - if (HasThreadStateNC(TSNC_SOWorkNeeded)) - { - ResetThreadStateNC(TSNC_SOWorkNeeded); - } -#else _ASSERTE(!HasThreadStateNC(TSNC_SOWorkNeeded)); -#endif } #ifdef FEATURE_COMINTEROP diff --git a/src/vm/threadstatics.cpp b/src/vm/threadstatics.cpp index fbcd4fa..8775898 100644 --- a/src/vm/threadstatics.cpp +++ b/src/vm/threadstatics.cpp @@ -23,7 +23,6 @@ void ThreadLocalBlock::FreeTLM(SIZE_T i, BOOL isThreadShuttingdown) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -81,7 +80,6 @@ void ThreadLocalBlock::FreeTable() { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -243,7 +241,6 @@ DWORD ThreadLocalModule::GetClassFlags(MethodTable* pMT, DWORD iClassIndex) // i CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; if (pMT->IsDynamicStatics()) @@ -288,7 +285,6 @@ void ThreadLocalBlock::AddPinningHandleToList(OBJECTHANDLE oh) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -302,7 +298,6 @@ void ThreadLocalBlock::FreePinningHandles() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/threadstatics.h b/src/vm/threadstatics.h index e2c9339..c85245d 100644 --- a/src/vm/threadstatics.h +++ b/src/vm/threadstatics.h @@ -115,7 +115,6 @@ struct ThreadLocalModule NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -169,7 +168,6 @@ struct ThreadLocalModule NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC; } CONTRACTL_END; @@ -378,7 +376,6 @@ struct ThreadLocalModule { THROWS; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp index 72218db..fcc9732 100644 --- a/src/vm/threadsuspend.cpp +++ b/src/vm/threadsuspend.cpp @@ -456,7 +456,6 @@ DWORD Thread::ResumeThread() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1012,7 +1011,6 @@ BOOL Thread::ReadyForAsyncException() CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -1026,9 +1024,6 @@ BOOL Thread::ReadyForAsyncException() return TRUE; } - // This needs the probe with GenerateHardSO - CONTRACT_VIOLATION(SOToleranceViolation); - if (GetThread() == this && HasThreadStateNC (TSNC_PreparingAbort) && !IsRudeAbort() ) { STRESS_LOG0(LF_APPDOMAIN, LL_INFO10, "in Thread::ReadyForAbort PreparingAbort\n"); @@ -1194,7 +1189,6 @@ BOOL Thread::IsRudeAbort() CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -2751,13 +2745,10 @@ void Thread::RareDisablePreemptiveGC() CONTRACTL { NOTHROW; - SO_TOLERANT; DISABLED(GC_TRIGGERS); // I think this is actually wrong: prevents a p->c->p mode switch inside a NOTRIGGER region. } CONTRACTL_END; - CONTRACT_VIOLATION(SOToleranceViolation); - if (IsAtProcessExit()) { goto Exit; @@ -3000,9 +2991,7 @@ void Thread::HandleThreadAbort (BOOL fForce) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_SO_TOLERANT; - BEGIN_SO_INTOLERANT_CODE(this); TESTHOOKCALL(AppDomainCanBeUnloaded(GetDomain()->GetId().m_dwId,FALSE)); // It's possible we could go through here if we hit a hard SO and MC++ has called back @@ -3058,7 +3047,6 @@ void Thread::HandleThreadAbort (BOOL fForce) RaiseTheExceptionInternalOnly(exceptObj, FALSE); } - END_SO_INTOLERANT_CODE; END_PRESERVE_LAST_ERROR; } @@ -3090,9 +3078,6 @@ void Thread::PreWorkForThreadAbort() case eRudeExitProcess: case eDisableRuntime: { - // We're about to exit the process, if we take an SO here we'll just exit faster right??? - CONTRACT_VIOLATION(SOToleranceViolation); - GetEEPolicy()->NotifyHostOnDefaultAction(OPR_ThreadRudeAbortInCriticalRegion,action); GetEEPolicy()->HandleExitProcessFromEscalation(action,HOST_E_EXITPROCESS_ADUNLOAD); } @@ -3178,12 +3163,11 @@ void Thread::RareEnablePreemptiveGC() CONTRACTL { NOTHROW; DISABLED(GC_TRIGGERS); // I think this is actually wrong: prevents a p->c->p mode switch inside a NOTRIGGER region. - SO_TOLERANT; } CONTRACTL_END; // @todo - Needs a hard SO probe - CONTRACT_VIOLATION(GCViolation|FaultViolation|SOToleranceViolation); + CONTRACT_VIOLATION(GCViolation|FaultViolation); // If we have already received our PROCESS_DETACH during shutdown, there is only one thread in the // process and no coordination is necessary. @@ -3342,7 +3326,6 @@ void RedirectedThreadFrame::ExceptionUnwind() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -3485,7 +3468,6 @@ void NotifyHostOnGCSuspension() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -3517,15 +3499,6 @@ void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason) Thread *pThread = GetThread(); _ASSERTE(pThread); -#ifdef FEATURE_STACK_PROBE - if (GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) == eRudeUnloadAppDomain) - { - RetailStackProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), pThread); - } -#endif - - BEGIN_CONTRACT_VIOLATION(SOToleranceViolation); - // Get the saved context CONTEXT *pCtx = pThread->GetSavedRedirectContext(); _ASSERTE(pCtx); @@ -3683,9 +3656,6 @@ void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason) } #endif // _TARGET_X86_ - - END_CONTRACT_VIOLATION; - } //**************************************************************************************** @@ -4988,13 +4958,6 @@ ThrowControlForThread( _ASSERTE(pThread->PreemptiveGCDisabled()); -#ifdef FEATURE_STACK_PROBE - if (GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) == eRudeUnloadAppDomain) - { - RetailStackProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), pThread); - } -#endif - // Check if we can start abort // We use InducedThreadRedirect as a marker to tell stackwalker that a thread is redirected from JIT code. // This is to distinguish a thread is in Preemptive mode and in JIT code. @@ -5830,7 +5793,6 @@ void Thread::UnhijackThread() CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -6061,24 +6023,12 @@ void STDCALL OnHijackWorker(HijackArgs * pArgs) CONTRACTL{ THROWS; GC_TRIGGERS; - SO_TOLERANT; } CONTRACTL_END; #ifdef HIJACK_NONINTERRUPTIBLE_THREADS Thread *thread = GetThread(); -#ifdef FEATURE_STACK_PROBE - if (GetEEPolicy()->GetActionOnFailure(FAIL_StackOverflow) == eRudeUnloadAppDomain) - { - // Make sure default domain does not see SO. - // probe for our entry point amount and throw if not enough stack - RetailStackProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT), thread); - } -#endif // FEATURE_STACK_PROBE - - CONTRACT_VIOLATION(SOToleranceViolation); - thread->ResetThreadState(Thread::TS_Hijacked); // Fix up our caller's stack, so it can resume from the hijack correctly diff --git a/src/vm/tlbexport.h b/src/vm/tlbexport.h index c104c5b..32db10b 100644 --- a/src/vm/tlbexport.h +++ b/src/vm/tlbexport.h @@ -158,7 +158,6 @@ private: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -239,7 +238,7 @@ protected: } ~CHrefOfTIHash() { - CONTRACTL { NOTHROW; SO_TOLERANT; } CONTRACTL_END; + CONTRACTL { NOTHROW; } CONTRACTL_END; Clear(); } diff --git a/src/vm/typectxt.cpp b/src/vm/typectxt.cpp index e2d6aba..8d3341a 100644 --- a/src/vm/typectxt.cpp +++ b/src/vm/typectxt.cpp @@ -23,7 +23,6 @@ void SigTypeContext::InitTypeContext(MethodDesc *md, Instantiation exactClassInst, Instantiation exactMethodInst, SigTypeContext *pRes) { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; MethodTable *pMT = md->GetMethodTable(); if (pMT->IsArray()) @@ -43,7 +42,6 @@ void SigTypeContext::InitTypeContext(MethodDesc *md, SigTypeContext *pRes) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; PRECONDITION(CheckPointer(md)); @@ -67,7 +65,6 @@ void SigTypeContext::InitTypeContext(MethodDesc *md, TypeHandle declaringType, S NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; PRECONDITION(CheckPointer(md)); @@ -137,7 +134,6 @@ void SigTypeContext::InitTypeContext(MethodDesc *md, TypeHandle declaringType, I NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; PRECONDITION(CheckPointer(md)); } CONTRACTL_END; @@ -181,7 +177,6 @@ void SigTypeContext::InitTypeContext(FieldDesc *pFD, TypeHandle declaringType, S NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; PRECONDITION(CheckPointer(declaringType, NULL_OK)); PRECONDITION(CheckPointer(pFD)); @@ -197,7 +192,6 @@ void SigTypeContext::InitTypeContext(TypeHandle th, SigTypeContext *pRes) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END; if (th.IsNull()) @@ -221,7 +215,6 @@ const SigTypeContext * SigTypeContext::GetOptionalTypeContext(MethodDesc *md, Ty { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -246,7 +239,6 @@ const SigTypeContext * SigTypeContext::GetOptionalTypeContext(TypeHandle th, Sig { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -272,7 +264,6 @@ BOOL SigTypeContext::IsValidTypeOnlyInstantiationOf(const SigTypeContext *pCtxTy { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/typedesc.cpp b/src/vm/typedesc.cpp index bac52f5..a19551c 100644 --- a/src/vm/typedesc.cpp +++ b/src/vm/typedesc.cpp @@ -25,8 +25,6 @@ #include "compile.h" #endif #include "array.h" -#include "stackprobe.h" - #ifndef DACCESS_COMPILE #ifdef _DEBUG @@ -107,12 +105,10 @@ PTR_Module TypeDesc::GetLoaderModule() _ASSERTE(GetInternalCorElementType() == ELEMENT_TYPE_FNPTR); PTR_FnPtrTypeDesc asFnPtr = dac_cast(this); - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), fFail = TRUE ); if (!fFail) { - retVal = ClassLoader::ComputeLoaderModuleForFunctionPointer(asFnPtr->GetRetAndArgTypesPointer(), asFnPtr->GetNumArgs()+1); + retVal = ClassLoader::ComputeLoaderModuleForFunctionPointer(asFnPtr->GetRetAndArgTypesPointer(), asFnPtr->GetNumArgs()+1); } - END_SO_INTOLERANT_CODE; return retVal; } } @@ -145,7 +141,6 @@ PTR_Module TypeDesc::GetModule() { NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; SUPPORTS_DAC; // Function pointer types belong to no module //PRECONDITION(GetInternalCorElementType() != ELEMENT_TYPE_FNPTR); @@ -541,7 +536,6 @@ TypeHandle::CastResult TypeDesc::CanCastToNoGC(TypeHandle toType) NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END @@ -633,7 +627,6 @@ TypeHandle::CastResult TypeDesc::CanCastParamNoGC(TypeHandle fromParam, TypeHand NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END @@ -708,7 +701,6 @@ BOOL TypeDesc::IsEquivalentTo(TypeHandle type COMMA_INDEBUG(TypeHandlePairList * THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/typedesc.h b/src/vm/typedesc.h index 06b544b..a6671df 100644 --- a/src/vm/typedesc.h +++ b/src/vm/typedesc.h @@ -350,7 +350,6 @@ public: , m_pCCWTemplate(NULL) #endif // FEATURE_COMINTEROP { - STATIC_CONTRACT_SO_TOLERANT; WRAPPER_NO_CONTRACT; INDEBUG(Verify()); } diff --git a/src/vm/typehandle.cpp b/src/vm/typehandle.cpp index 5004ab9..53725af 100644 --- a/src/vm/typehandle.cpp +++ b/src/vm/typehandle.cpp @@ -42,7 +42,6 @@ void TypeHandle::NormalizeUnsharedArrayMT() { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; // @TODO: This is probably incorrect if (IsNull() || IsTypeDesc()) return; @@ -61,8 +60,6 @@ void TypeHandle::NormalizeUnsharedArrayMT() CorElementType kind = AsMethodTable()->GetInternalCorElementType(); unsigned rank = AsMethodTable()->GetRank(); - // @todo This should be turned into a probe with a hard SO when we have one - CONTRACT_VIOLATION(SOToleranceViolation); // == FailIfNotLoadedOrNotRestored TypeHandle arrayType = ClassLoader::LoadArrayTypeThrowing( elemType, kind, @@ -194,9 +191,7 @@ Module *TypeHandle::GetDefiningModuleForOpenType() const SUPPORTS_DAC; Module* returnValue = NULL; - - INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(goto Exit;); - + if (IsGenericVariable()) { PTR_TypeVarTypeDesc pTyVar = dac_cast(AsTypeDesc()); @@ -213,15 +208,12 @@ Module *TypeHandle::GetDefiningModuleForOpenType() const returnValue = GetMethodTable()->GetDefiningModuleForOpenType(); } Exit: - ; - END_INTERIOR_STACK_PROBE; return returnValue; } BOOL TypeHandle::ContainsGenericVariables(BOOL methodOnly /*=FALSE*/) const { - STATIC_CONTRACT_SO_TOLERANT; STATIC_CONTRACT_NOTHROW; SUPPORTS_DAC; @@ -405,7 +397,6 @@ PTR_LoaderAllocator TypeHandle::GetLoaderAllocator() const STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_INTOLERANT; STATIC_CONTRACT_SUPPORTS_DAC; if (IsTypeDesc()) @@ -755,18 +746,14 @@ void TypeHandle::GetName(SString &result) const { THROWS; GC_NOTRIGGER; - SO_TOLERANT; INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END - INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(goto Exit;); - { - if (IsTypeDesc()) { AsTypeDesc()->GetName(result); - goto Exit; + return; } AsMethodTable()->_GetFullyQualifiedNameForClass(result); @@ -775,10 +762,6 @@ void TypeHandle::GetName(SString &result) const Instantiation inst = GetInstantiation(); if (!inst.IsEmpty()) TypeString::AppendInst(result, inst); - } -Exit: - ; - END_INTERIOR_STACK_PROBE; } TypeHandle TypeHandle::GetParent() const @@ -786,7 +769,6 @@ TypeHandle TypeHandle::GetParent() const STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; if (IsTypeDesc()) return(AsTypeDesc()->GetParent()); @@ -1276,7 +1258,6 @@ OBJECTREF TypeHandle::GetManagedClassObjectFast() const NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; FORBID_FAULT; } @@ -1605,7 +1586,6 @@ BOOL TypeHandle::SatisfiesClassConstraints() const THROWS; GC_TRIGGERS; MODE_ANY; - SO_INTOLERANT; INJECT_FAULT(COMPlusThrowOM()); } @@ -1617,8 +1597,6 @@ BOOL TypeHandle::SatisfiesClassConstraints() const Instantiation typicalInst; SigTypeContext typeContext; TypeHandle thParent; - - INTERIOR_STACK_PROBE_CHECK_THREAD; //TODO: cache (positive?) result in methodtable using, say, enum_flag2_UNUSEDxxx @@ -1627,14 +1605,12 @@ BOOL TypeHandle::SatisfiesClassConstraints() const if (!thParent.IsNull() && !thParent.SatisfiesClassConstraints()) { - returnValue = FALSE; - goto Exit; + return FALSE; } if (!HasInstantiation()) { - returnValue = TRUE; - goto Exit; + return TRUE; } classInst = GetInstantiation(); @@ -1646,9 +1622,9 @@ BOOL TypeHandle::SatisfiesClassConstraints() const typicalInst = thCanonical.GetInstantiation(); SigTypeContext::InitTypeContext(*this, &typeContext); - + for (DWORD i = 0; i < classInst.GetNumArgs(); i++) - { + { TypeHandle thArg = classInst[i]; _ASSERTE(!thArg.IsNull()); @@ -1660,23 +1636,16 @@ BOOL TypeHandle::SatisfiesClassConstraints() const if (!tyvar->SatisfiesConstraints(&typeContext, thArg)) { - returnValue = FALSE; - goto Exit; + return FALSE; } + } - } - returnValue = TRUE; -Exit: - ; - END_INTERIOR_STACK_PROBE; - - return returnValue; + return TRUE; } TypeKey TypeHandle::GetTypeKey() const { LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; PRECONDITION(!IsGenericVariable()); if (IsTypeDesc()) @@ -1845,7 +1814,6 @@ CHECK TypeHandle::CheckFullyLoaded() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/typehandle.h b/src/vm/typehandle.h index f704c3e..9e373df 100644 --- a/src/vm/typehandle.h +++ b/src/vm/typehandle.h @@ -674,7 +674,6 @@ inline CHECK CheckPointer(TypeHandle th, IsNullOK ok = NULL_NOT_OK) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; SUPPORTS_DAC; STATIC_CONTRACT_CANNOT_TAKE_LOCK; diff --git a/src/vm/typehandle.inl b/src/vm/typehandle.inl index 9f6fb7b..545519f 100644 --- a/src/vm/typehandle.inl +++ b/src/vm/typehandle.inl @@ -203,7 +203,6 @@ inline BOOL TypeHandle::IsEquivalentTo(TypeHandle type COMMA_INDEBUG(TypeHandleP THROWS; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/typehash.cpp b/src/vm/typehash.cpp index a1d6d77..552960b 100644 --- a/src/vm/typehash.cpp +++ b/src/vm/typehash.cpp @@ -224,7 +224,6 @@ static DWORD HashTypeHandle(DWORD level, TypeHandle t) NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; PRECONDITION(CheckPointer(t)); PRECONDITION(!t.IsEncodedFixup()); SUPPORTS_DAC; @@ -233,8 +232,6 @@ static DWORD HashTypeHandle(DWORD level, TypeHandle t) DWORD retVal = 0; - INTERIOR_STACK_PROBE_NOTHROW_CHECK_THREAD(goto Exit;); - if (t.HasTypeParam()) { retVal = HashParamType(level, t.GetInternalCorElementType(), t.GetTypeParam()); @@ -254,12 +251,6 @@ static DWORD HashTypeHandle(DWORD level, TypeHandle t) } else retVal = HashPossiblyInstantiatedType(level, t.GetCl(), Instantiation()); - -#if defined(FEATURE_STACK_PROBE) && !defined(DACCESS_COMPILE) -Exit: - ; -#endif - END_INTERIOR_STACK_PROBE; return retVal; } @@ -624,7 +615,6 @@ BOOL EETypeHashTable::ContainsValue(TypeHandle th) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; diff --git a/src/vm/typekey.h b/src/vm/typekey.h index 22f8abf..95a9f8b 100644 --- a/src/vm/typekey.h +++ b/src/vm/typekey.h @@ -148,7 +148,6 @@ public: { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; SUPPORTS_DAC; } diff --git a/src/vm/typeparse.cpp b/src/vm/typeparse.cpp index 1fd867a..34bf964 100644 --- a/src/vm/typeparse.cpp +++ b/src/vm/typeparse.cpp @@ -16,7 +16,6 @@ #include "typeparse.h" #include "typestring.h" #include "assemblynative.hpp" -#include "stackprobe.h" #include "fstring.h" // @@ -68,7 +67,6 @@ HRESULT STDMETHODCALLTYPE TypeNameFactory::ParseTypeName(LPCWSTR szTypeName, DWO { CONTRACTL { - SO_TOLERANT; WRAPPER(THROWS); }CONTRACTL_END; @@ -76,7 +74,6 @@ HRESULT STDMETHODCALLTYPE TypeNameFactory::ParseTypeName(LPCWSTR szTypeName, DWO return E_INVALIDARG; HRESULT hr = S_OK; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); *ppTypeName = NULL; *pError = (DWORD)-1; @@ -102,8 +99,6 @@ HRESULT STDMETHODCALLTYPE TypeNameFactory::ParseTypeName(LPCWSTR szTypeName, DWO } } - END_SO_INTOLERANT_CODE; - return hr; } @@ -124,8 +119,6 @@ HRESULT STDMETHODCALLTYPE TypeNameFactory::GetTypeNameBuilder(ITypeNameBuilder** HRESULT hr = S_OK; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - ITypeNameBuilder* pTypeNameBuilder = new (nothrow) TypeNameBuilderWrapper(); if (pTypeNameBuilder) @@ -139,8 +132,6 @@ HRESULT STDMETHODCALLTYPE TypeNameFactory::GetTypeNameBuilder(ITypeNameBuilder** hr = E_OUTOFMEMORY; } - END_SO_INTOLERANT_CODE; - return hr; } @@ -153,14 +144,10 @@ SString* TypeName::ToString(SString* pBuf, BOOL bAssemblySpec, BOOL bSignature, PRECONDITION(!bGenericArguments & !bSignature &! bAssemblySpec); - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return pBuf); - { TypeNameBuilder tnb(pBuf); for (COUNT_T i = 0; i < m_names.GetCount(); i ++) tnb.AddName(m_names[i]->GetUnicode()); - } - END_SO_INTOLERANT_CODE; return pBuf; } @@ -181,10 +168,8 @@ DWORD STDMETHODCALLTYPE TypeName::Release() { THROWS; GC_TRIGGERS; - SO_TOLERANT; } CONTRACTL_END; - VALIDATE_BACKOUT_STACK_CONSUMPTION; m_count--; @@ -201,10 +186,8 @@ TypeName::~TypeName() { THROWS; GC_TRIGGERS; - SO_TOLERANT; } CONTRACTL_END; - VALIDATE_BACKOUT_STACK_CONSUMPTION; for(COUNT_T i = 0; i < m_genericArguments.GetCount(); i ++) m_genericArguments[i]->Release(); @@ -243,7 +226,6 @@ HRESULT STDMETHODCALLTYPE TypeName::GetNames(DWORD count, BSTR* bszName, DWORD* { CONTRACTL { - SO_TOLERANT; WRAPPER(THROWS); }CONTRACTL_END; @@ -260,12 +242,8 @@ HRESULT STDMETHODCALLTYPE TypeName::GetNames(DWORD count, BSTR* bszName, DWORD* if (!bszName) return E_INVALIDARG; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - { for (COUNT_T i = 0; i < m_names.GetCount(); i ++) bszName[i] = SysAllocString(m_names[i]->GetUnicode()); - } - END_SO_INTOLERANT_CODE; return hr; } @@ -343,7 +321,6 @@ HRESULT STDMETHODCALLTYPE TypeName::GetAssemblyName(BSTR* pszAssemblyName) { CONTRACTL { - SO_TOLERANT; WRAPPER(THROWS); }CONTRACTL_END; @@ -352,14 +329,9 @@ HRESULT STDMETHODCALLTYPE TypeName::GetAssemblyName(BSTR* pszAssemblyName) if (pszAssemblyName == NULL) return E_INVALIDARG; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - { *pszAssemblyName = SysAllocString(m_assembly.GetUnicode()); - } - END_SO_INTOLERANT_CODE; - if (*pszAssemblyName == NULL) - hr= E_OUTOFMEMORY; + hr = E_OUTOFMEMORY; return hr; } @@ -1430,18 +1402,6 @@ TypeHandle TypeName::GetTypeFromAsm() if (pKeepAlive == NULL) pAsmRef = NULL; - //requires a lot of space - DECLARE_INTERIOR_STACK_PROBE; - // This function is recursive, so it must have an interior probe - if (bThrowIfNotFound) - { - DO_INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(12); - } - else - { - DO_INTERIOR_STACK_PROBE_FOR_NOTHROW_CHECK_THREAD(12, goto Exit;); - } - // An explicit assembly has been specified so look for the type there if (!GetAssembly()->IsEmpty()) { @@ -1643,8 +1603,6 @@ TypeHandle TypeName::GetTypeFromAsm() Exit: ; - END_INTERIOR_STACK_PROBE; - GCPROTECT_END(); RETURN th; diff --git a/src/vm/typeparse.h b/src/vm/typeparse.h index 14cd843..171a22c 100644 --- a/src/vm/typeparse.h +++ b/src/vm/typeparse.h @@ -95,10 +95,8 @@ private: CONTRACTL { NOTHROW; - SO_TOLERANT; } CONTRACTL_END; - VALIDATE_BACKOUT_STACK_CONSUMPTION; if (m_next) delete m_next; diff --git a/src/vm/typestring.cpp b/src/vm/typestring.cpp index 7f53935..bdf8cd9 100644 --- a/src/vm/typestring.cpp +++ b/src/vm/typestring.cpp @@ -578,8 +578,6 @@ HRESULT TypeNameBuilder::AddAssemblySpec(LPCWSTR szAssemblySpec) HRESULT hr = S_OK; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - m_parseState = ParseStateASSEMSPEC; if (szAssemblySpec && *szAssemblySpec) @@ -599,8 +597,6 @@ HRESULT TypeNameBuilder::AddAssemblySpec(LPCWSTR szAssemblySpec) hr = S_OK; } - END_SO_INTOLERANT_CODE; - return hr; } @@ -629,8 +625,6 @@ HRESULT TypeNameBuilder::Clear() } CONTRACTL_END; - CONTRACT_VIOLATION(SOToleranceViolation); - if (m_pStr) { m_pStr->Clear(); @@ -660,12 +654,10 @@ void TypeString::AppendTypeDef(SString& ss, IMDInternalImport *pImport, mdTypeDe } CONTRACT_END - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(COMPlusThrowSO()); { TypeNameBuilder tnb(&ss, TypeNameBuilder::ParseStateNAME); AppendTypeDef(tnb, pImport, td, format); } - END_SO_INTOLERANT_CODE; RETURN; } @@ -745,14 +737,12 @@ void TypeString::AppendInst(SString& ss, Instantiation inst, DWORD format) } CONTRACT_END - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(COMPlusThrowSO()); { TypeNameBuilder tnb(&ss, TypeNameBuilder::ParseStateNAME); if ((format & FormatAngleBrackets) != 0) tnb.SetUseAngleBracketsForGenerics(TRUE); AppendInst(tnb, inst, format); } - END_SO_INTOLERANT_CODE; RETURN; } @@ -854,15 +844,13 @@ void TypeString::AppendType(SString& ss, TypeHandle ty, Instantiation typeInstan THROWS; } CONTRACT_END - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(COMPlusThrowSO()); + { TypeNameBuilder tnb(&ss); if ((format & FormatAngleBrackets) != 0) tnb.SetUseAngleBracketsForGenerics(TRUE); AppendType(tnb, ty, typeInstantiation, format); } - END_SO_INTOLERANT_CODE; RETURN; } @@ -883,8 +871,6 @@ void TypeString::AppendType(TypeNameBuilder& tnb, TypeHandle ty, Instantiation t } CONTRACT_END - INTERIOR_STACK_PROBE_FOR_CHECK_THREAD(10); - BOOL bToString = (format & (FormatNamespace|FormatFullInst|FormatAssembly)) == FormatNamespace; // It's null! @@ -1022,12 +1008,9 @@ void TypeString::AppendType(TypeNameBuilder& tnb, TypeHandle ty, Instantiation t tnb.AddAssemblySpec(pAssemblyName.GetUnicode()); - } - - END_INTERIOR_STACK_PROBE; - + } - RETURN; + RETURN; } void TypeString::AppendMethod(SString& s, MethodDesc *pMD, Instantiation typeInstantiation, const DWORD format) @@ -1077,7 +1060,6 @@ void TypeString::AppendMethodImpl(SString& ss, MethodDesc *pMD, Instantiation ty } CONTRACTL_END - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(COMPlusThrowSO()); { TypeHandle th; @@ -1153,7 +1135,6 @@ void TypeString::AppendMethodImpl(SString& ss, MethodDesc *pMD, Instantiation ty } } } - END_SO_INTOLERANT_CODE; } void TypeString::AppendField(SString& s, FieldDesc *pFD, Instantiation typeInstantiation, const DWORD format /* = FormatNamespace */) @@ -1168,7 +1149,6 @@ void TypeString::AppendField(SString& s, FieldDesc *pFD, Instantiation typeInsta } CONTRACTL_END; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(COMPlusThrowSO()); { TypeHandle th(pFD->GetApproxEnclosingMethodTable()); AppendType(s, th, typeInstantiation, format); @@ -1176,7 +1156,6 @@ void TypeString::AppendField(SString& s, FieldDesc *pFD, Instantiation typeInsta s.AppendUTF8(NAMESPACE_SEPARATOR_STR); s.AppendUTF8(pFD->GetName()); } - END_SO_INTOLERANT_CODE; } #ifdef _DEBUG @@ -1219,7 +1198,6 @@ void TypeString::AppendTypeDebug(SString& ss, TypeHandle t) NOTHROW; PRECONDITION(CheckPointer(t)); PRECONDITION(ss.Check()); - SO_NOT_MAINLINE; } CONTRACTL_END @@ -1249,7 +1227,6 @@ void TypeString::AppendTypeKeyDebug(SString& ss, TypeKey *pTypeKey) NOTHROW; PRECONDITION(CheckPointer(pTypeKey)); PRECONDITION(ss.Check()); - SO_NOT_MAINLINE; } CONTRACTL_END @@ -1281,7 +1258,6 @@ void TypeString::AppendTypeKey(TypeNameBuilder& tnb, TypeKey *pTypeKey, DWORD fo THROWS; if (format & (FormatAssembly|FormatFullInst)) GC_TRIGGERS; else GC_NOTRIGGER; PRECONDITION(CheckPointer(pTypeKey)); - SO_INTOLERANT; } CONTRACT_END @@ -1368,13 +1344,11 @@ void TypeString::AppendTypeKey(SString& ss, TypeKey *pTypeKey, DWORD format) PRECONDITION(CheckPointer(pTypeKey)); } CONTRACT_END - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(COMPlusThrowSO()); + { TypeNameBuilder tnb(&ss); AppendTypeKey(tnb, pTypeKey, format); } - END_SO_INTOLERANT_CODE; RETURN; } @@ -1422,7 +1396,6 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::QueryInterface(REFIID riid, vo NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -1446,7 +1419,6 @@ ULONG STDMETHODCALLTYPE TypeNameBuilderWrapper::AddRef() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -1460,21 +1432,16 @@ ULONG STDMETHODCALLTYPE TypeNameBuilderWrapper::Release() NOTHROW; GC_NOTRIGGER; MODE_ANY; - SO_TOLERANT; SUPPORTS_DAC_HOST_ONLY; } CONTRACTL_END; LONG ref = 0; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - ref = InterlockedDecrement(&m_ref); if (ref == 0) delete this; - END_SO_INTOLERANT_CODE; - return ref; } @@ -1490,9 +1457,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::OpenGenericArguments() CONTRACTL_END; HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); hr = m_tnb.OpenGenericArguments(); - END_SO_INTOLERANT_CODE; return hr; } @@ -1507,9 +1472,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::CloseGenericArguments() CONTRACTL_END; HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); hr = m_tnb.CloseGenericArguments(); - END_SO_INTOLERANT_CODE; return hr; } @@ -1524,9 +1487,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::OpenGenericArgument() CONTRACTL_END; HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); hr = m_tnb.OpenGenericArgument(); - END_SO_INTOLERANT_CODE; return hr; } @@ -1541,9 +1502,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::CloseGenericArgument() CONTRACTL_END; HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); hr = m_tnb.CloseGenericArgument(); - END_SO_INTOLERANT_CODE; return hr; } @@ -1557,11 +1516,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddName(LPCWSTR szName) } CONTRACTL_END; - HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - hr = m_tnb.AddName(szName); - END_SO_INTOLERANT_CODE; - return hr; + return m_tnb.AddName(szName); } HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddPointer() @@ -1574,11 +1529,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddPointer() } CONTRACTL_END; - HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - hr = m_tnb.AddPointer(); - END_SO_INTOLERANT_CODE; - return hr; + return m_tnb.AddPointer(); } HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddByRef() @@ -1591,11 +1542,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddByRef() } CONTRACTL_END; - HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - hr = m_tnb.AddByRef(); - END_SO_INTOLERANT_CODE; - return hr; + return m_tnb.AddByRef(); } HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddSzArray() @@ -1608,11 +1555,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddSzArray() } CONTRACTL_END; - HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - hr = m_tnb.AddSzArray(); - END_SO_INTOLERANT_CODE; - return hr; + return m_tnb.AddSzArray(); } HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddArray(DWORD rank) @@ -1625,11 +1568,7 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddArray(DWORD rank) } CONTRACTL_END; - HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - hr = m_tnb.AddArray(rank); - END_SO_INTOLERANT_CODE; - return hr; + return m_tnb.AddArray(rank); } HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddAssemblySpec(LPCWSTR szAssemblySpec) @@ -1642,22 +1581,14 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::AddAssemblySpec(LPCWSTR szAsse } CONTRACTL_END; - HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - hr = m_tnb.AddAssemblySpec(szAssemblySpec); - END_SO_INTOLERANT_CODE; - return hr; + return m_tnb.AddAssemblySpec(szAssemblySpec); } HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::ToString(BSTR* pszStringRepresentation) { WRAPPER_NO_CONTRACT; - HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - hr = m_tnb.ToString(pszStringRepresentation); - END_SO_INTOLERANT_CODE; - return hr; + return m_tnb.ToString(pszStringRepresentation); } HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::Clear() @@ -1670,9 +1601,5 @@ HRESULT STDMETHODCALLTYPE TypeNameBuilderWrapper::Clear() } CONTRACTL_END; - HRESULT hr; - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - hr = m_tnb.Clear(); - END_SO_INTOLERANT_CODE; - return hr; + return m_tnb.Clear(); } diff --git a/src/vm/util.cpp b/src/vm/util.cpp index 9b18764..5565a01 100644 --- a/src/vm/util.cpp +++ b/src/vm/util.cpp @@ -314,7 +314,6 @@ LPVOID CQuickHeap::Alloc(UINT sz) { THROWS; GC_NOTRIGGER; - SO_TOLERANT; // So long as we cleanup the heap when we're done, all the memory goes with it INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2055,7 +2054,6 @@ HMODULE CLRGetModuleHandle(LPCWSTR lpModuleFileName) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; HMODULE hMod = WszGetModuleHandle(lpModuleFileName); return hMod; @@ -2068,7 +2066,6 @@ HMODULE CLRGetCurrentModuleHandle() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; HMODULE hMod = WszGetModuleHandle(NULL); return hMod; @@ -2226,7 +2223,6 @@ static HMODULE CLRLoadLibraryWorker(LPCWSTR lpLibFileName, DWORD *pLastError) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; HMODULE hMod; UINT last = SetErrorMode(SEM_NOOPENFILEERRORBOX|SEM_FAILCRITICALERRORS); @@ -2249,12 +2245,7 @@ HMODULE CLRLoadLibrary(LPCWSTR lpLibFileName) DWORD dwLastError = 0; HMODULE hmod = 0; - // This method should be marked "throws" due to the probe here. - STATIC_CONTRACT_VIOLATION(ThrowsViolation); - - BEGIN_SO_TOLERANT_CODE(GetThread()); hmod = CLRLoadLibraryWorker(lpLibFileName, &dwLastError); - END_SO_TOLERANT_CODE; SetLastError(dwLastError); return hmod; @@ -2269,7 +2260,6 @@ static HMODULE CLRLoadLibraryExWorker(LPCWSTR lpLibFileName, HANDLE hFile, DWORD STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_FAULT; - STATIC_CONTRACT_SO_TOLERANT; HMODULE hMod; UINT last = SetErrorMode(SEM_NOOPENFILEERRORBOX|SEM_FAILCRITICALERRORS); @@ -2294,10 +2284,8 @@ HMODULE CLRLoadLibraryEx(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) DWORD lastError = ERROR_SUCCESS; HMODULE hmod = NULL; - BEGIN_SO_TOLERANT_CODE(GetThread()); hmod = CLRLoadLibraryExWorker(lpLibFileName, hFile, dwFlags, &lastError); - END_SO_TOLERANT_CODE; - + SetLastError(lastError); return hmod; } @@ -2310,7 +2298,6 @@ BOOL CLRFreeLibrary(HMODULE hModule) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; return FreeLibrary(hModule); } @@ -2321,7 +2308,6 @@ VOID CLRFreeLibraryAndExitThread(HMODULE hModule,DWORD dwExitCode) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SO_TOLERANT; // This is no-return FreeLibraryAndExitThread(hModule,dwExitCode); @@ -2791,7 +2777,6 @@ void DACRaiseException(TADDR *args, UINT argCount) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; struct Param { @@ -2817,7 +2802,6 @@ void DACNotifyExceptionHelper(TADDR *args, UINT argCount) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_ANY; } CONTRACTL_END; @@ -2876,7 +2860,6 @@ void DACNotify::DoJITNotification(MethodDesc *MethodDescPtr, TADDR NativeCodeLoc { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_PREEMPTIVE; } CONTRACTL_END; @@ -2891,7 +2874,6 @@ void DACNotify::DoJITPitchingNotification(MethodDesc *MethodDescPtr) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_PREEMPTIVE; } CONTRACTL_END; @@ -2909,7 +2891,6 @@ void DACNotify::DoModuleLoadNotification(Module *ModulePtr) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_PREEMPTIVE; } CONTRACTL_END; @@ -2927,7 +2908,6 @@ void DACNotify::DoModuleUnloadNotification(Module *ModulePtr) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_PREEMPTIVE; } CONTRACTL_END; @@ -2945,7 +2925,6 @@ void DACNotify::DoExceptionNotification(Thread* ThreadPtr) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_PREEMPTIVE; } CONTRACTL_END; @@ -2963,7 +2942,6 @@ void DACNotify::DoGCNotification(const GcEvtArgs& args) { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -2981,7 +2959,6 @@ void DACNotify::DoExceptionCatcherEnterNotification(MethodDesc *MethodDescPtr, D { NOTHROW; GC_NOTRIGGER; - SO_INTOLERANT; MODE_COOPERATIVE; } CONTRACTL_END; @@ -3201,7 +3178,6 @@ BOOL EnableARM() // can be called on a COOP thread and it has a GC_NOTRIGGER contract. // We should use the AD unload thread to call this function on. GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -3215,11 +3191,6 @@ BOOL EnableARM() Thread *pThread = NULL; CONTRACT_VIOLATION(GCViolation); - // I am returning TRUE here so the caller will NOT enable - // ARM - if we can't take the thread store lock, something - // is already kind of messed up so no need to proceed with - // enabling ARM. - BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return TRUE); // Take the thread store lock while we enumerate threads. ThreadStoreLockHolder tsl ; @@ -3229,8 +3200,6 @@ BOOL EnableARM() continue; pThread->QueryThreadProcessorUsage(); } - - END_SO_INTOLERANT_CODE; } g_fEnableARM = TRUE; } diff --git a/src/vm/util.hpp b/src/vm/util.hpp index 82e87e4..7f88f31 100644 --- a/src/vm/util.hpp +++ b/src/vm/util.hpp @@ -756,8 +756,7 @@ BOOL IsHostRegisteredForEvent(EClrEvent event); #define InternalSetupForComCall(CannotEnterRetVal, OOMRetVal, SORetVal, CheckCanRunManagedCode) \ SetupThreadForComCall(OOMRetVal); \ if (CheckCanRunManagedCode && !CanRunManagedCode()) \ - return CannotEnterRetVal; \ -SO_INTOLERANT_CODE_NOTHROW(CURRENT_THREAD, return SORetVal) + return CannotEnterRetVal; #define SetupForComCallHRNoHostNotif() InternalSetupForComCall(HOST_E_CLRNOTAVAILABLE, E_OUTOFMEMORY, COR_E_STACKOVERFLOW, true) #define SetupForComCallHRNoHostNotifNoCheckCanRunManagedCode() InternalSetupForComCall(HOST_E_CLRNOTAVAILABLE, E_OUTOFMEMORY, COR_E_STACKOVERFLOW, false) @@ -777,7 +776,6 @@ InternalSetupForComCall(HOST_E_CLRNOTAVAILABLE, E_OUTOFMEMORY, COR_E_STACKOVERFL if (CheckCanRunManagedCode && !CanRunManagedCode()) \ return CannotEnterRetVal; \ SetupThreadForComCall(OOMRetVal); \ -BEGIN_SO_INTOLERANT_CODE_NOTHROW(CURRENT_THREAD, SORetVal) \ #define BeginSetupForComCallHRWithEscapingCorruptingExceptions() \ HRESULT __hr = S_OK; \ @@ -788,7 +786,6 @@ if (SUCCEEDED(__hr)) \ #define EndSetupForComCallHRWithEscapingCorruptingExceptions() \ } \ -END_SO_INTOLERANT_CODE; \ \ if (FAILED(__hr)) \ { \ diff --git a/src/vm/versionresilienthashcode.cpp b/src/vm/versionresilienthashcode.cpp index 4271c75..70ca3d8 100644 --- a/src/vm/versionresilienthashcode.cpp +++ b/src/vm/versionresilienthashcode.cpp @@ -12,7 +12,6 @@ bool GetVersionResilientTypeHashCode(IMDInternalImport *pMDImport, mdExportedTyp { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; PRECONDITION(CheckPointer(pdwHashCode)); } diff --git a/src/vm/virtualcallstub.cpp b/src/vm/virtualcallstub.cpp index 31cfdd9..08ad121 100644 --- a/src/vm/virtualcallstub.cpp +++ b/src/vm/virtualcallstub.cpp @@ -1022,7 +1022,6 @@ VirtualCallStubManager *VirtualCallStubManager::FindStubManager(PCODE stubAddres NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; } CONTRACTL_END #ifndef DACCESS_COMPILE @@ -1040,7 +1039,6 @@ VirtualCallStubManager *VirtualCallStubManager::FindStubManager(PCODE stubAddres // LockedRangeList::IsInRangeWorker // VirtualCallStubManager::isDispatchingStub // - CONTRACT_VIOLATION(SOToleranceViolation); kind = pCur->getStubKind(stubAddress, usePredictStubKind); if (kind != SK_UNKNOWN) { @@ -1578,12 +1576,9 @@ ResolveCacheElem* __fastcall VirtualCallStubManager::PromoteChainEntry(ResolveCa NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_TOLERANT; PRECONDITION(CheckPointer(pElem)); } CONTRACTL_END; - // @todo - Remove this when have a probe that generates a hard SO. - CONTRACT_VIOLATION(SOToleranceViolation); g_resolveCache->PromoteChainEntry(pElem); return pElem; } @@ -1615,7 +1610,6 @@ PCODE VSD_ResolveWorker(TransitionBlock * pTransitionBlock, INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pTransitionBlock)); MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; MAKE_CURRENT_THREAD_AVAILABLE(); @@ -1651,8 +1645,6 @@ PCODE VSD_ResolveWorker(TransitionBlock * pTransitionBlock, #ifndef _TARGET_X86_ if (flags & SDF_ResolvePromoteChain) { - BEGIN_SO_INTOLERANT_CODE(CURRENT_THREAD); - ResolveCacheElem * pElem = (ResolveCacheElem *)token; g_resolveCache->PromoteChainEntry(pElem); target = (PCODE) pElem->target; @@ -1665,8 +1657,6 @@ PCODE VSD_ResolveWorker(TransitionBlock * pTransitionBlock, pMgr->BackPatchWorker(&callSite); } - END_SO_INTOLERANT_CODE; - return target; } #endif @@ -2445,7 +2435,6 @@ VirtualCallStubManager::GetRepresentativeMethodDescFromToken( MODE_COOPERATIVE; PRECONDITION(CheckPointer(pMT)); POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; } CONTRACT_END; // This is called when trying to create a HelperMethodFrame, which means there are @@ -2511,7 +2500,6 @@ PCODE VirtualCallStubManager::CacheLookup(size_t token, UINT16 tokenHash, Method CONTRACTL { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; PRECONDITION(CheckPointer(pMT)); } CONTRACTL_END diff --git a/src/vm/vmholder.h b/src/vm/vmholder.h index a9869fc..3c5b1e7 100644 --- a/src/vm/vmholder.h +++ b/src/vm/vmholder.h @@ -14,10 +14,7 @@ inline void DoTheReleaseHost(TYPE *value) { if (value) { - BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread()); value->Release(); - END_SO_TOLERANT_CODE_CALLING_HOST; - } } diff --git a/src/vm/weakreferencenative.cpp b/src/vm/weakreferencenative.cpp index 236052e..5c7a4da 100644 --- a/src/vm/weakreferencenative.cpp +++ b/src/vm/weakreferencenative.cpp @@ -325,7 +325,6 @@ NOINLINE OBJECTHANDLE AcquireWeakHandleSpinLockSpin(WEAKREFERENCEREF pThis) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -371,7 +370,6 @@ FORCEINLINE OBJECTHANDLE AcquireWeakHandleSpinLock(WEAKREFERENCEREF pThis) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; } CONTRACTL_END; @@ -581,7 +579,6 @@ static FORCEINLINE OBJECTREF GetWeakReferenceTarget(WEAKREFERENCEREF pThis) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - SO_TOLERANT; } CONTRACTL_END; diff --git a/src/vm/win32threadpool.cpp b/src/vm/win32threadpool.cpp index 330dcff..908fedf 100644 --- a/src/vm/win32threadpool.cpp +++ b/src/vm/win32threadpool.cpp @@ -525,8 +525,6 @@ BOOL ThreadpoolMgr::SetMaxThreadsHelper(DWORD MaxWorkerThreads, MaxWorkerThreads != 0 && MaxIOCompletionThreads != 0) { - BEGIN_SO_INTOLERANT_CODE(GetThread()); - if (GetForceMaxWorkerThreadsValue() == 0) { MaxLimitTotalWorkerThreads = min(MaxWorkerThreads, (DWORD)ThreadCounter::MaxPossibleCount); @@ -545,8 +543,6 @@ BOOL ThreadpoolMgr::SetMaxThreadsHelper(DWORD MaxWorkerThreads, } } - END_SO_INTOLERANT_CODE; - MaxLimitTotalCPThreads = min(MaxIOCompletionThreads, (DWORD)ThreadCounter::MaxPossibleCount); result = TRUE; @@ -613,8 +609,6 @@ BOOL ThreadpoolMgr::SetMinThreads(DWORD MinWorkerThreads, MinWorkerThreads <= (DWORD) MaxLimitTotalWorkerThreads && MinIOCompletionThreads <= (DWORD) MaxLimitTotalCPThreads) { - BEGIN_SO_INTOLERANT_CODE(GetThread()); - if (GetForceMinWorkerThreadsValue() == 0) { MinLimitTotalWorkerThreads = max(1, min(MinWorkerThreads, (DWORD)ThreadCounter::MaxPossibleCount)); @@ -645,8 +639,6 @@ BOOL ThreadpoolMgr::SetMinThreads(DWORD MinWorkerThreads, } } - END_SO_INTOLERANT_CODE; - MinLimitTotalCPThreads = max(1, min(MinIOCompletionThreads, (DWORD)ThreadCounter::MaxPossibleCount)); init_result = TRUE; @@ -755,7 +747,6 @@ void ThreadpoolMgr::ReportThreadStatus(bool isWorking) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -790,7 +781,6 @@ int TakeMaxWorkingThreadCount() { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1576,7 +1566,6 @@ BOOL ThreadpoolMgr::SetAppDomainRequestsActive(BOOL UnmanagedTP) NOTHROW; MODE_ANY; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; @@ -1628,7 +1617,6 @@ void ThreadpoolMgr::ClearAppDomainRequestsActive(BOOL UnmanagedTP, BOOL AdUnload NOTHROW; MODE_ANY; GC_TRIGGERS; - SO_INTOLERANT; } CONTRACTL_END; @@ -1716,7 +1704,6 @@ void ThreadpoolMgr::RecycleMemory(LPVOID mem, enum MemType memType) { NOTHROW; GC_NOTRIGGER; - SO_TOLERANT; MODE_ANY; } CONTRACTL_END; @@ -1756,7 +1743,6 @@ void ThreadpoolMgr::RecycleMemory(LPVOID mem, enum MemType memType) DWORD WINAPI ThreadpoolMgr::intermediateThreadProc(PVOID arg) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; offset_counter++; if (offset_counter * offset_multiplier > (int)GetOsPageSize()) @@ -1904,7 +1890,6 @@ DWORD WINAPI ThreadpoolMgr::WorkerThreadStart(LPVOID lpArgs) THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -2474,7 +2459,6 @@ BOOL ThreadpoolMgr::CreateWaitThread() void ThreadpoolMgr::InsertNewWaitForSelf(WaitInfo* pArgs) { WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; WaitInfo* waitInfo = pArgs; @@ -2594,7 +2578,6 @@ DWORD WINAPI ThreadpoolMgr::WaitThreadStart(LPVOID lpArgs) THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -2616,7 +2599,6 @@ DWORD WINAPI ThreadpoolMgr::WaitThreadStart(LPVOID lpArgs) return 0; } - BEGIN_SO_INTOLERANT_CODE(pThread); // we probe at the top of the thread so we can safely call anything below here. { // wait threads never die. (Why?) for (;;) @@ -2777,7 +2759,6 @@ DWORD WINAPI ThreadpoolMgr::WaitThreadStart(LPVOID lpArgs) } } } - END_SO_INTOLERANT_CODE; //This is unreachable...so no return required. } @@ -2861,7 +2842,6 @@ DWORD WINAPI ThreadpoolMgr::AsyncCallbackCompletion(PVOID pArgs) THROWS; MODE_PREEMPTIVE; GC_TRIGGERS; - SO_TOLERANT; } CONTRACTL_END; @@ -2880,7 +2860,6 @@ DWORD WINAPI ThreadpoolMgr::AsyncCallbackCompletion(PVOID pArgs) } } - BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, return ERROR_STACK_OVERFLOW); { AsyncCallback * asyncCallback = (AsyncCallback*) pArgs; @@ -2901,7 +2880,6 @@ DWORD WINAPI ThreadpoolMgr::AsyncCallbackCompletion(PVOID pArgs) ((WAITORTIMERCALLBACKFUNC) waitInfo->Callback) ( waitInfo->Context, asyncCallback->waitTimedOut != FALSE); } - END_SO_INTOLERANT_CODE; return ERROR_SUCCESS; } @@ -3097,9 +3075,7 @@ BOOL ThreadpoolMgr::UnregisterWaitEx(HANDLE hWaitObject,HANDLE Event) void ThreadpoolMgr::DeregisterWait(WaitInfo* pArgs) { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; WaitInfo* waitInfo = pArgs; @@ -3276,7 +3252,6 @@ DWORD WINAPI ThreadpoolMgr::CompletionPortThreadStart(LPVOID lpArgs) THROWS; if (GetThread()) { MODE_PREEMPTIVE;} else { DISABLED(MODE_ANY);} if (GetThread()) { GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);} - SO_INTOLERANT; } CONTRACTL_END; @@ -3717,7 +3692,6 @@ LPOVERLAPPED ThreadpoolMgr::CompletionPortDispatchWorkWithinAppDomain( STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; LPOVERLAPPED lpOverlapped=NULL; @@ -3800,7 +3774,6 @@ void ThreadpoolMgr::StoreOverlappedInfoInThread(Thread* pThread, DWORD dwErrorCo STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_SO_TOLERANT; _ASSERTE(pThread); @@ -3823,7 +3796,6 @@ BOOL ThreadpoolMgr::ShouldGrowCompletionPortThreadpool(ThreadCounter::Counts cou GC_NOTRIGGER; NOTHROW; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; @@ -4121,7 +4093,6 @@ DWORD WINAPI ThreadpoolMgr::GateThreadStart(LPVOID lpArgs) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_INTOLERANT; } CONTRACTL_END; @@ -4571,7 +4542,6 @@ DWORD WINAPI ThreadpoolMgr::TimerThreadStart(LPVOID p) STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; // due to SetApartment STATIC_CONTRACT_MODE_PREEMPTIVE; - STATIC_CONTRACT_SO_INTOLERANT; /* cannot use contract because of SEH CONTRACTL { @@ -4683,7 +4653,6 @@ void ThreadpoolMgr::InsertNewTimer(TimerInfo* pArg) MODE_ANY; } CONTRACTL_END; - STATIC_CONTRACT_SO_INTOLERANT; _ASSERTE(pArg); TimerInfo * timerInfo = pArg; @@ -4813,7 +4782,6 @@ DWORD WINAPI ThreadpoolMgr::AsyncTimerCallbackCompletion(PVOID pArgs) THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; @@ -4832,7 +4800,6 @@ DWORD WINAPI ThreadpoolMgr::AsyncTimerCallbackCompletion(PVOID pArgs) } } - BEGIN_SO_INTOLERANT_CODE(pThread); { TimerInfo* timerInfo = (TimerInfo*) pArgs; ((WAITORTIMERCALLBACKFUNC) timerInfo->Function) (timerInfo->Context, TRUE) ; @@ -4842,7 +4809,6 @@ DWORD WINAPI ThreadpoolMgr::AsyncTimerCallbackCompletion(PVOID pArgs) DeleteTimer(timerInfo); } } - END_SO_INTOLERANT_CODE; return ERROR_SUCCESS; } @@ -5222,7 +5188,6 @@ void ThreadpoolMgr::DeregisterTimer(TimerInfo* pArgs) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_INTOLERANT; } CONTRACTL_END; diff --git a/src/vm/wrappers.h b/src/vm/wrappers.h index 5d51252..505430c 100644 --- a/src/vm/wrappers.h +++ b/src/vm/wrappers.h @@ -93,7 +93,6 @@ inline void SafeComRelease(TYPE *value) NOTHROW; GC_TRIGGERS; MODE_ANY; - SO_TOLERANT; } CONTRACTL_END; SafeRelease((IUnknown*)value); @@ -105,7 +104,6 @@ inline void SafeComReleasePreemp(TYPE *value) NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - SO_TOLERANT; } CONTRACTL_END; SafeReleasePreemp((IUnknown*)value); diff --git a/src/vm/zapsig.cpp b/src/vm/zapsig.cpp index 734491e..dbb318d 100644 --- a/src/vm/zapsig.cpp +++ b/src/vm/zapsig.cpp @@ -682,7 +682,6 @@ Module *ZapSig::DecodeModuleFromIndexIfLoaded(Module *fromModule, NOTHROW; GC_NOTRIGGER; FORBID_FAULT; - SO_INTOLERANT; } CONTRACTL_END; diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index 3fa6073..d5d48ae 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -2128,13 +2128,6 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h CompileStatus result = NOT_COMPILED; - // This is an entry point into the JIT which can call back into the VM. There are methods in the - // JIT that will swallow exceptions and only the VM guarentees that exceptions caught or swallowed - // with restore the debug state of the stack guards. So it is necessary to ensure that the status - // is restored on return from the call into the JIT, which this light-weight transition macro - // will do. - REMOVE_STACK_GUARD; - CORINFO_MODULE_HANDLE module; // We only compile IL_STUBs from the current assembly diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp index 829e5b0..9845cae 100644 --- a/src/zap/zapinfo.cpp +++ b/src/zap/zapinfo.cpp @@ -475,8 +475,6 @@ void ZapInfo::CompileMethod() #ifdef ALLOW_SXS_JIT_NGEN if (m_zapper->m_alternateJit) { - REMOVE_STACK_GUARD; - res = m_zapper->m_alternateJit->compileMethod( this, &m_currentMethodInfo, CORJIT_FLAGS::CORJIT_FLAG_CALL_GETJITFLAGS, @@ -492,8 +490,6 @@ void ZapInfo::CompileMethod() if (FAILED(res)) { - REMOVE_STACK_GUARD; - ICorJitCompiler * pCompiler = m_zapper->m_pJitCompiler; res = pCompiler->compileMethod(this, &m_currentMethodInfo, diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp index f4ddb92..244c00d 100644 --- a/src/zap/zapper.cpp +++ b/src/zap/zapper.cpp @@ -845,7 +845,6 @@ BOOL Zapper::IsAssembly(LPCWSTR path) BEGIN_ENTRYPOINT_NOTHROW; EX_TRY { - REMOVE_STACK_GUARD; ((DomainCallback *) pvArgs)->doCallback(); } EX_CATCH_HRESULT(hr); -- 2.7.4