diff --git a/docs/coding-guidelines/clr-code-guide.md b/docs/coding-guidelines/clr-code-guide.md index 11b79fea262300..0ec79a69d0a17c 100644 --- a/docs/coding-guidelines/clr-code-guide.md +++ b/docs/coding-guidelines/clr-code-guide.md @@ -41,10 +41,7 @@ Written in 2006, by: * [2.2.8.4 Critical Section Holder](#2.2.8.4) * [2.3 Does your code follow our OOM rules?](#2.3) * [2.3.1 What is OOM and why is it important?](#2.3.1) - * [2.3.2 Documenting where OOM's can happen](#2.3.2) - * [2.3.2.1 Functions that handle OOM's internally](#2.3.2.1) - * [2.3.2.2 OOM state control outside of contracts](#2.3.2.2) - * [2.3.2.3 Remember...](#2.3.2.3) + * [2.3.2 Handling OOM failures](#2.3.2) * [2.4 Are you using SString and/or the safe string manipulation functions?](#2.4) * [2.4.1 SString](#2.4.1) * [2.5 Are you using safemath.h for pointer and memory size allocations?](#2.5) @@ -70,14 +67,13 @@ Written in 2006, by: * [2.10 Does your function declare a CONTRACT?](#2.10) * [2.10.1 What can be said in a contract?](#2.10.1) * [2.10.1.1 THROWS/NOTHROW](#2.10.1.1) - * [2.10.1.2 INJECT_FAULT(handler-stmt)/FORBID_FAULT](#2.10.1.2) - * [2.10.1.3 GC_TRIGGERS/GC_NOTRIGGER](#2.10.1.3) - * [2.10.1.4 MODE_PREEMPTIVE/ MODE_COOPERATIVE/ MODE_ANY](#2.10.1.4) - * [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 PRECONDITION(expr)](#2.10.1.8) - * [2.10.1.9 POSTCONDITION(expr)](#2.10.1.9) + * [2.10.1.2 GC_TRIGGERS/GC_NOTRIGGER](#2.10.1.2) + * [2.10.1.3 MODE_PREEMPTIVE/ MODE_COOPERATIVE/ MODE_ANY](#2.10.1.3) + * [2.10.1.4 LOADS_TYPE(loadlevel)](#2.10.1.4) + * [2.10.1.5 CAN_TAKE_LOCK / CANNOT_TAKE_LOCK](#2.10.1.5) + * [2.10.1.6 EE_THREAD_REQUIRED / EE_THREAD_NOT_REQUIRED](#2.10.1.6) + * [2.10.1.7 PRECONDITION(expr)](#2.10.1.7) + * [2.10.1.8 POSTCONDITION(expr)](#2.10.1.8) * [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) @@ -639,76 +635,12 @@ This means that: - Any operation that fails due to an OOM must allow future retries. This means any changes to global data structures must be rolled back and OOM exceptions cannot be cached. - OOM failures must be distinguishable from other error results. OOM's must never be transformed into some other error code. Doing so may cause some operations to cache the error and return the same error on each retry. -- Every function must declare whether or not it can generate an OOM error. We cannot write OOM-safe code if we have no way to know what calls can generate OOM's. This declaration is done by the INJECT_FAULT and FORBID_FAULT contract annotations. -### 2.3.2 Documenting where OOM's can happen +### 2.3.2 Handling OOM failures -Sometimes, a code sequence requires that no opportunities for OOM occur. Backout code is the most common example. This can become hard to maintain if the code calls out to other functions. Because of this, it is very important that every function document in its contract whether or not it can fail due to OOM. We do this using the (poorly named) INJECT_FAULT and FORBID_FAULT annotations. +Treat every allocation as capable of failing unless the called API explicitly documents otherwise. Code that mutates shared state must remain retryable after an OOM, typically by using holders or another backout mechanism to defer committing changes until all required allocations succeed. -To document that a function _can_ fail due to OOM: - -**Runtime-based (preferred)** - - void AllocateThingie() - { - CONTRACTL - { - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END - } - -**Static** - - void AllocateThingie() - { - STATIC_CONTRACT_FAULT; - } - -To document that a function _cannot_ fail due to OOM: - -**Runtime-based (preferred)** - - BOOL IsARedObject() - { - CONTRACTL - { - FORBID_FAULT; - } - CONTRACTL_END - } - -**Static** - - BOOL IsARedObject() - { - STATIC_CONTRACT_FORBID_FAULT; - } - -INJECT_FAULT()'s argument is the code that executes when the function reports an OOM. Typically this is to throw an OOM exception or return E_OUTOFMEMORY. The original intent for this was for our OOM fault injection test harness to insert simulated OOM's at this point and execute this line. At the moment, this argument is ignored but we may still employ this fault injection idea in the future so please code it appropriately. - -The CLR asserts if you invoke an INJECT_FAULT function under the scope of a FORBID_FAULT. All our allocation functions, including the C++ new operator, are declared INJECT_FAULT. - -#### 2.3.2.1 Functions that handle OOM's internally - -Sometimes, a function handles an internal OOM without needing to notify the caller. For example, perhaps the additional memory was used to implement an internal cache but your function can still do its job without it. Or perhaps the function is a logging function in which case, it can silently NOP – the caller doesn't care. In such cases, wrap the allocation in the FAULT_NOT_FATAL holder which temporarily lifts the FORBID_FAULT state. - - { - FAULT_NOT_FATAL(); - pv = new Foo(); - } - -FAULT_NOT_FATAL() is almost identical to a CONTRACT_VIOLATION() but the name indicates that it is by design, not a bug. It is analogous to TRY/CATCH for exceptions. - -#### 2.3.2.2 OOM state control outside of contracts - -If you wish to set the OOM state for a scope rather than a function, use the FAULT_FORBID() holder. To test the current state, use the ARE_FAULTS_FORBIDDEN() predicate. - -#### 2.3.2.3 Remember... - -- Do not use INJECT_FAULT to indicate the possibility of non-OOM errors such as entries not existing in a hash table or a COM object not supporting an interface. INJECT_FAULT indicates OOM errors and no other type. -- Be very suspicious if your INJECT_FAULT() argument is anything other than throwing an OOM exception or returning E_OUTOFMEMORY. OOM errors must be distinguishable from other types of errors so if you're merely returning NULL without indicating the type of error, you'd better be a simple memory allocator or some other function that will never fail for any reason other than an OOM. -- THROWS and INJECT_FAULT correlate strongly but are independent. A NOTHROW/INJECT_FAULT combo might indicate a function that returns HRESULTs including E_OUTOFMEMORY. A THROWS/FORBID_FAULT however indicates a function that can throw an exception but not an OutOfMemoryException. While theoretically possible, such a contract is probably a bug. +If an allocation is optional, such as memory used only for a cache or diagnostics, handle its failure explicitly and leave the surrounding operation in a valid state. Otherwise, propagate the OOM without converting it to an unrelated error. ## 2.4 Are you using SString and/or the safe string manipulation functions? @@ -967,11 +899,11 @@ CrstUnordered (used in rules inside CrstTypes.def) is a special level that says The following matrix lists the effective contract and side-effects of entering a crst for all combinations of CRST_HOST_BREAKABLE and CRST_UNSAFE_\* flags. The SAMELEVEL flag has no effect on any of these parameters. -| | Default | CRST_HOST_BREAKABLE | -| ------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| Default | NOTHROW
FORBID_FAULT
GC_TRIGGERS
MODE_ANY
(switches thread to preemptive) | THROWS
INJECT_FAULT
GC_TRIGGERS
MODE_ANY
(switches thread to preemptive) | -| CRST_UNSAFE_COOPGC | NOTHROW
FORBID_FAULT
GC_NOTRIGGER
MODE_COOP
(puts thread in GCNoTrigger mode) | THROWS
INJECT_FAULT
GC_NOTRIGGER
MODE_COOP
(puts thread in GCNoTrigger mode) | -| CRST_UNSAFE_ANYMODE | NOTHROW
FORBID_FAULT
GC_NOTRIGGER
MODE_ANY
(puts thread in GCNoTrigger mode) | THROWS
INJECT_FAULT
GC_NOTRIGGER
MODE_ANY
(puts thread in GCNoTrigger mode) | +| | Default | CRST_HOST_BREAKABLE | +| ------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------- | +| Default | NOTHROW
GC_TRIGGERS
MODE_ANY
(switches thread to preemptive) | THROWS
GC_TRIGGERS
MODE_ANY
(switches thread to preemptive) | +| CRST_UNSAFE_COOPGC | NOTHROW
GC_NOTRIGGER
MODE_COOP
(puts thread in GCNoTrigger mode) | THROWS
GC_NOTRIGGER
MODE_COOP
(puts thread in GCNoTrigger mode) | +| CRST_UNSAFE_ANYMODE | NOTHROW
GC_NOTRIGGER
MODE_ANY
(puts thread in GCNoTrigger mode) | THROWS
GC_NOTRIGGER
MODE_ANY
(puts thread in GCNoTrigger mode) | ### 2.6.11 Using Events and Waitable Handles @@ -1092,7 +1024,6 @@ Here is a typical contract: CONTRACTL { THROWS; // This function may throw - INJECT_FAULT(COMPlusThrowOM()); // This function may fail due to OOM GC_TRIGGERS; // This function may trigger a GC MODE_COOPERATIVE; // Must be in GC-cooperative mode to call CAN_TAKE_LOCK; // This function may take a Crst, spinlock, etc. @@ -1109,7 +1040,7 @@ There are several flavors of contracts. This example shows the most common type At runtime (on a checked build), the contract does the following: -At the start of Foo(), it validates that it's safe to throw, safe to generate an out of memory error, safe to trigger gc, that the GC mode is cooperative, and that your preconditions are true. +At the start of Foo(), it validates that it's safe to throw, safe to trigger gc, that the GC mode is cooperative, and that your preconditions are true. On a retail build, CONTRACT expands to nothing. @@ -1121,27 +1052,23 @@ As you can see, a contract is a laundry list of "items" that either assert some Declares whether an exception can be thrown out of this function. Declaring **NOTHROW** puts the thread in a NOTHROW state for the duration of the function call. You will get an assert if you throw an exception or call a function declared THROWS. An EX_TRY/EX_CATCH construct however will lift the NOTHROW state for the duration of the TRY body. -#### 2.10.1.2 INJECT_FAULT(_handler-stmt_)/FORBID_FAULT - -This is a poorly named item. INJECT_FAULT declares that the function can **fail** due to an out of memory (OOM) condition. FORBID_FAULT means that the function promises never to fail due to OOM. FORBID_FAULT puts the thread in a FORBID_FAULT state for the duration of the function call. You will get an assert if you allocate memory (even with the C++ new operator) or call a function declared INJECT_FAULT. - -#### 2.10.1.3 GC_TRIGGERS/GC_NOTRIGGER +#### 2.10.1.2 GC_TRIGGERS/GC_NOTRIGGER Declares whether the function is allowed to trigger a GC. GC_NOTRIGGER puts the thread in a NOTRIGGER state where any call to a GC_TRIGGERS function will assert. **Observation:** THROWS does not necessarily imply GC_TRIGGERS. COMPlusThrow does not trigger GC. -#### 2.10.1.4 MODE_PREEMPTIVE/ MODE_COOPERATIVE/ MODE_ANY +#### 2.10.1.3 MODE_PREEMPTIVE/ MODE_COOPERATIVE/ MODE_ANY This item asserts that the thread is in a particular mode or declares that the function is mode-agnostic. It does not change the state of the thread in any way. -#### 2.10.1.5 LOADS_TYPE(_loadlevel_) +#### 2.10.1.4 LOADS_TYPE(_loadlevel_) This item asserts that the function may invoke the loader and cause a type to loaded up to (and including) the indicated loadlevel. Valid load levels are taken from ClassLoadLevel enumerationin [classLoadLevel.h](https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/classloadlevel.h). The CLR asserts if any attempt is made to load a type past the current limit set by LOADS_TYPE. A call to any function that has a LOADS_TYPE contract is treated as an attempt to load a type up to that limit. -#### 2.10.1.6 CAN_TAKE_LOCK / CANNOT_TAKE_LOCK +#### 2.10.1.5 CAN_TAKE_LOCK / CANNOT_TAKE_LOCK These declare whether a function or callee takes any kind of EE or user lock: Crst, SpinLock, readerwriter, clr critical section, or even your own home-grown spin lock (e.g., ExecutionManager::IncrementReader). @@ -1160,7 +1087,7 @@ In TLS we keep track of the current intent (whether to lock), and actual reality - Remembers stack of lock pointers for diagnosis - ASSERT_NO_EE_LOCKS_HELD(): Handy way for you to verify no locks are held right now on this thread (i.e., lock count == 0) -#### 2.10.1.7 EE_THREAD_REQUIRED / EE_THREAD_NOT_REQUIRED +#### 2.10.1.6 EE_THREAD_REQUIRED / EE_THREAD_NOT_REQUIRED These declare whether a function or callee deals with the case "GetThread() == NULL". @@ -1210,11 +1137,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 PRECONDITION(_expr_) +#### 2.10.1.7 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.9 POSTCONDITION(_expr_) +#### 2.10.1.8 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. @@ -1229,10 +1156,11 @@ Preconditions and postconditions will execute in the order declared. The "intrin Contracts come in several forms: - CONTRACTL: This is the most common type. It does runtime checks as well as being visible to the static scanner. It is suitable for all runtime contracts except those that use postconditions. When in doubt, use this form. +- STANDARD_VM_CONTRACT: The recommended default for ordinary EE code. It is a CONTRACTL containing THROWS, GC_TRIGGERS, and MODE_PREEMPTIVE. Use an explicit CONTRACTL instead when a function needs different annotations or additional checks. - CONTRACT(returntype): This is an uglier version that's needed if you include a POSTCONDITION. You must supply the correct function return type for this form and it cannot be "void" (use CONTRACT_VOID instead.) You must also use the special RETURN macro rather than the normal return keyword. - CONTRACT_VOID: Use this if you need a postcondition and the return type is void. CONTRACT(void) will not work. - STATIC_CONTRACT_\*: This form generates no runtime code but still emits the hidden tags visible to the static contract scanner. Use this only if checked build perf would suffer greatly by putting a runtime contract there or if for some technical reason, the runtime-based contract is not possible.. -- LIMITED_METHOD_CONTRACT: A static contract equivalent to NOTHROW/GC_NOTRIGGER/FORBID_FAULT/MODE_ANY/CANNOT_TAKE_LOCK. Use this form only for trivial one-liner functions. Remember it does not do runtime checks so it should not be used for complex functions. +- LIMITED_METHOD_CONTRACT: A static contract equivalent to NOTHROW/GC_NOTRIGGER/MODE_ANY/CANNOT_TAKE_LOCK. Use this form only for trivial one-liner functions. Remember it does not do runtime checks so it should not be used for complex functions. - WRAPPER_NO_CONTRACT: A static no-op contract for functions that trivially wrap another. This was invented back when we didn't have static contracts and we now wish it hadn't been invented. Please don't use this in new code. ### 2.10.4 When is it safe to use a runtime contract? diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index b4fbf49209acb5..33f3404a46913b 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -5402,12 +5402,6 @@ void Debugger::TraceCall(const BYTE *code) // There are situations where our callers can't tolerate us throwing. EX_TRY { - // Since we have a try catch and the debugger code can deal properly with - // faults occurring inside DebuggerController::DispatchTraceCall, we can safely - // establish a FAULT_NOT_FATAL region. This is required since some callers can't - // tolerate faults. - FAULT_NOT_FATAL(); - DebuggerController::DispatchTraceCall(pCurThread, code); } EX_CATCH diff --git a/src/coreclr/debug/ee/debuggermessagebox.cpp b/src/coreclr/debug/ee/debuggermessagebox.cpp index 19c6da84fa2a27..ee9b9ddf5170cb 100644 --- a/src/coreclr/debug/ee/debuggermessagebox.cpp +++ b/src/coreclr/debug/ee/debuggermessagebox.cpp @@ -47,8 +47,6 @@ static int MessageBoxImpl( { CONTRACTL { - INJECT_FAULT(return IDCANCEL;); - // Assert if none of MB_ICON is set PRECONDITION((uType & MB_ICONMASK) != 0); } @@ -100,7 +98,6 @@ static int UtilMessageBoxNonLocalized( CONTRACTL { NOTHROW; - INJECT_FAULT(return IDCANCEL;); // Assert if none of MB_ICON is set PRECONDITION((uType & MB_ICONMASK) != 0); @@ -152,7 +149,6 @@ int NotifyUserOfFaultMessageBox( CONTRACTL { NOTHROW; - INJECT_FAULT(return IDCANCEL;); } CONTRACTL_END; diff --git a/src/coreclr/debug/ee/functioninfo.cpp b/src/coreclr/debug/ee/functioninfo.cpp index 0e652d890dac14..6c0ac028cb6c91 100644 --- a/src/coreclr/debug/ee/functioninfo.cpp +++ b/src/coreclr/debug/ee/functioninfo.cpp @@ -1806,7 +1806,6 @@ void DebuggerMethodInfo::DJIIterator::Next(BOOL fFirst /*=FALSE*/) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; CANNOT_TAKE_LOCK; } diff --git a/src/coreclr/gc/background.cpp b/src/coreclr/gc/background.cpp index ae602fdf9115fc..267ff4adfd94f6 100644 --- a/src/coreclr/gc/background.cpp +++ b/src/coreclr/gc/background.cpp @@ -2671,7 +2671,6 @@ void gc_heap::background_grow_c_mark_list() dprintf (2, ("stack copy buffer overflow")); uint8_t** new_c_mark_list = 0; { - FAULT_NOT_FATAL(); if (c_mark_list_length >= (SIZE_T_MAX / (2 * sizeof (uint8_t*)))) { should_drain_p = TRUE; diff --git a/src/coreclr/gc/env/gcenv.base.h b/src/coreclr/gc/env/gcenv.base.h index 22b18b832f260e..6f9a323892c42e 100644 --- a/src/coreclr/gc/env/gcenv.base.h +++ b/src/coreclr/gc/env/gcenv.base.h @@ -388,14 +388,10 @@ inline void* ALIGN_DOWN(void* ptr, size_t alignment) #define GC_NOTRIGGER #define CAN_TAKE_LOCK #define SUPPORTS_DAC -#define FORBID_FAULT #define CONTRACTL_END #define TRIGGERSGC() #define WRAPPER(_contract) #define DISABLED(_contract) -#define INJECT_FAULT(_expr) -#define INJECTFAULT_GCHEAP 0x2 -#define FAULT_NOT_FATAL() #define BEGIN_DEBUG_ONLY_CODE #define END_DEBUG_ONLY_CODE #define BEGIN_GETTHREAD_ALLOWED diff --git a/src/coreclr/gc/handletable.cpp b/src/coreclr/gc/handletable.cpp index 3aae454829eba4..3f06238dc6efa6 100644 --- a/src/coreclr/gc/handletable.cpp +++ b/src/coreclr/gc/handletable.cpp @@ -97,7 +97,6 @@ HHANDLETABLE HndCreateHandleTable(const uint32_t *pTypeFlags, uint32_t uTypeCoun { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return NULL); } CONTRACTL_END; diff --git a/src/coreclr/gc/handletablecache.cpp b/src/coreclr/gc/handletablecache.cpp index c201e32929c308..c195929c24677b 100644 --- a/src/coreclr/gc/handletablecache.cpp +++ b/src/coreclr/gc/handletablecache.cpp @@ -407,7 +407,6 @@ void TableFullRebalanceCache(HandleTable *pTable, { // allocate the new handles - we intentionally don't check for success here - FAULT_NOT_FATAL(); uHandleCount += TableAllocBulkHandles(pTable, uType, pHandleBase, uAlloc); } diff --git a/src/coreclr/gc/handletablescan.cpp b/src/coreclr/gc/handletablescan.cpp index 15137c85f1e2e1..46f9c317f38442 100644 --- a/src/coreclr/gc/handletablescan.cpp +++ b/src/coreclr/gc/handletablescan.cpp @@ -1438,7 +1438,6 @@ PTR_TableSegment CALLBACK StandardSegmentIterator(PTR_HandleTable pTable, PTR_Ta { WRAPPER(NOTHROW); WRAPPER(GC_TRIGGERS); - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -1479,7 +1478,6 @@ PTR_TableSegment CALLBACK FullSegmentIterator(PTR_HandleTable pTable, PTR_TableS { WRAPPER(THROWS); WRAPPER(GC_TRIGGERS); - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/coreclr/gc/objecthandle.cpp b/src/coreclr/gc/objecthandle.cpp index 92fd6889c87d51..10ebc01485ba3d 100644 --- a/src/coreclr/gc/objecthandle.cpp +++ b/src/coreclr/gc/objecthandle.cpp @@ -641,7 +641,6 @@ bool Ref_Initialize() { NOTHROW; WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(return false); } CONTRACTL_END; diff --git a/src/coreclr/inc/caparser.h b/src/coreclr/inc/caparser.h index 7328597ee27a40..59692d6becd450 100644 --- a/src/coreclr/inc/caparser.h +++ b/src/coreclr/inc/caparser.h @@ -276,7 +276,6 @@ class CustomAttributeParser { HRESULT GetString(LPCUTF8 *pszString, ULONG *pcbString) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr; @@ -309,7 +308,6 @@ class CustomAttributeParser { HRESULT GetNonNullString(LPCUTF8 *pszString, ULONG *pcbString) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr; @@ -330,7 +328,6 @@ class CustomAttributeParser { HRESULT GetNonEmptyString(LPCUTF8 *pszString, ULONG *pcbString) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr; diff --git a/src/coreclr/inc/ceegentokenmapper.h b/src/coreclr/inc/ceegentokenmapper.h index 02d98c92d53c3b..0e02181b1aa5dd 100644 --- a/src/coreclr/inc/ceegentokenmapper.h +++ b/src/coreclr/inc/ceegentokenmapper.h @@ -60,7 +60,6 @@ friend class PESectionMan; virtual ULONG STDMETHODCALLTYPE Release() { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; SUPPORTS_DAC_HOST_ONLY; ULONG cRefs = --m_cRefs; diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index acba41b4e740a4..d4303963fc69db 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -219,7 +219,6 @@ CONFIG_DWORD_INFO(INTERNAL_ConditionalContracts, W("ConditionalContracts"), 0, " CONFIG_DWORD_INFO(INTERNAL_ConsistencyCheck, W("ConsistencyCheck"), 0, "") CONFIG_DWORD_INFO(INTERNAL_ContinueOnAssert, W("ContinueOnAssert"), 0, "If set, doesn't break on asserts.") CONFIG_DWORD_INFO(INTERNAL_InjectFatalError, W("InjectFatalError"), 0, "") -CONFIG_DWORD_INFO(INTERNAL_InjectFault, W("InjectFault"), 0, "") CONFIG_DWORD_INFO(INTERNAL_SuppressChecks, W("SuppressChecks"),0, "") CONFIG_DWORD_INFO(INTERNAL_SuppressLockViolationsOnReentryFromOS, W("SuppressLockViolationsOnReentryFromOS"), 0, "64 bit OOM tests re-enter the CLR via RtlVirtualUnwind. This indicates whether to suppress resulting locking violations.") diff --git a/src/coreclr/inc/contract.h b/src/coreclr/inc/contract.h index 0d9706b1a91172..5a61f0aa5e8237 100644 --- a/src/coreclr/inc/contract.h +++ b/src/coreclr/inc/contract.h @@ -24,13 +24,6 @@ // THROWS an exception might be thrown out of the function // -or- NOTHROW an exception will NOT be thrown out of the function // -// -// -// INJECT_FAULT(statement) function might require its caller to handle an OOM -// -or- FAULT_FORBID function will NOT require its caller to handle an OOM -// -// -// // GC_TRIGGERS the function can trigger a GC // -or- GC_NOTRIGGER the function will never trigger a GC provided its // called in coop mode. @@ -82,7 +75,7 @@ // // Static: // LIMITED_METHOD_CONTRACT -// A static contract equivalent to NOTHROW/GC_NOTRIGGER/FORBID_FAULT/MODE_ANY. +// A static contract equivalent to NOTHROW/GC_NOTRIGGER/MODE_ANY. // Use only for trivial functions that call only functions with LIMITED_METHOD_CONTRACTs // (as long as there is no cycle that may introduce infinite recursion). // @@ -90,8 +83,6 @@ // STATIC_CONTRACT_NOTHROW // STATIC_CONTRACT_GC_TRIGGERS // STATIC_CONTRACT_GCNOTRIGGER -// STATIC_CONTRACT_FAULT -// STATIC_CONTRACT_FORBID_FAULT // use to implement statically checkable contracts // when runtime contracts cannot be used. // @@ -115,8 +106,6 @@ // ThrowsViolation // GCViolation // ModeViolation -// FaultViolation -// FaultNotFatal // LoadsTypeViolation // TakesLockViolation // @@ -171,7 +160,6 @@ // - THROWS/NOTHROW defaults to THROWS // - GCTRIGGERS/GCNOTRIGGER defaults to GCTRIGGERS within the VM directory // and to no check otherwise -// - INJECT/FORBID_FAULT defaults to no check // - MODE defaults to MODE_ANY // // The problem is that defaults don't work well with static contracts. @@ -342,14 +330,9 @@ struct DbgStateLockState #define CONTRACT_BITMASK_OK_TO_THROW 0x1 << 0 -#define CONTRACT_BITMASK_FAULT_FORBID 0x1 << 1 -// Unused 0x1 << 2 -#define CONTRACT_BITMASK_SOTOLERANT 0x1 << 3 -#define CONTRACT_BITMASK_DEBUGONLY 0x1 << 4 -#define CONTRACT_BITMASK_SONOTMAINLINE 0x1 << 5 -#define CONTRACT_BITMASK_OK_TO_LOCK 0x1 << 6 -#define CONTRACT_BITMASK_OK_TO_RETAKE_LOCK 0x1 << 7 - +#define CONTRACT_BITMASK_DEBUGONLY 0x1 << 1 +#define CONTRACT_BITMASK_OK_TO_LOCK 0x1 << 2 +#define CONTRACT_BITMASK_OK_TO_RETAKE_LOCK 0x1 << 3 #define CONTRACT_BITMASK_IS_SET(whichbit) ((m_flags & (whichbit)) != 0) #define CONTRACT_BITMASK_SET(whichbit) (m_flags |= (whichbit)) @@ -377,18 +360,15 @@ class ClrDebugState final // Default is we're in a THROWS scope. This is not ideal, but there are // just too many places that I'd have to go clean up right now // (hundreds) in order to make this FALSE by default. - // Faults not forbidden (an unfortunate default but - // we'd never get this debug infrastructure bootstrapped otherwise.) // We start out in SO-tolerant mode and must probe before entering SO-intolerant // any global state updates. // Initial mode is non-debug until we say otherwise // Everything defaults to mainline // By default, GetThread() is perfectly fine to call // By default, it's ok to take a lock (or call someone who does) - m_flags = CONTRACT_BITMASK_OK_TO_THROW| - CONTRACT_BITMASK_SOTOLERANT| - CONTRACT_BITMASK_OK_TO_LOCK| - CONTRACT_BITMASK_OK_TO_RETAKE_LOCK; + m_flags = CONTRACT_BITMASK_OK_TO_THROW + | CONTRACT_BITMASK_OK_TO_LOCK + | CONTRACT_BITMASK_OK_TO_RETAKE_LOCK; m_pContractStackTrace = NULL; // At top of stack, no contracts in force m_GCNoTriggerCount = 0; @@ -450,31 +430,6 @@ class ClrDebugState final { CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_OK_TO_THROW); } - //--// - - BOOL IsFaultForbid() - { - return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_FAULT_FORBID); - } - - - void SetFaultForbid() - { - CONTRACT_BITMASK_SET(CONTRACT_BITMASK_FAULT_FORBID); - } - - BOOL SetFaultForbid(BOOL value) - { - BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_FAULT_FORBID); - CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_FAULT_FORBID, value); - return prevState; - } - - void ResetFaultForbid() - { - CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_FAULT_FORBID); - } - //--// BOOL IsDebugOnly() { @@ -805,10 +760,10 @@ class BaseContract GC_NoTrigger = 0x00000004, GC_Disabled = 0x00000008, - FAULT_Mask = 0x00000030, - FAULT_Disabled = 0x00000000, // the default - FAULT_Inject = 0x00000010, - FAULT_Forbid = 0x00000020, + // Unused = 0x00000030, + // Unused = 0x00000000, + // Unused = 0x00000010, + // Unused = 0x00000020, MODE_Mask = 0x000000C0, MODE_Disabled = 0x00000000, // the default @@ -839,7 +794,7 @@ class BaseContract LOADS_TYPE_Shift = 20, // # of bits to right-shift to get loadstype bits to rightmost position. LOADS_TYPE_Disabled = 0x00000000, // the default - ALL_Disabled = THROWS_Disabled|GC_Disabled|FAULT_Disabled|MODE_Disabled|LOADS_TYPE_Disabled| + ALL_Disabled = THROWS_Disabled|GC_Disabled|MODE_Disabled|LOADS_TYPE_Disabled| CAN_TAKE_LOCK_Disabled|CAN_RETAKE_LOCK_No_Disabled }; @@ -877,7 +832,6 @@ class BaseContract void Disable() { } - BOOL CheckFaultInjection(); protected: UINT m_testmask; @@ -910,15 +864,13 @@ class Contract final : public BaseContract // Valid parameters for CONTRACT_VIOLATION macro enum ContractViolationBits { - ThrowsViolation = 0x00000001, // suppress THROW tags in this scope - GCViolation = 0x00000002, // suppress GCTRIGGER tags in this scope - 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 - LoadsTypeViolation = 0x00000040, // suppress LOADS_TYPE tags in this scope - TakesLockViolation = 0x00000080, // suppress CAN_TAKE_LOCK tags in this scope - - //These are not violation bits. We steal some bits out of the violation mask to serve as + ThrowsViolation = 0x00000001, // suppress THROW tags in this scope + GCViolation = 0x00000002, // suppress GCTRIGGER tags in this scope + ModeViolation = 0x00000004, // suppress MODE_PREEMP and MODE_COOP tags in this scope + LoadsTypeViolation = 0x00000008, // suppress LOADS_TYPE tags in this scope + TakesLockViolation = 0x00000010, // suppress CAN_TAKE_LOCK tags in this scope + + // These are not violation bits. We steal some bits out of the violation mask to serve as // general flag bits. CanFreeMe = 0x00010000, // If this bit is ON, the ClrDebugState was allocated by // a version of utilcode that registers an Fls Callback to free @@ -999,22 +951,6 @@ static UINT ___testmask; #define REQUEST_TEST(thetest, todisable) (___testmask |= (___CheckMustBeInside_CONTRACT, (___disabled ? (todisable) : (thetest)))) - -#define INJECT_FAULT(_statement) \ - do \ - { \ - STATIC_CONTRACT_FAULT; \ - REQUEST_TEST(Contract::FAULT_Inject, Contract::FAULT_Disabled); \ - if (0) \ - { \ - _statement; \ - } \ - } \ - while(0) \ - - -#define FORBID_FAULT do { STATIC_CONTRACT_FORBID_FAULT; REQUEST_TEST(Contract::FAULT_Forbid, Contract::FAULT_Disabled); } while(0) - #define THROWS do { STATIC_CONTRACT_THROWS; REQUEST_TEST(Contract::THROWS_Yes, Contract::THROWS_Disabled); } while(0) #define NOTHROW do { STATIC_CONTRACT_NOTHROW; REQUEST_TEST(Contract::THROWS_No, Contract::THROWS_Disabled); } while(0) \ @@ -1108,7 +1044,7 @@ static UINT ___testmask; { \ _contracttype ___contract; \ STATIC_CONTRACT_LEAF; \ - ___contract.DoChecks(Contract::THROWS_No|Contract::GC_NoTrigger|Contract::MODE_Disabled|Contract::FAULT_Disabled); \ + ___contract.DoChecks(Contract::THROWS_No|Contract::GC_NoTrigger|Contract::MODE_Disabled); \ /* Should add some assertion mechanism to ensure no other contracts are called */ \ } #else @@ -1160,8 +1096,6 @@ class EEContract final : public BaseContract #define CONTRACTL_SETUP(_contracttype) if (0) { struct YouCannotUseThisHere { int x; }; // inside contracts and asserts but nowhere else. -#define INJECT_FAULT(_statement) -#define FORBID_FAULT #define THROWS #define NOTHROW #define CAN_TAKE_LOCK @@ -1237,8 +1171,7 @@ class ContractViolationHolder // compiler's desire to fold all the Enter and Ctor implementations together. FORCEINLINE void EnterInternal(UINT_PTR violationMask) { - _ASSERTE(0 == (violationMask & ~(ThrowsViolation | GCViolation | ModeViolation | FaultViolation | - FaultNotFatal | + _ASSERTE(0 == (violationMask & ~(ThrowsViolation | GCViolation | ModeViolation | TakesLockViolation | LoadsTypeViolation)) || violationMask == AllViolation); @@ -1336,123 +1269,6 @@ enum PermanentContractViolationReason #define PERMANENT_CONTRACT_VIOLATION(violationMask, reasonEnum) #endif - - -#ifdef ENABLE_CONTRACTS_IMPL -// Holder for setting up a faultforbid region -class FaultForbidHolder -{ - public: - DEBUG_NOINLINE FaultForbidHolder(BOOL fConditional, BOOL fAlloc, const char *szFunction, const char *szFile, int lineNum) - { - STATIC_CONTRACT_FORBID_FAULT; - - m_fConditional = fConditional; - if (m_fConditional) - { - m_pClrDebugState = GetClrDebugState(fAlloc); - - // - // If we fail to get a debug state, then we must not be allocating and - // we simply no-op this holder. - // - if (m_pClrDebugState == NULL) - { - _ASSERTE(!fAlloc); - m_fConditional = FALSE; - return; - } - - m_oldClrDebugState = *m_pClrDebugState; - - m_pClrDebugState->ViolationMaskReset( FaultViolation|FaultNotFatal ); - m_pClrDebugState->SetFaultForbid(); - - m_ContractStackRecord.m_szFunction = szFunction; - m_ContractStackRecord.m_szFile = szFile; - m_ContractStackRecord.m_lineNum = lineNum; - m_ContractStackRecord.m_testmask = (Contract::ALL_Disabled & ~((UINT)(Contract::FAULT_Mask))) | Contract::FAULT_Forbid; - m_ContractStackRecord.m_construct = "FAULT_FORBID"; - m_pClrDebugState->LinkContractStackTrace( &m_ContractStackRecord ); - } - } - - DEBUG_NOINLINE ~FaultForbidHolder() - { - if (m_fConditional) - { - *m_pClrDebugState = m_oldClrDebugState; - } - } - - private: - ClrDebugState *m_pClrDebugState; - ClrDebugState m_oldClrDebugState; - BOOL m_fConditional; - ContractStackRecord m_ContractStackRecord; - -}; -#endif // ENABLE_CONTRACTS_IMPL - - -#ifdef ENABLE_CONTRACTS_IMPL - -#define FAULT_FORBID() FaultForbidHolder _ffh(TRUE, TRUE, __FUNCTION__, __FILE__, __LINE__); -#define FAULT_FORBID_NO_ALLOC() FaultForbidHolder _ffh(TRUE, FALSE, __FUNCTION__, __FILE__, __LINE__); -#define MAYBE_FAULT_FORBID(cond) FaultForbidHolder _ffh(cond, TRUE, __FUNCTION__, __FILE__, __LINE__); -#define MAYBE_FAULT_FORBID_NO_ALLOC(cond) FaultForbidHolder _ffh(cond, FALSE, __FUNCTION__, __FILE__, __LINE__); - -#else // ENABLE_CONTRACTS_IMPL - -#define FAULT_FORBID() ; -#define FAULT_FORBID_NO_ALLOC() ; -#define MAYBE_FAULT_FORBID(cond) ; -#define MAYBE_FAULT_FORBID_NO_ALLOC(cond) ; - -#endif // ENABLE_CONTRACTS_IMPL - - -#ifdef ENABLE_CONTRACTS_IMPL - -inline BOOL AreFaultsForbiddenHelper() -{ - STATIC_CONTRACT_DEBUG_ONLY; - STATIC_CONTRACT_NOTHROW; - - ClrDebugState *pClrDebugState = CheckClrDebugState(); - if (!pClrDebugState) - { - // By default, faults are not forbidden. Not the most desirable default - // but we'd never get this debug infrastructure bootstrapped otherwise. - return FALSE; - } - else - { - return pClrDebugState->IsFaultForbid() && (!(pClrDebugState->ViolationMask() & (FaultViolation|FaultNotFatal|BadDebugState))); - } -} - -#define ARE_FAULTS_FORBIDDEN() AreFaultsForbiddenHelper() -#else - -// If you got an error about ARE_FAULTS_FORBIDDEN being undefined, it's because you tried -// to use this predicate in a free build outside of a CONTRACT or ASSERT. -// -#define ARE_FAULTS_FORBIDDEN() (sizeof(YouCannotUseThisHere) != 0) -#endif - - -// This allows a fault-forbid region to invoke a non-mandatory allocation, such as for the -// purpose of growing a lookaside cache (if the allocation fails, the code can abandon the -// cache growing operation without negative effect.) -// -// Although it's implemented using CONTRACT_VIOLATION(), it's not a bug to have this in the code. -// -// It *is* a bug to use this to hide a situation where an OOM is genuinely fatal but not handled. -#define FAULT_NOT_FATAL() CONTRACT_VIOLATION(FaultNotFatal) - - - #ifdef ENABLE_CONTRACTS_IMPL //------------------------------------------------------------------------------------ diff --git a/src/coreclr/inc/contract.inl b/src/coreclr/inc/contract.inl index 5c5dd79ce5911e..bdbf6102e3a6fd 100644 --- a/src/coreclr/inc/contract.inl +++ b/src/coreclr/inc/contract.inl @@ -45,34 +45,6 @@ inline void BaseContract::DoChecks(UINT testmask, _In_z_ const char *szFunction, m_pClrDebugState->SetDebugOnly(); } - switch (testmask & FAULT_Mask) - { - case FAULT_Forbid: - m_pClrDebugState->ViolationMaskReset( FaultViolation|FaultNotFatal ); - m_pClrDebugState->SetFaultForbid(); - break; - - case FAULT_Inject: - if (m_pClrDebugState->IsFaultForbid() && - !(m_pClrDebugState->ViolationMask() & (FaultViolation|FaultNotFatal|BadDebugState))) - { - CONTRACT_ASSERT("INJECT_FAULT called in a FAULTFORBID region.", - BaseContract::FAULT_Forbid, - BaseContract::FAULT_Mask, - m_contractStackRecord.m_szFunction, - m_contractStackRecord.m_szFile, - m_contractStackRecord.m_lineNum); - } - break; - - case FAULT_Disabled: - // Nothing - break; - - default: - UNREACHABLE(); - } - switch (testmask & THROWS_Mask) { case THROWS_Yes: @@ -153,12 +125,6 @@ inline void BaseContract::DoChecks(UINT testmask, _In_z_ const char *szFunction, } -FORCEINLINE BOOL BaseContract::CheckFaultInjection() -{ - // ??? use m_tag to see if we should trigger an injection - return FALSE; -} - inline BOOL ClrDebugState::CheckOkayToThrowNoAssert() { if (!IsOkToThrow() && !(m_violationmask & (ThrowsViolation|BadDebugState))) diff --git a/src/coreclr/inc/ex.h b/src/coreclr/inc/ex.h index 0c3f82b9c265b5..48600212713ac9 100644 --- a/src/coreclr/inc/ex.h +++ b/src/coreclr/inc/ex.h @@ -683,8 +683,6 @@ void ExThrowTrap(const char *fcn, const char *file, int line, const char *szType #define EX_THROW(_type, _args) \ { \ - FAULT_NOT_FATAL(); \ - \ _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 */ \ @@ -709,8 +707,6 @@ Exception *ExThrowWithInnerHelper(Exception *inner); // #define EX_THROW_WITH_INNER(_type, _args, _inner) \ { \ - FAULT_NOT_FATAL(); \ - \ Exception *_inner2 = ExThrowWithInnerHelper(_inner); \ _type *___pExForExThrow = new _type _args ; \ ___pExForExThrow->SetInnerException(_inner2); \ diff --git a/src/coreclr/inc/sstring.h b/src/coreclr/inc/sstring.h index 072ffbf805f4d8..98dd8144b996b1 100644 --- a/src/coreclr/inc/sstring.h +++ b/src/coreclr/inc/sstring.h @@ -889,12 +889,6 @@ typedef InlineSString<2 * 260> LongPathString; #define THROWS_UNLESS_BOTH_NORMALIZED(s) \ if (IsNormalized() && s.IsNormalized()) NOTHROW; else THROWS -#define FAULTS_UNLESS_NORMALIZED(stmt) \ - if (IsNormalized()) FORBID_FAULT; else INJECT_FAULT(stmt) - -#define FAULTS_UNLESS_BOTH_NORMALIZED(s, stmt) \ - if (IsNormalized() && s.IsNormalized()) FORBID_FAULT; else INJECT_FAULT(stmt) - // ================================================================================ // Inline definitions // ================================================================================ diff --git a/src/coreclr/inc/staticcontract.h b/src/coreclr/inc/staticcontract.h index b4558c9f04c231..13f46ec770837a 100644 --- a/src/coreclr/inc/staticcontract.h +++ b/src/coreclr/inc/staticcontract.h @@ -11,8 +11,6 @@ #define STATIC_CONTRACT_NOTHROW #define STATIC_CONTRACT_CAN_TAKE_LOCK #define STATIC_CONTRACT_CANNOT_TAKE_LOCK -#define STATIC_CONTRACT_FAULT -#define STATIC_CONTRACT_FORBID_FAULT #define STATIC_CONTRACT_GC_TRIGGERS #define STATIC_CONTRACT_GC_NOTRIGGER diff --git a/src/coreclr/inc/utilcode.h b/src/coreclr/inc/utilcode.h index d45900517c5d0c..a22660bc037bde 100644 --- a/src/coreclr/inc/utilcode.h +++ b/src/coreclr/inc/utilcode.h @@ -2842,7 +2842,6 @@ class RangeList { INSTANCE_CHECK; NOTHROW; - FORBID_FAULT; GC_NOTRIGGER; } CONTRACTL_END diff --git a/src/coreclr/md/inc/stgpool.h b/src/coreclr/md/inc/stgpool.h index b0a82ee8592d34..544d1e209a9a71 100644 --- a/src/coreclr/md/inc/stgpool.h +++ b/src/coreclr/md/inc/stgpool.h @@ -277,7 +277,6 @@ friend class MetaData::BlobHeapRO; GUID UNALIGNED **ppGuid) // Output buffer for Guid. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr; MetaData::DataBlob heapData; @@ -394,7 +393,6 @@ class StgBlobPoolReadOnly : public StgPoolReadOnly virtual int IsValidOffset(UINT32 nOffset) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; MetaData::DataBlob data; return (StgBlobPoolReadOnly::GetBlob(nOffset, &data) == S_OK); @@ -519,7 +517,6 @@ friend struct ::cdac_data; UINT32 *pcbSaveSize) const { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(pcbSaveSize != NULL); // Size is offset of last seg + size of last seg. @@ -542,7 +539,6 @@ friend struct ::cdac_data; UINT32 *pcbSaveSize) const // Return save size of this pool. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(pcbSaveSize != NULL); UINT32 cbSize = 0; @@ -1029,7 +1025,6 @@ class StgGuidPool : public StgPool UINT32 *pcbSaveSize) const { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(pcbSaveSize != NULL); @@ -1161,7 +1156,6 @@ class StgBlobPool : public StgPool virtual int IsEmpty() // true if empty. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; return (GetNextOffset() <= 1); } @@ -1176,7 +1170,6 @@ class StgBlobPool : public StgPool UINT32 *pcbSaveSize) const { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; return StgPool::GetSaveSize(pcbSaveSize); } @@ -1189,7 +1182,6 @@ class StgBlobPool : public StgPool virtual int IsValidOffset(UINT32 nOffset) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; MetaData::DataBlob data; return (StgBlobPool::GetBlob(nOffset, &data) == S_OK); diff --git a/src/coreclr/md/inc/stgpooli.h b/src/coreclr/md/inc/stgpooli.h index b1b09aae396a73..2b489f7d12246d 100644 --- a/src/coreclr/md/inc/stgpooli.h +++ b/src/coreclr/md/inc/stgpooli.h @@ -90,7 +90,6 @@ class CBlobPoolHash : public CChainedHash { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; ULONG ulSize; ulSize = CPackedLen::GetLength(pData); diff --git a/src/coreclr/md/runtime/stgpool.cpp b/src/coreclr/md/runtime/stgpool.cpp index 3561ac5995bde8..06fa355b47003f 100644 --- a/src/coreclr/md/runtime/stgpool.cpp +++ b/src/coreclr/md/runtime/stgpool.cpp @@ -56,7 +56,6 @@ StgPool::InitNew( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END @@ -88,7 +87,6 @@ StgPool::InitOnMem( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -126,7 +124,6 @@ StgPool::TakeOwnershipOfInitMem() { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -163,7 +160,6 @@ void StgPool::Uninit() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -202,7 +198,6 @@ StgPool::ConvertToRW() { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -227,7 +222,6 @@ StgPool::SetHash(int bHash) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -243,7 +237,6 @@ void StgPool::Trim() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -283,7 +276,6 @@ bool StgPool::Grow( // true if successful. { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END @@ -388,7 +380,6 @@ StgPool::AddSegment( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -461,7 +452,6 @@ StgPool::PersistToStream( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END @@ -535,7 +525,6 @@ StgPool::PersistPartialToStream( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END @@ -771,7 +760,6 @@ StgStringPool::InitNew( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END @@ -818,7 +806,6 @@ StgStringPool::InitOnMem( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END @@ -851,7 +838,6 @@ void StgStringPool::Uninit() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -874,7 +860,6 @@ StgStringPool::SetHash(int bHash) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -903,7 +888,6 @@ StgStringPool::AddString( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -980,7 +964,6 @@ StgStringPool::AddStringW( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1076,7 +1059,6 @@ StgStringPool::RehashStrings() { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1142,7 +1124,6 @@ StgGuidPool::InitNew( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1177,7 +1158,6 @@ StgGuidPool::InitOnMem( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1216,7 +1196,6 @@ void StgGuidPool::Uninit() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -1241,7 +1220,6 @@ StgGuidPool::AddSegment( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1264,7 +1242,6 @@ StgGuidPool::SetHash(int bHash) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1293,7 +1270,6 @@ StgGuidPool::AddGuid( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1359,7 +1335,6 @@ StgGuidPool::RehashGuids() { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1420,7 +1395,6 @@ StgBlobPool::InitNew( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1479,7 +1453,6 @@ StgBlobPool::InitOnMem( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1528,7 +1501,6 @@ void StgBlobPool::Uninit() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -1562,7 +1534,6 @@ StgBlobPool::AddBlob( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1631,7 +1602,6 @@ StgBlobPool::GetBlob( MetaData::DataBlob *pData) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr; @@ -1672,7 +1642,6 @@ StgBlobPool::GetBlobWithSizePrefix( MetaData::DataBlob *pData) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr; @@ -1720,7 +1689,6 @@ StgBlobPool::SetHash(int bHash) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -1746,7 +1714,6 @@ StgBlobPool::RehashBlobs() { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END diff --git a/src/coreclr/md/runtime/stgpooli.cpp b/src/coreclr/md/runtime/stgpooli.cpp index 08f3162c776706..562625694ab49a 100644 --- a/src/coreclr/md/runtime/stgpooli.cpp +++ b/src/coreclr/md/runtime/stgpooli.cpp @@ -20,7 +20,6 @@ int CStringPoolHash::Cmp( void *pItem) // A hash item which refers to a string. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; LPCSTR p1 = reinterpret_cast(pData); LPCSTR p2; @@ -37,7 +36,6 @@ int CBlobPoolHash::Cmp( void *pItem) // A hash item which refers to a blob. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; ULONG ul1; ULONG ul2; @@ -68,7 +66,6 @@ int CBlobPoolHash::Cmp( int CGuidPoolHash::Cmp(const void *pData, void *pItem) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; GUID *p2; if (FAILED(m_Pool->GetGuid(reinterpret_cast(pItem)->iIndex, &p2))) @@ -93,7 +90,6 @@ void const *CPackedLen::GetData( // Pointer to data, or 0 on error. ULONG *pLength) // Put length here, or -1 on error. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; BYTE const *pBytes = reinterpret_cast(pData); @@ -133,7 +129,6 @@ HRESULT CPackedLen::SafeGetLength( // S_OK, or error void const **ppDataNext) // Pointer immediately following encoded length { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; if (pDataSource == NULL || pDataSourceEnd == NULL || @@ -199,7 +194,6 @@ HRESULT CPackedLen::SafeGetData( // S_OK, or error void const **ppData) // Start of data { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr = S_OK; @@ -235,7 +229,6 @@ HRESULT CPackedLen::SafeGetData( // S_OK, or error void const **ppData) // Start of data { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; return SafeGetData(pDataSource, (void const *)((BYTE const *)pDataSource + cbDataSource), pcbData, ppData); } // CPackedLen::GetLength @@ -248,7 +241,6 @@ ULONG CPackedLen::GetLength( // Length or -1 on error. void const **ppCode) // Put pointer to bytes here, if not 0. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; BYTE const *pBytes = reinterpret_cast(pData); @@ -281,7 +273,6 @@ ULONG CPackedLen::GetLength( // Length or -1 on error. int *pSizeLen) // Put size of length here, if not 0. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; BYTE const *pBytes = reinterpret_cast(pData); @@ -314,7 +305,6 @@ void* CPackedLen::PutLength( // First byte past length. ULONG iLen) // The length. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; BYTE *pBytes = reinterpret_cast(pData); diff --git a/src/coreclr/md/runtime/stgpoolreadonly.cpp b/src/coreclr/md/runtime/stgpoolreadonly.cpp index 0eaaff15b96555..ff648fe2ef0453 100644 --- a/src/coreclr/md/runtime/stgpoolreadonly.cpp +++ b/src/coreclr/md/runtime/stgpoolreadonly.cpp @@ -42,7 +42,6 @@ HRESULT StgPoolReadOnly::InitOnMemReadOnly(// Return code. CONTRACTL { NOTHROW; - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END @@ -84,8 +83,6 @@ HRESULT StgPoolReadOnly::GetStringW( // Return code. int cchBuffer) // Size of output buffer. { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FAULT; - HRESULT hr; LPCSTR pString; // The string in UTF8. int iChars; @@ -107,7 +104,6 @@ StgPoolReadOnly::GetBlob( MetaData::DataBlob *pData) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr; UINT32 cbBlobContentSize; @@ -159,7 +155,6 @@ StgBlobPoolReadOnly::GetBlob( MetaData::DataBlob *pData) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; HRESULT hr; UINT32 cbBlobContentSize; diff --git a/src/coreclr/utilcode/allocmemtracker.cpp b/src/coreclr/utilcode/allocmemtracker.cpp index 87ca402d9f87b7..72d0a2696c7c5a 100644 --- a/src/coreclr/utilcode/allocmemtracker.cpp +++ b/src/coreclr/utilcode/allocmemtracker.cpp @@ -14,7 +14,6 @@ AllocMemTracker::AllocMemTracker() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; CANNOT_TAKE_LOCK; } CONTRACTL_END @@ -32,7 +31,6 @@ AllocMemTracker::~AllocMemTracker() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -95,7 +93,6 @@ void *AllocMemTracker::Track(TaggedMemAllocPtr tmap) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END @@ -113,7 +110,6 @@ void *AllocMemTracker::Track_NoThrow(TaggedMemAllocPtr tmap) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return NULL;); } CONTRACTL_END diff --git a/src/coreclr/utilcode/arraylist.cpp b/src/coreclr/utilcode/arraylist.cpp index db7e76bb65cc48..a6fbc6236b6b50 100644 --- a/src/coreclr/utilcode/arraylist.cpp +++ b/src/coreclr/utilcode/arraylist.cpp @@ -25,7 +25,6 @@ void ArrayListBase::Clear() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -43,7 +42,6 @@ void ArrayListBase::Clear() PTR_VOID * ArrayListBase::GetPtr(DWORD index) const { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_CANNOT_TAKE_LOCK; SUPPORTS_DAC; @@ -68,7 +66,6 @@ HRESULT ArrayListBase::Append(void *element) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -115,7 +112,6 @@ DWORD ArrayListBase::FindElement(DWORD start, PTR_VOID element) const { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END diff --git a/src/coreclr/utilcode/check.cpp b/src/coreclr/utilcode/check.cpp index 985c3868ed79d9..98ae53761179f5 100644 --- a/src/coreclr/utilcode/check.cpp +++ b/src/coreclr/utilcode/check.cpp @@ -49,45 +49,25 @@ template<> AutoCleanupContractViolationHolder::AutoCleanupContractViolatio SPECIALIZE_CONTRACT_VIOLATION_HOLDER(mask); \ SPECIALIZE_AUTO_CLEANUP_CONTRACT_VIOLATION_HOLDER(mask) -// There is a special case that requires 0... Why??? Who knows, let's fix that case. - -SPECIALIZED_VIOLATION(0); // Basic Specializations - SPECIALIZED_VIOLATION(AllViolation); SPECIALIZED_VIOLATION(ThrowsViolation); SPECIALIZED_VIOLATION(GCViolation); SPECIALIZED_VIOLATION(ModeViolation); -SPECIALIZED_VIOLATION(FaultViolation); -SPECIALIZED_VIOLATION(FaultNotFatal); -SPECIALIZED_VIOLATION(TakesLockViolation); SPECIALIZED_VIOLATION(LoadsTypeViolation); +SPECIALIZED_VIOLATION(TakesLockViolation); // Other Specializations used by the RUNTIME, if you get a compile time error you need // to add the specific specialization that you are using here. SPECIALIZED_VIOLATION(ThrowsViolation|GCViolation); +SPECIALIZED_VIOLATION(ThrowsViolation|GCViolation|ModeViolation); +SPECIALIZED_VIOLATION(ThrowsViolation|GCViolation|LoadsTypeViolation|TakesLockViolation); SPECIALIZED_VIOLATION(ThrowsViolation|GCViolation|TakesLockViolation); -SPECIALIZED_VIOLATION(ThrowsViolation|ModeViolation); -SPECIALIZED_VIOLATION(ThrowsViolation|FaultNotFatal); -SPECIALIZED_VIOLATION(ThrowsViolation|FaultViolation); -SPECIALIZED_VIOLATION(ThrowsViolation|TakesLockViolation); -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|FaultViolation); -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); - - +SPECIALIZED_VIOLATION(GCViolation|ModeViolation|TakesLockViolation); +SPECIALIZED_VIOLATION(GCViolation|TakesLockViolation); #undef SPECIALIZED_VIOLATION #undef SPECIALIZE_AUTO_CLEANUP_CONTRACT_VIOLATION_HOLDER @@ -108,7 +88,6 @@ void CHECK::Trigger(LPCSTR reason) EX_TRY { - FAULT_NOT_FATAL(); pMessage = new StackSString(); pMessage->AppendASCII(reason); @@ -165,7 +144,6 @@ void CHECK::Setup(LPCSTR message, LPCSTR condition, LPCSTR file, INT line) { EX_TRY { - FAULT_NOT_FATAL(); // Try to build a stack of condition failures StackSString context; @@ -219,7 +197,7 @@ LPCSTR CHECK::FormatMessage(LPCSTR messageFormat, ...) { // This path is only run in debug. TakesLockViolation suppresses // problems with SString below. - CONTRACT_VIOLATION(FaultNotFatal|TakesLockViolation); + CONTRACT_VIOLATION(TakesLockViolation); EX_TRY { diff --git a/src/coreclr/utilcode/clrconfig.cpp b/src/coreclr/utilcode/clrconfig.cpp index 8cb18dfbf1114b..57cfab3d0529f4 100644 --- a/src/coreclr/utilcode/clrconfig.cpp +++ b/src/coreclr/utilcode/clrconfig.cpp @@ -136,7 +136,6 @@ namespace { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -180,8 +179,6 @@ namespace wcscat_s(buff, ARRAY_SIZE(buff), name); - FAULT_NOT_FATAL(); // We don't report OOM errors here, we return a default value. - NewArrayHolder ret = NULL; HRESULT hr = S_OK; EX_TRY @@ -238,14 +235,12 @@ namespace { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; CANNOT_TAKE_LOCK; } CONTRACTL_END; SUPPORTS_DAC_HOST_ONLY; - FAULT_NOT_FATAL(); // We don't report OOM errors here, we return a default value. int radix = CheckLookupOption(options, LookupOptions::ParseIntegerAsBase10) ? 10 @@ -277,13 +272,11 @@ namespace { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; NewArrayHolder ret(NULL); - FAULT_NOT_FATAL(); // We don't report OOM errors here, we return a default value. ret = EnvGetString(name, options); if (ret != NULL) @@ -444,7 +437,6 @@ DWORD CLRConfig::GetConfigValue(const ConfigDWORDInfo & info, /* [Out] */ bool * { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -513,14 +505,12 @@ LPWSTR CLRConfig::GetConfigValue(const ConfigStringInfo & info) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; LPWSTR result = NULL; // TODO: We swallow OOM exception here. Is this OK? - FAULT_NOT_FATAL(); // If this fails, result will stay NULL. GetConfigValue(info, &result); @@ -545,7 +535,6 @@ HRESULT CLRConfig::GetConfigValue(const ConfigStringInfo & info, _Outptr_result_ CONTRACTL { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT (return E_OUTOFMEMORY); } CONTRACTL_END; LPWSTR result = NULL; diff --git a/src/coreclr/utilcode/clrhost.cpp b/src/coreclr/utilcode/clrhost.cpp index 2c6915c3fdfad5..8ab71987902622 100644 --- a/src/coreclr/utilcode/clrhost.cpp +++ b/src/coreclr/utilcode/clrhost.cpp @@ -137,7 +137,6 @@ LoadsTypeHolder::LoadsTypeHolder(BOOL fConditional, // This fcn makes non-scoped changes to ClrDebugState so we cannot use a runtime CONTRACT here. STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; m_fConditional = fConditional; @@ -188,7 +187,6 @@ LoadsTypeHolder::~LoadsTypeHolder() // This fcn makes non-scoped changes to ClrDebugState so we cannot use a runtime CONTRACT here. STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (m_fConditional) diff --git a/src/coreclr/utilcode/debug.cpp b/src/coreclr/utilcode/debug.cpp index 59bfab207ae6a8..ae1c730063384b 100644 --- a/src/coreclr/utilcode/debug.cpp +++ b/src/coreclr/utilcode/debug.cpp @@ -88,7 +88,6 @@ void DoRaiseExceptionOnAssert(DWORD chance) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_DEBUG_ONLY; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; #if !defined(DACCESS_COMPILE) @@ -118,7 +117,6 @@ BOOL RaiseExceptionOnAssert(RaiseOnAssertOptions option = rTestAndRaise) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_DEBUG_ONLY; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; // ok for debug-only code to take locks @@ -235,10 +233,9 @@ bool _DbgBreakCheck( { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_DEBUG_ONLY; - CONTRACT_VIOLATION(FaultNotFatal | GCViolation | TakesLockViolation); + CONTRACT_VIOLATION(GCViolation | TakesLockViolation); char formatBuffer[4096]; @@ -311,7 +308,6 @@ bool _DbgBreakCheckNoThrow( { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_DEBUG_ONLY; bool failed = false; @@ -364,7 +360,6 @@ VOID DbgAssertDialog(const char *szFile, int iLine, const char *szExpr) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; DEBUG_ONLY_FUNCTION; @@ -423,7 +418,6 @@ VOID DbgAssertDialog(const char *szFile, int iLine, const char *szExpr) #ifndef DACCESS_COMPILE EX_TRY { - FAULT_NOT_FATAL(); szExprToDisplay = &g_szExprWithStack2[0]; strcpy(szExprToDisplay, szExpr); strcat_s(szExprToDisplay, ARRAY_SIZE(g_szExprWithStack2), "\n\n"); @@ -461,7 +455,6 @@ bool GetStackTraceAtContext(SString & s, CONTEXT * pContext) // NULL means use the current context. bool fSuccess = false; - FAULT_NOT_FATAL(); #ifndef TARGET_UNIX EX_TRY diff --git a/src/coreclr/utilcode/ex.cpp b/src/coreclr/utilcode/ex.cpp index c786f65619a251..83b0f9c65950f3 100644 --- a/src/coreclr/utilcode/ex.cpp +++ b/src/coreclr/utilcode/ex.cpp @@ -1263,7 +1263,6 @@ static DWORD MarkAsThrownByUsWorker(UINT numArgs, /*out*/ ULONG_PTR exceptionArg { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(numArgs < INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE); @@ -1282,7 +1281,6 @@ DWORD MarkAsThrownByUs(/*out*/ ULONG_PTR exceptionArgs[INSTANCE_TAGGED_SEH_PARAM { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; return MarkAsThrownByUsWorker(0, exceptionArgs); } @@ -1291,7 +1289,6 @@ DWORD MarkAsThrownByUs(/*out*/ ULONG_PTR exceptionArgs[INSTANCE_TAGGED_SEH_PARAM { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; return MarkAsThrownByUsWorker(1, exceptionArgs, arg0); } @@ -1305,7 +1302,6 @@ BOOL WasThrownByUs(const EXCEPTION_RECORD *pcER, DWORD dwExceptionCode) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; _ASSERTE(IsInstanceTaggedSEHCode(dwExceptionCode)); @@ -1346,7 +1342,6 @@ VOID RaiseComPlusException() { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; ULONG_PTR exceptionArgs[INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE]; diff --git a/src/coreclr/utilcode/executableallocator.cpp b/src/coreclr/utilcode/executableallocator.cpp index f982fa1f940b6b..6b4b0a55a33bf9 100644 --- a/src/coreclr/utilcode/executableallocator.cpp +++ b/src/coreclr/utilcode/executableallocator.cpp @@ -395,9 +395,6 @@ bool ExecutableAllocator::AddRWBlock(void* baseRW, void* baseRX, size_t size, Ca { LIMITED_METHOD_CONTRACT; - // The new "nothrow" below failure is handled as fail fast since it is not recoverable - PERMANENT_CONTRACT_VIOLATION(FaultViolation, ReasonContractInfrastructure); - BlockRW* pBlockRW = new (nothrow) BlockRW(); if (pBlockRW == NULL) { diff --git a/src/coreclr/utilcode/explicitcontrolloaderheap.cpp b/src/coreclr/utilcode/explicitcontrolloaderheap.cpp index 2dd3a3642fb9fc..57ffeac972ea4a 100644 --- a/src/coreclr/utilcode/explicitcontrolloaderheap.cpp +++ b/src/coreclr/utilcode/explicitcontrolloaderheap.cpp @@ -56,7 +56,6 @@ ExplicitControlLoaderHeap::ExplicitControlLoaderHeap(bool fMakeExecutable) : { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -79,7 +78,6 @@ ExplicitControlLoaderHeap::~ExplicitControlLoaderHeap() DESTRUCTOR_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -160,7 +158,6 @@ BOOL ExplicitControlLoaderHeap::ReservePages(size_t dwSizeToCommit) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END; @@ -250,7 +247,6 @@ BOOL ExplicitControlLoaderHeap::GetMoreCommittedPages(size_t dwMinSize) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END; @@ -304,12 +300,10 @@ void *ExplicitControlLoaderHeap::AllocMemForCode_NoThrow(size_t dwHeaderSize, si INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return NULL;); PRECONDITION(0 == (dwCodeAlignment & (dwCodeAlignment - 1))); // require power of 2 } CONTRACTL_END; - INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN())); // We don't know how much "extra" we need to satisfy the alignment until we know // which address will be handed out which in turn we don't know because we don't diff --git a/src/coreclr/utilcode/format1.cpp b/src/coreclr/utilcode/format1.cpp index 306248465e76f4..7bf11b5e164385 100644 --- a/src/coreclr/utilcode/format1.cpp +++ b/src/coreclr/utilcode/format1.cpp @@ -31,14 +31,12 @@ COR_ILMETHOD_DECODER::COR_ILMETHOD_DECODER( DecoderStatus * wbStatus) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; // Can't put contract because of SEH // CONTRACTL // { // NOTHROW; // GC_NOTRIGGER; - // FORBID_FAULT; // } // CONTRACTL_END diff --git a/src/coreclr/utilcode/interleavedloaderheap.cpp b/src/coreclr/utilcode/interleavedloaderheap.cpp index 09e6deecc93468..1803495db6a7e7 100644 --- a/src/coreclr/utilcode/interleavedloaderheap.cpp +++ b/src/coreclr/utilcode/interleavedloaderheap.cpp @@ -45,7 +45,6 @@ UnlockedInterleavedLoaderHeap::UnlockedInterleavedLoaderHeap( { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -59,7 +58,6 @@ UnlockedInterleavedLoaderHeap::~UnlockedInterleavedLoaderHeap() DESTRUCTOR_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -144,7 +142,6 @@ BOOL UnlockedInterleavedLoaderHeap::UnlockedReservePages(size_t dwSizeToCommit) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END; @@ -266,7 +263,6 @@ BOOL UnlockedInterleavedLoaderHeap::GetMoreCommittedPages(size_t dwMinSize) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END; @@ -380,35 +376,6 @@ BOOL UnlockedInterleavedLoaderHeap::GetMoreCommittedPages(size_t dwMinSize) return UnlockedReservePages(dwMinSize); } -#ifdef _DEBUG -static DWORD ShouldInjectFault() -{ - static DWORD fInjectFault = 99; - - if (fInjectFault == 99) - fInjectFault = (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_InjectFault) != 0); - return fInjectFault; -} - -#define SHOULD_INJECT_FAULT(return_statement) \ - do { \ - if (ShouldInjectFault() & 0x1) \ - { \ - char *a = new (nothrow) char; \ - if (a == NULL) \ - { \ - return_statement; \ - } \ - delete a; \ - } \ - } while (FALSE) - -#else - -#define SHOULD_INJECT_FAULT(return_statement) do { (void)((void *)0); } while (FALSE) - -#endif - void UnlockedInterleavedLoaderHeap::UnlockedBackoutStub(void *pMem COMMA_INDEBUG(_In_ const char *szFile) COMMA_INDEBUG(int lineNum) @@ -420,7 +387,6 @@ void UnlockedInterleavedLoaderHeap::UnlockedBackoutStub(void *pMem INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -470,23 +436,14 @@ void *UnlockedInterleavedLoaderHeap::UnlockedAllocStub_NoThrow( { NOTHROW; GC_NOTRIGGER; - - // Macro syntax can't handle this INJECT_FAULT expression - we'll use a precondition instead - //INJECT_FAULT( do{ if (*pdwExtra) {*pdwExtra = 0} RETURN NULL; } while(0) ); - } CONTRACTL_END size_t dwRequestedSize = m_dwGranularity; size_t alignment = 1; - STATIC_CONTRACT_FAULT; - - SHOULD_INJECT_FAULT(return NULL); - void *pResult; - INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN())); _ASSERTE(m_dwGranularity >= sizeof(InterleavedStubFreeListNode)); @@ -552,7 +509,6 @@ void *UnlockedInterleavedLoaderHeap::UnlockedAllocStub( { THROWS; GC_NOTRIGGER; - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END diff --git a/src/coreclr/utilcode/loaderheap.cpp b/src/coreclr/utilcode/loaderheap.cpp index 4e82cc21f6d09a..4472b272ff4627 100644 --- a/src/coreclr/utilcode/loaderheap.cpp +++ b/src/coreclr/utilcode/loaderheap.cpp @@ -51,7 +51,6 @@ UnlockedLoaderHeap::UnlockedLoaderHeap(DWORD dwReserveBlockSize, { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -77,7 +76,6 @@ UnlockedLoaderHeap::~UnlockedLoaderHeap() DESTRUCTOR_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -167,7 +165,6 @@ BOOL UnlockedLoaderHeap::UnlockedReservePages(size_t dwSizeToCommit) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END; @@ -293,7 +290,6 @@ BOOL UnlockedLoaderHeap::GetMoreCommittedPages(size_t dwMinSize) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END; @@ -357,7 +353,6 @@ void *UnlockedLoaderHeap::UnlockedAllocMem(size_t dwSize INSTANCE_CHECK; THROWS; GC_NOTRIGGER; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END; @@ -370,35 +365,6 @@ void *UnlockedLoaderHeap::UnlockedAllocMem(size_t dwSize return pResult; } -#ifdef _DEBUG -static DWORD ShouldInjectFault() -{ - static DWORD fInjectFault = 99; - - if (fInjectFault == 99) - fInjectFault = (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_InjectFault) != 0); - return fInjectFault; -} - -#define SHOULD_INJECT_FAULT(return_statement) \ - do { \ - if (ShouldInjectFault() & 0x1) \ - { \ - char *a = new (nothrow) char; \ - if (a == NULL) \ - { \ - return_statement; \ - } \ - delete a; \ - } \ - } while (FALSE) - -#else - -#define SHOULD_INJECT_FAULT(return_statement) do { (void)((void *)0); } while (FALSE) - -#endif - void *UnlockedLoaderHeap::UnlockedAllocMem_NoThrow(size_t dwSize COMMA_INDEBUG(_In_ const char *szFile) COMMA_INDEBUG(int lineNum)) @@ -408,17 +374,12 @@ void *UnlockedLoaderHeap::UnlockedAllocMem_NoThrow(size_t dwSize INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return NULL;); PRECONDITION(dwSize != 0); } CONTRACTL_END; - SHOULD_INJECT_FAULT(return NULL); - INDEBUG(size_t dwRequestedSize = dwSize;) - INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN())); - #ifdef RANDOMIZE_ALLOC dwSize += s_randomForLoaderHeap.Next() % 256; #endif @@ -509,7 +470,6 @@ void UnlockedLoaderHeap::UnlockedBackoutMem(void *pMem, INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -528,7 +488,7 @@ void UnlockedLoaderHeap::UnlockedBackoutMem(void *pMem, if (pTag->m_dwRequestedSize != dwRequestedSize || pTag->m_allocationType != kAllocMem) { - CONTRACT_VIOLATION(ThrowsViolation|FaultViolation); // We're reporting a heap corruption - who cares about violations + CONTRACT_VIOLATION(ThrowsViolation); // We're reporting a heap corruption StackSString message; message.Printf("HEAP VIOLATION: Invalid BackoutMem() call made at:\n" @@ -679,28 +639,19 @@ void *UnlockedLoaderHeap::UnlockedAllocAlignedMem_NoThrow(size_t dwRequestedSiz NOTHROW; GC_NOTRIGGER; - // Macro syntax can't handle this INJECT_FAULT expression - we'll use a precondition instead - //INJECT_FAULT( do{ if (*pdwExtra) {*pdwExtra = 0} RETURN NULL; } while(0) ); - PRECONDITION( alignment != 0 ); PRECONDITION(0 == (alignment & (alignment - 1))); // require power of 2 } CONTRACTL_END - STATIC_CONTRACT_FAULT; - // Set default value if (pdwExtra) { *pdwExtra = 0; } - SHOULD_INJECT_FAULT(return NULL); - void *pResult; - INCONTRACT(_ASSERTE(!ARE_FAULTS_FORBIDDEN())); - // Check for overflow if we align the allocation if (dwRequestedSize + alignment < dwRequestedSize) { @@ -809,7 +760,6 @@ void *UnlockedLoaderHeap::UnlockedAllocAlignedMem(size_t dwRequestedSize, { THROWS; GC_NOTRIGGER; - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END @@ -885,11 +835,6 @@ void UnlockedLoaderHeap::DumpFreeList() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - // The new "nothrow" below failure is handled in a non-fault way, so - // make sure that callers with FORBID_FAULT can call this method without - // firing the contract violation assert. - PERMANENT_CONTRACT_VIOLATION(FaultViolation, ReasonContractInfrastructure); - LOADER_HEAP_BEGIN_TRAP_FAULT // It's illegal to insert a free block that's smaller than the minimum sized allocation - @@ -941,8 +886,6 @@ void UnlockedLoaderHeap::DumpFreeList() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - INCONTRACT(_ASSERTE_IMPL(!ARE_FAULTS_FORBIDDEN())); - void *pResult = NULL; LOADER_HEAP_BEGIN_TRAP_FAULT @@ -1080,7 +1023,7 @@ void UnlockedLoaderHeap::ValidateFreeList(UnlockedLoaderHeap *pHeap) // is a secondary assert inside the contract stuff. // // This contract violation is permanent. - CONTRACT_VIOLATION(ThrowsViolation|FaultViolation|GCViolation|ModeViolation); // This violation won't be removed + CONTRACT_VIOLATION(ThrowsViolation|GCViolation|ModeViolation); // This violation won't be removed LoaderHeapFreeBlock *pFree = pHeap->m_pFirstFreeBlock; LoaderHeapFreeBlock *pPrev = NULL; diff --git a/src/coreclr/utilcode/loaderheap_shared.cpp b/src/coreclr/utilcode/loaderheap_shared.cpp index 073d4eb847b49a..118753de0ca5d4 100644 --- a/src/coreclr/utilcode/loaderheap_shared.cpp +++ b/src/coreclr/utilcode/loaderheap_shared.cpp @@ -39,7 +39,6 @@ UnlockedLoaderHeapBase::~UnlockedLoaderHeapBase() DESTRUCTOR_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -178,14 +177,12 @@ BOOL LoaderHeapEvent::QuietValidate() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; //If we OOM in here, we just throw the event away. } CONTRACTL_END LoaderHeapEvent *pNewEvent; { { - FAULT_NOT_FATAL(); pNewEvent = new (nothrow) LoaderHeapEvent; } if (!pNewEvent) @@ -216,7 +213,6 @@ BOOL LoaderHeapEvent::QuietValidate() /*static*/ VOID LoaderHeapSniffer::ClearEvents(UnlockedLoaderHeapBase *pHeap) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; LoaderHeapEvent *pEvent = pHeap->m_pEventList; while (pEvent) @@ -231,7 +227,6 @@ BOOL LoaderHeapEvent::QuietValidate() /*static*/ VOID LoaderHeapSniffer::CompactEvents(UnlockedLoaderHeapBase *pHeap) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; LoaderHeapEvent **ppEvent = &(pHeap->m_pEventList); while (*ppEvent) @@ -280,7 +275,6 @@ BOOL LoaderHeapEvent::QuietValidate() /*static*/ VOID LoaderHeapSniffer::PrintEvents(UnlockedLoaderHeapBase *pHeap) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; printf("\n------------- LoaderHeapEvents (in reverse time order!) --------------------"); diff --git a/src/coreclr/utilcode/memorypool.cpp b/src/coreclr/utilcode/memorypool.cpp index d5b21a1017353e..d5d3cb5ea9ac35 100644 --- a/src/coreclr/utilcode/memorypool.cpp +++ b/src/coreclr/utilcode/memorypool.cpp @@ -27,7 +27,6 @@ BOOL MemoryPool::AddBlock(SIZE_T elementCount) CONTRACTL { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END; // @@ -215,7 +214,6 @@ void *MemoryPool::AllocateElementNoThrow() CONTRACTL { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT( return FALSE; ); } CONTRACTL_END; void *element = m_freeList; diff --git a/src/coreclr/utilcode/namespaceutil.cpp b/src/coreclr/utilcode/namespaceutil.cpp index c17b07abae3ab5..85fb3c7db830ee 100644 --- a/src/coreclr/utilcode/namespaceutil.cpp +++ b/src/coreclr/utilcode/namespaceutil.cpp @@ -31,7 +31,6 @@ int ns::GetFullLength( // Number of chars in full name. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; int iLen = 1; // Null terminator. if (szNameSpace) @@ -49,7 +48,6 @@ int ns::GetFullLength( // Number of chars in full name. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; int iLen = 1; @@ -76,7 +74,6 @@ WCHAR *ns::FindSep( // Pointer to separator or null. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(szPath); WCHAR *ptr = (WCHAR*)u16_strrchr(szPath, NAMESPACE_SEPARATOR_WCHAR); @@ -92,7 +89,6 @@ LPUTF8 ns::FindSep( // Pointer to separator or null. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; _ASSERTE(szPath); @@ -114,7 +110,6 @@ LPUTF8 ns::SplitInline( // Pointer to name portion. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; LPUTF8 ptr = ns::FindSep(szPath); if (ptr) @@ -132,7 +127,6 @@ void ns::SplitInline( { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; LPUTF8 ptr = SplitInline(szPath); if (ptr) @@ -160,7 +154,6 @@ int ns::SplitPath( // true ok, false trunction. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; const WCHAR *ptr = ns::FindSep(szPath); size_t iLen = (ptr) ? ptr - szPath : 0; @@ -207,7 +200,6 @@ int ns::SplitPath( // true ok, false trunction. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; LPCUTF8 ptr = ns::FindSep(szPath); size_t iLen = (ptr) ? ptr - szPath : 0; @@ -256,7 +248,6 @@ int ns::MakePath( // true ok, false truncation. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (cchChars < 1) return false; @@ -298,7 +289,6 @@ int ns::MakePath( // true ok, false truncation. { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (cchChars < 1) return false; @@ -340,8 +330,6 @@ void ns::MakePath( // throws on out of memory { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FAULT; - ssBuf.Clear(); if (!ssNameSpace.IsEmpty()) diff --git a/src/coreclr/utilcode/pedecoder.cpp b/src/coreclr/utilcode/pedecoder.cpp index 2603c294ffab6c..905d7009b008f8 100644 --- a/src/coreclr/utilcode/pedecoder.cpp +++ b/src/coreclr/utilcode/pedecoder.cpp @@ -890,7 +890,6 @@ BOOL PEDecoder::PointerInPE(PTR_CVOID data) const INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/coreclr/utilcode/prettyprintsig.cpp b/src/coreclr/utilcode/prettyprintsig.cpp index 1d1d9e45b478aa..258b23176c94f5 100644 --- a/src/coreclr/utilcode/prettyprintsig.cpp +++ b/src/coreclr/utilcode/prettyprintsig.cpp @@ -21,7 +21,6 @@ static WCHAR* asStringW(CQuickBytes *out) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return NULL;); } CONTRACTL_END @@ -41,7 +40,6 @@ static CHAR* asStringA(CQuickBytes *out) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return NULL;); } CONTRACTL_END @@ -64,7 +62,6 @@ static HRESULT appendStrW(CQuickBytes *out, const WCHAR* str) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -88,7 +85,6 @@ static HRESULT appendStrA(CQuickBytes *out, const CHAR* str) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -109,7 +105,6 @@ static HRESULT appendStrNumW(CQuickBytes *out, int num) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -124,7 +119,6 @@ static HRESULT appendStrNumA(CQuickBytes *out, int num) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -139,7 +133,6 @@ static HRESULT appendStrHexW(CQuickBytes *out, int num) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -154,7 +147,6 @@ static HRESULT appendStrHexA(CQuickBytes *out, int num) { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -578,7 +570,6 @@ static HRESULT PrettyPrintTypeA( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -856,7 +847,6 @@ static HRESULT PrettyPrintClass( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -924,7 +914,6 @@ HRESULT PrettyPrintSigInternalLegacy( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END @@ -942,7 +931,6 @@ HRESULT PrettyPrintSigWorkerInternal( { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END diff --git a/src/coreclr/utilcode/rangelist.cpp b/src/coreclr/utilcode/rangelist.cpp index 39b4173c18f75d..08276e3ac73ba7 100644 --- a/src/coreclr/utilcode/rangelist.cpp +++ b/src/coreclr/utilcode/rangelist.cpp @@ -60,7 +60,6 @@ BOOL RangeList::AddRangeWorker(const BYTE *start, const BYTE *end, void *id) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return FALSE;); } CONTRACTL_END @@ -129,7 +128,6 @@ void RangeList::RemoveRangesWorker(void *id) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -187,7 +185,6 @@ BOOL RangeList::IsInRangeWorker(TADDR address) { INSTANCE_CHECK; NOTHROW; - FORBID_FAULT; GC_NOTRIGGER; } CONTRACTL_END diff --git a/src/coreclr/utilcode/sigparser.cpp b/src/coreclr/utilcode/sigparser.cpp index d24582a276eb15..506d11faa2bae5 100644 --- a/src/coreclr/utilcode/sigparser.cpp +++ b/src/coreclr/utilcode/sigparser.cpp @@ -18,7 +18,6 @@ HRESULT SigParser::SkipExactlyOne() INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -132,7 +131,6 @@ SigParser::SkipMethodHeaderSignature( INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -175,7 +173,6 @@ HRESULT SigParser::SkipSignature() INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END diff --git a/src/coreclr/utilcode/sstring.cpp b/src/coreclr/utilcode/sstring.cpp index 96b85fad3b352d..a7681e8fec75b6 100644 --- a/src/coreclr/utilcode/sstring.cpp +++ b/src/coreclr/utilcode/sstring.cpp @@ -1409,7 +1409,6 @@ BOOL SString::Equals(const SString &s) const INSTANCE_CHECK; PRECONDITION(s.Check()); THROWS_UNLESS_BOTH_NORMALIZED(s); - FAULTS_UNLESS_BOTH_NORMALIZED(s, ThrowOutOfMemory()); GC_NOTRIGGER; } CONTRACTL_END; @@ -1452,7 +1451,6 @@ BOOL SString::EqualsCaseInsensitive(const SString &s) const INSTANCE_CHECK; PRECONDITION(s.Check()); THROWS_UNLESS_BOTH_NORMALIZED(s); - FAULTS_UNLESS_BOTH_NORMALIZED(s, ThrowOutOfMemory()); GC_NOTRIGGER; } CONTRACTL_END; diff --git a/src/coreclr/utilcode/stresslog.cpp b/src/coreclr/utilcode/stresslog.cpp index 255c0d5527e580..7b987cdd1aea32 100644 --- a/src/coreclr/utilcode/stresslog.cpp +++ b/src/coreclr/utilcode/stresslog.cpp @@ -377,7 +377,6 @@ void StressLog::AddModule(uint8_t* moduleBase) /*********************************************************************************/ void StressLog::Terminate(BOOL fProcessDetach) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; theLog.facilitiesToLog = 0; @@ -423,7 +422,6 @@ ThreadStressLog* StressLog::CreateThreadStressLog() { { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -519,7 +517,6 @@ ThreadStressLog* StressLog::CreateThreadStressLogHelper() { { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; CANNOT_TAKE_LOCK; } CONTRACTL_END; @@ -572,7 +569,6 @@ ThreadStressLog* StressLog::CreateThreadStressLogHelper() { } if (msgs == 0) { - FAULT_NOT_FATAL(); // We don't mind if we can't allocate here, we'll try again later. if (IsInCantAllocStressLogRegion ()) { goto LEAVE; @@ -638,7 +634,6 @@ ThreadStressLog* StressLog::CreateThreadStressLogHelper() { /* static */ void StressLog::ThreadDetach() { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_CANNOT_TAKE_LOCK; ThreadStressLog* msgs = t_pCurrentThreadLog; @@ -740,7 +735,6 @@ void TrackSO(BOOL tolerance) FORCEINLINE void ThreadStressLog::LogMsg(unsigned facility, int cArgs, const char* format, va_list Args) { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; // Asserts in this function cause infinite loops in the asserting mechanism. // Just use debug breaks instead. @@ -863,7 +857,6 @@ void StressLog::LogMsg(unsigned level, unsigned facility, int cArgs, const char* #ifndef DACCESS_COMPILE STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; // Any stresslog LogMsg could theoretically create a new stress log and thus @@ -903,7 +896,6 @@ void StressLog::LogMsg(unsigned level, unsigned facility, const StressLogMsg &ms #ifndef DACCESS_COMPILE STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; // Any stresslog LogMsg could theoretically create a new stress log and thus diff --git a/src/coreclr/utilcode/util.cpp b/src/coreclr/utilcode/util.cpp index 86c493578d8e8c..f70b23b1fa5e49 100644 --- a/src/coreclr/utilcode/util.cpp +++ b/src/coreclr/utilcode/util.cpp @@ -344,17 +344,6 @@ HRESULT FakeCoCreateInstanceEx(REFCLSID rclsid, return hr; } -#ifdef _DEBUG -static DWORD ShouldInjectFaultInRange() -{ - static DWORD fInjectFaultInRange = 99; - - if (fInjectFaultInRange == 99) - fInjectFaultInRange = (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_InjectFault) & 0x40); - return fInjectFaultInRange; -} -#endif - // Reserves free memory within the range [pMinAddr..pMaxAddr] using // ClrVirtualQuery to find free memory and ClrVirtualAlloc to reserve it. // @@ -442,7 +431,6 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr, // BYTE * tryAddr = (BYTE *)ALIGN_UP((BYTE *)pMinAddr, VIRTUAL_ALLOC_RESERVE_GRANULARITY); bool virtualQueryFailed = false; - bool faultInjected = false; unsigned virtualQueryCount = 0; // Now scan memory and try to find a free block of the size requested. @@ -476,15 +464,6 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr, break; } -#ifdef _DEBUG - if (ShouldInjectFaultInRange()) - { - // return nullptr (failure) - faultInjected = true; - break; - } -#endif // _DEBUG - // On UNIX we can also fail if our request size 'dwSize' is larger than 64K and // and our tryAddr is pointing at a small MEM_FREE region (smaller than 'dwSize') // However we can't distinguish between this and the race case. @@ -520,11 +499,6 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr, { STRESS_LOG0(LF_JIT, LL_INFO100, "Additional reason: VirtualQuery operation failed.\n"); } - - if (faultInjected) - { - STRESS_LOG0(LF_JIT, LL_INFO100, "Additional reason: fault injected.\n"); - } } return pResult; diff --git a/src/coreclr/utilcode/winfix.cpp b/src/coreclr/utilcode/winfix.cpp index 2c5290b750acd8..644517a44d7770 100644 --- a/src/coreclr/utilcode/winfix.cpp +++ b/src/coreclr/utilcode/winfix.cpp @@ -68,7 +68,6 @@ static volatile ULONG g_dwMaxDBCSCharByteSize = 0; DWORD GetMaxDBCSCharByteSize() { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_CANNOT_TAKE_LOCK; if (g_dwMaxDBCSCharByteSize == 0) diff --git a/src/coreclr/vm/amd64/excepamd64.cpp b/src/coreclr/vm/amd64/excepamd64.cpp index bcc715912e8493..b62873d2c1f3ad 100644 --- a/src/coreclr/vm/amd64/excepamd64.cpp +++ b/src/coreclr/vm/amd64/excepamd64.cpp @@ -417,13 +417,9 @@ RtlVirtualUnwind_Worker ( { // InEpilogue && HasManagedBreakpoint, this means we have to make the fake code buffer - // We explicitly handle the case where the new below can't allocate, but we're still - // getting an assert from inside new b/c we can be called within a FAULT_FORBID scope. - // // If new does fail we will still end up crashing, but the debugger doesn't have to // be OOM hardened in Whidbey and this is a debugger only code path so we're ok in // that department. - FAULT_NOT_FATAL(); LOG((LF_CORDB, LL_EVERYTHING, "RVU_CBSW: Function has >1 managed bp in the epilogue, and we are in the epilogue, need a code buffer for RtlVirtualUnwind\n")); diff --git a/src/coreclr/vm/amd64/profiler.cpp b/src/coreclr/vm/amd64/profiler.cpp index bf01c87aba6503..aea02ab673bb35 100644 --- a/src/coreclr/vm/amd64/profiler.cpp +++ b/src/coreclr/vm/amd64/profiler.cpp @@ -179,7 +179,6 @@ LPVOID ProfileArgIterator::CopyStructFromRegisters() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 5e610ed1967c1d..adf01a71b790f4 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -111,7 +111,6 @@ PinnedHeapHandleBucket::PinnedHeapHandleBucket(PinnedHeapHandleBucket *pNext, PT THROWS; GC_NOTRIGGER; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -221,7 +220,6 @@ PinnedHeapHandleTable::PinnedHeapHandleTable(DWORD InitialBucketSize) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -259,7 +257,6 @@ OBJECTREF* PinnedHeapHandleTable::AllocateHandles(DWORD nRequested) GC_TRIGGERS; MODE_COOPERATIVE; PRECONDITION(nRequested > 0); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -559,7 +556,6 @@ OBJECTREF* AppDomain::AllocateObjRefPtrsInLargeTable(int nRequested, DynamicStat GC_TRIGGERS; MODE_ANY; PRECONDITION((nRequested > 0)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -647,7 +643,6 @@ STRINGREF* AppDomain::IsStringInterned(STRINGREF *pString) THROWS; MODE_COOPERATIVE; PRECONDITION(CheckPointer(pString)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -662,7 +657,6 @@ STRINGREF* AppDomain::GetOrInternString(STRINGREF *pString) THROWS; MODE_COOPERATIVE; PRECONDITION(CheckPointer(pString)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -676,7 +670,6 @@ void AppDomain::InitPinnedHeapHandleTable() THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -714,7 +707,6 @@ void SystemDomain::Attach() GC_TRIGGERS; MODE_ANY; PRECONDITION(m_pSystemDomain == NULL); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -804,7 +796,6 @@ void SystemDomain::PreallocateSpecialObjects() THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -821,7 +812,6 @@ void SystemDomain::CreatePreallocatedExceptions() THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -909,7 +899,6 @@ void SystemDomain::LazyInitGlobalStringLiteralMap() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -932,7 +921,6 @@ void SystemDomain::LazyInitFrozenObjectsHeap() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1321,7 +1309,6 @@ Module* SystemDomain::GetCallersModule(StackCrawlMark* stackMark) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1365,7 +1352,6 @@ StackWalkAction SystemDomain::CallersMethodCallbackWithStackMark(CrawlFrame* pCf THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1641,7 +1627,6 @@ AppDomain::AppDomain() THROWS; GC_TRIGGERS; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -1761,7 +1746,6 @@ void AppDomain::AddAssembly(Assembly * assem) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1830,7 +1814,6 @@ EEClassFactoryInfoHashTable* AppDomain::SetupClassFactHash() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1858,7 +1841,6 @@ DispIDCache* AppDomain::SetupRefDispIDCache() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1889,7 +1871,6 @@ FileLoadLock* FileLoadLock::Create(PEFileListLock* pLock, PEAssembly* pPEAssembl MODE_ANY; PRECONDITION(pLock->HasLock()); PRECONDITION(pLock->FindFileLock(pPEAssembly) == NULL); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2083,7 +2064,6 @@ void FileLoadLock::SetError(Exception *ex) THROWS; PRECONDITION(CheckPointer(ex)); PRECONDITION(HasLock()); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2291,8 +2271,6 @@ void AppDomain::LoadAssembly(Assembly *pAssembly, { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM();); } - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2346,7 +2324,6 @@ Assembly *AppDomain::LoadAssembly(AssemblySpec* pSpec, THROWS; MODE_ANY; PRECONDITION(CheckPointer(pPEAssembly)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2416,7 +2393,6 @@ Assembly *AppDomain::LoadAssemblyInternal(AssemblySpec* pIdentity, MODE_ANY; PRECONDITION(CheckPointer(pPEAssembly)); PRECONDITION(::GetAppDomain()==this); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2723,7 +2699,6 @@ void AppDomain::SetupSharedStatics() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2795,7 +2770,6 @@ void AppDomain::SetFriendlyName(LPCWSTR pwzFriendlyName) THROWS; GC_TRIGGERS; // for NameChangeEvent MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2832,7 +2806,6 @@ LPCWSTR AppDomain::GetFriendlyName() NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2854,7 +2827,6 @@ BOOL AppDomain::AddFileToCache(AssemblySpec* pSpec, PEAssembly * pPEAssembly) GC_TRIGGERS; MODE_ANY; PRECONDITION(CheckPointer(pSpec)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2873,7 +2845,6 @@ BOOL AppDomain::AddAssemblyToCache(AssemblySpec* pSpec, Assembly *pAssembly) MODE_ANY; PRECONDITION(CheckPointer(pSpec)); PRECONDITION(CheckPointer(pAssembly)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2893,7 +2864,6 @@ BOOL AppDomain::AddExceptionToCache(AssemblySpec* pSpec, Exception *ex) GC_TRIGGERS; MODE_ANY; PRECONDITION(CheckPointer(pSpec)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2916,7 +2886,6 @@ void AppDomain::AddUnmanagedImageToCache(LPCWSTR libraryName, NATIVE_LIBRARY_HAN MODE_ANY; PRECONDITION(CheckPointer(libraryName)); PRECONDITION(CheckPointer(hMod)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2945,7 +2914,6 @@ NATIVE_LIBRARY_HANDLE AppDomain::FindUnmanagedImageInCache(LPCWSTR libraryName) GC_NOTRIGGER; MODE_ANY; PRECONDITION(CheckPointer(libraryName)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2988,7 +2956,6 @@ BOOL AppDomain::RemoveAssemblyFromCache(Assembly* pAssembly) GC_TRIGGERS; MODE_ANY; PRECONDITION(CheckPointer(pAssembly)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -3347,7 +3314,6 @@ void AppDomain::RaiseLoadingAssemblyEvent(Assembly *pAssembly) } GCX_COOP(); - FAULT_NOT_FATAL(); OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(CLASS_LOADED); EX_TRY @@ -3422,7 +3388,6 @@ DefaultAssemblyBinder *AppDomain::CreateDefaultBinder() GC_TRIGGERS; THROWS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -3551,7 +3516,6 @@ RCWCache *AppDomain::CreateRCWCache() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -3606,7 +3570,6 @@ Assembly* AppDomain::RaiseTypeResolveEventThrowing(Assembly* pAssembly, LPCSTR s MODE_ANY; GC_TRIGGERS; THROWS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -3661,7 +3624,6 @@ Assembly* AppDomain::RaiseResourceResolveEvent(Assembly* pAssembly, LPCSTR szNam THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -3708,7 +3670,6 @@ AppDomain::RaiseAssemblyResolveEvent( THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -4289,7 +4250,6 @@ TypeEquivalenceHashTable * AppDomain::GetTypeEquivalenceCache() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END; diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 337d10b486cd57..1a014b6d66814c 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -212,7 +212,6 @@ class PEFileListLock : public ListLock { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; PRECONDITION(HasLock()); @@ -1252,8 +1251,6 @@ class AppDomain final { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - if (m_pRefClassFactHash != NULL) { return m_pRefClassFactHash; } @@ -1267,8 +1264,6 @@ class AppDomain final { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - if (m_pRefDispIDCache != NULL) { return m_pRefDispIDCache; } diff --git a/src/coreclr/vm/argdestination.h b/src/coreclr/vm/argdestination.h index b94c23743aabc0..8e12931b0dae94 100644 --- a/src/coreclr/vm/argdestination.h +++ b/src/coreclr/vm/argdestination.h @@ -221,7 +221,6 @@ class ArgDestination { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; // To zero the struct, we create a zero filled array of large enough size and @@ -245,7 +244,6 @@ class ArgDestination { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; _ASSERTE(IsStructPassedInRegs()); diff --git a/src/coreclr/vm/array.cpp b/src/coreclr/vm/array.cpp index e27e2e46d75685..0c772ef0458a88 100644 --- a/src/coreclr/vm/array.cpp +++ b/src/coreclr/vm/array.cpp @@ -956,7 +956,6 @@ MethodDesc* GetActualImplementationForArrayGenericIListOrIReadOnlyListMethod(Met { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index bc6ef3b21f7e3e..a9e1dcc0fb00b9 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -68,7 +68,6 @@ namespace THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -204,12 +203,11 @@ void Assembly::Init(AllocMemTracker *pamTracker) { CANNOTTHROWCOMPLUSEXCEPTION(); - FAULT_FORBID(); //Cannot fail after this point. InterlockedIncrement((LONG*)&m_pClassLoader->m_cUnhashedModules); - return; // Explicit return to let you know you are NOT welcome to add code after the CANNOTTHROW/FAULT_FORBID expires + return; // Explicit return to let you know you are NOT welcome to add code after the CANNOTTHROW expires } } @@ -219,7 +217,6 @@ Assembly::~Assembly() { NOTHROW; GC_TRIGGERS; - DISABLED(FORBID_FAULT); //Must clean up some profiler stuff } CONTRACTL_END @@ -278,7 +275,6 @@ void Assembly::StartUnload() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FORBID_FAULT; #ifdef PROFILING_SUPPORTED if (CORProfilerTrackAssemblyLoads()) @@ -375,7 +371,6 @@ Assembly *Assembly::CreateDynamic(AssemblyBinder* pBinder, NativeAssemblyNamePar { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_COOPERATIVE; } CONTRACTL_END; @@ -518,7 +513,6 @@ Assembly *Assembly::CreateDynamic(AssemblyBinder* pBinder, NativeAssemblyNamePar { CANNOTTHROWCOMPLUSEXCEPTION(); - FAULT_FORBID(); // Cannot fail after this point @@ -566,7 +560,6 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; SUPPORTS_DAC; } @@ -693,7 +686,6 @@ Module * Assembly::FindModuleByTypeRef( { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM();); } MODE_ANY; @@ -888,7 +880,6 @@ void Assembly::CacheFriendAssemblyInfo() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -912,7 +903,6 @@ void Assembly::UpdateCachedFriendAssemblyInfo() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -1043,7 +1033,6 @@ void DECLSPEC_NORETURN ThrowMainMethodException(MethodDesc* pMD, UINT resID) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -1067,7 +1056,6 @@ void ValidateMainMethod(MethodDesc * pFD, CorEntryPointType *pType) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pType)); } @@ -1278,7 +1266,6 @@ static void RunMainPost() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(GetThreadNULLOk())); } CONTRACTL_END @@ -1306,7 +1293,6 @@ void RunManagedStartup() THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1323,7 +1309,6 @@ INT32 Assembly::ExecuteMainMethod(PTRARRAYREF *stringArgs, bool captureException GC_TRIGGERS; MODE_ANY; ENTRY_POINT; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -1409,7 +1394,6 @@ MethodDesc* Assembly::GetEntryPoint() CONTRACTL { THROWS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; // Can return NULL if no entry point. @@ -1506,7 +1490,6 @@ OBJECTREF Assembly::GetExposedObject() { GC_TRIGGERS; THROWS; - INJECT_FAULT(COMPlusThrowOM();); MODE_COOPERATIVE; } CONTRACTL_END; @@ -1601,7 +1584,6 @@ BOOL Assembly::GetResource(LPCSTR szName, DWORD *cbResource, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1623,7 +1605,6 @@ ITypeLib* Assembly::GetTypeLib() { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -1640,7 +1621,6 @@ bool Assembly::TrySetTypeLib(_In_ ITypeLib *pNew) { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; PRECONDITION(CheckPointer(pNew)); } CONTRACTL_END @@ -1666,7 +1646,6 @@ mdAssemblyRef Assembly::AddAssemblyRef(Assembly *refedAssembly, IMetaDataAssembl CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(refedAssembly)); PRECONDITION(CheckPointer(pAssemEmitter, NULL_NOT_OK)); } @@ -1703,7 +1682,6 @@ void Assembly::AddType( THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -1730,7 +1708,6 @@ void Assembly::AddExportedType(mdExportedType cl) THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -2330,7 +2307,6 @@ DebuggerAssemblyControlFlags Assembly::ComputeDebuggingConfig() THROWS; WRAPPER(GC_TRIGGERS); MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2354,7 +2330,6 @@ HRESULT Assembly::GetDebuggingCustomAttributes(DWORD *pdwFlags) NOTHROW; WRAPPER(GC_TRIGGERS); MODE_ANY; - FORBID_FAULT; PRECONDITION(CheckPointer(pdwFlags)); } CONTRACTL_END; diff --git a/src/coreclr/vm/assemblyspec.cpp b/src/coreclr/vm/assemblyspec.cpp index a1bb956517e724..05de4d9b8afc13 100644 --- a/src/coreclr/vm/assemblyspec.cpp +++ b/src/coreclr/vm/assemblyspec.cpp @@ -34,7 +34,6 @@ BOOL UnsafeVerifyLookupAssembly(AssemblySpecBindingCache *pCache, AssemblySpec * { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FORBID_FAULT; BOOL result = FALSE; @@ -64,7 +63,6 @@ BOOL UnsafeVerifyLookupFile(AssemblySpecBindingCache *pCache, AssemblySpec *pSpe { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FORBID_FAULT; BOOL result = FALSE; @@ -96,7 +94,6 @@ BOOL UnsafeContains(AssemblySpecBindingCache *pCache, AssemblySpec *pSpec) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FORBID_FAULT; BOOL result = FALSE; @@ -165,7 +162,6 @@ void AssemblySpec::InitializeSpec(PEAssembly * pFile) GC_NOTRIGGER; MODE_ANY; PRECONDITION(CheckPointer(pFile)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; IMDInternalImport* pImport = pFile->GetMDImport(); @@ -310,7 +306,6 @@ Assembly *AssemblySpec::LoadAssembly(FileLoadLevel targetLevel, THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -350,7 +345,6 @@ Assembly *AssemblySpec::LoadAssembly(LPCSTR pSimpleName, GC_TRIGGERS; MODE_ANY; PRECONDITION(CheckPointer(pSimpleName)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -369,7 +363,6 @@ Assembly *AssemblySpec::LoadAssembly(LPCWSTR pFilePath) GC_TRIGGERS; MODE_ANY; PRECONDITION(CheckPointer(pFilePath)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -416,7 +409,6 @@ HRESULT AssemblySpec::EmitToken( MODE_ANY; NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END; @@ -546,13 +538,11 @@ AssemblySpecBindingCache::AssemblyBinding* AssemblySpecBindingCache::LookupInter { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } else { GC_NOTRIGGER; NOTHROW; - FORBID_FAULT; } MODE_ANY; PRECONDITION(pSpec != NULL); @@ -611,12 +601,10 @@ Assembly *AssemblySpecBindingCache::LookupAssembly(AssemblySpec *pSpec, if (fThrow) { GC_TRIGGERS; THROWS; - INJECT_FAULT(COMPlusThrowOM();); } else { GC_NOTRIGGER; NOTHROW; - FORBID_FAULT; } MODE_ANY; } @@ -648,12 +636,10 @@ PEAssembly *AssemblySpecBindingCache::LookupFile(AssemblySpec *pSpec, BOOL fThro if (fThrow) { GC_TRIGGERS; THROWS; - INJECT_FAULT(COMPlusThrowOM();); } else { GC_NOTRIGGER; NOTHROW; - FORBID_FAULT; } MODE_ANY; } @@ -725,7 +711,6 @@ class AssemblyBindingHolder { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -747,7 +732,6 @@ class AssemblyBindingHolder { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -809,7 +793,6 @@ BOOL AssemblySpecBindingCache::StoreAssembly(AssemblySpec *pSpec, Assembly *pAss THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -889,7 +872,6 @@ BOOL AssemblySpecBindingCache::StorePEAssembly(AssemblySpec *pSpec, PEAssembly * THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -968,7 +950,6 @@ BOOL AssemblySpecBindingCache::StoreException(AssemblySpec *pSpec, Exception* pE THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; diff --git a/src/coreclr/vm/asynccontinuations.cpp b/src/coreclr/vm/asynccontinuations.cpp index 9200b68e96f346..96510def97ae09 100644 --- a/src/coreclr/vm/asynccontinuations.cpp +++ b/src/coreclr/vm/asynccontinuations.cpp @@ -275,7 +275,6 @@ EEHashEntry_t* ContinuationLayoutKeyHashTableHelper::AllocateEntry(ContinuationL { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(return FALSE;); } CONTRACTL_END diff --git a/src/coreclr/vm/baseassemblyspec.cpp b/src/coreclr/vm/baseassemblyspec.cpp index 469535aa7f4db2..7d023749d9e9b9 100644 --- a/src/coreclr/vm/baseassemblyspec.cpp +++ b/src/coreclr/vm/baseassemblyspec.cpp @@ -22,7 +22,6 @@ BOOL BaseAssemblySpec::IsCoreLib() INSTANCE_CHECK; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; if (m_pAssemblyName == NULL) @@ -52,7 +51,6 @@ BOOL BaseAssemblySpec::IsCoreLibSatellite() const INSTANCE_CHECK; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; diff --git a/src/coreclr/vm/baseassemblyspec.inl b/src/coreclr/vm/baseassemblyspec.inl index 31833695de6ce1..f189d1d0fa2574 100644 --- a/src/coreclr/vm/baseassemblyspec.inl +++ b/src/coreclr/vm/baseassemblyspec.inl @@ -71,7 +71,6 @@ inline VOID BaseAssemblySpec::CloneFields() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END @@ -116,7 +115,6 @@ inline VOID BaseAssemblySpec::CloneFieldsToLoaderHeap(LoaderHeap *pHeap, AllocMe THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END @@ -159,7 +157,6 @@ inline void BaseAssemblySpec::CopyFrom(const BaseAssemblySpec *pSpec) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END diff --git a/src/coreclr/vm/binder.cpp b/src/coreclr/vm/binder.cpp index 5c992c1ad3a3f7..682d8b108db836 100644 --- a/src/coreclr/vm/binder.cpp +++ b/src/coreclr/vm/binder.cpp @@ -49,7 +49,6 @@ PTR_MethodTable CoreLibBinder::LookupClassLocal(BinderClassID id) { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(id != CLASS__NIL); PRECONDITION(id <= m_cClasses); @@ -127,7 +126,6 @@ MethodDesc * CoreLibBinder::LookupMethodLocal(BinderMethodID id) { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(id != METHOD__NIL); PRECONDITION(id <= m_cMethods); @@ -186,7 +184,6 @@ FieldDesc * CoreLibBinder::LookupFieldLocal(BinderFieldID id) { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(id != FIELD__NIL); PRECONDITION(id <= m_cFields); @@ -216,7 +213,6 @@ NOINLINE PTR_MethodTable CoreLibBinder::LookupClassIfExist(BinderClassID id) { GC_NOTRIGGER; NOTHROW; - FORBID_FAULT; MODE_ANY; PRECONDITION(id != CLASS__NIL); @@ -252,7 +248,6 @@ Signature CoreLibBinder::GetSignature(LPHARDCODEDMETASIG pHardcodedSig) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -282,7 +277,6 @@ Signature CoreLibBinder::GetTargetSignature(LPHARDCODEDMETASIG pHardcodedSig) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -297,7 +291,6 @@ Signature CoreLibBinder::GetSignatureLocal(LPHARDCODEDMETASIG pHardcodedSig) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -463,7 +456,6 @@ const BYTE* CoreLibBinder::ConvertSignature(LPHARDCODEDMETASIG pHardcodedSig, co { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -505,7 +497,6 @@ void CoreLibBinder::TriggerGCUnderStress() { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; diff --git a/src/coreclr/vm/binder.h b/src/coreclr/vm/binder.h index ba3cc41aba0e9e..81806e74ee6b2e 100644 --- a/src/coreclr/vm/binder.h +++ b/src/coreclr/vm/binder.h @@ -332,7 +332,6 @@ FORCEINLINE PTR_MethodTable CoreLibBinder::GetClass(BinderClassID id) { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(id != CLASS__NIL); PRECONDITION((&g_CoreLib)->m_cClasses > 0); // Make sure CoreLib has been loaded. @@ -355,7 +354,6 @@ FORCEINLINE MethodDesc * CoreLibBinder::GetMethod(BinderMethodID id) { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(id != METHOD__NIL); PRECONDITION(id <= (&g_CoreLib)->m_cMethods); @@ -377,7 +375,6 @@ FORCEINLINE FieldDesc * CoreLibBinder::GetField(BinderFieldID id) { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(id != FIELD__NIL); PRECONDITION(id <= (&g_CoreLib)->m_cFields); @@ -423,7 +420,6 @@ FORCEINLINE PTR_MethodTable CoreLibBinder::GetClassIfExist(BinderClassID id) { GC_NOTRIGGER; NOTHROW; - FORBID_FAULT; MODE_ANY; PRECONDITION(id != CLASS__NIL); diff --git a/src/coreclr/vm/cachelinealloc.cpp b/src/coreclr/vm/cachelinealloc.cpp index 3cea6f9802b518..2d3501c1dd9361 100644 --- a/src/coreclr/vm/cachelinealloc.cpp +++ b/src/coreclr/vm/cachelinealloc.cpp @@ -86,7 +86,6 @@ void *CCacheLineAllocator::VAlloc(ULONG cbSize) NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(return NULL); } CONTRACTL_END; @@ -166,7 +165,6 @@ void *CCacheLineAllocator::GetCacheLine64() NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(return NULL); } CONTRACTL_END; @@ -214,7 +212,6 @@ void *CCacheLineAllocator::GetCacheLine32() NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(return NULL); } CONTRACTL_END; diff --git a/src/coreclr/vm/callhelpers.cpp b/src/coreclr/vm/callhelpers.cpp index 48564f5539213d..af057ca667efe9 100644 --- a/src/coreclr/vm/callhelpers.cpp +++ b/src/coreclr/vm/callhelpers.cpp @@ -248,7 +248,6 @@ void MethodDescCallSite::CallTargetWorker(const ARG_SLOT *pArguments, ARG_SLOT * { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_COOPERATIVE; PRECONDITION(GetAppDomain()->CheckCanExecuteManagedCode(m_pMD)); PRECONDITION(m_pMD->CheckActivated()); // EnsureActive will trigger, so we must already be activated @@ -282,9 +281,7 @@ void MethodDescCallSite::CallTargetWorker(const ARG_SLOT *pArguments, ARG_SLOT * GCX_FORBID(); // - // All types must already be loaded. This macro also sets up a FAULT_FORBID region which is - // also required for critical calls since we cannot inject any failure points between the - // caller of MethodDesc::CallDescr and the actual transition to managed code. + // All types must already be loaded. // ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE(); diff --git a/src/coreclr/vm/callingconvention.h b/src/coreclr/vm/callingconvention.h index 10c2e4a6d918de..715f7348f533c3 100644 --- a/src/coreclr/vm/callingconvention.h +++ b/src/coreclr/vm/callingconvention.h @@ -1166,7 +1166,6 @@ int ArgIteratorTemplate::GetParamTypeArgOffset() INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; } CONTRACTL_END @@ -1216,7 +1215,6 @@ int ArgIteratorTemplate::GetAsyncContinuationArgOffset() INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; } CONTRACTL_END @@ -1955,7 +1953,6 @@ void ArgIteratorTemplate::ComputeReturnFlags() INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; } CONTRACTL_END @@ -2102,7 +2099,6 @@ void ArgIteratorTemplate::ForceSigWalk() INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; } CONTRACTL_END diff --git a/src/coreclr/vm/castcache.cpp b/src/coreclr/vm/castcache.cpp index a1cf95999327b3..848a90bb4c41fc 100644 --- a/src/coreclr/vm/castcache.cpp +++ b/src/coreclr/vm/castcache.cpp @@ -34,7 +34,6 @@ BASEARRAYREF CastCache::CreateCastCache(DWORD size) // if we get an OOM here, we try a smaller size EX_TRY { - FAULT_NOT_FATAL(); table = (BASEARRAYREF)AllocatePrimitiveArray(CorElementType::ELEMENT_TYPE_I4, (size + 1) * sizeof(CastCacheEntry) / sizeof(INT32)); } EX_SWALLOW_NONTERMINAL @@ -45,7 +44,6 @@ BASEARRAYREF CastCache::CreateCastCache(DWORD size) // if we get an OOM again we return NULL EX_TRY { - FAULT_NOT_FATAL(); table = (BASEARRAYREF)AllocatePrimitiveArray(CorElementType::ELEMENT_TYPE_I4, (size + 1) * sizeof(CastCacheEntry) / sizeof(INT32)); } EX_SWALLOW_NONTERMINAL diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index c75a5b6bb2667c..b088cefc84e0b1 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -217,7 +217,6 @@ void Module::UpdateNewlyAddedTypes() MODE_PREEMPTIVE; THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -278,7 +277,6 @@ void Module::NotifyProfilerLoadFinished(HRESULT hr) INSTANCE_CHECK; THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_PREEMPTIVE; } CONTRACTL_END; @@ -365,7 +363,6 @@ Module::Module(Assembly *pAssembly, PEAssembly *pPEAssembly) { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -835,7 +832,6 @@ MethodTable *Module::GetGlobalMethodTable() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(return NULL;); } CONTRACTL_END; @@ -1972,7 +1968,6 @@ void Module::ReleaseISymUnmanagedReader(void) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -1998,7 +1993,6 @@ ILStubCache* Module::GetILStubCache() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2221,7 +2215,6 @@ BOOL Module::IsSigInILImpl(PCCOR_SIGNATURE signature) CONTRACTL { INSTANCE_CHECK; - FORBID_FAULT; MODE_ANY; NOTHROW; GC_NOTRIGGER; @@ -2239,7 +2232,6 @@ void ModuleBase::InitializeStringData(DWORD token, EEStringData *pstrData, CQuic THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(TypeFromToken(token) == mdtString); } CONTRACTL_END; @@ -2276,7 +2268,6 @@ STRINGREF* ModuleBase::ResolveStringRef(DWORD token, void** ppPinnedString) { INSTANCE_CHECK; STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(TypeFromToken(token) == mdtString); } CONTRACTL_END; @@ -2340,7 +2331,6 @@ Module::GetAssemblyIfLoaded( INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; SUPPORTS_DAC; } @@ -2465,7 +2455,6 @@ Assembly * Module::LoadAssemblyImpl(mdAssemblyRef kAssemblyRef) INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM();); } MODE_ANY; } CONTRACTL_END; @@ -2524,7 +2513,6 @@ Module *Module::GetModuleIfLoaded(mdFile kFile) MODE_ANY; PRECONDITION(TypeFromToken(kFile) == mdtFile || TypeFromToken(kFile) == mdtModuleRef); - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -2593,8 +2581,6 @@ PTR_Module Module::LookupModule(mdToken kFile) INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; - else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; PRECONDITION(TypeFromToken(kFile) == mdtFile || TypeFromToken(kFile) == mdtModuleRef); @@ -2619,7 +2605,6 @@ TypeHandle ModuleBase::LookupTypeRef(mdTypeRef token) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; SUPPORTS_DAC; _ASSERTE(TypeFromToken(token) == mdtTypeRef); @@ -2648,7 +2633,6 @@ PTR_TADDR LookupMapBase::GrowMap(ModuleBase * pModule, DWORD rid) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END; @@ -3478,7 +3462,6 @@ IMDInternalImport* Module::GetNativeAssemblyImport(BOOL loadAllowed) INSTANCE_CHECK; if (loadAllowed) GC_TRIGGERS; else GC_NOTRIGGER; if (loadAllowed) THROWS; else NOTHROW; - if (loadAllowed) INJECT_FAULT(COMPlusThrowOM()); else FORBID_FAULT; MODE_ANY; PRECONDITION(IsReadyToRun()); } @@ -3847,7 +3830,6 @@ ReflectionModule::ReflectionModule(Assembly *pAssembly, PEAssembly *pPEAssembly) { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -4250,7 +4232,6 @@ VASigCookie *Module::GetVASigCookie(Signature vaSignature, const SigTypeContext* { INSTANCE_CHECK; STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -4291,7 +4272,6 @@ VASigCookie *Module::GetVASigCookieWorker(Module* pDefiningModule, Module* pLoad CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -4445,7 +4425,6 @@ LookupMapBase::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -4471,7 +4450,6 @@ LookupMapBase::ListEnumMemoryRegions(CLRDataEnumMemoryFlags flags) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -4544,7 +4522,6 @@ void Module::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -4625,7 +4602,6 @@ LPCWSTR Module::GetPathForErrorMessages() { THROWS; GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } } CONTRACTL_END @@ -4647,7 +4623,6 @@ LPCWSTR ModuleBase::GetPathForErrorMessages() { THROWS; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END; return W(""); diff --git a/src/coreclr/vm/ceeload.h b/src/coreclr/vm/ceeload.h index 2fcdaaa16c39e1..4a9147cf42ad43 100644 --- a/src/coreclr/vm/ceeload.h +++ b/src/coreclr/vm/ceeload.h @@ -1210,13 +1210,13 @@ class Module : public ModuleBase #ifndef DACCESS_COMPILE VOID EnsureTypeDefCanBeStored(mdTypeDef token) { - WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/INJECT_FAULT()/MODE_ANY + WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/MODE_ANY m_TypeDefToMethodTableMap.EnsureElementCanBeStored(this, RidFromToken(token)); } void EnsuredStoreTypeDef(mdTypeDef token, TypeHandle value) { - WRAPPER_NO_CONTRACT; // NOTHROW/GC_NOTRIGGER/FORBID_FAULT/MODE_ANY + WRAPPER_NO_CONTRACT; // NOTHROW/GC_NOTRIGGER/MODE_ANY _ASSERTE(TypeFromToken(token) == mdtTypeDef); m_TypeDefToMethodTableMap.SetElement(RidFromToken(token), value.AsMethodTable()); @@ -1235,7 +1235,7 @@ class Module : public ModuleBase void EnsureTypeRefCanBeStored(mdTypeRef token) { - WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/INJECT_FAULT()/MODE_ANY + WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/MODE_ANY _ASSERTE(TypeFromToken(token) == mdtTypeRef); m_TypeRefToMethodTableMap.EnsureElementCanBeStored(this, RidFromToken(token)); @@ -1247,13 +1247,13 @@ class Module : public ModuleBase #ifndef DACCESS_COMPILE void EnsureMethodDefCanBeStored(mdMethodDef token) { - WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/INJECT_FAULT()/MODE_ANY + WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/MODE_ANY m_MethodDefToDescMap.EnsureElementCanBeStored(this, RidFromToken(token)); } void EnsuredStoreMethodDef(mdMethodDef token, MethodDesc *value) { - WRAPPER_NO_CONTRACT; // NOTHROW/GC_NOTRIGGER/FORBID_FAULT/MODE_ANY + WRAPPER_NO_CONTRACT; // NOTHROW/GC_NOTRIGGER/MODE_ANY _ASSERTE(TypeFromToken(token) == mdtMethodDef); m_MethodDefToDescMap.SetElement(RidFromToken(token), value); @@ -1266,14 +1266,14 @@ class Module : public ModuleBase #ifndef DACCESS_COMPILE void EnsureILCodeVersioningStateCanBeStored(mdMethodDef token) { - WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/INJECT_FAULT()/MODE_ANY + WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/MODE_ANY _ASSERTE(CodeVersionManager::IsLockOwnedByCurrentThread()); m_ILCodeVersioningStateMap.EnsureElementCanBeStored(this, RidFromToken(token)); } void EnsuredStoreILCodeVersioningState(mdMethodDef token, PTR_ILCodeVersioningState value) { - WRAPPER_NO_CONTRACT; // NOTHROW/GC_NOTRIGGER/FORBID_FAULT/MODE_ANY + WRAPPER_NO_CONTRACT; // NOTHROW/GC_NOTRIGGER/MODE_ANY _ASSERTE(CodeVersionManager::IsLockOwnedByCurrentThread()); _ASSERTE(TypeFromToken(token) == mdtMethodDef); m_ILCodeVersioningStateMap.SetElement(RidFromToken(token), value); @@ -1297,13 +1297,13 @@ class Module : public ModuleBase #ifndef DACCESS_COMPILE void EnsureFieldDefCanBeStored(mdFieldDef token) { - WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/INJECT_FAULT()/MODE_ANY + WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/MODE_ANY m_FieldDefToDescMap.EnsureElementCanBeStored(this, RidFromToken(token)); } void EnsuredStoreFieldDef(mdFieldDef token, FieldDesc *value) { - WRAPPER_NO_CONTRACT; // NOTHROW/GC_NOTRIGGER/FORBID_FAULT/MODE_ANY + WRAPPER_NO_CONTRACT; // NOTHROW/GC_NOTRIGGER/MODE_ANY _ASSERTE(TypeFromToken(token) == mdtFieldDef); m_FieldDefToDescMap.SetElement(RidFromToken(token), value); @@ -1351,7 +1351,7 @@ class Module : public ModuleBase void EnsureAssemblyRefCanBeStored(mdAssemblyRef token) { - WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/INJECT_FAULT()/MODE_ANY + WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/MODE_ANY _ASSERTE(TypeFromToken(token) == mdtAssemblyRef); m_ManifestModuleReferencesMap.EnsureElementCanBeStored(this, RidFromToken(token)); diff --git a/src/coreclr/vm/ceeload.inl b/src/coreclr/vm/ceeload.inl index 0a2d07474aa635..1b4204d8de96fc 100644 --- a/src/coreclr/vm/ceeload.inl +++ b/src/coreclr/vm/ceeload.inl @@ -147,7 +147,6 @@ void LookupMap::AddElement(ModuleBase * pModule, DWORD rid, TYPE value, TA THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END; @@ -180,7 +179,6 @@ void LookupMap::EnsureElementCanBeStored(Module * pModule, DWORD rid) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END; @@ -326,7 +324,7 @@ inline Assembly *ModuleBase::LookupAssemblyRef(mdAssemblyRef token) #ifndef DACCESS_COMPILE inline void Module::ForceStoreAssemblyRef(mdAssemblyRef token, Assembly *value) { - WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/INJECT_FAULT()/MODE_ANY + WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/MODE_ANY _ASSERTE(value->GetModule()); _ASSERTE(TypeFromToken(token) == mdtAssemblyRef); diff --git a/src/coreclr/vm/ceemain.cpp b/src/coreclr/vm/ceemain.cpp index e59c29fed207f3..a1141a33dc803a 100644 --- a/src/coreclr/vm/ceemain.cpp +++ b/src/coreclr/vm/ceemain.cpp @@ -2001,7 +2001,6 @@ void ContractRegressionCheckInner() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; LOADS_TYPE(CLASS_LOAD_BEGIN); CANNOT_TAKE_LOCK; } @@ -2035,13 +2034,11 @@ void ContractRegressionCheck() // B#564831 (which left a huge swath of contracts silently disabled for over six months) PERMANENT_CONTRACT_VIOLATION(ThrowsViolation | GCViolation - | FaultViolation | LoadsTypeViolation | TakesLockViolation , ReasonContractInfrastructure ); { - FAULT_NOT_FATAL(); ContractRegressionCheckInner(); } } diff --git a/src/coreclr/vm/class.cpp b/src/coreclr/vm/class.cpp index 281ea7e7c11c68..c367dd1c5a94ad 100644 --- a/src/coreclr/vm/class.cpp +++ b/src/coreclr/vm/class.cpp @@ -41,7 +41,6 @@ void *EEClass::operator new( { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -60,7 +59,6 @@ void EEClass::Destruct() { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -114,7 +112,6 @@ MethodTable *MethodTable::LoadEnclosingMethodTable(ClassLoadLevel targetLevel) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; } CONTRACTL_END @@ -145,7 +142,6 @@ VOID EEClass::FixupFieldDescForEnC(MethodTable * pMT, EnCFieldDesc *pFD, mdField { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -1686,7 +1682,6 @@ MethodDesc* MethodTable::GetBoxedEntryPointMD(MethodDesc *pMD) MODE_PREEMPTIVE; THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(IsValueType()); PRECONDITION(!pMD->ContainsGenericVariables()); PRECONDITION(!pMD->IsUnboxingStub()); @@ -1709,7 +1704,6 @@ MethodDesc* MethodTable::GetUnboxedEntryPointMD(MethodDesc *pMD) MODE_PREEMPTIVE; THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(IsValueType()); // reflection needs to call this for methods in non instantiated classes, // so move the assert to the caller when needed @@ -1734,7 +1728,6 @@ MethodDesc* MethodTable::GetExistingUnboxedEntryPointMD(MethodDesc *pMD) CONTRACTL { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(IsValueType()); // reflection needs to call this for methods in non instantiated classes, // so move the assert to the caller when needed @@ -2098,7 +2091,6 @@ TypeHandle MethodTable::GetCoClassForInterface() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -2123,7 +2115,6 @@ TypeHandle MethodTable::SetupCoClassForInterface() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(IsComClassInterface()); } @@ -2165,7 +2156,6 @@ void MethodTable::GetEventInterfaceInfo(MethodTable **ppSrcItfClass, MethodTable { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -2221,7 +2211,6 @@ TypeHandle MethodTable::GetDefItfForComClassItf() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -2333,7 +2322,6 @@ SString &MethodTable::_GetFullyQualifiedNameForClassNestedAware(SString &ssBuf) CONTRACTL { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; ssBuf.Clear(); @@ -2394,7 +2382,6 @@ SString &MethodTable::_GetFullyQualifiedNameForClass(SString &ssBuf) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -2438,7 +2425,6 @@ LPCUTF8 MethodTable::GetFullyQualifiedNameInfo(LPCUTF8 *ppszNamespace) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -2470,7 +2456,6 @@ CorIfaceAttr MethodTable::GetComInterfaceType() { THROWS; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -2856,7 +2841,6 @@ MethodTable::GetSubstitutionForParent( { THROWS; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -3004,7 +2988,6 @@ WORD SparseVTableMap::LookupVTSlot(WORD MTSlot) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -3114,7 +3097,6 @@ ApproxFieldDescIterator::ApproxFieldDescIterator() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -3131,7 +3113,6 @@ void ApproxFieldDescIterator::Init(MethodTable *pMT, int iteratorType) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -3162,7 +3143,6 @@ PTR_FieldDesc ApproxFieldDescIterator::Next() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END diff --git a/src/coreclr/vm/classcompat.cpp b/src/coreclr/vm/classcompat.cpp index 82be81e0130308..08aa35589cf746 100644 --- a/src/coreclr/vm/classcompat.cpp +++ b/src/coreclr/vm/classcompat.cpp @@ -3438,7 +3438,6 @@ MethodHashEntry *MethodNameHash::Lookup(LPCUTF8 pszName, DWORD dwHash) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (!dwHash) diff --git a/src/coreclr/vm/classhash.cpp b/src/coreclr/vm/classhash.cpp index 9c979c7f621b53..fe22899131ea3e 100644 --- a/src/coreclr/vm/classhash.cpp +++ b/src/coreclr/vm/classhash.cpp @@ -75,7 +75,6 @@ EEClassHashTable *EEClassHashTable::Create(Module *pModule, DWORD dwNumBuckets, THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(!FORBIDGC_LOADER_USE_ENABLED()); } @@ -99,7 +98,6 @@ EEClassHashEntry_t *EEClassHashTable::AllocNewEntry(AllocMemTracker *pamTracker) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; PRECONDITION(!FORBIDGC_LOADER_USE_ENABLED()); @@ -120,7 +118,6 @@ VOID EEClassHashTable::UncompressModuleAndNonExportClassDef(HashDatum Data, Modu INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; SUPPORTS_DAC; } @@ -143,7 +140,6 @@ bool EEClassHashTable::UncompressModuleAndClassDef(HashDatum Data, Loader::LoadF INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM();); } MODE_ANY; PRECONDITION(CheckPointer(pCL)); @@ -176,7 +172,6 @@ mdToken EEClassHashTable::UncompressModuleAndClassDef(HashDatum Data) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; SUPPORTS_DAC; } @@ -223,7 +218,6 @@ VOID EEClassHashTable::ConstructKeyFromData(PTR_EEClassHashEntry pEntry, // IN THROWS; WRAPPER(MODE_ANY); WRAPPER(GC_TRIGGERS); - if (IsCaseInsensitiveTable()) INJECT_FAULT(COMPlusThrowOM();); else WRAPPER(FORBID_FAULT); SUPPORTS_DAC; } CONTRACTL_END; @@ -299,7 +293,7 @@ VOID EEClassHashTable::ConstructKeyFromData(PTR_EEClassHashEntry pEntry, // IN else { #ifndef DACCESS_COMPILE - CONTRACT_VIOLATION(ThrowsViolation | FaultViolation); + CONTRACT_VIOLATION(ThrowsViolation); ConstructKeyFromDataCaseInsensitive(pCallback, pszNameSpace, pszName); #else DacNotImpl(); @@ -324,7 +318,6 @@ EEClassHashEntry_t *EEClassHashTable::InsertValueUsingPreallocatedEntry(EEClassH NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; PRECONDITION(!FORBIDGC_LOADER_USE_ENABLED()); } @@ -372,7 +365,6 @@ BOOL EEClassHashTable::CompareKeys(PTR_EEClassHashEntry pEntry, LPCUTF8 * pKey2) { if (IsCaseInsensitiveTable()) THROWS; else NOTHROW; if (IsCaseInsensitiveTable()) GC_TRIGGERS; else GC_NOTRIGGER; - if (IsCaseInsensitiveTable()) INJECT_FAULT(COMPlusThrowOM();); else FORBID_FAULT; MODE_ANY; SUPPORTS_DAC; } @@ -439,7 +431,6 @@ EEClassHashTable *EEClassHashTable::MakeCaseInsensitiveTable(Module *pModule, Al THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(!FORBIDGC_LOADER_USE_ENABLED()); } @@ -487,7 +478,6 @@ BOOL CompareNestedEntryWithExportedType(IMDInternalImport * pImport, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -561,7 +551,6 @@ BOOL CompareNestedEntryWithTypeDef(IMDInternalImport * pImport, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -617,7 +606,6 @@ BOOL CompareNestedEntryWithTypeRef(IMDInternalImport * pImport, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -677,7 +665,6 @@ BOOL EEClassHashTable::IsNested(ModuleBase *pModule, mdToken token, mdToken *mdE { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; GC_NOTRIGGER; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; SUPPORTS_DAC; } @@ -715,7 +702,6 @@ BOOL EEClassHashTable::IsNested(const NameHandle* pName, mdToken *mdEncloser) { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; GC_NOTRIGGER; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; SUPPORTS_DAC; } diff --git a/src/coreclr/vm/classhash.inl b/src/coreclr/vm/classhash.inl index ff1c25d93a93c2..8370554a32aa7a 100644 --- a/src/coreclr/vm/classhash.inl +++ b/src/coreclr/vm/classhash.inl @@ -45,7 +45,6 @@ inline DWORD EEClassHashTable::Hash(LPCUTF8 pszNamespace, LPCUTF8 pszClassName, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/coreclr/vm/clrex.cpp b/src/coreclr/vm/clrex.cpp index 9754a7e0b4bb47..b5bb498d945f5b 100644 --- a/src/coreclr/vm/clrex.cpp +++ b/src/coreclr/vm/clrex.cpp @@ -61,7 +61,6 @@ OBJECTREF CLRException::GetThrowable() GC_TRIGGERS; NOTHROW; MODE_COOPERATIVE; - FORBID_FAULT; } CONTRACTL_END; @@ -161,7 +160,6 @@ OBJECTREF CLRException::GetThrowable() EX_TRY { - FAULT_NOT_FATAL(); throwable = CreateThrowable(); } EX_CATCH @@ -224,7 +222,6 @@ OBJECTREF CLRException::GetThrowable() if (m_innerException != NULL && !CLRException::IsPreallocatedExceptionObject(throwable)) { // Only set inner exception if the exception is not preallocated. - FAULT_NOT_FATAL(); // If inner exception is not empty, then set the managed exception's // _innerException field properly @@ -435,7 +432,6 @@ BOOL CLRException::IsPreallocatedExceptionObject(OBJECTREF o) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - FORBID_FAULT; } CONTRACTL_END; @@ -459,7 +455,6 @@ BOOL CLRException::IsPreallocatedExceptionHandle(OBJECTHANDLE h) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -484,7 +479,6 @@ OBJECTHANDLE CLRException::GetPreallocatedHandleForObject(OBJECTREF o) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - FORBID_FAULT; } CONTRACTL_END; @@ -518,7 +512,6 @@ OBJECTREF CLRException::GetBestException(HRESULT hr, PTR_MethodTable mt) EX_TRY { - FAULT_NOT_FATAL(); EXCEPTIONREF pOutOfMemory = (EXCEPTIONREF)AllocateObject(mt); pOutOfMemory->SetHResult(hr); @@ -1651,7 +1644,6 @@ void DECLSPEC_NORETURN EEFileLoadException::Throw(AssemblySpec *pSpec, HRESULT // Extract the requesting assembly chain for diagnostic purposes { - FAULT_NOT_FATAL(); Exception *inner2 = ExThrowWithInnerHelper(pInnerException); EEFileLoadException *pException = new EEFileLoadException(name, hr); @@ -1711,7 +1703,6 @@ void DECLSPEC_NORETURN EEFileLoadException::Throw(AssemblySpec *pSpec, HRESULT h // Extract the requesting assembly chain for diagnostic purposes { - FAULT_NOT_FATAL(); Exception *inner2 = ExThrowWithInnerHelper(pInnerException); EEFileLoadException *pException = new EEFileLoadException(name, hr, diagnosticInfo); diff --git a/src/coreclr/vm/clrex.h b/src/coreclr/vm/clrex.h index 598355a4a33fde..1c62d50a0f6600 100644 --- a/src/coreclr/vm/clrex.h +++ b/src/coreclr/vm/clrex.h @@ -842,18 +842,6 @@ LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv); #define EX_ENDTRY \ PAL_CPP_ENDTRY - -// CLRException::GetErrorInfo below invokes GetComIPFromObjectRef -// that invokes ObjHeader::GetSyncBlock which has the INJECT_FAULT contract. -// -// This EX_CATCH_HRESULT implementation can be used in functions -// that have FORBID_FAULT contracts. -// -// However, failure due to OOM (or any other potential exception) in GetErrorInfo -// implies that we couldnt get the interface pointer from the objectRef and would be -// returned NULL. -// -// Thus, the scoped use of FAULT_NOT_FATAL macro. #undef EX_CATCH_HRESULT #ifdef FEATURE_COMINTEROP #define EX_CATCH_HRESULT(_hr) \ @@ -861,7 +849,6 @@ LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv); { \ (_hr) = GET_EXCEPTION()->GetHR(); \ { \ - FAULT_NOT_FATAL(); \ HRESULT hrErrorInfo = GET_EXCEPTION()->SetErrorInfo(); \ if (FAILED(hrErrorInfo)) \ { \ diff --git a/src/coreclr/vm/clsload.cpp b/src/coreclr/vm/clsload.cpp index 8a97119f824239..74252ae0ec82c0 100644 --- a/src/coreclr/vm/clsload.cpp +++ b/src/coreclr/vm/clsload.cpp @@ -105,7 +105,6 @@ PTR_Module ClassLoader::ComputeLoaderModuleWorker( { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; PRECONDITION(CheckPointer(pDefinitionModule, NULL_OK)); SUPPORTS_DAC; @@ -244,7 +243,6 @@ BOOL ClassLoader::IsTypicalInstantiation(Module *pModule, mdToken token, Instant { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(pModule)); PRECONDITION(TypeFromToken(token) == mdtTypeDef || TypeFromToken(token) == mdtMethodDef); SUPPORTS_DAC; @@ -317,7 +315,6 @@ TypeHandle ClassLoader::LoadTypeByNameThrowing(Assembly *pAssembly, { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; if (FORBIDGC_LOADER_USE_ENABLED() || fLoadTypes != LoadTypes) { LOADS_TYPE(CLASS_LOAD_BEGIN); } else { LOADS_TYPE(level); } @@ -380,7 +377,6 @@ TypeHandle ClassLoader::LoadTypeHandleThrowIfFailed(NameHandle* pName, ClassLoad INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } DAC_LOADS_TYPE(level, !pName->OKToLoad()); MODE_ANY; PRECONDITION(CheckPointer(pName)); @@ -441,7 +437,6 @@ EEClassHashEntry_t* ClassLoader::InsertValue(EEClassHashTable *pClassHash, EECla THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -460,8 +455,6 @@ EEClassHashEntry_t* ClassLoader::InsertValue(EEClassHashTable *pClassHash, EECla { // ! We cannot fail after this point. CANNOTTHROWCOMPLUSEXCEPTION(); - FAULT_FORBID(); - pClassHash->InsertValueUsingPreallocatedEntry(pEntry, pszNamespace, pszClassName, Data, pEncloser); @@ -491,7 +484,6 @@ void ClassLoader::GetClassValue(NameHandleTable nhTable, MODE_ANY; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } PRECONDITION(CheckPointer(pName)); SUPPORTS_DAC; } @@ -607,7 +599,6 @@ VOID ClassLoader::PopulateAvailableClassHashTable(Module* pModule, THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -661,7 +652,6 @@ void ClassLoader::LazyPopulateCaseSensitiveHashTablesDontHaveLock() THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -678,7 +668,6 @@ void ClassLoader::LazyPopulateCaseSensitiveHashTables() THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -712,7 +701,6 @@ void ClassLoader::LazyPopulateCaseInsensitiveHashTables() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -737,7 +725,6 @@ void ClassLoader::LazyPopulateCaseInsensitiveHashTables() { CANNOTTHROWCOMPLUSEXCEPTION(); - FAULT_FORBID(); amTracker.SuppressRelease(); pModule->SetAvailableClassCaseInsHash(pNewClassCaseInsHash); @@ -772,7 +759,6 @@ TypeHandle ClassLoader::LoadConstructedTypeThrowing(const TypeKey *pKey, { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; 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); } PRECONDITION(CheckPointer(pKey)); PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); @@ -833,7 +819,6 @@ void ClassLoader::EnsureLoaded(TypeHandle typeHnd, ClassLoadLevel level) PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; 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()) { LOADS_TYPE(CLASS_LOAD_BEGIN); } else { LOADS_TYPE(level); } SUPPORTS_DAC; @@ -863,7 +848,6 @@ TypeHandle ClassLoader::LookupTypeKey(const TypeKey *pKey, EETypeHashTable *pTab CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(pKey)); PRECONDITION(pKey->IsConstructed()); PRECONDITION(CheckPointer(pTable)); @@ -880,7 +864,6 @@ TypeHandle ClassLoader::LookupInLoaderModule(const TypeKey *pKey) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(pKey)); PRECONDITION(pKey->IsConstructed()); MODE_ANY; @@ -901,7 +884,6 @@ TypeHandle ClassLoader::LookupTypeHandleForTypeKey(const TypeKey *pKey) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(pKey)); MODE_ANY; SUPPORTS_DAC; @@ -978,7 +960,6 @@ BOOL ClassLoader::FindClassModuleThrowing( INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } PRECONDITION(CheckPointer(pName)); PRECONDITION(CheckPointer(ppModule)); MODE_ANY; @@ -1132,7 +1113,7 @@ bool CompareNameHandleWithTypeHandleNoThrow( { // This block is specifically designed to handle transient faults such // as OOM exceptions. - CONTRACT_VIOLATION(FaultViolation | ThrowsViolation); + CONTRACT_VIOLATION(ThrowsViolation); StackSString ssBuiltName; ns::MakePath(ssBuiltName, StackSString(SString::Utf8, pName->GetNameSpace()), @@ -1174,7 +1155,6 @@ ClassLoader::LoadTypeHandleThrowing( INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } DAC_LOADS_TYPE(level, !pName->OKToLoad()); PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); PRECONDITION(CheckPointer(pName)); @@ -1349,7 +1329,6 @@ TypeHandle ClassLoader::LoadPointerOrByrefTypeThrowing(CorElementType typ, { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; 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); } MODE_ANY; PRECONDITION(CheckPointer(baseType)); @@ -1372,7 +1351,6 @@ TypeHandle ClassLoader::LoadNativeValueTypeThrowing(TypeHandle baseType, { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; PRECONDITION(CheckPointer(baseType)); PRECONDITION(baseType.AsMethodTable()->IsValueType()); @@ -1395,7 +1373,6 @@ TypeHandle ClassLoader::LoadFnptrTypeThrowing(BYTE callConv, { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; 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); } PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); MODE_ANY; @@ -1496,7 +1473,6 @@ HRESULT ClassLoader::FindTypeDefByExportedType(IMDInternalImport *pCTImport, mdE { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; SUPPORTS_DAC; } @@ -1537,7 +1513,6 @@ VOID ClassLoader::CreateCanonicallyCasedKey(LPCUTF8 pszNameSpace, LPCUTF8 pszNam INSTANCE_CHECK; THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; } CONTRACTL_END @@ -1582,7 +1557,6 @@ TypeHandle ClassLoader::LookupTypeDefOrRefInModule(ModuleBase *pModule, mdToken { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; PRECONDITION(CheckPointer(pModule)); SUPPORTS_DAC; @@ -1623,7 +1597,6 @@ void ClassLoader::FreeModules() NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - DISABLED(FORBID_FAULT); //Lots of crud to clean up to make this work } CONTRACTL_END; @@ -1643,7 +1616,6 @@ ClassLoader::~ClassLoader() DESTRUCTOR_CHECK; GC_TRIGGERS; MODE_PREEMPTIVE; - DISABLED(FORBID_FAULT); //Lots of crud to clean up to make this work } CONTRACTL_END @@ -1703,7 +1675,6 @@ ClassLoader::ClassLoader(Assembly *pAssembly) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END @@ -1778,7 +1749,6 @@ TypeHandle ClassLoader::LoadTypeDefOrRefOrSpecThrowing(Module *pModule, if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; MODE_ANY; - 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); } PRECONDITION(CheckPointer(pModule)); PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); @@ -1841,7 +1811,6 @@ TypeHandle ClassLoader::LoadTypeDefThrowing(Module *pModule, if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; MODE_ANY; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } DAC_LOADS_TYPE(level, !NameHandle::OKToLoad(typeDef, tokenNotToLoad)); PRECONDITION(CheckPointer(pModule)); PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); @@ -2022,7 +1991,6 @@ TypeHandle ClassLoader::LoadTypeDefOrRefThrowing(ModuleBase *pModule, if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; MODE_ANY; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } PRECONDITION(CheckPointer(pModule)); PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); @@ -2190,7 +2158,6 @@ ClassLoader::ResolveTokenToTypeDefThrowing( if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; MODE_ANY; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } PRECONDITION(CheckPointer(pTypeRefModule)); SUPPORTS_DAC; } @@ -2282,7 +2249,6 @@ ClassLoader::ResolveNameToTypeDefThrowing( if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; MODE_ANY; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } PRECONDITION(CheckPointer(pModule)); PRECONDITION(CheckPointer(pName)); SUPPORTS_DAC; @@ -2372,7 +2338,6 @@ ClassLoader::GetEnclosingClassThrowing( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END; @@ -2417,7 +2382,6 @@ ClassLoader::LoadApproxTypeThrowing( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; PRECONDITION(CheckPointer(pSigInst, NULL_OK)); PRECONDITION(CheckPointer(pModule)); @@ -2516,7 +2480,6 @@ ClassLoader::LoadApproxParentThrowing( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END; @@ -2798,7 +2761,6 @@ TypeHandle ClassLoader::PublishType(const TypeKey *pTypeKey, TypeHandle typeHnd) // ! We cannot fail after this point. CANNOTTHROWCOMPLUSEXCEPTION(); - FAULT_FORBID(); // The type could have been loaded by a different thread as side-effect of avoiding deadlocks caused by LoadsTypeViolation TypeHandle existing = pModule->LookupTypeDef(typeDef); @@ -2913,7 +2875,6 @@ void ClassLoader::NotifyUnload(MethodTable* pMT, bool unloadStarted) NOTHROW; GC_TRIGGERS; MODE_ANY; - FORBID_FAULT; PRECONDITION(pMT != NULL); } CONTRACTL_END @@ -2941,7 +2902,6 @@ void ClassLoader::NotifyUnload(MethodTable* pMT, bool unloadStarted) // profiling API. // - FAULT_NOT_FATAL(); EX_TRY { @@ -3400,7 +3360,6 @@ ClassLoader::LoadArrayTypeThrowing( { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; 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); } MODE_ANY; SUPPORTS_DAC; @@ -3475,7 +3434,6 @@ VOID ClassLoader::AddAvailableClassDontHaveLock(Module *pModule, THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -3510,7 +3468,6 @@ VOID ClassLoader::AddAvailableClassHaveLock( THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -3584,7 +3541,6 @@ VOID ClassLoader::AddExportedTypeDontHaveLock(Module *pManifestModule, THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -3609,7 +3565,6 @@ VOID ClassLoader::AddExportedTypeHaveLock(Module *pManifestModule, THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -3691,7 +3646,6 @@ static MethodTable* GetEnclosingMethodTable(MethodTable *pMT) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; PRECONDITION(CheckPointer(pMT)); } @@ -4125,7 +4079,6 @@ BOOL ClassLoader::CanAccessMethodInstantiation( // True if access is legal, fals { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; PRECONDITION(CheckPointer(pContext)); } @@ -4185,7 +4138,6 @@ BOOL ClassLoader::CanAccessClass( // True if access is legal, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; PRECONDITION(CheckPointer(pContext)); PRECONDITION(CheckPointer(pTargetClass)); @@ -4327,7 +4279,6 @@ BOOL ClassLoader::CanAccess( // TRUE if access is all { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pContext)); MODE_ANY; } @@ -4408,7 +4359,6 @@ BOOL ClassLoader::CheckAccessMember( // TRUE if access is allowed { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pContext)); MODE_ANY; } @@ -4590,7 +4540,6 @@ BOOL ClassLoader::CanAccessFamily( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; PRECONDITION(CheckPointer(pTargetClass)); } diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index b9041ad1ed51de..46837a587d428c 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -2265,14 +2265,7 @@ void CodeFragmentHeap::AddBlock(VOID * pMem, size_t dwSize) } CONTRACTL_END; - // The new "nothrow" below failure is handled in a non-fault way, so - // make sure that callers with FORBID_FAULT can call this method without - // firing the contract violation assert. - PERMANENT_CONTRACT_VIOLATION(FaultViolation, ReasonContractInfrastructure); - FreeBlock * pBlock = new (nothrow) FreeBlock; - // In the OOM case we don't add the block to the list of free blocks - // as we are in a FORBID_FAULT code path. if (pBlock != NULL) { pBlock->m_pNext = m_pFreeBlocks; @@ -5454,7 +5447,6 @@ NativeCodeVersion ExecutionManager::GetNativeCodeVersion(PCODE currentPC) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -5469,7 +5461,6 @@ MethodDesc * ExecutionManager::GetCodeMethodDesc(PCODE currentPC) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END diff --git a/src/coreclr/vm/codeversion.cpp b/src/coreclr/vm/codeversion.cpp index 279d2ad2e7b4a5..404821527a9e00 100644 --- a/src/coreclr/vm/codeversion.cpp +++ b/src/coreclr/vm/codeversion.cpp @@ -937,7 +937,6 @@ PTR_COR_ILMETHOD ILCodeVersion::GetIL() const { THROWS; //GetILHeader throws GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; } CONTRACTL_END diff --git a/src/coreclr/vm/comcache.cpp b/src/coreclr/vm/comcache.cpp index 31b99cf63de5fc..ee0f3dd5c04dbd 100644 --- a/src/coreclr/vm/comcache.cpp +++ b/src/coreclr/vm/comcache.cpp @@ -125,7 +125,6 @@ STDAPI_(LPSTREAM) CreateMemStm(DWORD cb, BYTE** ppBuf) NOTHROW; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(return NULL); PRECONDITION(CheckPointer(ppBuf, NULL_OK)); PRECONDITION(CheckPointer(ppBuf, NULL_OK)); } @@ -342,7 +341,6 @@ CtxEntry* CtxEntryCache::FindCtxEntry(LPVOID pCtxCookie, Thread *pThread) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pCtxCookie)); } CONTRACTL_END; @@ -1214,7 +1212,6 @@ VOID CtxEntry::Init() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); // Make sure COM has been started PRECONDITION(g_fComStarted == TRUE); diff --git a/src/coreclr/vm/comcallablewrapper.cpp b/src/coreclr/vm/comcallablewrapper.cpp index 1658bfa98c1a3b..1e6c46b9216470 100644 --- a/src/coreclr/vm/comcallablewrapper.cpp +++ b/src/coreclr/vm/comcallablewrapper.cpp @@ -740,7 +740,6 @@ void SimpleComCallWrapper::InitDispatchExInfo() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); // Make sure the class supports at least IReflect.. PRECONDITION(SupportsIReflect(m_pMT)); @@ -860,7 +859,6 @@ ConnectionPoint *SimpleComCallWrapper::CreateConnectionPoint(ComCallWrapper *pWr THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pWrap)); PRECONDITION(CheckPointer(pEventMT)); } @@ -876,7 +874,6 @@ CQuickArray *SimpleComCallWrapper::CreateCPArray() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -1266,7 +1263,6 @@ void SimpleComCallWrapper::EnumConnectionPoints(IEnumConnectionPoints **ppEnumCP THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(ppEnumCP)); } CONTRACTL_END; @@ -1526,7 +1522,6 @@ ComCallWrapper* ComCallWrapper::CopyFromTemplate(ComCallWrapperTemplate* pTempla THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pTemplate)); PRECONDITION(CheckPointer(pWrapperCache)); PRECONDITION(oh != NULL); @@ -2664,7 +2659,6 @@ ComCallWrapperCache *ComCallWrapperCache::Create(LoaderAllocator *pLoaderAllocat THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pLoaderAllocator)); } CONTRACTL_END; @@ -2788,7 +2782,6 @@ namespace THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -2816,7 +2809,6 @@ void ComMethodTable::LayOutClassMethodTable() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -3340,7 +3332,6 @@ void ComMethodTable::LayOutBasicMethodTable() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -3403,7 +3394,6 @@ DispatchInfo *ComMethodTable::GetDispatchInfo() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -3803,7 +3793,6 @@ ComMethodTable* ComCallWrapperTemplate::CreateComMethodTableForClass(MethodTable THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pClassMT)); PRECONDITION(!pClassMT->IsInterface()); PRECONDITION(!pClassMT->GetComPlusParentMethodTable() || pClassMT->GetComPlusParentMethodTable()->GetComCallWrapperTemplate()); @@ -4019,7 +4008,6 @@ ComMethodTable* ComCallWrapperTemplate::CreateComMethodTableForInterface(MethodT THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pInterfaceMT)); PRECONDITION(pInterfaceMT->IsInterface()); } @@ -4096,7 +4084,6 @@ ComMethodTable* ComCallWrapperTemplate::CreateComMethodTableForBasic(MethodTable THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -4273,7 +4260,6 @@ ComCallWrapperTemplate* ComCallWrapperTemplate::CreateTemplate(TypeHandle thClas THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(!thClass.IsNull()); } CONTRACTL_END; @@ -4408,7 +4394,6 @@ ComCallWrapperTemplate *ComCallWrapperTemplate::CreateTemplateForInterface(Metho THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pItfMT)); PRECONDITION(pItfMT->IsInterface()); } diff --git a/src/coreclr/vm/comconnectionpoints.cpp b/src/coreclr/vm/comconnectionpoints.cpp index 67cb74c8c46aaf..8bf743a426e00f 100644 --- a/src/coreclr/vm/comconnectionpoints.cpp +++ b/src/coreclr/vm/comconnectionpoints.cpp @@ -408,7 +408,6 @@ void ConnectionPoint::SetupEventMethods() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -514,7 +513,6 @@ void ConnectionPoint::InvokeProviderMethod( OBJECTREF pProvider, OBJECTREF pSubs THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pProvMethodDesc)); PRECONDITION(CheckPointer(pEventMethodDesc)); } diff --git a/src/coreclr/vm/comconnectionpoints.h b/src/coreclr/vm/comconnectionpoints.h index f1eedc44f85f96..df6dc979db18ca 100644 --- a/src/coreclr/vm/comconnectionpoints.h +++ b/src/coreclr/vm/comconnectionpoints.h @@ -58,7 +58,6 @@ struct ConnectionCookie THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(NULL != hndEventProvObj); } CONTRACTL_END; diff --git a/src/coreclr/vm/comdelegate.cpp b/src/coreclr/vm/comdelegate.cpp index dc7f140946e6a8..bc9b0e59f595eb 100644 --- a/src/coreclr/vm/comdelegate.cpp +++ b/src/coreclr/vm/comdelegate.cpp @@ -887,7 +887,6 @@ static PCODE SetupShuffleThunk(MethodTable * pDelMT, MethodDesc *pTargetMeth) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -950,7 +949,6 @@ static PCODE GetVirtualCallStub(MethodDesc *method, TypeHandle scopeType) THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); // from MetaSig::SizeOfArgStack } CONTRACTL_END; @@ -1259,7 +1257,6 @@ LPVOID COMDelegate::ConvertToCallback(OBJECTREF pDelegateObj) GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/commtmemberinfomap.cpp b/src/coreclr/vm/commtmemberinfomap.cpp index 1f1e45e55a050d..83037b47854413 100644 --- a/src/coreclr/vm/commtmemberinfomap.cpp +++ b/src/coreclr/vm/commtmemberinfomap.cpp @@ -102,7 +102,6 @@ EEHashEntry_t * EEModuleTokenHashTableHelper::AllocateEntry(EEModuleTokenPair *p NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(return NULL); PRECONDITION(CheckPointer(pKey)); } CONTRACTL_END; @@ -1585,7 +1584,6 @@ void ComMTMemberInfoMap::PopulateMemberHashtable() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/comutilnative.cpp b/src/coreclr/vm/comutilnative.cpp index 4444343d4404d2..39641bbd437241 100644 --- a/src/coreclr/vm/comutilnative.cpp +++ b/src/coreclr/vm/comutilnative.cpp @@ -175,7 +175,6 @@ static void GetExceptionHelp(OBJECTREF objException, BSTR *pbstrHelpFile, DWORD THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(IsException(objException->GetMethodTable())); PRECONDITION(CheckPointer(pbstrHelpFile)); PRECONDITION(CheckPointer(pdwHelpContext)); diff --git a/src/coreclr/vm/contractimpl.cpp b/src/coreclr/vm/contractimpl.cpp index 7894ebd90eda95..ff850244a922a7 100644 --- a/src/coreclr/vm/contractimpl.cpp +++ b/src/coreclr/vm/contractimpl.cpp @@ -269,7 +269,6 @@ DispatchMapBuilderNode * DispatchMapBuilder::NewEntry() CONTRACTL { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; return new (m_pAllocator) DispatchMapBuilderNode(); @@ -312,7 +311,6 @@ DispatchMap::CreateEncodedMapping( CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pMapBuilder)); PRECONDITION(CheckPointer(pAllocator)); PRECONDITION(CheckPointer(ppbMap)); @@ -673,7 +671,6 @@ DispatchMapEntry * DispatchMap::Iterator::Entry() MODE_ANY; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } PRECONDITION(IsValid()); } CONTRACTL_END; */ diff --git a/src/coreclr/vm/contractimpl.h b/src/coreclr/vm/contractimpl.h index 71e09e3a0a616b..92cfa6422c3cd6 100644 --- a/src/coreclr/vm/contractimpl.h +++ b/src/coreclr/vm/contractimpl.h @@ -445,7 +445,6 @@ class TypeIDProvider THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(m_nextID != 0); } CONTRACTL_END; UINT32 id = m_nextID; @@ -474,7 +473,6 @@ class TypeIDProvider THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(m_nextFatID != 0); } CONTRACTL_END; UINT32 id = m_nextFatID; diff --git a/src/coreclr/vm/custommarshalerinfo.cpp b/src/coreclr/vm/custommarshalerinfo.cpp index 6563aa99a10d43..61e71a77fe32f7 100644 --- a/src/coreclr/vm/custommarshalerinfo.cpp +++ b/src/coreclr/vm/custommarshalerinfo.cpp @@ -87,7 +87,6 @@ void *CustomMarshalerInfo::operator new(size_t size, LoaderHeap *pHeap) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pHeap)); } CONTRACTL_END; @@ -142,7 +141,6 @@ EEHashEntry_t * EECMInfoHashtableHelper::AllocateEntry(EECMInfoHashtableKey *pKe NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(return NULL;); } CONTRACTL_END; diff --git a/src/coreclr/vm/dacenumerablehash.inl b/src/coreclr/vm/dacenumerablehash.inl index 7a615da7616fec..be7b168a8cc025 100644 --- a/src/coreclr/vm/dacenumerablehash.inl +++ b/src/coreclr/vm/dacenumerablehash.inl @@ -179,7 +179,6 @@ void DacEnumerableHashTable::GrowTable() // If we can't increase the number of buckets, we lose perf but not correctness. So we won't report this // error to our caller. - FAULT_NOT_FATAL(); DPTR(PTR_VolatileEntry) curBuckets = GetBuckets(); DWORD cBuckets = GetLength(curBuckets); diff --git a/src/coreclr/vm/decodemd.cpp b/src/coreclr/vm/decodemd.cpp index 99f06631c3aa96..8abd07e675619b 100644 --- a/src/coreclr/vm/decodemd.cpp +++ b/src/coreclr/vm/decodemd.cpp @@ -208,7 +208,6 @@ BYTE Decoder::Nibbles::Next() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; BYTE result = Read(); @@ -237,7 +236,6 @@ unsigned Decoder::Nibbles::Bits(unsigned number) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; unsigned n = number; @@ -261,7 +259,6 @@ void Decoder::Init(PTR_BYTE bytes) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; state = emptyDecode; @@ -288,7 +285,6 @@ unsigned Decoder::Next() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; tryagain: @@ -324,7 +320,6 @@ signed Decoder::NextSigned() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; signed v = (signed) Next(); @@ -360,7 +355,6 @@ void Encoder::EncodeSigned(signed value) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (!signedNumbers) @@ -378,7 +372,6 @@ void Encoder::Encode(unsigned value) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (value < BASE_1) @@ -420,7 +413,6 @@ void Encoder::Encode(signed value, BOOL isSigned) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (isSigned) EncodeSigned(value); @@ -436,7 +428,6 @@ void Encoder::Add(unsigned value, unsigned length) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(!done); while (length >= unusedBits) @@ -458,7 +449,6 @@ void Encoder::Add64(uint64_t value, unsigned length) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(!done); while (length >= unusedBits) diff --git a/src/coreclr/vm/dispatchinfo.cpp b/src/coreclr/vm/dispatchinfo.cpp index 0762ffdb345353..aaf03d3b3a448d 100644 --- a/src/coreclr/vm/dispatchinfo.cpp +++ b/src/coreclr/vm/dispatchinfo.cpp @@ -208,7 +208,6 @@ HRESULT DispatchMemberInfo::GetIDsOfParameters(_In_reads_(NumNames) WCHAR **astr THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); // The member info must have been initialized before this is called. PRECONDITION(TRUE == m_bInitialized); @@ -478,7 +477,6 @@ LPWSTR DispatchMemberInfo::GetMemberName(OBJECTREF MemberInfoObj, ComMTMemberInf THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(MemberInfoObj != NULL); PRECONDITION(CheckPointer(pMemberMap, NULL_OK)); } @@ -878,7 +876,6 @@ void DispatchMemberInfo::SetUpDispParamAttributes(int iParam, MarshalInfo* Info) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(Info)); } CONTRACTL_END; @@ -1027,7 +1024,6 @@ DispatchMemberInfo* DispatchInfo::CreateDispatchMemberInfoInstance(DISPID dispID THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -1111,7 +1107,6 @@ void DispatchInfo::InvokeMemberWorker(DispatchMemberInfo* pDispMemberInfo, THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); // there are too many fields in pObjs, here I assume once one of them is // protected, the whole structure is protected. PRECONDITION(IsProtectedByGCFrame(&pObjs->MemberInfo)); @@ -1760,7 +1755,6 @@ HRESULT DispatchInfo::InvokeMember(SimpleComCallWrapper *pSimpleWrap, DISPID id, THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pSimpleWrap)); PRECONDITION(CheckPointer(pdp, NULL_OK)); PRECONDITION(CheckPointer(pVarRes, NULL_OK)); @@ -2233,7 +2227,6 @@ void DispatchInfo::SetUpNamedParamArray(DispatchMemberInfo *pMemberInfo, DISPID THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pMemberInfo, NULL_OK)); PRECONDITION(CheckPointer(pSrcArgNames)); PRECONDITION(pNamedParamArray != NULL); @@ -2662,7 +2655,6 @@ OBJECTREF DispatchInfo::GetOleAutBinder() THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -2829,7 +2821,6 @@ ComMTMemberInfoMap *DispatchInfo::GetMemberInfoMap() THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/dispparammarshaler.cpp b/src/coreclr/vm/dispparammarshaler.cpp index 88a123a596db3f..a5e9d41d9fe020 100644 --- a/src/coreclr/vm/dispparammarshaler.cpp +++ b/src/coreclr/vm/dispparammarshaler.cpp @@ -366,7 +366,6 @@ void DispParamRecordMarshaler::MarshalNativeToManaged(VARIANT *pSrcVar, OBJECTRE THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pSrcVar)); } CONTRACTL_END; @@ -459,7 +458,6 @@ void DispParamDelegateMarshaler::MarshalNativeToManaged(VARIANT *pSrcVar, OBJECT THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pSrcVar)); } CONTRACTL_END; diff --git a/src/coreclr/vm/dllimportcallback.cpp b/src/coreclr/vm/dllimportcallback.cpp index 8ec9a4244483e1..72c261779196de 100644 --- a/src/coreclr/vm/dllimportcallback.cpp +++ b/src/coreclr/vm/dllimportcallback.cpp @@ -268,7 +268,6 @@ UMEntryThunkData* UMEntryThunkData::CreateUMEntryThunk() THROWS; GC_NOTRIGGER; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -307,7 +306,6 @@ UMEntryThunkData* UMEntryThunkData::CreateUMEntryThunk(LoaderAllocator* pLoaderA MODE_ANY; PRECONDITION(CheckPointer(pLoaderAllocator)); PRECONDITION(CheckPointer(pamTracker)); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/dwreport.cpp b/src/coreclr/vm/dwreport.cpp index c7de8cfb59dff3..afe7893afd2620 100644 --- a/src/coreclr/vm/dwreport.cpp +++ b/src/coreclr/vm/dwreport.cpp @@ -959,12 +959,10 @@ static DWORD WINAPI DoFaultReportCreateThreadCallback(LPVOID pFaultReportInfoAsV { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FORBID_FAULT; // We are allowed to ignore OOM's here as FaultReport() is merely a notification of // an unhandled exception. If we can't do the report, that's just too bad. - FAULT_NOT_FATAL(); LOG((LF_EH, LL_INFO100, "DoFaultReport: at sp %p ...\n", GetCurrentSP())); @@ -983,7 +981,6 @@ VOID WINAPI DoFaultReportDoFavorCallback(LPVOID pFaultReportInfoAsVoid) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FORBID_FAULT; // Since the debugger thread doesn't allow ordinary New's which our stuff diff --git a/src/coreclr/vm/dynamicmethod.cpp b/src/coreclr/vm/dynamicmethod.cpp index 335621ea1b8b93..2cab6b9fd6276a 100644 --- a/src/coreclr/vm/dynamicmethod.cpp +++ b/src/coreclr/vm/dynamicmethod.cpp @@ -26,7 +26,6 @@ DynamicMethodTable* Module::GetDynamicMethodTable() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -53,7 +52,6 @@ void DynamicMethodTable::CreateDynamicMethodTable(DynamicMethodTable **ppLocatio THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(ppLocation)); PRECONDITION(CheckPointer(pModule)); } @@ -103,7 +101,6 @@ void DynamicMethodTable::MakeMethodTable(AllocMemTracker *pamTracker) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -144,7 +141,6 @@ void DynamicMethodTable::AddMethodsToList() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -220,7 +216,6 @@ DynamicMethodDesc* DynamicMethodTable::GetDynamicMethod(BYTE *psig, DWORD sigSiz THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(psig)); PRECONDITION(sigSize > 0); } @@ -321,7 +316,6 @@ HeapList* HostCodeHeap::CreateCodeHeap(CodeHeapRequestInfo *pInfo, EECodeGenMana THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -351,7 +345,6 @@ HostCodeHeap::HostCodeHeap(EECodeGenManager *pJitManager, bool isExecutable) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -444,8 +437,6 @@ HeapList* HostCodeHeap::InitializeHeapList(CodeHeapRequestInfo *pInfo) pTracker = AllocMemory_NoThrow(0, JUMP_ALLOCATE_SIZE, sizeof(void*), 0); if (pTracker == NULL) { - // This should only ever happen with fault injection - _ASSERTE(g_pConfig->ShouldInjectFault(INJECTFAULT_DYNAMICCODEHEAP)); delete pHp; ThrowOutOfMemory(); } @@ -726,16 +717,6 @@ HostCodeHeap::TrackAllocation* HostCodeHeap::AllocMemory_NoThrow(size_t header, } CONTRACTL_END; -#ifdef _DEBUG - if (g_pConfig->ShouldInjectFault(INJECTFAULT_DYNAMICCODEHEAP)) - { - char *a = new (nothrow) char; - if (a == NULL) - return NULL; - delete a; - } -#endif // _DEBUG - // Skip walking the free list if the cached size of the largest block is not enough size_t totalRequiredSize = ALIGN_UP(sizeof(TrackAllocation) + header + size + (alignment - 1) + reserveForJumpStubs, sizeof(void*)); if (totalRequiredSize > m_ApproximateLargestBlock) diff --git a/src/coreclr/vm/eeconfig.cpp b/src/coreclr/vm/eeconfig.cpp index 2f232e54450ee2..e6d21d6e9b1936 100644 --- a/src/coreclr/vm/eeconfig.cpp +++ b/src/coreclr/vm/eeconfig.cpp @@ -168,7 +168,6 @@ HRESULT EEConfig::Init() #endif #ifdef _DEBUG - fShouldInjectFault = 0; testThreadAbort = 0; #endif @@ -233,7 +232,6 @@ HRESULT EEConfig::Init() HRESULT EEConfig::Cleanup() { CONTRACTL { - FORBID_FAULT; NOTHROW; GC_NOTRIGGER; MODE_ANY; @@ -293,7 +291,6 @@ HRESULT EEConfig::sync() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT (return E_OUTOFMEMORY); } CONTRACTL_END; ETWOnStartup (EEConfigSync_V1, EEConfigSyncEnd_V1); @@ -636,8 +633,6 @@ HRESULT EEConfig::sync() iPerfNumAllocsThreshold = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_PerfNumAllocsThreshold); iPerfAllocsSizeThreshold = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_PerfAllocsSizeThreshold); - fShouldInjectFault = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_InjectFault); - testThreadAbort = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_HostTestThreadAbort); #endif //_DEBUG @@ -860,7 +855,6 @@ HRESULT EEConfig::ParseMethList(_In_z_ LPWSTR str, MethodNamesList** out) { NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(return E_OUTOFMEMORY); PRECONDITION(CheckPointer(str, NULL_OK)); PRECONDITION(CheckPointer(out)); } CONTRACTL_END; @@ -943,7 +937,6 @@ HRESULT EEConfig::ParseTypeList(_In_z_ LPWSTR str, TypeNamesList** out) MODE_ANY; PRECONDITION(CheckPointer(out)); PRECONDITION(CheckPointer(str, NULL_OK)); - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END; HRESULT hr = S_OK; @@ -1066,7 +1059,6 @@ HRESULT TypeNamesList::Init(_In_z_ LPCWSTR str) NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(str)); - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END; pNames = NULL; @@ -1148,7 +1140,6 @@ TypeNamesList::~TypeNamesList() { CONTRACTL { NOTHROW; - FORBID_FAULT; GC_NOTRIGGER; MODE_ANY; } CONTRACTL_END; diff --git a/src/coreclr/vm/eeconfig.h b/src/coreclr/vm/eeconfig.h index b9eddae5e9efbb..b310f9b618db6e 100644 --- a/src/coreclr/vm/eeconfig.h +++ b/src/coreclr/vm/eeconfig.h @@ -435,16 +435,6 @@ class EEConfig DWORD GetHostTestThreadAbort() const {LIMITED_METHOD_CONTRACT; return testThreadAbort;} -#define INJECTFAULT_LOADERHEAP 0x1 -#define INJECTFAULT_GCHEAP 0x2 -#define INJECTFAULT_SO 0x4 -#define INJECTFAULT_GMHEAP 0x8 -#define INJECTFAULT_DYNAMICCODEHEAP 0x10 -#define INJECTFAULT_MAPVIEWOFFILE 0x20 -#define INJECTFAULT_JITHEAP 0x40 - - DWORD ShouldInjectFault(DWORD faultType) const {LIMITED_METHOD_CONTRACT; return fShouldInjectFault & faultType;} - #endif #ifdef FEATURE_INTERPRETER @@ -585,7 +575,6 @@ class EEConfig #endif // _DEBUG #ifdef _DEBUG - DWORD fShouldInjectFault; DWORD testThreadAbort; #endif diff --git a/src/coreclr/vm/eedbginterfaceimpl.cpp b/src/coreclr/vm/eedbginterfaceimpl.cpp index a18dcbe12428d2..75e8efe38bb190 100644 --- a/src/coreclr/vm/eedbginterfaceimpl.cpp +++ b/src/coreclr/vm/eedbginterfaceimpl.cpp @@ -811,11 +811,6 @@ TypeHandle EEDbgInterfaceImpl::FindLoadedInstantiation(Module *pModule, // Lookup operations run the class loader in non-load mode. ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE(); - - // scan violation: asserts that this can be suppressed since there is currently - // work on dac-izing all this code and as a result the issue will become moot. - CONTRACT_VIOLATION(FaultViolation); - return ClassLoader::LoadGenericInstantiationThrowing(pModule, typeDef, Instantiation(inst, ntypars), ClassLoader::DontLoadTypes); } @@ -1171,7 +1166,6 @@ bool EEDbgInterfaceImpl::TraceFrame(Thread *thread, if (fResult) { SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - FAULT_NOT_FATAL(); SString buffer; StubManager::DbgWriteLog(" td=%s\n", trace->DbgToString(buffer)); } @@ -1217,7 +1211,6 @@ bool EEDbgInterfaceImpl::TraceManager(Thread *thread, if (fResult) { // Should never be on helper thread - FAULT_NOT_FATAL(); SString buffer; StubManager::DbgWriteLog(" td=%s\n", trace->DbgToString(buffer)); } diff --git a/src/coreclr/vm/eehash.cpp b/src/coreclr/vm/eehash.cpp index f21a43c5fbccb2..89600bbdd694ca 100644 --- a/src/coreclr/vm/eehash.cpp +++ b/src/coreclr/vm/eehash.cpp @@ -68,7 +68,6 @@ EEHashEntry_t * EEUnicodeStringLiteralHashTableHelper::AllocateEntry(EEStringDat { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return NULL;); } CONTRACTL_END @@ -92,7 +91,6 @@ void EEUnicodeStringLiteralHashTableHelper::DeleteEntry(EEHashEntry_t *pEntry, v { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -116,7 +114,6 @@ BOOL EEUnicodeStringLiteralHashTableHelper::CompareKeys(EEHashEntry_t *pEntry, E { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -216,7 +213,6 @@ EEHashEntry_t *EEClassFactoryInfoHashTableHelper::AllocateEntry(ClassFactoryInfo { NOTHROW; GC_NOTRIGGER; - INJECT_FAULT(return NULL;); } CONTRACTL_END diff --git a/src/coreclr/vm/eehash.h b/src/coreclr/vm/eehash.h index bfb3ed51bea904..2ee042b0796a0c 100644 --- a/src/coreclr/vm/eehash.h +++ b/src/coreclr/vm/eehash.h @@ -237,7 +237,6 @@ class EEIntHashTableHelper { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(return NULL;); } CONTRACTL_END @@ -297,7 +296,6 @@ class EEPtrPlusIntHashTableHelper { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(return NULL;); } CONTRACTL_END @@ -435,7 +433,6 @@ class EEPtrHashTableHelper { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(return FALSE;); } CONTRACTL_END diff --git a/src/coreclr/vm/eehash.inl b/src/coreclr/vm/eehash.inl index 7b60713a9a9d94..ed362a38f4d82c 100644 --- a/src/coreclr/vm/eehash.inl +++ b/src/coreclr/vm/eehash.inl @@ -48,7 +48,6 @@ void EEHashTableBase::Destroy() { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; } CONTRACTL_END @@ -81,7 +80,6 @@ void EEHashTableBase::ClearHashTable() { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; } CONTRACTL_END @@ -122,7 +120,6 @@ void EEHashTableBase::EmptyHashTable() { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; } CONTRACTL_END @@ -159,7 +156,6 @@ BOOL EEHashTableBase::Init(DWORD dwNumBucke { WRAPPER(NOTHROW); WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(return FALSE;); #ifndef DACCESS_COMPILE PRECONDITION(m_pVolatileBucketTable.Load() == NULL && "EEHashTable::Init() called twice."); @@ -211,7 +207,6 @@ void EEHashTableBase::InsertValue(KeyType p { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -257,7 +252,6 @@ void EEHashTableBase::InsertKeyAsValue(KeyT { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -302,7 +296,6 @@ BOOL EEHashTableBase::DeleteValue(KeyType p { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; } CONTRACTL_END @@ -353,7 +346,6 @@ BOOL EEHashTableBase::GetValue(KeyType pKey { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -378,7 +370,6 @@ BOOL EEHashTableBase::GetValue(KeyType pKey { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; } CONTRACTL_END @@ -448,7 +439,6 @@ EEHashEntry_t *EEHashTableBase::FindItem(Ke { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -463,7 +453,6 @@ EEHashEntry_t *EEHashTableBase::FindItem(Ke { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -579,7 +568,6 @@ BOOL EEHashTableBase::GrowHashTable() { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - INJECT_FAULT(return FALSE;); } CONTRACTL_END @@ -698,7 +686,6 @@ void EEHashTableBase:: { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; } CONTRACTL_END @@ -719,7 +706,6 @@ BOOL EEHashTableBase:: { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; } CONTRACTL_END @@ -763,7 +749,6 @@ KeyType EEHashTableBase:: { WRAPPER(THROWS); WRAPPER(GC_NOTRIGGER); - FORBID_FAULT; } CONTRACTL_END diff --git a/src/coreclr/vm/eepolicy.cpp b/src/coreclr/vm/eepolicy.cpp index f8941460b3a141..bdf31244611f23 100644 --- a/src/coreclr/vm/eepolicy.cpp +++ b/src/coreclr/vm/eepolicy.cpp @@ -51,7 +51,6 @@ void SafeExitProcess(UINT exitCode, ShutdownCompleteAction sca = SCA_ExitProcess if (exitCode != goodExit) { _ASSERTE(!"Bad Exit value"); - FAULT_NOT_FATAL(); // if we OOM we can simply give up minipal_log_print_error("Error 0x%08x.\n\nBreakOnBadExit: returning bad exit code.", exitCode); DebugBreak(); } @@ -697,7 +696,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 | FaultNotFatal | TakesLockViolation); + CONTRACT_VIOLATION(GCViolation | ModeViolation | TakesLockViolation); WRAPPER_NO_CONTRACT; @@ -884,7 +883,6 @@ int NOINLINE EEPolicy::HandleFatalError(UINT exitCode, UINT_PTR address, LPCWSTR WRAPPER_NO_CONTRACT; // All of the code from here on out is robust to any failures in any API's that are called. - FAULT_NOT_FATAL(); EXCEPTION_RECORD exceptionRecord; EXCEPTION_POINTERS exceptionPointers; @@ -917,8 +915,7 @@ int NOINLINE EEPolicy::HandleFatalError(UINT exitCode, UINT_PTR address, LPCWSTR { // 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 | FaultNotFatal | TakesLockViolation); - + CONTRACT_VIOLATION(GCViolation | ModeViolation | TakesLockViolation); // Setting g_fFatalErrorOccurredOnGCThread allows code to avoid attempting to make GC mode transitions which could // block indefinitely if the fatal error occurred during the GC. diff --git a/src/coreclr/vm/encee.cpp b/src/coreclr/vm/encee.cpp index 8471ed781a80bc..e0d5c9f6e1b139 100644 --- a/src/coreclr/vm/encee.cpp +++ b/src/coreclr/vm/encee.cpp @@ -43,7 +43,6 @@ EditAndContinueModule::EditAndContinueModule(Assembly *pAssembly, PEAssembly *pP { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -65,7 +64,6 @@ void EditAndContinueModule::Initialize(AllocMemTracker *pamTracker, LPCWSTR szNa { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -1735,7 +1733,6 @@ PTR_FieldDesc EncApproxFieldDescIterator::Next() { NOTHROW; if (m_flags & FixUpEncFields) {GC_TRIGGERS;} else {GC_NOTRIGGER;} - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -1763,7 +1760,6 @@ PTR_FieldDesc EncApproxFieldDescIterator::Next() // if we get an OOM during fixup, the field will just not get fixed up EX_TRY { - FAULT_NOT_FATAL(); pFD->Fixup(pFD->GetMemberDef()); } EX_CATCH @@ -1791,7 +1787,6 @@ int EncApproxFieldDescIterator::Count() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -1825,7 +1820,6 @@ PTR_EnCFieldDesc EncApproxFieldDescIterator::NextEnC() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index bd0e6dab7a2f85..b4f2e8d6cc5337 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -2675,7 +2675,6 @@ extern "C" if(g_fEEStarted) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}; MODE_ANY; CAN_TAKE_LOCK; - STATIC_CONTRACT_FAULT; } CONTRACTL_END; // Mark that we are the special ETWRundown thread. Currently all this does diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp index 4f5eb856b2bf7b..a9d8cee58df64e 100644 --- a/src/coreclr/vm/excep.cpp +++ b/src/coreclr/vm/excep.cpp @@ -107,7 +107,6 @@ BOOL ShouldOurUEFDisplayUI(PEXCEPTION_POINTERS pExceptionInfo) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; // Test first for the canned SO EXCEPTION_POINTERS structure as it has a NULL context record and will break the code below. extern EXCEPTION_POINTERS g_SOExceptionPointers; @@ -137,7 +136,6 @@ BOOL ExceptionIsOfRightType(TypeHandle clauseType, TypeHandle thrownType) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -172,7 +170,6 @@ ULONG GetExceptionMessage(OBJECTREF throwable, THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; @@ -212,7 +209,6 @@ void GetExceptionMessage(OBJECTREF throwable, SString &result) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; @@ -230,7 +226,6 @@ STRINGREF GetExceptionMessage(OBJECTREF throwable) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; @@ -370,7 +365,6 @@ void ExceptionPreserveStackTrace( // No return. THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; @@ -596,7 +590,6 @@ DWORD ComputeEnclosingHandlerNestingLevel(IJitManager *pIJM, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -1089,7 +1082,6 @@ HRESULT EHRangeTreeNode::AddNode(EHRangeTreeNode *pNode) NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(return E_OUTOFMEMORY;); PRECONDITION(pNode != NULL); } CONTRACTL_END; @@ -1439,7 +1431,6 @@ TRY_CATCH_FINALLY GetTcf(EHRangeTreeNode *pNode, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -1665,7 +1656,6 @@ HRESULT DestinationIsValid(void *pDjiToken, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -1699,7 +1689,6 @@ HRESULT SetIPFromSrcToDst(Thread *pThread, THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(return E_OUTOFMEMORY;); } CONTRACTL_END; @@ -1844,7 +1833,6 @@ BOOL IsInFirstFrameOfHandler(Thread *pThread, IJitManager *pJitManager, const ME NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -2749,7 +2737,6 @@ BOOL IsExceptionOfType(RuntimeExceptionKind reKind, Exception *pException) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_FORBID_FAULT; if (pException->IsType(reKind)) return TRUE; @@ -2774,7 +2761,6 @@ BOOL IsExceptionOfType(RuntimeExceptionKind reKind, OBJECTREF *pThrowable) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(pThrowable != NULL); @@ -2792,7 +2778,6 @@ BOOL IsUncatchable(OBJECTREF *pThrowable) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - FORBID_FAULT; } CONTRACTL_END; _ASSERTE(pThrowable != NULL); @@ -3587,7 +3572,6 @@ LONG UserBreakpointFilter(EXCEPTION_POINTERS* pEP) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -3596,7 +3580,7 @@ LONG UserBreakpointFilter(EXCEPTION_POINTERS* pEP) // user breakpoints as if they're unhandled exceptions right away. // // @todo: The InternalUnhandledExceptionFilter can trigger. - CONTRACT_VIOLATION(GCViolation | ThrowsViolation | ModeViolation | FaultViolation | FaultNotFatal); + CONTRACT_VIOLATION(GCViolation | ThrowsViolation | ModeViolation); #ifdef TARGET_UNIX int result = COMUnhandledExceptionFilter(pEP); @@ -3660,7 +3644,6 @@ LONG DefaultCatchFilter(EXCEPTION_POINTERS *ep, PVOID pv) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -3753,7 +3736,6 @@ BOOL InstallUnhandledExceptionFilter() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_ANY; - STATIC_CONTRACT_FORBID_FAULT; #ifndef TARGET_UNIX g_pOriginalUnhandledExceptionFilter = SetUnhandledExceptionFilter(COMUnhandledExceptionFilter); @@ -4930,7 +4912,6 @@ BOOL IsThreadHijackedForThreadStop(Thread* pThread, EXCEPTION_RECORD* pException NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -4971,7 +4952,6 @@ void AdjustContextForThreadStop(Thread* pThread, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; @@ -5004,7 +4984,6 @@ CreateCOMPlusExceptionObject(Thread *pThread, EXCEPTION_RECORD *pExceptionRecord NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - FORBID_FAULT; } CONTRACTL_END; @@ -5034,7 +5013,6 @@ CreateCOMPlusExceptionObject(Thread *pThread, EXCEPTION_RECORD *pExceptionRecord { EX_TRY { - FAULT_NOT_FATAL(); ThreadPreventAsyncHolder preventAsync; ResetProcessorStateHolder procState; @@ -5761,8 +5739,6 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo Thread *pThread; { - MAYBE_FAULT_FORBID_NO_ALLOC((pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_NO_MEMORY)); - pThread = GetThreadNULLOk(); // @@ -5849,16 +5825,6 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo return VEH_CONTINUE_SEARCH; } - // We can't probe here, because we won't return from the CLRVectoredExceptionHandlerPhase2 - // on WIN64 - // - - if (pThread) - { - FAULT_FORBID_NO_ALLOC(); - CantAllocHolder caHolder; - } - return CLRVectoredExceptionHandlerPhase2(pExceptionInfo); } @@ -5890,7 +5856,6 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandlerPhase2(PEXCEPTION_POINTERS pExcepti VEH_ACTION action; { - MAYBE_FAULT_FORBID_NO_ALLOC((pExceptionRecord->ExceptionCode == STATUS_NO_MEMORY)); CantAllocHolder caHolder; action = CLRVectoredExceptionHandlerPhase3(pExceptionInfo); } @@ -5909,7 +5874,6 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandlerPhase2(PEXCEPTION_POINTERS pExcepti // In OOM situations, this call better not fault. // { - MAYBE_FAULT_FORBID_NO_ALLOC((pExceptionRecord->ExceptionCode == STATUS_NO_MEMORY)); CantAllocHolder caHolder; // Give the debugger a chance. Note that its okay for this call to trigger a GC, since the debugger will take @@ -5961,7 +5925,6 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandlerPhase2(PEXCEPTION_POINTERS pExcepti BOOL fShouldHandleManagedFault; { - MAYBE_FAULT_FORBID_NO_ALLOC((pExceptionRecord->ExceptionCode == STATUS_NO_MEMORY)); CantAllocHolder caHolder; fShouldHandleManagedFault = ShouldHandleManagedFault(pExceptionInfo->ExceptionRecord, pExceptionInfo->ContextRecord, @@ -6106,7 +6069,7 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandlerPhase3(PEXCEPTION_POINTERS pExcepti PCODE ip = (PCODE)GetIP(pContext); if (IsIPInModule(GetClrModuleBase(), ip) || IsIPInModule(GCHeapUtilities::GetGCModuleBase(), ip)) { - CONTRACT_VIOLATION(ThrowsViolation|FaultViolation); + CONTRACT_VIOLATION(ThrowsViolation); // // If you're debugging, set the debugger to catch first-chance AV's, then simply hit F5 or @@ -9435,7 +9398,6 @@ VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(_In_z_ const ch { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); SUPPORTS_DAC; } CONTRACTL_END diff --git a/src/coreclr/vm/exstate.cpp b/src/coreclr/vm/exstate.cpp index 0738f6b2bb3615..b5ccd433109dfc 100644 --- a/src/coreclr/vm/exstate.cpp +++ b/src/coreclr/vm/exstate.cpp @@ -91,7 +91,6 @@ BOOL ThreadExceptionState::IsComPlusException() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (GetExceptionCode() != EXCEPTION_COMPLUS) { diff --git a/src/coreclr/vm/field.cpp b/src/coreclr/vm/field.cpp index 5ca860efd9536d..a5cf04b4820e3f 100644 --- a/src/coreclr/vm/field.cpp +++ b/src/coreclr/vm/field.cpp @@ -26,7 +26,6 @@ VOID FieldDesc::SetStaticOBJECTREF(OBJECTREF objRef) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -115,7 +114,6 @@ TypeHandle FieldDesc::LookupFieldTypeHandle(ClassLoadLevel level, BOOL dropGener NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END @@ -222,7 +220,6 @@ PTR_VOID FieldDesc::GetStaticAddressHandle(PTR_VOID base) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; PRECONDITION(IsStatic()); } CONTRACTL_END @@ -254,7 +251,7 @@ PTR_VOID FieldDesc::GetStaticAddressHandle(PTR_VOID base) GCX_COOP(); // This routine doesn't have a failure semantic - but Resolve*Field(...) does. // Something needs to be rethought here and I think it's E&C. - CONTRACT_VIOLATION(ThrowsViolation|FaultViolation|GCViolation); //B#25680 (Fix Enc violations) + CONTRACT_VIOLATION(ThrowsViolation|GCViolation); //B#25680 (Fix Enc violations) retVal = (void*)(pEnCModule->ResolveOrAllocateField(NULL, pFD)); } #endif // !DACCESS_COMPILE @@ -308,7 +305,6 @@ void FieldDesc::GetInstanceField(OBJECTREF o, VOID * pOutVal) if (FORBIDGC_LOADER_USE_ENABLED() ) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED() ) GC_NOTRIGGER; else GC_TRIGGERS; MODE_ANY; - if (FORBIDGC_LOADER_USE_ENABLED() ) FORBID_FAULT; else INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -355,7 +351,6 @@ void FieldDesc::SetInstanceField(OBJECTREF o, const VOID * pInVal) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -683,7 +678,6 @@ UINT FieldDesc::GetSize(MethodTable *pMTOfValueTypeField) NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END @@ -709,7 +703,6 @@ UINT FieldDesc::GetSize() NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END @@ -796,7 +789,6 @@ REFLECTFIELDREF FieldDesc::AllocateStubFieldInfo() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_COOPERATIVE; } CONTRACTL_END; diff --git a/src/coreclr/vm/field.h b/src/coreclr/vm/field.h index 96f372b10b8cee..5b42aaff870bb2 100644 --- a/src/coreclr/vm/field.h +++ b/src/coreclr/vm/field.h @@ -516,7 +516,6 @@ class FieldDesc THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -543,7 +542,6 @@ class FieldDesc { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/fieldmarshaler.cpp b/src/coreclr/vm/fieldmarshaler.cpp index 5bffde6a50bc28..f8b2a7c0d15c6c 100644 --- a/src/coreclr/vm/fieldmarshaler.cpp +++ b/src/coreclr/vm/fieldmarshaler.cpp @@ -255,7 +255,6 @@ VOID ParseNativeType(Module* pModule, THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pNFD)); } CONTRACTL_END; diff --git a/src/coreclr/vm/fptrstubs.cpp b/src/coreclr/vm/fptrstubs.cpp index f0e3a466df6bf0..12da28ac734c10 100644 --- a/src/coreclr/vm/fptrstubs.cpp +++ b/src/coreclr/vm/fptrstubs.cpp @@ -64,7 +64,6 @@ PCODE FuncPtrStubs::GetFuncPtrStub(MethodDesc * pMD, PrecodeType type) { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END diff --git a/src/coreclr/vm/frames.cpp b/src/coreclr/vm/frames.cpp index 202864af98c65b..153b353e15fb35 100644 --- a/src/coreclr/vm/frames.cpp +++ b/src/coreclr/vm/frames.cpp @@ -1506,7 +1506,6 @@ void TransitionFrame::PromoteCallerStack(promote_func* fn, ScanContext* sc) // INSTANCE_CHECK; // NOTHROW; // GC_NOTRIGGER; - // FORBID_FAULT; // MODE_ANY; //} //CONTRACTL_END @@ -1572,7 +1571,6 @@ void TransitionFrame::PromoteCallerStackHelper(promote_func* fn, ScanContext* sc // INSTANCE_CHECK; // NOTHROW; // GC_NOTRIGGER; - // FORBID_FAULT; // MODE_ANY; //} //CONTRACTL_END diff --git a/src/coreclr/vm/gchelpers.cpp b/src/coreclr/vm/gchelpers.cpp index ff0c2cbb656e89..1751ce3273b62f 100644 --- a/src/coreclr/vm/gchelpers.cpp +++ b/src/coreclr/vm/gchelpers.cpp @@ -469,14 +469,6 @@ inline Object* Alloc(size_t size, GC_ALLOC_FLAGS flags) MODE_COOPERATIVE; // returns an objref without pinning it => cooperative } CONTRACTL_END; -#ifdef _DEBUG - if (g_pConfig->ShouldInjectFault(INJECTFAULT_GCHEAP)) - { - char *a = new char; - delete a; - } -#endif - if (flags & GC_ALLOC_CONTAINS_REF) flags &= ~GC_ALLOC_ZEROING_OPTIONAL; @@ -822,14 +814,6 @@ OBJECTREF AllocateArrayEx(MethodTable *pArrayMT, INT32 *pArgs, DWORD dwNumArgs, PRECONDITION(dwNumArgs > 0); } CONTRACTL_END; -#ifdef _DEBUG - if (g_pConfig->ShouldInjectFault(INJECTFAULT_GCHEAP)) - { - char *a = new char; - delete a; - } -#endif - SetTypeHandleOnThreadForAlloc(TypeHandle(pArrayMT)); // keep original flags in case the call is recursive (jugged array case) @@ -1009,7 +993,6 @@ OBJECTREF AllocatePrimitiveArray(CorElementType type, DWORD cElements) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_COOPERATIVE; // returns an objref without pinning it => cooperative } CONTRACTL_END @@ -1102,14 +1085,6 @@ STRINGREF AllocateString( DWORD cchStringLength ) MODE_COOPERATIVE; // returns an objref without pinning it => cooperative } CONTRACTL_END; -#ifdef _DEBUG - if (g_pConfig->ShouldInjectFault(INJECTFAULT_GCHEAP)) - { - char *a = new char; - delete a; - } -#endif - // Limit the maximum string size to <2GB to mitigate risk of security issues caused by 32-bit integer // overflows in buffer size calculations. if (cchStringLength > CORINFO_String_MaxLength) diff --git a/src/coreclr/vm/gctoclreventsink.cpp b/src/coreclr/vm/gctoclreventsink.cpp index 5d0c5b2f05d092..13e35e861223c9 100644 --- a/src/coreclr/vm/gctoclreventsink.cpp +++ b/src/coreclr/vm/gctoclreventsink.cpp @@ -213,7 +213,6 @@ void GCToCLREventSink::FirePinObjectAtGCTime(void* object, uint8_t** ppObject) EX_TRY { - FAULT_NOT_FATAL(); TypeHandle th = obj->GetGCSafeTypeHandleIfPossible(); if(th != NULL) diff --git a/src/coreclr/vm/genericdict.cpp b/src/coreclr/vm/genericdict.cpp index 78df58b1c57ce8..444365af958152 100644 --- a/src/coreclr/vm/genericdict.cpp +++ b/src/coreclr/vm/genericdict.cpp @@ -44,7 +44,6 @@ DictionaryLayout* DictionaryLayout::Allocate(WORD numSlots, { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pAllocator)); PRECONDITION(numSlots > 0); } @@ -268,7 +267,6 @@ DictionaryLayout* DictionaryLayout::ExpandDictionaryLayout(LoaderAllocator* CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(ThrowOutOfMemory();); PRECONDITION(GetAppDomain()->GetGenericDictionaryExpansionLock()->OwnedByCurrentThread()); PRECONDITION(CheckPointer(pResult) && CheckPointer(pSlotOut)); } diff --git a/src/coreclr/vm/generics.cpp b/src/coreclr/vm/generics.cpp index b4307ca7902b5b..a4f1bf40b3311e 100644 --- a/src/coreclr/vm/generics.cpp +++ b/src/coreclr/vm/generics.cpp @@ -63,7 +63,6 @@ TypeHandle ClassLoader::CanonicalizeGenericArg(TypeHandle thGenericArg) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -81,7 +80,6 @@ TypeHandle ClassLoader::CanonicalizeGenericArg(TypeHandle thGenericArg) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -99,7 +97,6 @@ TypeHandle ClassLoader::CanonicalizeGenericArg(TypeHandle thGenericArg) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END diff --git a/src/coreclr/vm/genmeth.cpp b/src/coreclr/vm/genmeth.cpp index f15d7370a99e2e..25938af990c3a1 100644 --- a/src/coreclr/vm/genmeth.cpp +++ b/src/coreclr/vm/genmeth.cpp @@ -78,7 +78,6 @@ static MethodDesc* CreateMethodDesc(LoaderAllocator *pAllocator, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pAllocator)); PRECONDITION(CheckPointer(pMT)); PRECONDITION(CheckPointer(pTemplateMD)); @@ -327,7 +326,6 @@ static BOOL SatisfiesMethodConstraintsForInstantiation(MethodDesc *pGenericMetho THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pGenericMethodDef)); } CONTRACTL_END; @@ -405,7 +403,6 @@ InstantiatedMethodDesc::NewInstantiatedMethodDesc(MethodTable *pExactMT, MODE_PREEMPTIVE; THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pExactMT)); PRECONDITION(CheckPointer(pGenericMDescInRepMT)); PRECONDITION(methodInst.IsEmpty() || pGenericMDescInRepMT->IsGenericMethodDefinition()); @@ -612,7 +609,6 @@ InstantiatedMethodDesc::FindLoadedInstantiatedMethodDesc(MethodTable *pExactOrRe { THROWS; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(pExactOrRepMT)); SUPPORTS_DAC; @@ -774,7 +770,6 @@ MethodDesc::FindOrCreateAssociatedMethodDesc(MethodDesc* pDefMD, if (allowCreate) { MODE_PREEMPTIVE; } else { MODE_ANY; } if (allowCreate) { GC_TRIGGERS; } else { GC_NOTRIGGER; } if (!allowCreate) { SUPPORTS_DAC; } - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pDefMD)); PRECONDITION(CheckPointer(pExactMT)); @@ -1446,7 +1441,6 @@ void InstantiatedMethodDesc::SetupGenericMethodDefinition(IMDInternalImport* pIM { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pIMDII)); PRECONDITION(CheckPointer(pAllocator)); PRECONDITION(CheckPointer(pamTracker)); @@ -1649,7 +1643,6 @@ BOOL MethodDesc::SatisfiesMethodConstraints(TypeHandle thParent, BOOL fThrowIfNo GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/hash.cpp b/src/coreclr/vm/hash.cpp index 314c824c5231e8..a2b0698c5cf769 100644 --- a/src/coreclr/vm/hash.cpp +++ b/src/coreclr/vm/hash.cpp @@ -44,8 +44,6 @@ void *PtrHashMap::operator new(size_t size, LoaderHeap *pHeap) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FAULT; //return NULL; - return pHeap->AllocMem(S_SIZE_T(size)); } @@ -61,8 +59,6 @@ BOOL Bucket::InsertValue(const UPTR key, const UPTR value) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FAULT; //return FALSE; - _ASSERTE(key != EMPTY); _ASSERTE(key != DELETED); @@ -186,7 +182,6 @@ HashMap::HashMap() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; m_rgBuckets = NULL; m_pCompare = NULL; // comparison object @@ -262,7 +257,6 @@ void HashMap::Init(DWORD cbInitialSize, ComparePtr* pCompare, BOOL fAsyncMode, L { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -313,7 +307,6 @@ void PtrHashMap::Init(DWORD cbInitialSize, CompareFnPtr ptr, BOOL fAsyncMode, Lo { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -332,7 +325,6 @@ HashMap::~HashMap() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; // free the current table Clear(); @@ -350,7 +342,6 @@ void HashMap::Clear() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; // free the current table FreeBuckets(m_rgBuckets); @@ -437,7 +428,6 @@ void HashMap::ProfileLookup(UPTR ntry, UPTR retValue) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; #ifndef DACCESS_COMPILE #ifdef HASHTABLE_PROFILE @@ -472,8 +462,6 @@ void HashMap::InsertValue (UPTR key, UPTR value) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FAULT; - _ASSERTE (OwnLock()); // Enter EBR critical region to protect against concurrent bucket array @@ -668,7 +656,6 @@ UPTR HashMap::DeleteValue (UPTR key, UPTR value) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE (OwnLock()); @@ -753,7 +740,6 @@ UPTR HashMap::PutEntry (Bucket* rgBuckets, UPTR key, UPTR value) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -789,7 +775,6 @@ UPTR HashMap::NewSize() const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; ASSERT(m_cbInserts >= m_cbDeletes); UPTR cbValidSlots = m_cbInserts-m_cbDeletes; @@ -825,8 +810,6 @@ void HashMap::Rehash() { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FAULT; - EbrCriticalRegionHolder ebrHolder(&g_EbrCollector, m_fAsyncMode); _ASSERTE (!m_fAsyncMode || g_EbrCollector.InCriticalRegion()); @@ -991,7 +974,6 @@ void HashMap::Compact() { EX_TRY { - FAULT_NOT_FATAL(); Rehash(); } EX_CATCH @@ -1038,7 +1020,6 @@ BOOL HashMap::OwnLock() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; DEBUG_ONLY_FUNCTION; diff --git a/src/coreclr/vm/i386/stublinkerx86.cpp b/src/coreclr/vm/i386/stublinkerx86.cpp index 9b8a394f87238e..626c64907fc312 100644 --- a/src/coreclr/vm/i386/stublinkerx86.cpp +++ b/src/coreclr/vm/i386/stublinkerx86.cpp @@ -82,7 +82,6 @@ class X86NearJump : public InstructionFormat { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (fExternal) @@ -133,7 +132,6 @@ static BYTE gX86NearJump[sizeof(X86NearJump)]; { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; diff --git a/src/coreclr/vm/ilstubcache.cpp b/src/coreclr/vm/ilstubcache.cpp index 63e8119ffb094f..ab72b30caf20c0 100644 --- a/src/coreclr/vm/ilstubcache.cpp +++ b/src/coreclr/vm/ilstubcache.cpp @@ -452,7 +452,6 @@ MethodTable* ILStubCache::GetOrCreateStubMethodTable(Module* pModule) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/instmethhash.cpp b/src/coreclr/vm/instmethhash.cpp index 18976aaa65add2..50fc7ac5e6ffa3 100644 --- a/src/coreclr/vm/instmethhash.cpp +++ b/src/coreclr/vm/instmethhash.cpp @@ -53,7 +53,6 @@ void InstMethodHashEntry::SetMethodAndFlags(MethodDesc *pMethod, DWORD dwFlags) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -93,7 +92,6 @@ static DWORD Hash(TypeHandle declaringType, mdMethodDef token, Instantiation ins { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; DWORD dwHash = 0x87654321; #define INST_HASH_ADD(_value) dwHash = ((dwHash << 5) + dwHash) ^ (_value) @@ -126,7 +124,6 @@ MethodDesc* InstMethodHashTable::FindMethodDesc(TypeHandle declaringType, { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(declaringType)); } CONTRACTL_END @@ -297,7 +294,6 @@ void InstMethodHashTable::InsertMethodDesc(MethodDesc *pMD) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(IsUnsealed()); // If we are sealed then we should not be adding to this hashtable PRECONDITION(CheckPointer(pMD)); diff --git a/src/coreclr/vm/interopconverter.cpp b/src/coreclr/vm/interopconverter.cpp index c2407483da47fc..ec4023fe7f44d3 100644 --- a/src/coreclr/vm/interopconverter.cpp +++ b/src/coreclr/vm/interopconverter.cpp @@ -55,7 +55,6 @@ namespace return; // make sure we can cast to the specified class - FAULT_NOT_FATAL(); // Bad format exception thrown for backward compatibility THROW_BAD_FORMAT_MAYBE(pMTClass->IsArray() == FALSE, BFA_UNEXPECTED_ARRAY_TYPE, pMTClass); diff --git a/src/coreclr/vm/interoputil.cpp b/src/coreclr/vm/interoputil.cpp index 493a8195d1e15d..3b00bd779955cb 100644 --- a/src/coreclr/vm/interoputil.cpp +++ b/src/coreclr/vm/interoputil.cpp @@ -270,7 +270,6 @@ void GetCultureInfoForLCID(LCID lcid, OBJECTREF *pCultureObj) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pCultureObj)); } CONTRACTL_END; @@ -433,7 +432,6 @@ BOOL IsManagedObject(IUnknown *pIUnknown) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pIUnknown)); } CONTRACTL_END; @@ -744,7 +742,7 @@ ULONG SafeReleasePreemp(IUnknown * pUnk) return 0; // Message pump could happen, so arbitrary managed code could run. - CONTRACT_VIOLATION(ThrowsViolation | FaultViolation); + CONTRACT_VIOLATION(ThrowsViolation); return pUnk->Release(); } @@ -768,7 +766,7 @@ ULONG SafeRelease(IUnknown* pUnk) GCX_PREEMP_NO_DTOR_HAVE_THREAD(pThread); // Message pump could happen, so arbitrary managed code could run. - CONTRACT_VIOLATION(ThrowsViolation | FaultViolation); + CONTRACT_VIOLATION(ThrowsViolation); res = pUnk->Release(); @@ -1732,7 +1730,6 @@ DefaultInterfaceType GetDefaultInterfaceForClassInternal(TypeHandle hndClass, Ty THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(!hndClass.IsNull()); PRECONDITION(CheckPointer(pHndDefClass)); PRECONDITION(!hndClass.GetMethodTable()->IsInterface()); @@ -2012,7 +2009,6 @@ void GetComSourceInterfacesForClass(MethodTable *pMT, CQuickArray THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pMT)); } CONTRACTL_END; @@ -2184,7 +2180,6 @@ ULONG GetStringizedClassItfDef(TypeHandle InterfaceType, CQuickArray &rDef THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(!InterfaceType.IsNull()); } CONTRACTL_END; @@ -2277,7 +2272,6 @@ void GenerateClassItfGuid(TypeHandle InterfaceType, GUID *pGuid) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(!InterfaceType.IsNull()); PRECONDITION(CheckPointer(pGuid)); } @@ -3522,7 +3516,6 @@ static void GetComClassHelper( THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(CheckPointer(pRef)); PRECONDITION(CheckPointer(pClassFactHash)); PRECONDITION(CheckPointer(pClassFactInfo)); @@ -3582,7 +3575,6 @@ void GetComClassFromCLSID(REFCLSID clsid, _In_opt_z_ PCWSTR wszServer, OBJECTREF THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(pRef != NULL); } CONTRACTL_END; @@ -3626,7 +3618,6 @@ ClassFactoryBase *GetComClassFactory(MethodTable* pClassMT) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(CheckPointer(pClassMT)); PRECONDITION(pClassMT->IsComObjectType()); } diff --git a/src/coreclr/vm/interoputil.inl b/src/coreclr/vm/interoputil.inl index a03ed91685ef0b..78c9201900a1dd 100644 --- a/src/coreclr/vm/interoputil.inl +++ b/src/coreclr/vm/interoputil.inl @@ -11,7 +11,6 @@ inline BOOL ComInterfaceSlotIs(IUnknown* pUnk, int slot, LPVOID pvFunction) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; PRECONDITION(CheckPointer(pUnk)); } diff --git a/src/coreclr/vm/invokeutil.cpp b/src/coreclr/vm/invokeutil.cpp index d97f374d822c30..35eeca88e483e2 100644 --- a/src/coreclr/vm/invokeutil.cpp +++ b/src/coreclr/vm/invokeutil.cpp @@ -128,7 +128,6 @@ void InvokeUtil::CopyArg(TypeHandle th, PVOID argRef, ArgDestination *argDest) { GC_NOTRIGGER; // Caller does not protect object references MODE_COOPERATIVE; PRECONDITION(!th.IsNull()); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -275,7 +274,6 @@ void InvokeUtil::CreatePrimitiveValue(CorElementType dstType, MODE_COOPERATIVE; PRECONDITION(srcObj != NULL); PRECONDITION(CheckPointer(pDst)); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; CreatePrimitiveValue(dstType, srcType, srcObj->UnBox(), srcObj->GetMethodTable(), pDst); @@ -292,7 +290,6 @@ void InvokeUtil::CreatePrimitiveValue(CorElementType dstType, GC_NOTRIGGER; MODE_COOPERATIVE; PRECONDITION(CheckPointer(pDst)); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -451,7 +448,6 @@ void InvokeUtil::ValidField(TypeHandle th, OBJECTREF* value) PRECONDITION(!th.IsNull()); PRECONDITION(CheckPointer(value)); PRECONDITION(IsProtectedByGCFrame (value)); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -535,7 +531,6 @@ OBJECTREF InvokeUtil::CreateObjectAfterInvoke(TypeHandle th, void * pValue) { MODE_COOPERATIVE; PRECONDITION(!th.IsNull()); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -591,7 +586,6 @@ OBJECTREF InvokeUtil::CreateTargetExcept(OBJECTREF* except) { PRECONDITION(IsProtectedByGCFrame (except)); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -631,7 +625,6 @@ void InvokeUtil::ValidateObjectTarget(FieldDesc *pField, TypeHandle enclosingTyp PRECONDITION(!enclosingType.IsNull() || pField->IsStatic()); PRECONDITION(CheckPointer(target)); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -677,7 +670,6 @@ void InvokeUtil::SetValidField(CorElementType fldType, PRECONDITION(IsProtectedByGCFrame (valueObj)); PRECONDITION(declaringType.IsNull () || !declaringType.IsTypeDesc()); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -898,7 +890,6 @@ OBJECTREF InvokeUtil::GetFieldValue(FieldDesc* pField, TypeHandle fieldType, OBJ PRECONDITION(CheckPointer(target)); PRECONDITION(declaringType.IsNull () || !declaringType.IsTypeDesc()); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 8fc64fc082d3b1..9d497ca44a24cd 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -2015,7 +2015,6 @@ static bool IsSimdIntrinsicType(MethodTable* pMT) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; diff --git a/src/coreclr/vm/jitinterfacegen.cpp b/src/coreclr/vm/jitinterfacegen.cpp index 30a17975a93c49..015a2e8dc7c75b 100644 --- a/src/coreclr/vm/jitinterfacegen.cpp +++ b/src/coreclr/vm/jitinterfacegen.cpp @@ -36,12 +36,7 @@ void InitJITAllocationHelpers() _ASSERTE(g_SystemInfo.dwNumberOfProcessors != 0); // Allocation helpers, faster but non-logging - if (!((TrackAllocationsEnabled()) || - (LoggingOn(LF_GCALLOC, LL_INFO10)) -#ifdef _DEBUG - || (g_pConfig->ShouldInjectFault(INJECTFAULT_GCHEAP) != 0) -#endif // _DEBUG - )) + if (!(TrackAllocationsEnabled() || LoggingOn(LF_GCALLOC, LL_INFO10))) { // if (multi-proc || server GC || non-Windows) if (GCHeapUtilities::UseThreadAllocationContexts()) diff --git a/src/coreclr/vm/loaderallocator.cpp b/src/coreclr/vm/loaderallocator.cpp index 926978bbad9018..171e857208b4ae 100644 --- a/src/coreclr/vm/loaderallocator.cpp +++ b/src/coreclr/vm/loaderallocator.cpp @@ -1072,7 +1072,6 @@ void LoaderAllocator::ActivateManagedTracking() { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; MODE_ANY; } CONTRACTL_END @@ -1581,7 +1580,6 @@ DispatchToken LoaderAllocator::GetDispatchToken( THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; #ifdef FAT_DISPATCH_TOKENS @@ -1684,7 +1682,6 @@ EEMarshalingData *LoaderAllocator::GetMarshalingData() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -1802,7 +1799,6 @@ STRINGREF *LoaderAllocator::GetStringObjRefPtrFromUnicodeString(EEStringData *pS THROWS; MODE_COOPERATIVE; PRECONDITION(CheckPointer(pStringData)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; if (m_pStringLiteralMap == NULL) @@ -1821,7 +1817,6 @@ void LoaderAllocator::LazyInitStringLiteralMap() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1860,7 +1855,6 @@ STRINGREF *LoaderAllocator::IsStringInterned(STRINGREF *pString) THROWS; MODE_COOPERATIVE; PRECONDITION(CheckPointer(pString)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; if (m_pStringLiteralMap == NULL) @@ -1879,7 +1873,6 @@ STRINGREF *LoaderAllocator::GetOrInternString(STRINGREF *pString) THROWS; MODE_COOPERATIVE; PRECONDITION(CheckPointer(pString)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; if (m_pStringLiteralMap == NULL) @@ -1899,7 +1892,6 @@ void AssemblyLoaderAllocator::RegisterHandleForCleanup(OBJECTHANDLE objHandle) MODE_COOPERATIVE; CAN_TAKE_LOCK; PRECONDITION(CheckPointer(objHandle)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1919,7 +1911,6 @@ void AssemblyLoaderAllocator::RegisterHandleForCleanupLocked(OBJECTHANDLE objHan MODE_COOPERATIVE; CAN_TAKE_LOCK; PRECONDITION(CheckPointer(objHandle)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2056,7 +2047,6 @@ void LoaderAllocator::RegisterFailedTypeInitForCleanup(ListLockEntry *pListLockE MODE_ANY; CAN_TAKE_LOCK; PRECONDITION(CheckPointer(pListLockEntry)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2129,7 +2119,6 @@ ComCallWrapperCache * LoaderAllocator::GetComCallWrapperCache() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2154,7 +2143,6 @@ UMEntryThunkCache *LoaderAllocator::GetUMEntryThunkCache() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2267,7 +2255,6 @@ PTR_OnStackReplacementManager LoaderAllocator::GetOnStackReplacementManager() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2295,7 +2282,6 @@ PTR_AsyncContinuationsManager LoaderAllocator::GetAsyncContinuationsManager() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -2319,7 +2305,6 @@ void LoaderAllocator::AllocateBytesForStaticVariables(DynamicStaticsInfo* pStati { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -2393,7 +2378,6 @@ void LoaderAllocator::AllocateGCHandlesBytesForStaticVariables(DynamicStaticsInf { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -2455,7 +2439,6 @@ bool LoaderAllocator::InsertObjectIntoFieldWithLifetimeOfCollectibleLoaderAlloca THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); //REENTRANT } CONTRACTL_END; diff --git a/src/coreclr/vm/memberload.cpp b/src/coreclr/vm/memberload.cpp index f579a490dd397f..9d2d544b0546a0 100644 --- a/src/coreclr/vm/memberload.cpp +++ b/src/coreclr/vm/memberload.cpp @@ -727,7 +727,6 @@ MemberLoader::GetMethodDescFromMemberDefOrRefOrSpec( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pModule)); } CONTRACTL_END; @@ -903,7 +902,6 @@ MemberLoader::GetMethodDescFromMethodDef( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pModule)); PRECONDITION(TypeFromToken(MethodDef) == mdtMethodDef); } @@ -943,7 +941,6 @@ FieldDesc* MemberLoader::GetFieldDescFromMemberDefOrRef( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1040,7 +1037,6 @@ static BOOL CompareMethodSigWithCorrectSubstitution( THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -1083,7 +1079,6 @@ MemberLoader::FindMethod( CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; } CONTRACTL_END; @@ -1251,7 +1246,6 @@ MemberLoader::FindMethod(MethodTable * pMT, LPCUTF8 pwzName, LPHARDCODEDMETASIG CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; } CONTRACTL_END; @@ -1267,7 +1261,6 @@ MemberLoader::FindMethod(MethodTable * pMT, mdMethodDef mb) CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; } CONTRACTL_END; @@ -1294,7 +1287,6 @@ MemberLoader::FindMethodByName(MethodTable * pMT, LPCUTF8 pszName, FM_Flags flag CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(!pMT->IsArray()); MODE_ANY; } CONTRACTL_END; @@ -1380,7 +1372,6 @@ MemberLoader::FindPropertyMethod(MethodTable * pMT, LPCUTF8 pszName, EnumPropert CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; PRECONDITION(Method < 2); } CONTRACTL_END; @@ -1408,7 +1399,6 @@ MemberLoader::FindEventMethod(MethodTable * pMT, LPCUTF8 pszName, EnumEventMetho CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; PRECONDITION(Method < 3); } CONTRACTL_END; @@ -1438,7 +1428,6 @@ MemberLoader::FindConstructor(MethodTable * pMT, LPHARDCODEDMETASIG pwzSignature { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; } CONTRACTL_END @@ -1456,7 +1445,6 @@ MemberLoader::FindConstructor(MethodTable * pMT, PCCOR_SIGNATURE pSignature,DWOR { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; } CONTRACTL_END @@ -1514,7 +1502,6 @@ MemberLoader::FindField(MethodTable* pMT, LPCUTF8 pszName, PCCOR_SIGNATURE pSign { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); MODE_ANY; } CONTRACTL_END diff --git a/src/coreclr/vm/method.cpp b/src/coreclr/vm/method.cpp index caef55a6eabd1a..731de26b54d048 100644 --- a/src/coreclr/vm/method.cpp +++ b/src/coreclr/vm/method.cpp @@ -381,7 +381,6 @@ LPCUTF8 MethodDesc::GetName() { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; // MethodImpl::FindMethodDesc can throw. GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -498,7 +497,6 @@ void MethodDesc::GetSig(PCCOR_SIGNATURE *ppSig, DWORD *pcSig) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -551,7 +549,6 @@ void MethodDesc::GetSigFromMetadata(IMDInternalImport * importer, { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -765,7 +762,6 @@ DWORD MethodDesc::GetNumGenericMethodArgs() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; CANNOT_TAKE_LOCK; SUPPORTS_DAC; } @@ -810,7 +806,6 @@ Instantiation MethodDesc::GetExactClassInstantiation(TypeHandle possibleObjType) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -861,7 +856,6 @@ Instantiation MethodDesc::LoadMethodInstantiation() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -880,7 +874,6 @@ BOOL MethodDesc::ContainsGenericVariables() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -1200,7 +1193,6 @@ ULONG MethodDesc::GetRVA() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; PRECONDITION((IsIL() && MayHaveILHeader()) || (IsPInvoke() && ((PInvokeMethodDesc*)this)->IsEarlyBound())); @@ -1354,7 +1346,6 @@ ReturnKind MethodDesc::GetReturnKind() { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -1471,7 +1462,6 @@ WORD MethodDesc::GetComSlot() { THROWS; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(!IsAsyncMethod()); } CONTRACTL_END @@ -1596,7 +1586,6 @@ Module *MethodDesc::GetModule() const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; SUPPORTS_DAC; MethodTable* pMT = GetMethodDescChunk()->GetMethodTable(); @@ -1774,7 +1763,6 @@ MethodDesc* MethodDesc::LoadTypicalMethodDefinition() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -1875,7 +1863,6 @@ MethodDesc* MethodDesc::StripMethodInstantiation() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -1896,7 +1883,6 @@ MethodDescChunk *MethodDescChunk::CreateChunk(LoaderHeap *pHeap, DWORD methodDes { THROWS; GC_NOTRIGGER; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(CheckPointer(pHeap)); PRECONDITION(CheckPointer(pInitialMT)); @@ -2180,7 +2166,6 @@ PCODE MethodDesc::GetMultiCallableAddrOfCode(CORINFO_ACCESS_FLAGS accessFlags /* { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -2233,7 +2218,6 @@ PCODE MethodDesc::TryGetMultiCallableAddrOfCode(CORINFO_ACCESS_FLAGS accessFlags { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -2641,7 +2625,6 @@ MethodImpl *MethodDesc::GetMethodImpl() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(HasMethodImplSlot()); SUPPORTS_DAC; } @@ -2774,8 +2757,6 @@ void MethodDesc::CheckRestore(ClassLoadLevel level) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - if (!GetMethodTable()->IsFullyLoaded()) { if (GetClassification() == mcInstantiated) @@ -3567,7 +3548,6 @@ BOOL PInvokeMethodDesc::TryGetResolvedPInvokeTarget(_In_ PInvokeMethodDesc* pMD, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pMD)); PRECONDITION(CheckPointer(ndirectTarget)); } @@ -3766,7 +3746,6 @@ void PInvokeMethodDesc::InitEarlyBoundPInvokeTarget() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -3798,7 +3777,6 @@ BOOL MethodDesc::HasUnmanagedCallersOnlyAttribute() { THROWS; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; @@ -3826,7 +3804,6 @@ BOOL MethodDesc::ShouldSuppressGCTransition() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -3867,7 +3844,6 @@ void CLRToCOMCallMethodDesc::InitComEventCallInfo() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -4114,7 +4090,6 @@ REFLECTMETHODREF MethodDesc::AllocateStubMethodInfo() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_COOPERATIVE; } CONTRACTL_END; diff --git a/src/coreclr/vm/methodimpl.cpp b/src/coreclr/vm/methodimpl.cpp index 92428ab33c882c..3d76e531b1800d 100644 --- a/src/coreclr/vm/methodimpl.cpp +++ b/src/coreclr/vm/methodimpl.cpp @@ -61,7 +61,6 @@ PTR_MethodDesc MethodImpl::FindMethodDesc(DWORD slot, PTR_MethodDesc defaultRetu { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; } CONTRACTL_END @@ -80,7 +79,6 @@ PTR_MethodDesc MethodImpl::GetMethodDesc(DWORD slotIndex, PTR_MethodDesc default { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; } CONTRACTL_END @@ -104,7 +102,6 @@ void MethodImpl::SetSize(LoaderHeap *pHeap, AllocMemTracker *pamTracker, DWORD s GC_NOTRIGGER; PRECONDITION(CheckPointer(this)); PRECONDITION(pdwSlots==NULL && pImplementedMD==NULL); - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; if(size > 0) { diff --git a/src/coreclr/vm/methodtable.cpp b/src/coreclr/vm/methodtable.cpp index e8c610b5fa609c..2cfdf00b40f514 100644 --- a/src/coreclr/vm/methodtable.cpp +++ b/src/coreclr/vm/methodtable.cpp @@ -321,7 +321,6 @@ PTR_Module MethodTable::GetModuleIfLoaded() NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -667,7 +666,6 @@ MethodTable* CreateMinimalMethodTable(Module* pContainingModule, THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -3870,7 +3868,6 @@ void MethodTable::CheckRunClassInitThrowing() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(IsFullyLoaded()); } CONTRACTL_END; @@ -3898,7 +3895,6 @@ void MethodTable::EnsureStaticDataAllocated() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -3926,7 +3922,6 @@ bool MethodTable::IsClassInitedOrPreinited() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -3944,7 +3939,6 @@ bool MethodTable::IsInitedIfStaticDataAllocated() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -4128,7 +4122,6 @@ OBJECTREF MethodTable::GetManagedClassObject() THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); //REENTRANT } CONTRACTL_END; @@ -7396,7 +7389,6 @@ void MethodTable::MethodIterator::Init(MethodTable *pMTDecl, MethodTable *pMTImp CONTRACTL { THROWS; WRAPPER(GC_TRIGGERS); - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pMTDecl)); PRECONDITION(CheckPointer(pMTImpl)); } CONTRACTL_END; @@ -7803,7 +7795,6 @@ BOOL MethodTable::ContainsGenericMethodVariables() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -8678,7 +8669,6 @@ LPCWSTR MethodTable::GetPathForErrorMessages() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp index f8e9ef66c54c10..b7d156581b7951 100644 --- a/src/coreclr/vm/methodtablebuilder.cpp +++ b/src/coreclr/vm/methodtablebuilder.cpp @@ -22,7 +22,6 @@ int __cdecl compareCGCDescSeries(const void *arg1, const void *arg2) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; CGCDescSeries* gcInfo1 = (CGCDescSeries*) arg1; CGCDescSeries* gcInfo2 = (CGCDescSeries*) arg2; @@ -676,7 +675,6 @@ MethodTableBuilder::BuildMethodTableThrowException( { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -9005,7 +9003,6 @@ DWORD MethodTableBuilder::GetFieldSize(FieldDesc *pFD) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; // We should only be calling this while this class is being built. _ASSERTE(GetHalfBakedMethodTable() == 0); diff --git a/src/coreclr/vm/methodtablebuilder.inl b/src/coreclr/vm/methodtablebuilder.inl index aa5f1223c6ccdd..52c41a39f80bfa 100644 --- a/src/coreclr/vm/methodtablebuilder.inl +++ b/src/coreclr/vm/methodtablebuilder.inl @@ -244,7 +244,6 @@ FixedCapacityStackingAllocatedUTF8StringHash::Lookup( { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; DWORD dwHash = GetHashCode(pszName); DWORD dwBucket = dwHash % m_dwNumBuckets; @@ -270,7 +269,6 @@ FixedCapacityStackingAllocatedUTF8StringHash::FindNext( { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; CONSISTENCY_CHECK(CheckPointer(pEntry)); LPCUTF8 key = pEntry->m_pKey; diff --git a/src/coreclr/vm/mlinfo.cpp b/src/coreclr/vm/mlinfo.cpp index eb95219367193d..c8f5ec16ba2138 100644 --- a/src/coreclr/vm/mlinfo.cpp +++ b/src/coreclr/vm/mlinfo.cpp @@ -445,7 +445,6 @@ void *EEMarshalingData::operator new(size_t size, LoaderHeap *pHeap) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pHeap)); } CONTRACTL_END; @@ -468,7 +467,6 @@ CustomMarshalerInfo *EEMarshalingData::GetCustomMarshalerInfo(Assembly *pAssembl CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pAssembly)); } CONTRACTL_END; @@ -536,7 +534,6 @@ CustomMarshalerInfo *EEMarshalingData::GetIEnumeratorMarshalerInfo() CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -2107,7 +2104,6 @@ HRESULT MarshalInfo::HandleArrayElemType(NativeTypeParamInfo *pParamInfo, TypeHa CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pParamInfo)); } CONTRACTL_END; @@ -3079,7 +3075,6 @@ DispParamMarshaler *MarshalInfo::GenerateDispParamMarshaler() THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -3288,7 +3283,6 @@ void ArrayMarshalInfo::InitElementInfo(CorNativeType arrayNativeType, MarshalInf CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(!thElement.IsNull()); } CONTRACTL_END; diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp index 9e828f69512741..5b1f0fcb957c96 100644 --- a/src/coreclr/vm/multicorejit.cpp +++ b/src/coreclr/vm/multicorejit.cpp @@ -1168,7 +1168,6 @@ void MulticoreJitManager::StartProfile(AppDomain * pDomain, AssemblyBinder *pBin { THROWS; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); CAN_TAKE_LOCK; } CONTRACTL_END; @@ -1325,7 +1324,6 @@ void MulticoreJitManager::AutoStartProfile(AppDomain * pDomain) THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; diff --git a/src/coreclr/vm/multicorejitplayer.cpp b/src/coreclr/vm/multicorejitplayer.cpp index 61e52528b1f772..3b8a4d0a19572f 100644 --- a/src/coreclr/vm/multicorejitplayer.cpp +++ b/src/coreclr/vm/multicorejitplayer.cpp @@ -1332,7 +1332,6 @@ HRESULT MulticoreJitProfilePlayer::JITThreadProc(Thread * pThread) NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1368,7 +1367,6 @@ DWORD WINAPI MulticoreJitProfilePlayer::StaticJITThreadProc(void *args) GC_TRIGGERS; MODE_ANY; ENTRY_POINT; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; diff --git a/src/coreclr/vm/nativeimage.cpp b/src/coreclr/vm/nativeimage.cpp index 7f152c1261ade2..5c197a2186bbe0 100644 --- a/src/coreclr/vm/nativeimage.cpp +++ b/src/coreclr/vm/nativeimage.cpp @@ -49,7 +49,6 @@ NativeImage::NativeImage(AssemblyBinder *pAssemblyBinder, ReadyToRunLoadedImage { THROWS; STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; diff --git a/src/coreclr/vm/object.cpp b/src/coreclr/vm/object.cpp index fe18eef978bacb..01fafefc743c27 100644 --- a/src/coreclr/vm/object.cpp +++ b/src/coreclr/vm/object.cpp @@ -247,7 +247,6 @@ TypeHandle Object::GetGCSafeTypeHandleIfPossible() const { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pInterfaceMT)); PRECONDITION(pInterfaceMT->IsInterface()); } @@ -305,7 +304,6 @@ void Object::ValidateHeap(BOOL bDeep) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; #if defined (VERIFY_HEAP) //no need to verify next object's header in this case @@ -318,7 +316,6 @@ void Object::SetOffsetObjectRef(DWORD dwOffset, size_t dwValue) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; OBJECTREF* location; @@ -334,7 +331,6 @@ void SetObjectReferenceUnchecked(OBJECTREF *dst,OBJECTREF ref) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; STATIC_CONTRACT_CANNOT_TAKE_LOCK; @@ -353,7 +349,6 @@ void CopyValueClassUnchecked(void* dest, void* src, MethodTable *pMT) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; _ASSERTE(!pMT->IsArray()); // bunch of assumptions about arrays wrong. @@ -399,7 +394,6 @@ void CopyValueClassArgUnchecked(ArgDestination *argDest, void* src, MethodTable { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; #if defined(UNIX_AMD64_ABI) @@ -438,7 +432,6 @@ void InitValueClassArg(ArgDestination *argDest, MethodTable *pMT) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; #if defined(UNIX_AMD64_ABI) @@ -486,7 +479,6 @@ VOID Object::Validate(BOOL bDeep, BOOL bVerifyNextHeader, BOOL bVerifySyncBlock) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_MODE_COOPERATIVE; STATIC_CONTRACT_CANNOT_TAKE_LOCK; @@ -518,7 +510,7 @@ VOID Object::Validate(BOOL bDeep, BOOL bVerifyNextHeader, BOOL bVerifySyncBlock) { // ValidateInner can throw or fault on failure which violates contract. - CONTRACT_VIOLATION(ThrowsViolation | FaultViolation); + CONTRACT_VIOLATION(ThrowsViolation); // using inner helper because of TRY and stack objects with destructors. ValidateInner(bDeep, bVerifyNextHeader, bVerifySyncBlock); @@ -529,7 +521,6 @@ VOID Object::ValidateInner(BOOL bDeep, BOOL bVerifyNextHeader, BOOL bVerifySyncB { STATIC_CONTRACT_THROWS; // See CONTRACT_VIOLATION above STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FAULT; // See CONTRACT_VIOLATION above STATIC_CONTRACT_MODE_COOPERATIVE; STATIC_CONTRACT_CANNOT_TAKE_LOCK; @@ -838,7 +829,6 @@ OBJECTREF::OBJECTREF() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; m_asObj = (Object*)POISONC; Thread::ObjectRefNew(this); @@ -852,7 +842,6 @@ OBJECTREF::OBJECTREF(const OBJECTREF & objref) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_FORBID_FAULT; VALIDATEOBJECT(objref.m_asObj); @@ -886,7 +875,6 @@ OBJECTREF::OBJECTREF(const OBJECTREF *pObjref, tagVolatileLoadWithoutBarrier tag STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_FORBID_FAULT; Object* objrefAsObj = VolatileLoadWithoutBarrier(&pObjref->m_asObj); VALIDATEOBJECT(objrefAsObj); @@ -920,7 +908,6 @@ OBJECTREF::OBJECTREF(TADDR nul) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; //_ASSERTE(nul == 0); m_asObj = (Object*)nul; @@ -946,7 +933,6 @@ OBJECTREF::OBJECTREF(Object *pObject) STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_FORBID_FAULT; DEBUG_ONLY_FUNCTION; @@ -979,7 +965,6 @@ int OBJECTREF::operator!() const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; // We don't do any validation here, as we want to allow zero comparison in preemptive mode return !m_asObj; @@ -992,7 +977,6 @@ int OBJECTREF::operator==(const OBJECTREF &objref) const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (objref.m_asObj != NULL) // Allow comparison to zero in preemptive mode { @@ -1030,7 +1014,6 @@ int OBJECTREF::operator!=(const OBJECTREF &objref) const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (objref.m_asObj != NULL) // Allow comparison to zero in preemptive mode { @@ -1070,7 +1053,6 @@ Object* OBJECTREF::operator->() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; VALIDATEOBJECT(m_asObj); // If this assert fires, you probably did not protect @@ -1095,7 +1077,6 @@ const Object* OBJECTREF::operator->() const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; VALIDATEOBJECT(m_asObj); // If this assert fires, you probably did not protect @@ -1124,7 +1105,6 @@ OBJECTREF& OBJECTREF::operator=(const OBJECTREF &objref) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; VALIDATEOBJECT(objref.m_asObj); @@ -1158,7 +1138,6 @@ OBJECTREF& OBJECTREF::operator=(TADDR nul) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(nul == 0); Thread::ObjectRefAssign(this); @@ -1415,7 +1394,6 @@ OBJECTREF Nullable::Box(void* srcPtr, MethodTable* nullableMT) } CONTRACTL_END; - FAULT_NOT_FATAL(); // FIX_NOW: why do we need this? Nullable* src = (Nullable*) srcPtr; diff --git a/src/coreclr/vm/object.inl b/src/coreclr/vm/object.inl index 6780ec440ea3f9..389f8a030e6d55 100644 --- a/src/coreclr/vm/object.inl +++ b/src/coreclr/vm/object.inl @@ -189,7 +189,6 @@ inline TypeHandle ArrayBase::GetArrayElementTypeHandle() const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_SUPPORTS_DAC; return GetGCSafeMethodTable()->GetArrayElementTypeHandle(); @@ -227,7 +226,6 @@ inline TypeHandle Object::GetTypeHandle() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END diff --git a/src/coreclr/vm/olevariant.cpp b/src/coreclr/vm/olevariant.cpp index 1dcdedb59a32e8..ecacef1977ec47 100644 --- a/src/coreclr/vm/olevariant.cpp +++ b/src/coreclr/vm/olevariant.cpp @@ -459,7 +459,6 @@ void OleVariant::MarshalRecordVariantOleToObject(const VARIANT *pOleVariant, THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pOleVariant)); PRECONDITION(CheckPointer(pObj)); PRECONDITION(*pObj == NULL || (IsProtectedByGCFrame (pObj))); @@ -821,7 +820,6 @@ void OleVariant::MarshalObjectForOleVariant(const VARIANT * pOle, OBJECTREF * co THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pOle)); PRECONDITION(CheckPointer(pObj)); PRECONDITION(*pObj == NULL || (IsProtectedByGCFrame (pObj))); @@ -1735,7 +1733,6 @@ BASEARRAYREF OleVariant::CreateArrayRefForSafeArray(SAFEARRAY *pSafeArray, VARTY THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pSafeArray)); PRECONDITION(vt != VT_EMPTY); } @@ -2271,7 +2268,6 @@ void OleVariant::TransposeArrayData(BYTE *pDestData, BYTE *pSrcData, SIZE_T dwNu THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pDestData)); PRECONDITION(CheckPointer(pSrcData)); PRECONDITION(CheckPointer(pSafeArray)); diff --git a/src/coreclr/vm/peassembly.cpp b/src/coreclr/vm/peassembly.cpp index dcadff38073c22..f83aa4fe6232cb 100644 --- a/src/coreclr/vm/peassembly.cpp +++ b/src/coreclr/vm/peassembly.cpp @@ -174,7 +174,6 @@ void PEAssembly::GetPathOrCodeBase(SString &result) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -284,7 +283,6 @@ void PEAssembly::OpenImporter() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -309,7 +307,6 @@ void PEAssembly::ConvertMDInternalToReadWrite() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(EX_THROW(EEMessageException, (E_OUTOFMEMORY));); } CONTRACTL_END; @@ -376,7 +373,6 @@ void PEAssembly::OpenMDImport() THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -405,7 +401,6 @@ void PEAssembly::OpenEmitter() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -447,7 +442,6 @@ void PEAssembly::GetEmbeddedResource(DWORD dwOffset, DWORD *cbResource, PBYTE *p THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory();); } CONTRACTL_END; @@ -475,7 +469,6 @@ PEAssembly* PEAssembly::LoadAssembly(mdAssemblyRef kAssemblyRef) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -505,7 +498,6 @@ BOOL PEAssembly::GetResource(LPCSTR szName, DWORD *cbResource, INSTANCE_CHECK; THROWS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); WRAPPER(GC_TRIGGERS); } CONTRACTL_END; @@ -836,7 +828,6 @@ BOOL PEAssembly::GetCodeBase(SString &result) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -866,7 +857,6 @@ void PEAssembly::PathToUrl(SString &string) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -975,7 +965,6 @@ LPCWSTR PEAssembly::GetPathForErrorMessages() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); SUPPORTS_DAC_HOST_ONLY; } CONTRACTL_END diff --git a/src/coreclr/vm/peassembly.inl b/src/coreclr/vm/peassembly.inl index f16144a1e0ac39..c0a09602f634b0 100644 --- a/src/coreclr/vm/peassembly.inl +++ b/src/coreclr/vm/peassembly.inl @@ -125,7 +125,6 @@ inline void PEAssembly::GetMVID(GUID *pMvid) { THROWS; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; } CONTRACTL_END; @@ -352,7 +351,7 @@ inline BOOL PEAssembly::IsILOnly() WRAPPER_NO_CONTRACT; SUPPORTS_DAC; - CONTRACT_VIOLATION(ThrowsViolation|GCViolation|FaultViolation); + CONTRACT_VIOLATION(ThrowsViolation|GCViolation); if (IsReflectionEmit()) return FALSE; @@ -689,7 +688,6 @@ inline BOOL PEAssembly::IsPtrInPEImage(PTR_CVOID data) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; @@ -809,7 +807,6 @@ inline DWORD PEAssembly::GetFlags() INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; } CONTRACTL_END; diff --git a/src/coreclr/vm/peimage.cpp b/src/coreclr/vm/peimage.cpp index de61356db2930f..b285072b182e09 100644 --- a/src/coreclr/vm/peimage.cpp +++ b/src/coreclr/vm/peimage.cpp @@ -31,7 +31,6 @@ void PEImage::Startup() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -134,11 +133,10 @@ ULONG PEImage::Release() DESTRUCTOR_CHECK; NOTHROW; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; - CONTRACT_VIOLATION(FaultViolation|ThrowsViolation); + CONTRACT_VIOLATION(ThrowsViolation); COUNT_T result = 0; { // Use scoping to hold the hash lock @@ -304,7 +302,6 @@ void PEImage::OpenMDImport() GC_TRIGGERS; THROWS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; if (m_pMDImport==NULL) @@ -361,7 +358,6 @@ void PEImage::GetMVID(GUID *pMvid) GC_TRIGGERS; THROWS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -429,7 +425,6 @@ PEImage::IJWFixupData *PEImage::GetIJWData(void *pBase) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END // Take the IJW hash lock @@ -832,7 +827,6 @@ BOOL PEImage::IsPtrInImage(PTR_CVOID data) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/coreclr/vm/peimagelayout.cpp b/src/coreclr/vm/peimagelayout.cpp index c560e78ed5a76f..fbdcada5e07b31 100644 --- a/src/coreclr/vm/peimagelayout.cpp +++ b/src/coreclr/vm/peimagelayout.cpp @@ -870,7 +870,6 @@ FlatImageLayout::FlatImageLayout(PEImage* pOwner, const BYTE* array, COUNT_T siz THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; m_pOwner = pOwner; diff --git a/src/coreclr/vm/peimagelayout.inl b/src/coreclr/vm/peimagelayout.inl index 1a45e5d4f119e3..f92530d9bd78a7 100644 --- a/src/coreclr/vm/peimagelayout.inl +++ b/src/coreclr/vm/peimagelayout.inl @@ -29,7 +29,6 @@ inline ULONG PEImageLayout::Release() DESTRUCTOR_CHECK; NOTHROW; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; diff --git a/src/coreclr/vm/pendingload.cpp b/src/coreclr/vm/pendingload.cpp index f8fe5159ea1033..38ed7851029470 100644 --- a/src/coreclr/vm/pendingload.cpp +++ b/src/coreclr/vm/pendingload.cpp @@ -119,7 +119,6 @@ VOID DECLSPEC_NORETURN PendingTypeLoadTable::Entry::ThrowException() CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -157,7 +156,6 @@ void PendingTypeLoadTable::Entry::SetException(Exception *pException) // the details - so be it EX_TRY { - FAULT_NOT_FATAL(); m_pException = pException->Clone(); } EX_CATCH diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/vm/proftoeeinterfaceimpl.cpp index 36b07011130056..980d8ed25e647b 100644 --- a/src/coreclr/vm/proftoeeinterfaceimpl.cpp +++ b/src/coreclr/vm/proftoeeinterfaceimpl.cpp @@ -1336,7 +1336,6 @@ void ScanRootsHelper(Object* pObj, Object ** ppRoot, ScanContext *pSC, uint32_t // On the other hand, this only means profiling information will be incomplete, // so it's ok to swallow E_OUTOFMEMORY. // - FAULT_NOT_FATAL(); ProfilingScanContext *pPSC = (ProfilingScanContext *)pSC; @@ -5207,15 +5206,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassFromTokenAndTypeArgs(ModuleID moduleID, // impact retail builds, in which contracts are not available. ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE(); - // ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE also defines FAULT_FORBID, which - // causes Scanruntime to flag a fault violation in AssemblySpec::InitializeSpec, - // which is defined as FAULTS. It only happens in a type-loading path, which - // is not supported on a non-EE thread. Suppressing a contract violation in an - // unsupported execution path is more preferable than causing AV when calling - // GetClassFromTokenAndTypeArgs on a non-EE thread in a check build. See Dev10 - // 682526 for more details. - FAULT_NOT_FATAL(); - th = ClassLoader::LoadGenericInstantiationThrowing(pModule, typeDef, Instantiation(genericParameters, cTypeArgs), @@ -9807,7 +9797,6 @@ HRESULT ProfilingGetFunctionEnter3Info(FunctionID functionId, { // Can handle E_OUTOFMEMORY from ProfileArgIterator. - FAULT_NOT_FATAL(); pProfileArgIterator = new (nothrow) ProfileArgIterator(&metaSig, pELTInfo->platformSpecificHandle); @@ -10006,7 +9995,6 @@ HRESULT ProfilingGetFunctionLeave3Info(FunctionID functionId, { // Can handle E_OUTOFMEMORY from ProfileArgIterator. - FAULT_NOT_FATAL(); pProfileArgIterator = new (nothrow) ProfileArgIterator(&metaSig, pELTInfo->platformSpecificHandle); @@ -10168,7 +10156,6 @@ HRESULT ProfilingGetFunctionTailcall3Info(FunctionID functionId, { // Can handle E_OUTOFMEMORY from ProfileArgIterator. - FAULT_NOT_FATAL(); pProfileArgIterator = new (nothrow) ProfileArgIterator(&metaSig, pELTInfo->platformSpecificHandle); @@ -10812,7 +10799,6 @@ HCIMPL2(EXTERN_C void, ProfileEnter, UINT_PTR clientData, void * platformSpecifi { // Can handle E_OUTOFMEMORY from ProfileArgIterator. - FAULT_NOT_FATAL(); pProfileArgIterator = new (nothrow) ProfileArgIterator(&metaSig, platformSpecificHandle); diff --git a/src/coreclr/vm/readytoruninfo.cpp b/src/coreclr/vm/readytoruninfo.cpp index 12618b19863f28..0ddc7d72e47c5b 100644 --- a/src/coreclr/vm/readytoruninfo.cpp +++ b/src/coreclr/vm/readytoruninfo.cpp @@ -2217,7 +2217,6 @@ class NativeManifestModule : public ModuleBase MODE_ANY; PRECONDITION(TypeFromToken(kFile) == mdtFile || TypeFromToken(kFile) == mdtModuleRef); - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/coreclr/vm/reflectclasswriter.cpp b/src/coreclr/vm/reflectclasswriter.cpp index 62ecff703e0fa0..caa8dff09d3db8 100644 --- a/src/coreclr/vm/reflectclasswriter.cpp +++ b/src/coreclr/vm/reflectclasswriter.cpp @@ -16,7 +16,6 @@ HRESULT RefClassWriter::Init(ICeeGenInternal *pCeeGen, IUnknown *pUnk, LPCWSTR s { CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(return(E_OUTOFMEMORY)); PRECONDITION(CheckPointer(pCeeGen)); PRECONDITION(CheckPointer(pUnk)); @@ -75,7 +74,6 @@ RefClassWriter::~RefClassWriter() // we know that the com implementation is ours so we use mode-any to simplify // having to switch mode MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; diff --git a/src/coreclr/vm/runtimecallablewrapper.cpp b/src/coreclr/vm/runtimecallablewrapper.cpp index 196fc636ed3c96..3df0710a1261de 100644 --- a/src/coreclr/vm/runtimecallablewrapper.cpp +++ b/src/coreclr/vm/runtimecallablewrapper.cpp @@ -55,7 +55,6 @@ void ComClassFactory::ThrowHRMsg(HRESULT hr, DWORD dwMsgResID) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -87,7 +86,6 @@ IUnknown *ComClassFactory::CreateInstanceFromClassFactory(IClassFactory *pClassF THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pClassFact)); PRECONDITION(CheckPointer(punkOuter, NULL_OK)); PRECONDITION(CheckPointer(pfDidContainment, NULL_OK)); @@ -235,7 +233,6 @@ OBJECTREF ComClassFactory::CreateAggregatedInstance(MethodTable* pMTClass, BOOL THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pMTClass)); } CONTRACTL_END; @@ -452,7 +449,6 @@ OBJECTREF ComClassFactory::CreateInstance(MethodTable* pMTClass, BOOL ForManaged THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pMTClass, NULL_OK)); } CONTRACTL_END; @@ -1204,7 +1200,6 @@ RCW* RCW::CreateRCW(IUnknown *pUnk, DWORD dwSyncBlockIndex, DWORD flags, MethodT THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -1225,7 +1220,6 @@ RCW* RCW::CreateRCWInternal(IUnknown *pUnk, DWORD dwSyncBlockIndex, DWORD flags, THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pUnk)); PRECONDITION(dwSyncBlockIndex != 0); PRECONDITION(CheckPointer(pClassMT)); @@ -1262,7 +1256,6 @@ void RCW::Initialize(IUnknown* pUnk, DWORD dwSyncBlockIndex, MethodTable *pClass THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(CheckPointer(pUnk)); PRECONDITION(dwSyncBlockIndex != 0); PRECONDITION(CheckPointer(pClassMT)); @@ -1621,7 +1614,6 @@ void RCW::CreateDuplicateWrapper(MethodTable *pNewMT, RCWHolder* pNewRCW) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pNewMT)); PRECONDITION(pNewMT->IsComObjectType()); PRECONDITION(CheckPointer(pNewRCW)); @@ -2152,7 +2144,6 @@ OBJECTREF ComObject::CreateComObjectRef(MethodTable* pMT) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pMT)); PRECONDITION(pMT->IsComObjectType()); } @@ -2178,7 +2169,6 @@ BOOL ComObject::SupportsInterface(OBJECTREF oref, MethodTable* pIntfTable) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(oref != NULL); PRECONDITION(CheckPointer(pIntfTable)); } diff --git a/src/coreclr/vm/sigformat.cpp b/src/coreclr/vm/sigformat.cpp index 2e40cf514887b8..8559588e99603d 100644 --- a/src/coreclr/vm/sigformat.cpp +++ b/src/coreclr/vm/sigformat.cpp @@ -9,7 +9,7 @@ SigFormat::SigFormat() { - WRAPPER_NO_CONTRACT; // THROWS;GC_TRIGGERS;INJECT_FAULT(ThrowOM) + WRAPPER_NO_CONTRACT; // THROWS;GC_TRIGGERS; _size = SIG_INC; _pos = 0; _fmtSig = new char[_size]; @@ -31,7 +31,6 @@ SigFormat::SigFormat(MethodDesc* pMeth, TypeHandle owner, BOOL fIgnoreMethodName { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -81,7 +80,6 @@ void SigFormat::AddString(LPCUTF8 s) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -120,7 +118,6 @@ void SigFormat::AddTypeString(Module* pModule, SigPointer sig, const SigTypeCont { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -351,7 +348,6 @@ void SigFormat::FormatSig(MetaSig &sig, LPCUTF8 szMemberName, LPCUTF8 szClassNam { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -409,7 +405,6 @@ void SigFormat::AddType(TypeHandle th) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END diff --git a/src/coreclr/vm/siginfo.cpp b/src/coreclr/vm/siginfo.cpp index 05a667917707b4..05c245f78cfc8f 100644 --- a/src/coreclr/vm/siginfo.cpp +++ b/src/coreclr/vm/siginfo.cpp @@ -626,7 +626,6 @@ void MetaSig::Init( NOTHROW; MODE_ANY; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(szMetaSig)); PRECONDITION(CheckPointer(pModule)); PRECONDITION(CheckPointer(pTypeContext, NULL_OK)); @@ -779,7 +778,6 @@ static BOOL MethodDescMatchesSig(MethodDesc* pMD, PCCOR_SIGNATURE pSig, DWORD cS { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -800,7 +798,6 @@ MetaSig::MetaSig(BinderMethodID id) THROWS; MODE_ANY; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -819,7 +816,6 @@ MetaSig::MetaSig(LPHARDCODEDMETASIG pwzMetaSig) THROWS; MODE_ANY; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -901,7 +897,6 @@ MetaSig::NextArg() NOTHROW; MODE_ANY; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -972,7 +967,6 @@ IsTypeRefOrDef( { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; } CONTRACTL_END @@ -1109,7 +1103,6 @@ TypeHandle SigPointer::GetTypeHandleThrowing( if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; MODE_ANY; 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 != ClassLoader::LoadTypes) { LOADS_TYPE(CLASS_LOAD_BEGIN); } else { LOADS_TYPE(level); } PRECONDITION(CheckPointer(pModule)); PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); @@ -1965,7 +1958,6 @@ TypeHandle SigPointer::GetGenericInstType(ModuleBase * pModule, if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; MODE_ANY; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(return TypeHandle();); } if (FORBIDGC_LOADER_USE_ENABLED() || fLoadTypes != ClassLoader::LoadTypes) { LOADS_TYPE(CLASS_LOAD_BEGIN); } else { LOADS_TYPE(level); } SUPPORTS_DAC; } @@ -2067,7 +2059,6 @@ TypeHandle SigPointer::GetTypeVariableThrowing(ModuleBase *pModule, // unused - if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; MODE_ANY; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } SUPPORTS_DAC; } CONTRACTL_END @@ -2396,7 +2387,6 @@ BOOL SigPointer::HasCustomModifier(Module *pModule, LPCSTR szModName, CorElement INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; } CONTRACTL_END @@ -2478,7 +2468,6 @@ BOOL SigPointer::IsTypeDef(mdTypeDef* pTypeDef) const INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; } CONTRACTL_END; @@ -2514,7 +2503,6 @@ CorElementType SigPointer::PeekElemTypeNormalized(Module* pModule, const SigType INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; SUPPORTS_DAC; } @@ -2563,7 +2551,6 @@ SigPointer::PeekElemTypeClosed( INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; SUPPORTS_DAC; } @@ -2649,7 +2636,6 @@ mdTypeRef SigPointer::PeekValueTypeTokenClosed(Module *pModule, const SigTypeCon NOTHROW; GC_NOTRIGGER; PRECONDITION(PeekElemTypeClosed(NULL, pTypeContext) == ELEMENT_TYPE_VALUETYPE); - FORBID_FAULT; MODE_ANY; } CONTRACTL_END @@ -2725,7 +2711,6 @@ UINT MetaSig::GetElemSize(CorElementType etype, TypeHandle thValueType) { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; SUPPORTS_DAC; } @@ -2763,7 +2748,6 @@ UINT SigPointer::SizeOf(Module* pModule, const SigTypeContext *pTypeContext, Typ INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; UNCHECKED(PRECONDITION(CheckPointer(pModule))); UNCHECKED(PRECONDITION(CheckPointer(pTypeContext, NULL_OK))); @@ -2814,7 +2798,6 @@ CorElementType MetaSig::GetByRefType(TypeHandle *pTy) const INSTANCE_CHECK; THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -3251,7 +3234,6 @@ BOOL IsTypeDefEquivalent(mdToken tk, Module *pModule) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END; @@ -3368,7 +3350,6 @@ BOOL CompareTypeDefsForEquivalence(mdToken tk1, mdToken tk2, Module *pModule1, M { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END; @@ -3543,7 +3524,6 @@ BOOL CompareTypeTokens(mdToken tk1, mdToken tk2, ModuleBase *pModule1, ModuleBas { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -3788,7 +3768,6 @@ MetaSig::CompareElementType( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -4394,7 +4373,6 @@ MetaSig::CompareTypeDefsUnderSubstitutions( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -4467,7 +4445,6 @@ TypeHandleCompareHelper( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -4492,7 +4469,6 @@ MetaSig::CompareMethodSigs( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -4557,7 +4533,6 @@ MetaSig::CompareMethodSigs( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -4774,7 +4749,6 @@ MetaSig::CompareElementTypeToToken( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -4927,7 +4901,6 @@ BOOL MetaSig::CompareTypeSpecToToken(mdTypeSpec tk1, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -4959,7 +4932,6 @@ BOOL MetaSig::CompareTypeDefOrRefOrSpec(ModuleBase *pModule1, mdToken tok1, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -5008,7 +4980,6 @@ BOOL MetaSig::CompareVariableConstraints(const Substitution *pSubst1, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -5111,7 +5082,6 @@ BOOL MetaSig::CompareMethodConstraints(const Substitution *pSubst1, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; } CONTRACTL_END @@ -5353,7 +5323,6 @@ VOID MetaSig::GcScanRoots(ArgDestination *pValue, INSTANCE_CHECK; if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; } CONTRACTL_END diff --git a/src/coreclr/vm/siginfo.hpp b/src/coreclr/vm/siginfo.hpp index eaec1e8c0d3083..c192a62b1bdef0 100644 --- a/src/coreclr/vm/siginfo.hpp +++ b/src/coreclr/vm/siginfo.hpp @@ -809,7 +809,6 @@ class MetaSig { if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS; if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS; - if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); } MODE_ANY; SUPPORTS_DAC; } diff --git a/src/coreclr/vm/stackingallocator.cpp b/src/coreclr/vm/stackingallocator.cpp index b34dfb83541eea..843ab82814f7d0 100644 --- a/src/coreclr/vm/stackingallocator.cpp +++ b/src/coreclr/vm/stackingallocator.cpp @@ -226,7 +226,6 @@ void* StackingAllocator::UnsafeAllocSafeThrow(UINT32 Size) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(m_CheckpointDepth > 0); } CONTRACTL_END; @@ -247,7 +246,6 @@ void *StackingAllocator::UnsafeAlloc(UINT32 Size) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(ThrowOutOfMemory()); PRECONDITION(m_CheckpointDepth > 0); } CONTRACTL_END; @@ -366,8 +364,6 @@ void StackingAllocator::Clear(StackBlock *ToBlock) void * __cdecl operator new(size_t n, StackingAllocator * alloc) { STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_FAULT; - #ifdef HOST_64BIT // size_t's too big on 64-bit platforms so we check for overflow if(n > (size_t)(1<<31)) ThrowOutOfMemory(); @@ -381,8 +377,6 @@ void * __cdecl operator new(size_t n, StackingAllocator * alloc) void * __cdecl operator new[](size_t n, StackingAllocator * alloc) { STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_FAULT; - #ifdef HOST_64BIT // size_t's too big on 64-bit platforms so we check for overflow if(n > (size_t)(1<<31)) ThrowOutOfMemory(); @@ -400,8 +394,6 @@ void * __cdecl operator new[](size_t n, StackingAllocator * alloc) void * __cdecl operator new(size_t n, StackingAllocator * alloc, const std::nothrow_t&) noexcept { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FAULT; - #ifdef HOST_64BIT // size_t's too big on 64-bit platforms so we check for overflow if(n > (size_t)(1<<31)) return NULL; @@ -413,8 +405,6 @@ void * __cdecl operator new(size_t n, StackingAllocator * alloc, const std::noth void * __cdecl operator new[](size_t n, StackingAllocator * alloc, const std::nothrow_t&) noexcept { STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_FAULT; - #ifdef HOST_64BIT // size_t's too big on 64-bit platforms so we check for overflow if(n > (size_t)(1<<31)) return NULL; diff --git a/src/coreclr/vm/stackingallocator.h b/src/coreclr/vm/stackingallocator.h index b89329d895e8f5..40daa78e9a7439 100644 --- a/src/coreclr/vm/stackingallocator.h +++ b/src/coreclr/vm/stackingallocator.h @@ -111,7 +111,6 @@ class StackingAllocator NOTHROW; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(return NULL;); PRECONDITION(m_CheckpointDepth > 0); } CONTRACTL_END; diff --git a/src/coreclr/vm/stdinterfaces.cpp b/src/coreclr/vm/stdinterfaces.cpp index 775b7a5f440843..b7959de9c874e1 100644 --- a/src/coreclr/vm/stdinterfaces.cpp +++ b/src/coreclr/vm/stdinterfaces.cpp @@ -664,7 +664,6 @@ HRESULT GetITypeInfoForEEClass(MethodTable *pClass, ITypeInfo **ppTI, bool bClas DISABLED(NOTHROW); GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(return E_OUTOFMEMORY); } CONTRACTL_END; @@ -920,7 +919,6 @@ IErrorInfo *GetSupportedErrorInfo(IUnknown *iface, REFIID riid) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(iface)); } CONTRACTL_END; @@ -1254,7 +1252,6 @@ Dispatch_GetIDsOfNames(IDispatch* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR NOTHROW; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(return E_OUTOFMEMORY); PRECONDITION(CheckPointer(pDisp)); PRECONDITION(IsInProcCCWTearOff(pDisp)); PRECONDITION(CheckPointer(rgszNames, NULL_OK)); @@ -1289,7 +1286,6 @@ Dispatch_Invoke THROWS; // InternalDispatchImpl_Invoke can throw if it encounters CE GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(return E_OUTOFMEMORY); PRECONDITION(CheckPointer(pDisp)); PRECONDITION(IsInProcCCWTearOff(pDisp)); } diff --git a/src/coreclr/vm/stringliteralmap.cpp b/src/coreclr/vm/stringliteralmap.cpp index 208286ecb2c4ff..631211e29fe7a2 100644 --- a/src/coreclr/vm/stringliteralmap.cpp +++ b/src/coreclr/vm/stringliteralmap.cpp @@ -71,7 +71,6 @@ void StringLiteralMap::Init() THROWS; GC_TRIGGERS; PRECONDITION(CheckPointer(this)); - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; @@ -346,7 +345,6 @@ void GlobalStringLiteralMap::Init() THROWS; GC_NOTRIGGER; PRECONDITION(CheckPointer(this)); - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; @@ -433,7 +431,6 @@ static void LogStringLiteral(_In_z_ const char* action, EEStringData *pStringDat { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; ULONG length = pStringData->GetCharCount(); length = min(length, (ULONG)128); diff --git a/src/coreclr/vm/stubgen.cpp b/src/coreclr/vm/stubgen.cpp index b6e2ec3a0e0d6d..6463b7d6801d20 100644 --- a/src/coreclr/vm/stubgen.cpp +++ b/src/coreclr/vm/stubgen.cpp @@ -1994,7 +1994,6 @@ DWORD ILStubLinker::NewLocal(CorElementType typ) CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -2032,7 +2031,6 @@ DWORD StubSigBuilder::Append(LocalDesc* pLoc) CONTRACTL { STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pLoc)); } CONTRACTL_END; @@ -2516,7 +2514,6 @@ ILStubLinker::ILStubLinker(Module* pStubSigModule, const Signature &signature, S { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END diff --git a/src/coreclr/vm/stubmgr.cpp b/src/coreclr/vm/stubmgr.cpp index d4521dc8930c20..7f59df5b170578 100644 --- a/src/coreclr/vm/stubmgr.cpp +++ b/src/coreclr/vm/stubmgr.cpp @@ -77,7 +77,6 @@ const CHAR * TraceDestination::DbgToString(SString & buffer) SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - FAULT_NOT_FATAL(); EX_TRY { @@ -171,7 +170,6 @@ void TraceDestination::InitForUnjittedMethod(MethodDesc * pDesc) { MethodDesc * pNewDesc = NULL; - FAULT_NOT_FATAL(); #ifndef DACCESS_COMPILE @@ -382,7 +380,6 @@ BOOL StubManager::IsSingleOwner(PCODE stubAddress, StubManager * pOwner) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_CAN_TAKE_LOCK; // courtesy StubManagerIterator // ensure this stubmanager owns it. @@ -559,7 +556,6 @@ BOOL StubManager::TraceStub(PCODE stubStartAddress, TraceDestination *trace) if (fValid) { SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - FAULT_NOT_FATAL(); SString buffer; DbgWriteLog(" td=%s\n", trace->DbgToString(buffer)); } @@ -605,7 +601,6 @@ BOOL StubManager::FollowTrace(TraceDestination *trace) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; while (trace->GetTraceType() == TRACE_STUB) { @@ -779,7 +774,6 @@ void StubManager::DbgBeginLog(TADDR addrCallInstruction, TADDR addrCallTarget) } // Now that we know we're not interop-debugging, we can safely call new. SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - FAULT_NOT_FATAL(); { CrstHolder ch(&s_DbgLogCrst); @@ -823,7 +817,6 @@ void StubManager::DbgFinishLog() // Since this is just a tool for debugging, we don't care if we call new. SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - FAULT_NOT_FATAL(); delete s_pDbgStubManagerLog; s_pDbgStubManagerLog = NULL; @@ -855,7 +848,6 @@ void StubManager::DbgWriteLog(const CHAR *format, ...) // Since this is just a tool for debugging, we don't care if we call new. SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - FAULT_NOT_FATAL(); CrstHolder ch(&s_DbgLogCrst); @@ -909,7 +901,6 @@ void StubManager::DbgGetLog(SString * pStringOut) // Since this is just a tool for debugging, we don't care if we call new. SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - FAULT_NOT_FATAL(); CrstHolder ch(&s_DbgLogCrst); @@ -1050,7 +1041,6 @@ BOOL PrecodeStubManager::DoTraceStub(PCODE stubStartAddress, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END @@ -1376,7 +1366,6 @@ BOOL StubLinkStubManager::TraceManager(Thread *thread, THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(return FALSE;); } CONTRACTL_END @@ -1476,7 +1465,6 @@ BOOL RangeSectionStubManager::DoTraceStub(PCODE stubStartAddress, TraceDestinati NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END diff --git a/src/coreclr/vm/syncblk.cpp b/src/coreclr/vm/syncblk.cpp index 3fa07e433449b9..9f5e41e22873cd 100644 --- a/src/coreclr/vm/syncblk.cpp +++ b/src/coreclr/vm/syncblk.cpp @@ -285,7 +285,6 @@ void SyncBlockCache::Init() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -447,7 +446,6 @@ void SyncBlockCache::Start() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -554,7 +552,6 @@ SyncBlock *SyncBlockCache::GetNextFreeSyncBlock() { CONTRACTL { - INJECT_FAULT(COMPlusThrowOM()); THROWS; GC_NOTRIGGER; MODE_ANY; @@ -611,7 +608,6 @@ void SyncBlockCache::Grow() THROWS; GC_NOTRIGGER; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -648,7 +644,6 @@ void SyncBlockCache::Grow() //! From here on, we assume that we will succeed and start doing global side-effects. //! Any operation that could fail must occur before this point. CANNOTTHROWCOMPLUSEXCEPTION(); - FAULT_FORBID(); newSyncTable.SuppressRelease(); newBitMap.SuppressRelease(); @@ -705,7 +700,6 @@ DWORD SyncBlockCache::NewSyncBlockSlot(Object *obj) THROWS; GC_NOTRIGGER; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; _ASSERTE(m_CacheLock.OwnedByCurrentThread()); // GetSyncBlock takes the lock, make sure no one else does. @@ -764,7 +758,6 @@ void SyncBlockCache::DeleteSyncBlock(SyncBlock *psb) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -815,7 +808,6 @@ void SyncBlockCache::DeleteSyncBlockMemory(SyncBlock *psb) INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -1424,7 +1416,6 @@ DWORD ObjHeader::GetSyncBlockIndex() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1560,7 +1551,6 @@ SyncBlock *ObjHeader::GetSyncBlock() THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -1606,8 +1596,6 @@ SyncBlock *ObjHeader::GetSyncBlock() //! NewSyncBlockSlot has side-effects that we don't have backout for - thus, that must be the last //! failable operation called. CANNOTTHROWCOMPLUSEXCEPTION(); - FAULT_FORBID(); - syncBlockMemoryHolder.SuppressRelease(); diff --git a/src/coreclr/vm/syncblk.h b/src/coreclr/vm/syncblk.h index 3cd637810282b6..81dc4f1dec5528 100644 --- a/src/coreclr/vm/syncblk.h +++ b/src/coreclr/vm/syncblk.h @@ -771,7 +771,6 @@ class ObjHeader INSTANCE_CHECK; NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; MODE_ANY; PRECONDITION(GetHeaderSyncBlockIndex() == 0); PRECONDITION(m_SyncBlockValue & BIT_SBLK_SPIN_LOCK); diff --git a/src/coreclr/vm/tailcallhelp.cpp b/src/coreclr/vm/tailcallhelp.cpp index 92efd671e2a6d0..3ad4f365c20546 100644 --- a/src/coreclr/vm/tailcallhelp.cpp +++ b/src/coreclr/vm/tailcallhelp.cpp @@ -118,7 +118,6 @@ MethodDesc* TailCallHelp::GetOrLoadTailCallDispatcherMD() { THROWS; GC_TRIGGERS; - INJECT_FAULT(ThrowOutOfMemory()); } CONTRACTL_END; diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index 3a8d4d1901be00..f97430acf59afa 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -3660,7 +3660,6 @@ Thread::ApartmentState Thread::SetApartment(ApartmentState state) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -4871,7 +4870,6 @@ BOOL Thread::UniqueStack(void* stackStart) else { fUnique = TRUE; - FAULT_NOT_FATAL(); UniqueStackHelper(stackTraceHash, stackTrace); } #ifdef _DEBUG diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h index 96db33d50df211..4036067b7bb095 100644 --- a/src/coreclr/vm/threads.h +++ b/src/coreclr/vm/threads.h @@ -5135,7 +5135,7 @@ class GCForbidLoaderUseHolder #endif -// Declaring this macro turns off the GC_TRIGGERS/THROWS/INJECT_FAULT contract in LoadTypeHandle. +// Declaring this macro turns off the GC_TRIGGERS/THROWS contract in LoadTypeHandle. // If you do this, you must restrict your use of the loader only to retrieve TypeHandles // for types that have already been loaded and resolved. If you fail to observe this restriction, you will // reach a GC_TRIGGERS point somewhere in the loader and assert. If you're lucky, that is. @@ -5165,8 +5165,7 @@ class GCForbidLoaderUseHolder #ifdef ENABLE_CONTRACTS_IMPL #define ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE() GCForbidLoaderUseHolder __gcfluh; \ CANNOTTHROWCOMPLUSEXCEPTION(); \ - GCX_NOTRIGGER(); \ - FAULT_FORBID(); + GCX_NOTRIGGER(); #else // _DEBUG_IMPL #define ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE() ; #endif // _DEBUG_IMPL diff --git a/src/coreclr/vm/threadstatics.cpp b/src/coreclr/vm/threadstatics.cpp index d5ae02973ac091..18788eee2559e6 100644 --- a/src/coreclr/vm/threadstatics.cpp +++ b/src/coreclr/vm/threadstatics.cpp @@ -332,7 +332,6 @@ void AllocateThreadStaticBoxes(MethodTable *pMT, PTRARRAYREF *ppRef) GC_TRIGGERS; MODE_COOPERATIVE; PRECONDITION(pMT->HasBoxedThreadStatics()); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; diff --git a/src/coreclr/vm/threadsuspend.cpp b/src/coreclr/vm/threadsuspend.cpp index 6b7bae1fa63edb..ffa7a535611f9e 100644 --- a/src/coreclr/vm/threadsuspend.cpp +++ b/src/coreclr/vm/threadsuspend.cpp @@ -5853,7 +5853,7 @@ void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext) return; } - // Calling this turns off the GC_TRIGGERS/THROWS/INJECT_FAULT contract in LoadTypeHandle. + // Calling this turns off the GC_TRIGGERS/THROWS contract in LoadTypeHandle. // We should not trigger any loads for unresolved types. ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE(); diff --git a/src/coreclr/vm/typectxt.cpp b/src/coreclr/vm/typectxt.cpp index 33ad0f0861a026..fcd4e6816ce37b 100644 --- a/src/coreclr/vm/typectxt.cpp +++ b/src/coreclr/vm/typectxt.cpp @@ -40,7 +40,6 @@ void SigTypeContext::InitTypeContext(MethodDesc *md, SigTypeContext *pRes) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; PRECONDITION(CheckPointer(md)); @@ -63,7 +62,6 @@ void SigTypeContext::InitTypeContext(MethodDesc *md, TypeHandle declaringType, S CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; PRECONDITION(CheckPointer(md)); @@ -174,7 +172,6 @@ void SigTypeContext::InitTypeContext(FieldDesc *pFD, TypeHandle declaringType, S CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(declaringType, NULL_OK)); PRECONDITION(CheckPointer(pFD)); @@ -189,7 +186,6 @@ void SigTypeContext::InitTypeContext(TypeHandle th, SigTypeContext *pRes) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; if (th.IsNull()) diff --git a/src/coreclr/vm/typedesc.cpp b/src/coreclr/vm/typedesc.cpp index 5b5c6f807c9c2c..55d6444edbea2c 100644 --- a/src/coreclr/vm/typedesc.cpp +++ b/src/coreclr/vm/typedesc.cpp @@ -25,7 +25,6 @@ BOOL ParamTypeDesc::Verify() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_CANNOT_TAKE_LOCK; STATIC_CONTRACT_DEBUG_ONLY; STATIC_CONTRACT_SUPPORTS_DAC; @@ -61,7 +60,6 @@ PTR_Module TypeDesc::GetLoaderModule() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; SUPPORTS_DAC; if (HasTypeParam()) @@ -124,7 +122,6 @@ PTR_Module TypeDesc::GetModule() { { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; // Function pointer types belong to no module //PRECONDITION(GetInternalCorElementType() != ELEMENT_TYPE_FNPTR); @@ -153,7 +150,6 @@ PTR_Module TypeDesc::GetModule() { Assembly* TypeDesc::GetAssembly() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; Module *pModule = GetModule(); _ASSERTE(pModule!=NULL); @@ -166,7 +162,6 @@ void TypeDesc::GetName(SString &ssBuf) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -196,7 +191,6 @@ void TypeDesc::ConstructName(CorElementType kind, { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM()); // SString operations can allocate. } CONTRACTL_END @@ -309,7 +303,6 @@ BOOL TypeDesc::CanCastTo(TypeHandle toTypeHnd, TypeHandlePairList *pVisited) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -389,7 +382,6 @@ BOOL TypeDesc::CanCastParam(TypeHandle fromParam, TypeHandle toParam, TypeHandle { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -439,7 +431,6 @@ TypeHandle::CastResult TypeDesc::CanCastToCached(TypeHandle toType) NOTHROW; GC_NOTRIGGER; MODE_COOPERATIVE; - FORBID_FAULT; } CONTRACTL_END @@ -489,7 +480,6 @@ TypeHandle TypeDesc::GetParent() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; CorElementType kind = GetInternalCorElementType(); @@ -507,7 +497,6 @@ OBJECTREF TypeDesc::GetManagedClassObject() GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -524,7 +513,6 @@ ClassLoadLevel TypeDesc::GetLoadLevel() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; SUPPORTS_DAC; if (_typeAndFlags & TypeDesc::enum_flag_IsNotFullyLoaded) @@ -760,7 +748,6 @@ void TypeVarTypeDesc::LoadConstraints(ClassLoadLevel level, WhichConstraintsToLo GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(level == CLASS_DEPENDENCIES_LOADED || level == CLASS_LOADED); } @@ -1138,7 +1125,6 @@ TypeHandle LoadTypeVarConstraint(TypeVarTypeDesc *pTypeVar, mdGenericParamConstr { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; PRECONDITION(CheckPointer(pTypeVar)); } @@ -1259,7 +1245,6 @@ BOOL SatisfiesSpecialConstraintRecursive(TypeVarTypeDesc *pTyArg, DWORD specialC { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; PRECONDITION(CheckPointer(pTyArg)); } @@ -1439,7 +1424,6 @@ void GatherConstraintsRecursive(TypeVarTypeDesc *pTyArg, ArrayList *pArgList, co { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); MODE_ANY; PRECONDITION(CheckPointer(pTyArg)); PRECONDITION(CheckPointer(pArgList)); @@ -1498,7 +1482,6 @@ BOOL TypeVarTypeDesc::SatisfiesConstraints(SigTypeContext *pTypeContextOfConstra MODE_ANY; PRECONDITION(!thArg.IsNull()); - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/typeequivalencehash.cpp b/src/coreclr/vm/typeequivalencehash.cpp index 0f61d594bb26d7..3c729f19e9335a 100644 --- a/src/coreclr/vm/typeequivalencehash.cpp +++ b/src/coreclr/vm/typeequivalencehash.cpp @@ -46,7 +46,6 @@ TypeEquivalenceHashTable *TypeEquivalenceHashTable::Create(AppDomain *pAppDomain THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; @@ -69,7 +68,6 @@ void TypeEquivalenceHashTable::RecordEquivalence(TypeHandle thA, TypeHandle thB, THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(match != TypeEquivalenceHashTable::MatchUnknown); } CONTRACTL_END; diff --git a/src/coreclr/vm/typehandle.cpp b/src/coreclr/vm/typehandle.cpp index 9c5cb10f2ca9cf..941fe30c81b7f3 100644 --- a/src/coreclr/vm/typehandle.cpp +++ b/src/coreclr/vm/typehandle.cpp @@ -23,7 +23,6 @@ BOOL TypeHandle::Verify() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; STATIC_CONTRACT_CANNOT_TAKE_LOCK; STATIC_CONTRACT_DEBUG_ONLY; STATIC_CONTRACT_SUPPORTS_DAC; @@ -588,7 +587,6 @@ BOOL TypeHandle::IsBoxedAndCanCastTo(TypeHandle type, TypeHandlePairList *pPairL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); LOADS_TYPE(CLASS_DEPENDENCIES_LOADED); @@ -635,7 +633,6 @@ BOOL TypeHandle::CanCastTo(TypeHandle type, TypeHandlePairList *pVisited) const THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); LOADS_TYPE(CLASS_DEPENDENCIES_LOADED); } @@ -701,7 +698,6 @@ void TypeHandle::GetName(SString &result) const { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -723,7 +719,6 @@ TypeHandle TypeHandle::GetParent() const { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (IsTypeDesc()) return(AsTypeDesc()->GetParent()); @@ -739,7 +734,6 @@ TypeHandle TypeHandle::MergeClassWithInterface(TypeHandle tClass, TypeHandle tIn { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -780,7 +774,6 @@ TypeHandle TypeHandle::MergeTypeHandlesToCommonParent(TypeHandle ta, TypeHandle { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -916,7 +909,6 @@ TypeHandle TypeHandle::MergeArrayTypeHandlesToCommonParent(TypeHandle ta, TypeHa { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -1059,7 +1051,6 @@ OBJECTREF TypeHandle::GetManagedClassObject() const GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; @@ -1337,7 +1328,6 @@ BOOL TypeHandle::SatisfiesClassConstraints() const GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END; diff --git a/src/coreclr/vm/typehandle.h b/src/coreclr/vm/typehandle.h index 4dd6c48d28fa20..b9e9267d0f865d 100644 --- a/src/coreclr/vm/typehandle.h +++ b/src/coreclr/vm/typehandle.h @@ -579,7 +579,6 @@ inline CHECK CheckPointer(TypeHandle th, IsNullOK ok = NULL_NOT_OK) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; SUPPORTS_DAC; STATIC_CONTRACT_CANNOT_TAKE_LOCK; diff --git a/src/coreclr/vm/typehandle.inl b/src/coreclr/vm/typehandle.inl index 2781f22d54bfb5..a9d5fced3b6542 100644 --- a/src/coreclr/vm/typehandle.inl +++ b/src/coreclr/vm/typehandle.inl @@ -258,7 +258,6 @@ FORCEINLINE OBJECTREF TypeHandle::GetManagedClassObjectIfExists() const NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; diff --git a/src/coreclr/vm/typehash.cpp b/src/coreclr/vm/typehash.cpp index a03aee31a7d3dc..31ee2e09bb3805 100644 --- a/src/coreclr/vm/typehash.cpp +++ b/src/coreclr/vm/typehash.cpp @@ -29,7 +29,6 @@ EETypeHashTable *EETypeHashTable::Create(LoaderAllocator* pAllocator, Module *pM THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -497,7 +496,6 @@ VOID EETypeHashTable::InsertValue(TypeHandle data) THROWS; GC_NOTRIGGER; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(IsUnsealed()); // If we are sealed then we should not be adding to this hashtable PRECONDITION(CheckPointer(data)); PRECONDITION(!data.IsGenericTypeDefinition()); // Generic type defs live in typedef table (availableClasses) diff --git a/src/coreclr/vm/util.cpp b/src/coreclr/vm/util.cpp index 67f522871e9bc7..55be0fd1b78c96 100644 --- a/src/coreclr/vm/util.cpp +++ b/src/coreclr/vm/util.cpp @@ -64,7 +64,6 @@ CQuickHeap::~CQuickHeap() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -89,7 +88,6 @@ LPVOID CQuickHeap::Alloc(UINT sz) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; sz = (sz+7) & ~7; @@ -126,7 +124,6 @@ void PrintToStdErrA(const char *pszString) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -139,7 +136,6 @@ void PrintToStdErrW(const WCHAR *pwzString) { THROWS; GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -158,7 +154,6 @@ bool operator ==(const ICorDebugInfo::VarLoc &varLoc1, { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; if (varLoc1.vlType != varLoc2.vlType) return false; @@ -215,7 +210,6 @@ SIZE_T GetRegOffsInCONTEXT(ICorDebugInfo::RegNum regNum) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; #ifdef TARGET_X86 switch(regNum) @@ -449,7 +443,6 @@ ULONG NativeVarLocations(const ICorDebugInfo::VarLoc & varLoc, { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; _ASSERTE(numLocs >= MAX_NATIVE_VAR_LOCS); @@ -561,7 +554,6 @@ SIZE_T *NativeVarStackAddr(const ICorDebugInfo::VarLoc & varLoc, { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; SIZE_T *dwAddr = NULL; @@ -669,7 +661,6 @@ bool GetNativeVarVal(const ICorDebugInfo::VarLoc & varLoc, STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; switch(varLoc.vlType) { @@ -775,7 +766,6 @@ bool SetNativeVarVal(const ICorDebugInfo::VarLoc & varLoc, { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; switch(varLoc.vlType) { @@ -881,27 +871,6 @@ CLRMapViewOfFile( return NULL; } -#ifdef _DEBUG -#ifdef TARGET_X86 - if (pv && g_pConfig && g_pConfig->ShouldInjectFault(INJECTFAULT_MAPVIEWOFFILE)) - { - MEMORY_BASIC_INFORMATION mbi; - memset(&mbi, 0, sizeof(mbi)); - if (!ClrVirtualQuery(pv, &mbi, sizeof(mbi))) - { - if(GetLastError()==ERROR_SUCCESS) - SetLastError(ERROR_OUTOFMEMORY); - return NULL; - } - UnmapViewOfFile(pv); - pv = ClrVirtualAlloc(lpBaseAddress, mbi.RegionSize, MEM_RESERVE, PAGE_NOACCESS); - } - else -#endif // TARGET_X86 -#endif // _DEBUG - { - } - if (!pv && GetLastError()==ERROR_SUCCESS) SetLastError(ERROR_OUTOFMEMORY); @@ -915,22 +884,7 @@ CLRUnmapViewOfFile( { STATIC_CONTRACT_ENTRY_POINT; -#ifdef _DEBUG -#ifdef TARGET_X86 - if (g_pConfig && g_pConfig->ShouldInjectFault(INJECTFAULT_MAPVIEWOFFILE)) - { - return ClrVirtualFree((LPVOID)lpBaseAddress, 0, MEM_RELEASE); - } - else -#endif // TARGET_X86 -#endif // _DEBUG - { - BOOL result = UnmapViewOfFile(lpBaseAddress); - if (result) - { - } - return result; - } + return UnmapViewOfFile(lpBaseAddress); } static HMODULE CLRLoadLibraryWorker(LPCWSTR lpLibFileName, DWORD *pLastError) @@ -938,8 +892,6 @@ static HMODULE CLRLoadLibraryWorker(LPCWSTR lpLibFileName, DWORD *pLastError) // Don't use dynamic contract: will override GetLastError value STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - HMODULE hMod; ErrorModeHolder errorMode{}; { @@ -955,8 +907,6 @@ HMODULE CLRLoadLibrary(LPCWSTR lpLibFileName) // Don't use dynamic contract: will override GetLastError value STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - DWORD dwLastError = 0; HMODULE hmod = 0; @@ -974,8 +924,6 @@ static HMODULE CLRLoadLibraryExWorker(LPCWSTR lpLibFileName, HANDLE hFile, DWORD // Don't use dynamic contract: will override GetLastError value STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - HMODULE hMod; ErrorModeHolder errorMode{}; { @@ -993,8 +941,6 @@ HMODULE CLRLoadLibraryEx(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) // This will throw in the case of SO //STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - DWORD lastError = ERROR_SUCCESS; HMODULE hmod = NULL; @@ -1011,7 +957,6 @@ BOOL CLRFreeLibrary(HMODULE hModule) // Don't use dynamic contract: will override GetLastError value STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FORBID_FAULT; return FreeLibrary(hModule); } @@ -1779,7 +1724,6 @@ int __cdecl stricmpUTF8(const char* szStr1, const char* szStr2) { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END diff --git a/src/coreclr/vm/virtualcallstub.cpp b/src/coreclr/vm/virtualcallstub.cpp index cecd103c44fff0..58592210e8213e 100644 --- a/src/coreclr/vm/virtualcallstub.cpp +++ b/src/coreclr/vm/virtualcallstub.cpp @@ -167,7 +167,6 @@ void VirtualCallStubManager::StartupLogging() { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -175,7 +174,6 @@ void VirtualCallStubManager::StartupLogging() EX_TRY { - FAULT_NOT_FATAL(); // We handle filecreation problems locally SString str; str.Printf("StubLog_%d.log", GetCurrentProcessId()); if (fopen_lp(&g_hStubLogFile, str.GetUnicode(), W("wb")) != 0) @@ -198,7 +196,6 @@ void VirtualCallStubManager::LoggingDump() { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -408,7 +405,6 @@ void VirtualCallStubManager::ResetCache() { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -444,7 +440,6 @@ void VirtualCallStubManager::Init(LoaderAllocator *pLoaderAllocator) CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; m_loaderAllocator = pLoaderAllocator; @@ -686,7 +681,6 @@ VirtualCallStubManager::~VirtualCallStubManager() CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; LogStats(); @@ -807,7 +801,6 @@ void VirtualCallStubManager::LogFinalStats() { NOTHROW; GC_TRIGGERS; - FORBID_FAULT; } CONTRACTL_END @@ -834,7 +827,6 @@ void VirtualCallStubManager::ReclaimAll() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; #ifdef FEATURE_VIRTUAL_STUB_DISPATCH /* @todo: if/when app domain unloading is supported, @@ -902,7 +894,6 @@ VirtualCallStubManager *VirtualCallStubManager::FindStubManager(PCODE stubAddres CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; SUPPORTS_DAC; } CONTRACTL_END @@ -942,7 +933,6 @@ BOOL VirtualCallStubManager::CheckIsStub_Internal(PCODE stubStartAddress) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; SUPPORTS_DAC; // Forwarded to from RangeSectionStubManager @@ -977,7 +967,6 @@ BOOL VirtualCallStubManager::TraceManager(Thread *thread, { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -1005,7 +994,6 @@ DispatchToken VirtualCallStubManager::GetTokenFromOwnerAndSlot(TypeHandle ownerT THROWS; GC_TRIGGERS; MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -1030,7 +1018,6 @@ PCODE VirtualCallStubManager::GetCallStub(TypeHandle ownerType, MethodDesc *pMD) MODE_PREEMPTIVE; PRECONDITION(CheckPointer(pMD)); PRECONDITION(!pMD->IsInterface() || ownerType.GetMethodTable()->HasSameTypeDefAs(pMD->GetMethodTable())); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; DispatchToken token = GetTokenFromOwnerAndSlot(ownerType, pMD->GetSlot()); @@ -1045,7 +1032,6 @@ PCODE VirtualCallStubManager::GetCallStub(DispatchToken token) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; GCX_COOP(); // This is necessary for BucketTable synchronization @@ -1090,7 +1076,6 @@ PCODE VirtualCallStubManager::GetVTableCallStub(DWORD slot) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; GCX_COOP(); // This is necessary for BucketTable synchronization @@ -1131,7 +1116,6 @@ VTableCallHolder* VirtualCallStubManager::GenerateVTableCallStub(DWORD slot) THROWS; GC_TRIGGERS; MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; //allocate from the requisite heap and copy the template over it. @@ -1180,7 +1164,6 @@ BYTE *VirtualCallStubManager::GenerateStubIndirection(PCODE target, DispatchToke CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(target != NULL); } CONTRACTL_END; @@ -1266,7 +1249,6 @@ ResolveCacheElem *VirtualCallStubManager::GetResolveCacheElem(void *pMT, THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END @@ -1303,7 +1285,6 @@ size_t VirtualCallStubManager::GetTokenFromStub(PCODE stub, T_CONTEXT *pContext) { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -1342,7 +1323,6 @@ size_t VirtualCallStubManager::GetTokenFromStubQuick(VirtualCallStubManager * pM { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -1399,7 +1379,6 @@ ResolveCacheElem* __fastcall VirtualCallStubManager::PromoteChainEntry(ResolveCa CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(CheckPointer(pElem)); } CONTRACTL_END; @@ -1415,7 +1394,6 @@ PCODE CachedInterfaceDispatchResolveWorker(StubCallSite* pCallSite, OBJECTREF *p THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(protectedObj != NULL); PRECONDITION(*protectedObj != NULL); PRECONDITION(IsProtectedByGCFrame(protectedObj)); @@ -1450,7 +1428,6 @@ extern "C" PCODE CID_VirtualOpenDelegateDispatchWorker(TransitionBlock * pTransi CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pTransitionBlock)); MODE_COOPERATIVE; } CONTRACTL_END; @@ -1536,7 +1513,6 @@ extern "C" PCODE CID_ResolveWorker(TransitionBlock * pTransitionBlock, CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pTransitionBlock)); MODE_COOPERATIVE; } CONTRACTL_END; @@ -1635,7 +1611,6 @@ PCODE VSD_ResolveWorker(TransitionBlock * pTransitionBlock, CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pTransitionBlock)); MODE_COOPERATIVE; } CONTRACTL_END; @@ -1759,7 +1734,6 @@ PCODE VSD_ResolveWorkerForInterfaceLookupSlot(TransitionBlock * pTransitionBlock CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pTransitionBlock)); MODE_COOPERATIVE; } CONTRACTL_END; @@ -1849,7 +1823,6 @@ void VirtualCallStubManager::BackPatchWorkerStatic(PCODE returnAddress, TADDR si CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; ENTRY_POINT; PRECONDITION(returnAddress != NULL); } CONTRACTL_END @@ -1888,7 +1861,6 @@ PCODE VirtualCallStubManager::ResolveWorker(StubCallSite* pCallSite, THROWS; GC_TRIGGERS; MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(protectedObj != NULL); PRECONDITION(*protectedObj != NULL); PRECONDITION(IsProtectedByGCFrame(protectedObj)); @@ -2640,7 +2612,6 @@ VirtualCallStubManager::GetTarget( CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(CheckPointer(pMT)); } CONTRACTL_END @@ -2711,7 +2682,6 @@ VirtualCallStubManager::TraceResolver( THROWS; GC_TRIGGERS; PRECONDITION(CheckPointer(pObj, NULL_OK)); - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END // If someone is trying to step into a stub dispatch call on a null object, @@ -2758,7 +2728,6 @@ void VirtualCallStubManager::BackPatchWorker(StubCallSite* pCallSite) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END PCODE callSiteTarget = pCallSite->GetSiteTarget(); @@ -2797,7 +2766,6 @@ void VirtualCallStubManager::BackPatchSite(StubCallSite* pCallSite, PCODE stub) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; PRECONDITION(stub != NULL); PRECONDITION(CheckPointer(pCallSite)); PRECONDITION(pCallSite->GetSiteTarget() != NULL); @@ -2862,7 +2830,6 @@ DispatchHolder *VirtualCallStubManager::GenerateDispatchStub(PCODE ad CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(addrOfCode != NULL); PRECONDITION(addrOfFail != NULL); PRECONDITION(CheckPointer(pMTExpected)); @@ -2947,7 +2914,6 @@ DispatchHolder *VirtualCallStubManager::GenerateDispatchStubLong(PCODE CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(addrOfCode != NULL); PRECONDITION(addrOfFail != NULL); PRECONDITION(CheckPointer(pMTExpected)); @@ -3007,7 +2973,6 @@ ResolveHolder *VirtualCallStubManager::GenerateResolveStub(PCODE addr CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(addrOfResolver != NULL); #if defined(TARGET_X86) PRECONDITION(addrOfPatcher != NULL); @@ -3093,7 +3058,6 @@ LookupHolder *VirtualCallStubManager::GenerateLookupStub(PCODE addrOfResolver, s CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(addrOfResolver != NULL); } CONTRACTL_END; @@ -3129,7 +3093,6 @@ ResolveCacheElem *VirtualCallStubManager::GenerateResolveCacheElem(void *addrOfC { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); PRECONDITION(pMayHaveReenteredCooperativeGCMode != nullptr); PRECONDITION(!*pMayHaveReenteredCooperativeGCMode); } @@ -3230,7 +3193,6 @@ void VirtualCallStubManager::LogStats() { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; // Our Init routine assignes all fields atomically so testing one field should suffice to // test whehter the Init succeeded. @@ -3312,7 +3274,6 @@ void Prober::InitProber(size_t key1, size_t key2, size_t* table) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END _ASSERTE(table); @@ -3329,7 +3290,6 @@ size_t Prober::Find() CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END size_t entry; @@ -3363,7 +3323,6 @@ size_t Prober::Add(size_t newEntry) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END size_t entry; @@ -3439,7 +3398,6 @@ size_t FastTable::Add(size_t entry, Prober* probe) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END size_t result = probe->Add(entry); @@ -3467,7 +3425,6 @@ BOOL BucketTable::GetMoreSpace(const Prober* p) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; // This is necessary for synchronization with BucketTable::Reclaim - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; //get ahold of the current bucket @@ -3561,7 +3518,6 @@ void BucketTable::Reclaim() { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END @@ -3630,7 +3586,6 @@ BOOL BucketTable::SetUpProber(size_t keyA, size_t keyB, Prober *prober) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; // This is necessary for synchronization with BucketTable::Reclaim - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; // The buckets[index] table starts off initialized to all CALL_STUB_EMPTY_ENTRY @@ -3686,7 +3641,6 @@ size_t BucketTable::Add(size_t entry, Prober* probe) THROWS; GC_TRIGGERS; MODE_COOPERATIVE; // This is necessary for synchronization with BucketTable::Reclaim - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END FastTable* table = (FastTable*)(probe->items()); @@ -3723,7 +3677,6 @@ DispatchCache::DispatchCache() { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); } CONTRACTL_END @@ -3785,7 +3738,6 @@ BOOL DispatchCache::Insert(ResolveCacheElem* elem, InsertKind insertKind) CONTRACTL { THROWS; GC_TRIGGERS; - FORBID_FAULT; PRECONDITION(insertKind != IK_NONE); } CONTRACTL_END; @@ -3902,7 +3854,6 @@ void DispatchCache::PromoteChainEntry(ResolveCacheElem* elem) CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; CrstHolder lh(&m_writeLock); @@ -4298,7 +4249,6 @@ MethodDesc *VirtualCallStubManagerManager::Entry2MethodDesc( { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END diff --git a/src/coreclr/vm/virtualcallstub.h b/src/coreclr/vm/virtualcallstub.h index 104be1ee462be9..181d83508a0c46 100644 --- a/src/coreclr/vm/virtualcallstub.h +++ b/src/coreclr/vm/virtualcallstub.h @@ -1508,7 +1508,6 @@ class FastTable CONTRACTL { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END; _ASSERTE(probe); @@ -1530,7 +1529,6 @@ class FastTable CONTRACTL { THROWS; GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; size_t size = CALL_STUB_MIN_ENTRIES; diff --git a/src/coreclr/vm/zapsig.cpp b/src/coreclr/vm/zapsig.cpp index 714ba32b698d6a..fd68ab6b41a554 100644 --- a/src/coreclr/vm/zapsig.cpp +++ b/src/coreclr/vm/zapsig.cpp @@ -297,7 +297,6 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; PRECONDITION(CheckPointer(pModule)); PRECONDITION(CheckPointer(pZapSigContext)); PRECONDITION(CheckPointer(pZapSigContext->pModuleContext)); @@ -547,7 +546,6 @@ BOOL ZapSig::CompareTypeHandleFieldToTypeHandle(TypeHandle *pTypeHnd, TypeHandle NOTHROW; GC_NOTRIGGER; MODE_ANY; - FORBID_FAULT; PRECONDITION(CheckPointer(pTypeHnd)); PRECONDITION(CheckPointer(typeHnd2)); } @@ -630,7 +628,6 @@ ModuleBase *ZapSig::DecodeModuleFromIndexIfLoaded(Module *fromModule, { NOTHROW; GC_NOTRIGGER; - FORBID_FAULT; } CONTRACTL_END;