Remove some dead code related to cross-appdomain exceptions. (dotnet/coreclr#20634)
authorAustin Wise <AustinWise@gmail.com>
Fri, 26 Oct 2018 16:35:09 +0000 (09:35 -0700)
committerJan Kotas <jkotas@microsoft.com>
Fri, 26 Oct 2018 16:35:09 +0000 (09:35 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/610dbc19a4fc3747d5afebb4c94ac77c41f56267

src/coreclr/src/System.Private.CoreLib/src/System/Exception.cs
src/coreclr/src/System.Private.CoreLib/src/System/Threading/Thread.cs
src/coreclr/src/debug/ee/rcthread.cpp
src/coreclr/src/vm/ceemain.cpp
src/coreclr/src/vm/context.h
src/coreclr/src/vm/mscorlib.h
src/coreclr/src/vm/rexcep.h
src/coreclr/src/vm/threads.cpp
src/coreclr/src/vm/threads.h

index b451000..0b1d39f 100644 (file)
@@ -694,9 +694,8 @@ namespace System
         // See src\inc\corexcep.h's EXCEPTION_COMPLUS definition:
         private const int _COMPlusExceptionCode = unchecked((int)0xe0434352);   // Win32 exception code for COM+ exceptions
 
-        // InternalToString is called by the runtime to get the exception text 
-        // and create a corresponding CrossAppDomainMarshaledException
-        internal virtual string InternalToString()
+        // InternalToString is called by the runtime to get the exception text.
+        internal string InternalToString()
         {
             // Get the current stack trace string. 
             return ToString(true, true);
@@ -747,29 +746,5 @@ namespace System
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
         private static extern void GetMessageFromNativeResources(ExceptionMessageKind kind, StringHandleOnStack retMesg);
     }
-
-    //--------------------------------------------------------------------------
-    // Telesto: Telesto doesn't support appdomain marshaling of objects so
-    // managed exceptions that leak across appdomain boundaries are flatted to
-    // its ToString() output and rethrown as an CrossAppDomainMarshaledException.
-    // The Message field is set to the ToString() output of the original exception.
-    //--------------------------------------------------------------------------
-
-    internal sealed class CrossAppDomainMarshaledException : SystemException
-    {
-        public CrossAppDomainMarshaledException(string message, int errorCode)
-            : base(message)
-        {
-            HResult = errorCode;
-        }
-
-        // Normally, only Telesto's UEF will see these exceptions.
-        // This override prints out the original Exception's ToString()
-        // output and hides the fact that it is wrapped inside another excepton.
-        internal override string InternalToString()
-        {
-            return Message;
-        }
-    }
 }
 
index 0fea39c..2c71856 100644 (file)
@@ -29,8 +29,6 @@ namespace System.Threading
     using System.Runtime.Versioning;
     using System.Diagnostics;
 
-    internal delegate object InternalCrossContextDelegate(object[] args);
-
     internal class ThreadHelper
     {
         private Delegate _start;
index 7ea3624..2d1b06d 100644 (file)
@@ -1570,17 +1570,6 @@ LExit:
     dbgOnly_IdentifySpecialEEThread();
 #endif
 
-    // We commit the thread's entire stack to ensure we're robust in low memory conditions. If we can't commit the
-    // stack, then we can't let the CLR continue to function.
-    BOOL fSuccess = Thread::CommitThreadStack(NULL);
-
-    if (!fSuccess)
-    {
-        STRESS_LOG0(LF_GC, LL_ALWAYS, "Thread::CommitThreadStack failed.\n");
-        _ASSERTE(!"Thread::CommitThreadStack failed.");
-        EEPOLICY_HANDLE_FATAL_ERROR(COR_E_STACKOVERFLOW);
-    }
-
     DebuggerRCThread* t = (DebuggerRCThread*)g_pRCThread;
 
     t->ThreadProc(); // this thread is local, go and become the helper
index 04b1226..e961510 100644 (file)
@@ -849,9 +849,6 @@ void EEStartupHelper(COINITIEE fFlags)
             IfFailGo(E_OUTOFMEMORY);
         }
 
-        // Initialize contexts
-        Context::Initialize();
-
         g_pEEShutDownEvent = new CLREvent();
         g_pEEShutDownEvent->CreateManualEvent(FALSE);
 
index 3c746b6..e14a185 100644 (file)
@@ -37,10 +37,6 @@ public:
         return m_pDomain;
     }
 
-    static void Initialize()
-    {
-    }
-
     typedef void (*ADCallBackFcnType)(LPVOID);
 
 #ifdef DACCESS_COMPILE
