Delete ResourceConstraintAction
authorJan Kotas <jkotas@microsoft.com>
Sat, 25 Apr 2020 05:27:06 +0000 (22:27 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 25 Apr 2020 13:53:01 +0000 (06:53 -0700)
src/coreclr/src/vm/eepolicy.cpp
src/coreclr/src/vm/eepolicy.h

index ff50b2b..19886f7 100644 (file)
@@ -267,81 +267,6 @@ static void HandleExitProcessHelper(EPolicyAction action, UINT exitCode, Shutdow
     }
 }
 
-
-EPolicyAction EEPolicy::DetermineResourceConstraintAction(Thread *pThread)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_NOTRIGGER;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EPolicyAction action = GetEEPolicy()->GetActionOnFailure(FAIL_CriticalResource);
-
-    AppDomain *pDomain = GetAppDomain();
-    // If it is default domain, we can not unload the appdomain
-    if (pDomain == SystemDomain::System()->DefaultDomain() &&
-        (action == eUnloadAppDomain || action == eRudeUnloadAppDomain))
-    {
-        action = eThrowException;
-    }
-    return action;
-}
-
-void EEPolicy::PerformResourceConstraintAction(Thread *pThread, EPolicyAction action, UINT exitCode, BOOL haveStack)
-    {
-    WRAPPER_NO_CONTRACT;
-
-    _ASSERTE(GetAppDomain() != NULL);
-
-    switch (action) {
-    case eThrowException:
-        // Caller is going to rethrow.
-        return;
-        break;
-    case eAbortThread:
-        pThread->UserAbort(Thread::TAR_Thread, TA_Safe, GetEEPolicy()->GetTimeout(OPR_ThreadAbort), Thread::UAC_Normal);
-        break;
-    case eRudeAbortThread:
-        pThread->UserAbort(Thread::TAR_Thread, TA_Rude, GetEEPolicy()->GetTimeout(OPR_ThreadAbort), Thread::UAC_Normal);
-        break;
-    case eExitProcess:
-    case eFastExitProcess:
-    case eRudeExitProcess:
-        HandleExitProcessFromEscalation(action, exitCode);
-        break;
-    default:
-        _ASSERTE (!"Invalid policy");
-        break;
-    }
-}
-
-void EEPolicy::HandleOutOfMemory()
-{
-    WRAPPER_NO_CONTRACT;
-
-    _ASSERTE (g_pOutOfMemoryExceptionClass);
-
-    Thread *pThread = GetThread();
-    _ASSERTE (pThread);
-
-    EPolicyAction action = DetermineResourceConstraintAction(pThread);
-
-    // Check if we are executing in the context of a Constrained Execution Region.
-    if (action != eThrowException && Thread::IsExecutingWithinCer())
-    {
-        // Hitting OOM in a CER region should throw the OOM without regard to the escalation policy
-        // since the CER author has declared they are hardened against such failures. That's
-        // the whole point of CERs, to denote regions where code knows exactly how to deal with
-        // failures in an attempt to minimize the need for rollback or recycling.
-        return;
-    }
-
-    PerformResourceConstraintAction(pThread, action, HOST_E_EXITPROCESS_OUTOFMEMORY, TRUE);
-}
-
 //---------------------------------------------------------------------------------------
 //
 // EEPolicy::HandleStackOverflow - Handle stack overflow according to policy
index 33f28e4..a96bfa8 100644 (file)
@@ -56,12 +56,6 @@ public:
 
     EPolicyAction GetActionOnFailure(EClrFailure failure);
 
-    static EPolicyAction DetermineResourceConstraintAction(Thread *pThread);
-
-    static void PerformResourceConstraintAction(Thread *pThread, EPolicyAction action, UINT exitCode, BOOL haveStack);
-
-    static void HandleOutOfMemory();
-
     static void HandleStackOverflow();
 
     static void HandleExitProcess(ShutdownCompleteAction sca = SCA_ExitProcessWhenShutdownComplete);