From 9c93286cb13d9f50f1f25cdcbcbc3719a178b374 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Sun, 12 Feb 2017 10:46:48 -0800 Subject: Remove always defined FEATURE_EXCEPTIONDISPATCHINFO --- clrdefinitions.cmake | 1 - src/ToolBox/SOS/Strike/strike.cpp | 2 -- src/debug/daccess/dacdbiimpl.cpp | 5 ----- src/vm/clrex.h | 2 -- src/vm/comutilnative.cpp | 2 -- src/vm/comutilnative.h | 2 -- src/vm/debugdebugger.cpp | 14 -------------- src/vm/debugdebugger.h | 10 ---------- src/vm/ecalllist.h | 2 -- src/vm/excep.cpp | 18 ------------------ src/vm/exstate.h | 4 ---- src/vm/jithelpers.cpp | 2 -- src/vm/mscorlib.h | 2 -- 13 files changed, 66 deletions(-) diff --git a/clrdefinitions.cmake b/clrdefinitions.cmake index 58426a615c..bd0c5a6c9b 100644 --- a/clrdefinitions.cmake +++ b/clrdefinitions.cmake @@ -123,7 +123,6 @@ endif(FEATURE_EVENT_TRACE) if(CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1) endif(CLR_CMAKE_PLATFORM_UNIX) -add_definitions(-DFEATURE_EXCEPTIONDISPATCHINFO) # NetBSD doesn't implement this feature if(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD) add_definitions(-DFEATURE_HIJACK) diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp index 3bb3f50200..31c58dfe4d 100644 --- a/src/ToolBox/SOS/Strike/strike.cpp +++ b/src/ToolBox/SOS/Strike/strike.cpp @@ -2090,11 +2090,9 @@ struct StackTraceElement UINT_PTR ip; UINT_PTR sp; DWORD_PTR pFunc; // MethodDesc -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // TRUE if this element represents the last frame of the foreign // exception stack trace. BOOL fIsLastFrameFromForeignStackTrace; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) }; diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp index 7c5ab14a7e..0ac5dc04ea 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -3470,12 +3470,7 @@ void DacDbiInterfaceImpl::GetStackFramesFromException(VMPTR_Object vmObject, Dac currentFrame.vmDomainFile.SetHostPtr(pDomainFile); currentFrame.ip = currentElement.ip; currentFrame.methodDef = currentElement.pFunc->GetMemberDef(); -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) currentFrame.isLastForeignExceptionFrame = currentElement.fIsLastFrameFromForeignStackTrace; -#else - // for CLRs lacking exception dispatch info just set it to 0 - currentFrame.isLastForeignExceptionFrame = 0; -#endif } } } diff --git a/src/vm/clrex.h b/src/vm/clrex.h index 02de452370..42cdf58825 100644 --- a/src/vm/clrex.h +++ b/src/vm/clrex.h @@ -28,11 +28,9 @@ struct StackTraceElement UINT_PTR ip; UINT_PTR sp; PTR_MethodDesc pFunc; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // TRUE if this element represents the last frame of the foreign // exception stack trace. BOOL fIsLastFrameFromForeignStackTrace; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) bool operator==(StackTraceElement const & rhs) const { diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp index 1c9703a0ac..a82289c30a 100644 --- a/src/vm/comutilnative.cpp +++ b/src/vm/comutilnative.cpp @@ -778,7 +778,6 @@ FCIMPL1(FC_BOOL_RET, ExceptionNative::IsTransient, INT32 hresult) FCIMPLEND -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // This FCall sets a flag against the thread exception state to indicate to // IL_Throw and the StackTraceInfo implementation to account for the fact // that we have restored a foreign exception dispatch details. @@ -979,7 +978,6 @@ FCIMPL1(Object*, ExceptionNative::CopyDynamicMethods, Object* pDynamicMethodsUNS } FCIMPLEND -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) BSTR BStrFromString(STRINGREF s) { diff --git a/src/vm/comutilnative.h b/src/vm/comutilnative.h index 32c1c2eef3..21d31f8672 100644 --- a/src/vm/comutilnative.h +++ b/src/vm/comutilnative.h @@ -95,13 +95,11 @@ public: static FCDECL1(FC_BOOL_RET, IsTransient, INT32 hresult); static FCDECL3(StringObject *, StripFileInfo, Object *orefExcepUNSAFE, StringObject *orefStrUNSAFE, CLR_BOOL isRemoteStackTrace); static void QCALLTYPE GetMessageFromNativeResources(ExceptionMessageKind kind, QCall::StringHandleOnStack retMesg); -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) static FCDECL0(VOID, PrepareForForeignExceptionRaise); static FCDECL1(Object*, CopyStackTrace, Object* pStackTraceUNSAFE); static FCDECL1(Object*, CopyDynamicMethods, Object* pDynamicMethodsUNSAFE); static FCDECL3(VOID, GetStackTracesDeepCopy, Object* pExceptionObjectUnsafe, Object **pStackTraceUnsafe, Object **pDynamicMethodsUnsafe); static FCDECL3(VOID, SaveStackTracesFromDeepCopy, Object* pExceptionObjectUnsafe, Object *pStackTraceUnsafe, Object *pDynamicMethodsUnsafe); -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) // NOTE: caller cleans up any partially initialized BSTRs in pED diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp index 098bdfdd4e..32c6cd6cce 100644 --- a/src/vm/debugdebugger.cpp +++ b/src/vm/debugdebugger.cpp @@ -446,7 +446,6 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal, SetObjectReference( (OBJECTREF *)&(pStackFrameHelper->rgiColumnNumber), (OBJECTREF)columnNumbers, pStackFrameHelper->GetAppDomain()); -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // Allocate memory for the flag indicating if this frame represents the last one from a foreign // exception stack trace provided we have any such frames. Otherwise, set it to null. // When StackFrameHelper.IsLastFrameFromForeignExceptionStackTrace is invoked in managed code, @@ -467,7 +466,6 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal, SetObjectReference( (OBJECTREF *)&(pStackFrameHelper->rgiLastFrameFromForeignExceptionStackTrace), NULL, pStackFrameHelper->GetAppDomain()); } -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) // Determine if there are any dynamic methods in the stack trace. If there are, // allocate an ObjectArray large enough to hold an ObjRef to each one. @@ -518,7 +516,6 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal, I4 *pILI4 = (I4 *)((I4ARRAYREF)pStackFrameHelper->rgiILOffset)->GetDirectPointerToNonObjectElements(); pILI4[iNumValidFrames] = data.pElements[i].dwILOffset; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) if (data.fDoWeHaveAnyFramesFromForeignStackTrace) { // Set the BOOL indicating if the frame represents the last frame from a foreign exception stack trace. @@ -526,7 +523,6 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal, ->GetDirectPointerToNonObjectElements(); pIsLastFrameFromForeignExceptionStackTraceU1 [iNumValidFrames] = (U1) data.pElements[i].fIsLastFrameFromForeignStackTrace; } -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) MethodDesc *pMethod = data.pElements[i].pFunc; @@ -1162,10 +1158,8 @@ void DebugStackTrace::GetStackFramesFromException(OBJECTREF * e, // The number of frame info elements in the stack trace info pData->cElements = static_cast(traceData.Size()); -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // By default, assume that we have no frames from foreign exception stack trace. pData->fDoWeHaveAnyFramesFromForeignStackTrace = FALSE; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) // Now we know the size, allocate the information for the data struct if (pData->cElements != 0) @@ -1178,7 +1172,6 @@ void DebugStackTrace::GetStackFramesFromException(OBJECTREF * e, { StackTraceElement const & cur = traceData[i]; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // If we come across any frame representing foreign exception stack trace, // then set the flag indicating so. This will be used to allocate the // corresponding array in StackFrameHelper. @@ -1186,7 +1179,6 @@ void DebugStackTrace::GetStackFramesFromException(OBJECTREF * e, { pData->fDoWeHaveAnyFramesFromForeignStackTrace = TRUE; } -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) // Fill out the MethodDesc* MethodDesc *pMD = cur.pFunc; @@ -1209,9 +1201,7 @@ void DebugStackTrace::GetStackFramesFromException(OBJECTREF * e, } pData->pElements[i].InitPass1(dwNativeOffset, pMD, (PCODE) cur.ip -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) , cur.fIsLastFrameFromForeignStackTrace -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) ); #ifndef DACCESS_COMPILE pData->pElements[i].InitPass2(); @@ -1233,9 +1223,7 @@ void DebugStackTrace::DebugStackTraceElement::InitPass1( DWORD dwNativeOffset, MethodDesc *pFunc, PCODE ip -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) , BOOL fIsLastFrameFromForeignStackTrace /*= FALSE*/ -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) ) { LIMITED_METHOD_CONTRACT; @@ -1247,9 +1235,7 @@ void DebugStackTrace::DebugStackTraceElement::InitPass1( this->pFunc = pFunc; this->dwOffset = dwNativeOffset; this->ip = ip; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) this->fIsLastFrameFromForeignStackTrace = fIsLastFrameFromForeignStackTrace; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) } #ifndef DACCESS_COMPILE diff --git a/src/vm/debugdebugger.h b/src/vm/debugdebugger.h index 9cf5c3c0f0..6c4d383765 100644 --- a/src/vm/debugdebugger.h +++ b/src/vm/debugdebugger.h @@ -92,9 +92,7 @@ public: I4ARRAYREF rgiLineNumber; I4ARRAYREF rgiColumnNumber; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) BOOLARRAYREF rgiLastFrameFromForeignExceptionStackTrace; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) OBJECTREF getSourceLineInfo; int iFrameCount; @@ -136,11 +134,9 @@ private: DWORD dwILOffset; MethodDesc *pFunc; PCODE ip; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // TRUE if this element represents the last frame of the foreign // exception stack trace. BOOL fIsLastFrameFromForeignStackTrace; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) // Initialization done under TSL. // This is used when first collecting the stack frame data. @@ -148,9 +144,7 @@ private: DWORD dwNativeOffset, MethodDesc *pFunc, PCODE ip -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) , BOOL fIsLastFrameFromForeignStackTrace = FALSE -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) ); // Initialization done outside the TSL. @@ -171,9 +165,7 @@ public: DebugStackTraceElement* pElements; THREADBASEREF TargetThread; AppDomain *pDomain; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) BOOL fDoWeHaveAnyFramesFromForeignStackTrace; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) GetStackFramesData() : skip(0), @@ -184,9 +176,7 @@ public: TargetThread((THREADBASEREF)(TADDR)NULL) { LIMITED_METHOD_CONTRACT; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) fDoWeHaveAnyFramesFromForeignStackTrace = FALSE; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) } diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index fba50a7ca9..d19624c445 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -286,13 +286,11 @@ FCFuncStart(gExceptionFuncs) FCFuncElement("nIsTransient", ExceptionNative::IsTransient) FCFuncElement("GetMethodFromStackTrace", SystemNative::GetMethodFromStackTrace) QCFuncElement("GetMessageFromNativeResources", ExceptionNative::GetMessageFromNativeResources) -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) FCFuncElement("PrepareForForeignExceptionRaise", ExceptionNative::PrepareForForeignExceptionRaise) FCFuncElement("CopyStackTrace", ExceptionNative::CopyStackTrace) FCFuncElement("CopyDynamicMethods", ExceptionNative::CopyDynamicMethods) FCFuncElement("GetStackTracesDeepCopy", ExceptionNative::GetStackTracesDeepCopy) FCFuncElement("SaveStackTracesFromDeepCopy", ExceptionNative::SaveStackTracesFromDeepCopy) -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) FCFuncEnd() FCFuncStart(gSafeHandleFuncs) diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index e4c5ddfe66..a62eb29d7e 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -2287,7 +2287,6 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable // Do not save stacktrace to preallocated exception. These are shared. if (CLRException::IsPreallocatedExceptionHandle(hThrowable)) { -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // Preallocated exceptions will never have this flag set. However, its possible // that after this flag is set for a regular exception but before we throw, we have an async // exception like a RudeThreadAbort, which will replace the exception @@ -2297,7 +2296,6 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable // preallocated exception will not have the restored (or any) stack trace. PTR_ThreadExceptionState pCurTES = GetThread()->GetExceptionState(); pCurTES->ResetRaisingForeignException(); -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) return; } @@ -2310,14 +2308,12 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable bool fSuccess = false; MethodTable* pMT = ObjectFromHandle(hThrowable)->GetTrueMethodTable(); -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // Check if the flag indicating foreign exception raise has been setup or not, // and then reset it so that subsequent processing of managed frames proceeds // normally. PTR_ThreadExceptionState pCurTES = GetThread()->GetExceptionState(); BOOL fRaisingForeignException = pCurTES->IsRaisingForeignException(); pCurTES->ResetRaisingForeignException(); -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) if (bAllowAllocMem && m_dFrameCount != 0) { @@ -2358,19 +2354,15 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable struct _gc { StackTraceArray stackTrace; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) StackTraceArray stackTraceTemp; PTRARRAYREF dynamicMethodsArrayTemp; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) PTRARRAYREF dynamicMethodsArray; // Object array of Managed Resolvers PTRARRAYREF pOrigDynamicArray; _gc() : stackTrace() -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) , stackTraceTemp() , dynamicMethodsArrayTemp(static_cast(NULL)) -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) , dynamicMethodsArray(static_cast(NULL)) , pOrigDynamicArray(static_cast(NULL)) {} @@ -2379,7 +2371,6 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable _gc gc; GCPROTECT_BEGIN(gc); -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // If the flag indicating foreign exception raise has been setup, then check // if the exception object has stacktrace or not. If we have an async non-preallocated // exception after setting this flag but before we throw, then the new @@ -2394,14 +2385,11 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable fRaisingForeignException = FALSE; } } -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) // Replace stack (i.e. build a new stack trace) only if we are not raising a foreign exception. // If we are, then we will continue to extend the existing stack trace. if (bReplaceStack -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) && (!fRaisingForeignException) -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) ) { // Cleanup previous info @@ -2435,7 +2423,6 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable // Fetch the stacktrace and the dynamic method array ((EXCEPTIONREF)ObjectFromHandle(hThrowable))->GetStackTrace(gc.stackTrace, &gc.pOrigDynamicArray); -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) if (fRaisingForeignException) { // Just before we append to the stack trace, mark the last recorded frame to be from @@ -2450,7 +2437,6 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable refLastElementFromForeignStackTrace.fIsLastFrameFromForeignStackTrace = TRUE; } } -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) if (bSkipLastElement && gc.stackTrace.Size() != 0) gc.stackTrace.AppendSkipLast(m_pStackTrace, m_pStackTrace + m_dFrameCount); @@ -2472,9 +2458,7 @@ void StackTraceInfo::SaveStackTrace(BOOL bAllowAllocMem, OBJECTHANDLE hThrowable } if ((gc.pOrigDynamicArray != NULL) -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) || (fRaisingForeignException) -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) ) { // Since we have just restored the dynamic method array as well, @@ -3768,12 +3752,10 @@ BOOL StackTraceInfo::AppendElement(BOOL bAllowAllocMem, UINT_PTR currentIP, UINT pStackTraceElem->ip = currentIP; pStackTraceElem->sp = currentSP; -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // When we are building stack trace as we encounter managed frames during exception dispatch, // then none of those frames represent a stack trace from a foreign exception (as they represent // the current exception). Hence, set the corresponding flag to FALSE. pStackTraceElem->fIsLastFrameFromForeignStackTrace = FALSE; -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) // This is a workaround to fix the generation of stack traces from exception objects so that // they point to the line that actually generated the exception instead of the line diff --git a/src/vm/exstate.h b/src/vm/exstate.h index 50e71ed79b..34f6427b51 100644 --- a/src/vm/exstate.h +++ b/src/vm/exstate.h @@ -116,16 +116,13 @@ public: // to start a funclet-skipping stackwalk in this time window. TEF_InconsistentExceptionState = 0x00000001, -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) TEF_ForeignExceptionRaise = 0x00000002, -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) }; void SetThreadExceptionFlag(ThreadExceptionFlag flag); void ResetThreadExceptionFlag(ThreadExceptionFlag flag); BOOL HasThreadExceptionFlag(ThreadExceptionFlag flag); -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) inline void SetRaisingForeignException() { LIMITED_METHOD_CONTRACT; @@ -143,7 +140,6 @@ public: LIMITED_METHOD_CONTRACT; ResetThreadExceptionFlag(TEF_ForeignExceptionRaise); } -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) #if defined(_DEBUG) void AssertStackTraceInfo(StackTraceInfo *pSTI); diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp index c8c4ba647c..5dc83b12f5 100644 --- a/src/vm/jithelpers.cpp +++ b/src/vm/jithelpers.cpp @@ -5413,7 +5413,6 @@ HCIMPL1(void, IL_Throw, Object* obj) EEPolicy::HandleOutOfMemory(); } -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) // If the flag indicating ForeignExceptionRaise has been set, // then do not clear the "_stackTrace" field of the exception object. if (GetThread()->GetExceptionState()->IsRaisingForeignException()) @@ -5421,7 +5420,6 @@ HCIMPL1(void, IL_Throw, Object* obj) ((EXCEPTIONREF)oref)->SetStackTraceString(NULL); } else -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) { ((EXCEPTIONREF)oref)->ClearStackTracePreservingRemoteStackTrace(); } diff --git a/src/vm/mscorlib.h b/src/vm/mscorlib.h index cf0d8e1100..506faca294 100644 --- a/src/vm/mscorlib.h +++ b/src/vm/mscorlib.h @@ -1271,9 +1271,7 @@ DEFINE_FIELD_U(rgiMethodToken, StackFrameHelper, rgiMethodToken) DEFINE_FIELD_U(rgFilename, StackFrameHelper, rgFilename) DEFINE_FIELD_U(rgiLineNumber, StackFrameHelper, rgiLineNumber) DEFINE_FIELD_U(rgiColumnNumber, StackFrameHelper, rgiColumnNumber) -#if defined(FEATURE_EXCEPTIONDISPATCHINFO) DEFINE_FIELD_U(rgiLastFrameFromForeignExceptionStackTrace, StackFrameHelper, rgiLastFrameFromForeignExceptionStackTrace) -#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO) DEFINE_FIELD_U(getSourceLineInfo, StackFrameHelper, getSourceLineInfo) DEFINE_FIELD_U(iFrameCount, StackFrameHelper, iFrameCount) -- cgit v1.2.3