index ab00e94..d9fb6da 100644 (file)
@@ -385,11 +385,6 @@ DEFINE_METHOD(EXCEPTION,            TRY_GET_RESTRICTED_LANGUAGE_ERROR_OBJECT,
 #endif // FEATURE_COMINTEROP
 
 
-DEFINE_CLASS(CROSSAPPDOMAINMARSHALEDEXCEPTION,  System,      CrossAppDomainMarshaledException)
-DEFINE_METHOD(CROSSAPPDOMAINMARSHALEDEXCEPTION, STR_INT_CTOR, .ctor, IM_Str_Int_RetVoid)
-
-
-
 DEFINE_CLASS(SYSTEM_EXCEPTION,      System,                 SystemException)
 DEFINE_METHOD(SYSTEM_EXCEPTION,     STR_EX_CTOR,            .ctor,                      IM_Str_Exception_RetVoid)
 
@@ -903,8 +898,6 @@ DEFINE_CLASS(CONTEXTCALLBACK,       Threading,       ContextCallback)
 DEFINE_CLASS(STACKCRAWMARK,         Threading,       StackCrawlMark)
 #endif
 
-DEFINE_CLASS(CROSS_CONTEXT_DELEGATE, Threading, InternalCrossContextDelegate)
-
 DEFINE_CLASS_U(Threading,              Thread,                     ThreadBaseObject)
 DEFINE_FIELD_U(m_Name,                     ThreadBaseObject,   m_Name)
 DEFINE_FIELD_U(m_Delegate,                 ThreadBaseObject,   m_Delegate)
index b4a8318..9113783 100644 (file)
@@ -300,8 +300,6 @@ DEFINE_EXCEPTION(g_SystemNS,           NotImplementedException,        false,  E
 
 DEFINE_EXCEPTION(g_SystemNS,           OutOfMemoryException,           false,  E_OUTOFMEMORY, CTL_E_OUTOFMEMORY, STD_CTL_SCODE(31001))
 
-DEFINE_EXCEPTION(g_SystemNS,           CrossAppDomainMarshaledException, false, E_FAIL)
-
 
 DEFINE_EXCEPTION(g_SystemNS,           ArgumentNullException,          false,  E_POINTER)
 
index b9395a8..7a638a9 100644 (file)
@@ -1814,14 +1814,6 @@ BOOL Thread::InitThread(BOOL fInternal)
         {
             ThrowOutOfMemory();
         }
-
-        // We commit the thread's entire stack when it enters the runtime to allow us to be reliable in low me
-        // situtations. See the comments in front of Thread::CommitThreadStack() for mor information.
-        ret = Thread::CommitThreadStack(this);
-        if (ret == FALSE)
-        {
-            ThrowOutOfMemory();
-        }
     }
 
     ret = Thread::AllocateIOCompletionContext();
@@ -1912,15 +1904,6 @@ BOOL Thread::HasStarted(BOOL bRequiresTSL)
         goto FAILURE;
     }
 
-    // We commit the thread's entire stack when it enters the runtime to allow us to be reliable in low memory
-    // situtations. See the comments in front of Thread::CommitThreadStack() for mor information.
-    res = Thread::CommitThreadStack(this);
-    if (res == FALSE)
-    {
-        m_pExceptionDuringStartup = Exception::GetOOMException();
-        goto FAILURE;
-    }
-
     // If any exception happens during HasStarted, we will cache the exception in Thread::m_pExceptionDuringStartup
     // which will be thrown in Thread.Start as an internal exception
     EX_TRY
@@ -7015,28 +6998,6 @@ __declspec(noinline) void AllocateSomeStack(){
     VolatileStore<INT8>(mem, 0);
 }
 
-
-/*
- * CommitThreadStack
- *
- * Commit the thread's entire stack. A thread's stack is usually only reserved memory, not committed. The OS will
- * commit more pages as the thread's stack grows. But, if the system is low on memory and disk space, its possible
- * that the OS will not have enough memory to grow the stack. That causes a stack overflow exception at very random
- * times, and the CLR can't handle that.
- *
- * Parameters:
- *  The Thread object for this thread, if there is one.  NULL otherwise.
- *
- * Returns:
- *  TRUE if the function succeeded, FALSE otherwise.
- */
-/*static*/
-BOOL Thread::CommitThreadStack(Thread* pThreadOptional)
-{
-
-    return TRUE;
-}
-
 #ifndef FEATURE_PAL
 
 // static // private
index d736fac..e36e784 100644 (file)
@@ -2434,30 +2434,9 @@ public:
     void EnterContextRestricted(Context* c, ContextTransitionFrame* pFrame);
     void ReturnToContext(ContextTransitionFrame *pFrame);
 
-private:
-    typedef enum {
-        RaiseCrossContextSuccess,
-        RaiseCrossContextRetry,
-        RaiseCrossContextClassInit
-    } RaiseCrossContextResult;
-
-
-    // The "orBlob" stores the serialized image of a managed Exception object as it gets marshaled
-    // across AD boundaries.
-    //
-    // In Telesto, we don't support true appdomain marshaling so the "orBlob" is in fact an
-    // agile wrapper object whose ToString() echoes the original exception's ToString().
-    typedef OBJECTREF  ORBLOBREF;
-
-    RaiseCrossContextResult TryRaiseCrossContextException(Exception **ppExOrig,
-                                                          Exception *pException,
-                                                          RuntimeExceptionKind *pKind,
-                                                          OBJECTREF *ppThrowable,
-                                                          ORBLOBREF *pOrBlob);
 public:
 
     void DECLSPEC_NORETURN RaiseCrossContextException(Exception* pEx, ContextTransitionFrame* pFrame);
-    void RaiseCrossContextExceptionHelper(Exception* pEx,ContextTransitionFrame* pFrame);
 
     // ClearContext are to be called only during shutdown
     void ClearContext();
@@ -3626,10 +3605,6 @@ public:
     // space to restore the guard page, so make sure you know what you're doing when you decide to call this.
     VOID RestoreGuardPage();
 
-    // Commit the thread's entire stack. Note: this works on managed or unmanaged threads, and pLowerBoundMemInfo
-    // is optional.
-    static BOOL CommitThreadStack(Thread* pThreadOptional);
-
 #if defined(FEATURE_HIJACK) && !defined(PLATFORM_UNIX)
 private:
     // Redirecting of threads in managed code at suspension