diff --git a/src/coreclr/src/vm/exceptionhandling.cpp b/src/coreclr/src/vm/exceptionhandling.cpp index 5d87011f99693b..cd33b0fbd88601 100644 --- a/src/coreclr/src/vm/exceptionhandling.cpp +++ b/src/coreclr/src/vm/exceptionhandling.cpp @@ -1104,10 +1104,8 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord CLRUnwindStatus status; -#ifdef USE_PER_FRAME_PINVOKE_INIT // Refer to comment in ProcessOSExceptionNotification about ICF and codegen difference. InlinedCallFrame *pICFSetAsLimitFrame = NULL; -#endif // USE_PER_FRAME_PINVOKE_INIT status = pTracker->ProcessOSExceptionNotification( pExceptionRecord, @@ -1116,11 +1114,8 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord dwExceptionFlags, sf, pThread, - STState -#ifdef USE_PER_FRAME_PINVOKE_INIT - , (PVOID)pICFSetAsLimitFrame -#endif // USE_PER_FRAME_PINVOKE_INIT - ); + STState, + (PVOID)pICFSetAsLimitFrame); if (FirstPassComplete == status) { @@ -1223,7 +1218,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord CONSISTENCY_CHECK(pLimitFrame > dac_cast(GetSP(pContextRecord))); -#ifdef USE_PER_FRAME_PINVOKE_INIT if (pICFSetAsLimitFrame != NULL) { _ASSERTE(pICFSetAsLimitFrame == pLimitFrame); @@ -1235,7 +1229,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord // the next pinvoke callsite does not see the frame as active. pICFSetAsLimitFrame->Reset(); } -#endif // USE_PER_FRAME_PINVOKE_INIT pThread->SetFrame(pLimitFrame); @@ -1715,11 +1708,8 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification( DWORD dwExceptionFlags, StackFrame sf, Thread* pThread, - StackTraceState STState -#ifdef USE_PER_FRAME_PINVOKE_INIT - , PVOID pICFSetAsLimitFrame -#endif // USE_PER_FRAME_PINVOKE_INIT -) + StackTraceState STState, + PVOID pICFSetAsLimitFrame) { CONTRACTL { @@ -1785,10 +1775,8 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification( this->m_EnclosingClauseInfoForGCReporting.SetEnclosingClauseCallerSP(uCallerSP); } -#ifdef USE_PER_FRAME_PINVOKE_INIT // Refer to detailed comment below. PTR_Frame pICFForUnwindTarget = NULL; -#endif // USE_PER_FRAME_PINVOKE_INIT CheckForRudeAbort(pThread, fIsFirstPass); @@ -1817,15 +1805,12 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification( while (((UINT_PTR)pFrame) < uCallerSP) { -#ifdef USE_PER_FRAME_PINVOKE_INIT // InlinedCallFrames (ICF) are allocated, initialized and linked to the Frame chain // by the code generated by the JIT for a method containing a PInvoke. // - // On X64, JIT generates code to dynamically link and unlink the ICF around - // each PInvoke call. On ARM, on the other hand, JIT's codegen, in context of ICF, - // is more inline with X86 and thus, it links in the ICF at the start of the method - // and unlinks it towards the method end. Thus, ICF is present on the Frame chain - // at any given point so long as the method containing the PInvoke is on the stack. + // JIT generates code that links in the ICF at the start of the method and unlinks it towards + // the method end. Thus, ICF is present on the Frame chain at any given point so long as the + // method containing the PInvoke is on the stack. // // Now, if the method containing ICF catches an exception, we will reset the Frame chain // with the LimitFrame, that is computed below, after the catch handler returns. Since this @@ -1895,7 +1880,6 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification( } } } -#endif // USE_PER_FRAME_PINVOKE_INIT cfThisFrame.CheckGSCookies(); @@ -2040,7 +2024,6 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification( if (fTargetUnwind && (status == SecondPassComplete)) { -#ifdef USE_PER_FRAME_PINVOKE_INIT // If we have got a ICF to set as the LimitFrame, do that now. // The Frame chain is still intact and would be updated using // the LimitFrame (done after the catch handler returns). @@ -2052,7 +2035,6 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification( m_pLimitFrame = pICFForUnwindTarget; pICFSetAsLimitFrame = (PVOID)pICFForUnwindTarget; } -#endif // USE_PER_FRAME_PINVOKE_INIT // Since second pass is complete and we have reached // the frame containing the catch funclet, reset the enclosing diff --git a/src/coreclr/src/vm/exceptionhandling.h b/src/coreclr/src/vm/exceptionhandling.h index 8c245daaa6e188..2f56f20340e775 100644 --- a/src/coreclr/src/vm/exceptionhandling.h +++ b/src/coreclr/src/vm/exceptionhandling.h @@ -13,10 +13,6 @@ #include "eexcp.h" #include "exstatecommon.h" -#if defined(TARGET_ARM) || defined(TARGET_X86) -#define USE_PER_FRAME_PINVOKE_INIT -#endif // TARGET_ARM || TARGET_X86 - // This address lies in the NULL pointer partition of the process memory. // Accessing it will result in AV. #define INVALID_RESUME_ADDRESS 0x000000000000bad0 @@ -195,10 +191,8 @@ class ExceptionTracker DWORD dwExceptionFlags, StackFrame sf, Thread* pThread, - StackTraceState STState -#ifdef USE_PER_FRAME_PINVOKE_INIT - , PVOID pICFSetAsLimitFrame -#endif // USE_PER_FRAME_PINVOKE_INIT + StackTraceState STState, + PVOID pICFSetAsLimitFrame ); CLRUnwindStatus ProcessExplicitFrame(