Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/coreclr/debug/runtimeinfo/datadescriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,13 +677,11 @@ CDAC_TYPE_FIELD(InlinedCallFrame, /*pointer*/, CallerReturnAddress, offsetof(Inl
CDAC_TYPE_FIELD(InlinedCallFrame, /*pointer*/, CalleeSavedFP, offsetof(InlinedCallFrame, m_pCalleeSavedFP))
CDAC_TYPE_END(InlinedCallFrame)

#ifdef FEATURE_EH_FUNCLETS
CDAC_TYPE_BEGIN(SoftwareExceptionFrame)
CDAC_TYPE_SIZE(sizeof(SoftwareExceptionFrame))
CDAC_TYPE_FIELD(SoftwareExceptionFrame, /*T_CONTEXT*/, TargetContext, cdac_data<SoftwareExceptionFrame>::TargetContext)
CDAC_TYPE_FIELD(SoftwareExceptionFrame, /*pointer*/, ReturnAddress, cdac_data<SoftwareExceptionFrame>::ReturnAddress)
CDAC_TYPE_END(SoftwareExceptionFrame)
#endif // FEATURE_EH_FUNCLETS

CDAC_TYPE_BEGIN(FramedMethodFrame)
CDAC_TYPE_SIZE(sizeof(FramedMethodFrame))
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/vm/FrameTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ FRAME_TYPE_NAME(ResumableFrame)
FRAME_TYPE_NAME(RedirectedThreadFrame)
#endif // FEATURE_HIJACK
FRAME_TYPE_NAME(FaultingExceptionFrame)
#ifdef FEATURE_EH_FUNCLETS
FRAME_TYPE_NAME(SoftwareExceptionFrame)
#endif // FEATURE_EH_FUNCLETS
#ifdef DEBUGGING_SUPPORTED
FRAME_TYPE_NAME(FuncEvalFrame)
#endif // DEBUGGING_SUPPORTED
Expand Down
14 changes: 11 additions & 3 deletions src/coreclr/vm/excep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11315,12 +11315,11 @@ MethodDesc * GetUserMethodForILStub(Thread * pThread, UINT_PTR uStubSP, MethodDe
}


#ifdef FEATURE_EH_FUNCLETS

void SoftwareExceptionFrame::UpdateRegDisplay_Impl(const PREGDISPLAY pRD, bool updateFloats)
{
LIMITED_METHOD_DAC_CONTRACT;

#ifdef FEATURE_EH_FUNCLETS
#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContext->regname = *dac_cast<PTR_SIZE_T>((TADDR)m_ContextPointers.regname);
ENUM_CALLEE_SAVED_REGISTERS();
#undef CALLEE_SAVED_REGISTER
Expand All @@ -11341,6 +11340,16 @@ void SoftwareExceptionFrame::UpdateRegDisplay_Impl(const PREGDISPLAY pRD, bool u

pRD->IsCallerContextValid = FALSE;
pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary.
#elif defined(TARGET_X86)
#define CALLEE_SAVED_REGISTER(regname) pRD->Set##regname##Location(m_ContextPointers.regname);
ENUM_CALLEE_SAVED_REGISTERS();
#undef CALLEE_SAVED_REGISTER

pRD->ControlPC = ::GetIP(&m_Context);
pRD->SP = ::GetSP(&m_Context);
#else // FEATURE_EH_FUNCLETS
PORTABILITY_ASSERT("SoftwareExceptionFrame::UpdateRegDisplay_Impl");
#endif // FEATURE_EH_FUNCLETS
}

#ifndef DACCESS_COMPILE
Expand Down Expand Up @@ -11421,4 +11430,3 @@ void SoftwareExceptionFrame::InitAndLink(Thread *pThread)
}

#endif // DACCESS_COMPILE
#endif // FEATURE_EH_FUNCLETS
3 changes: 0 additions & 3 deletions src/coreclr/vm/frames.h
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,6 @@ struct cdac_data<FaultingExceptionFrame>
#endif // FEATURE_EH_FUNCLETS
};

#ifdef FEATURE_EH_FUNCLETS

typedef DPTR(class SoftwareExceptionFrame) PTR_SoftwareExceptionFrame;

class SoftwareExceptionFrame : public Frame
Expand Down Expand Up @@ -1108,7 +1106,6 @@ struct cdac_data<SoftwareExceptionFrame>
static constexpr size_t TargetContext = offsetof(SoftwareExceptionFrame, m_Context);
static constexpr size_t ReturnAddress = offsetof(SoftwareExceptionFrame, m_ReturnAddress);
};
#endif // FEATURE_EH_FUNCLETS

//-----------------------------------------------------------------------
// Frame for debugger function evaluation
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/vm/i386/asmhelpers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,9 @@ EXTERN g_chained_lookup_miss_counter:DWORD
EXTERN g_dispatch_cache_chain_success_counter:DWORD
endif

ifdef FEATURE_EH_FUNCLETS
EXTERN @IL_Throw_x86@8:PROC
EXTERN @IL_ThrowExact_x86@8:PROC
EXTERN @IL_Rethrow_x86@4:PROC
endif ; FEATURE_EH_FUNCLETS

UNREFERENCED macro arg
local unref
Expand Down Expand Up @@ -1894,7 +1892,6 @@ _BackPatchWorkerAsmStub@0 proc public
ret
_BackPatchWorkerAsmStub@0 endp

ifdef FEATURE_EH_FUNCLETS
;==========================================================================
; Capture a transition block with register values and call the IL_Throw
; implementation written in C.
Expand Down Expand Up @@ -1942,6 +1939,5 @@ FASTCALL_FUNC IL_Rethrow, 0
STUB_EPILOG
ret 4
FASTCALL_ENDFUNC IL_Rethrow
endif ; FEATURE_EH_FUNCLETS

end
78 changes: 46 additions & 32 deletions src/coreclr/vm/jithelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ HCIMPLEND

/*************************************************************/

#if defined(TARGET_X86) && defined(FEATURE_EH_FUNCLETS)
#if defined(TARGET_X86)
EXTERN_C FCDECL1(void, IL_Throw, Object* obj);
EXTERN_C HCIMPL2(void, IL_Throw_x86, Object* obj, TransitionBlock* transitionBlock)
#else
Expand All @@ -1241,8 +1241,6 @@ HCIMPL1(void, IL_Throw, Object* obj)

OBJECTREF oref = ObjectToOBJECTREF(obj);

#ifdef FEATURE_EH_FUNCLETS

Thread *pThread = GetThread();

SoftwareExceptionFrame exceptionFrame;
Expand All @@ -1255,6 +1253,7 @@ HCIMPL1(void, IL_Throw, Object* obj)

FC_CAN_TRIGGER_GC();

#ifdef FEATURE_EH_FUNCLETS
if (oref == 0)
DispatchManagedException(kNullReferenceException);
else
Expand Down Expand Up @@ -1282,15 +1281,12 @@ HCIMPL1(void, IL_Throw, Object* obj)
}

DispatchManagedException(oref, exceptionFrame.GetContext());
FC_CAN_TRIGGER_GC_END();
UNREACHABLE();
#endif // FEATURE_EH_FUNCLETS

HELPER_METHOD_FRAME_BEGIN_ATTRIB_NOPOLL(Frame::FRAME_ATTR_EXCEPTION); // Set up a frame
#elif defined(TARGET_X86)
INSTALL_MANAGED_EXCEPTION_DISPATCHER;
INSTALL_UNWIND_AND_CONTINUE_HANDLER;

#if defined(_DEBUG) && defined(TARGET_X86)
__helperframe.EnsureInit(NULL);
g_ExceptionEIP = (LPVOID)__helperframe.GetReturnAddress();
g_ExceptionEIP = (PVOID)transitionBlock->m_ReturnAddress;
#endif // defined(_DEBUG) && defined(TARGET_X86)

if (oref == 0)
Expand Down Expand Up @@ -1321,13 +1317,20 @@ HCIMPL1(void, IL_Throw, Object* obj)

RaiseTheExceptionInternalOnly(oref, FALSE);

HELPER_METHOD_FRAME_END();
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
#else // FEATURE_EH_FUNCLETS
PORTABILITY_ASSERT("IL_Throw");
#endif // FEATURE_EH_FUNCLETS

FC_CAN_TRIGGER_GC_END();
UNREACHABLE();
}
HCIMPLEND

/*************************************************************/

#if defined(TARGET_X86) && defined(FEATURE_EH_FUNCLETS)
#if defined(TARGET_X86)
EXTERN_C FCDECL0(void, IL_Rethrow);
EXTERN_C HCIMPL1(void, IL_Rethrow_x86, TransitionBlock* transitionBlock)
#else
Expand All @@ -1338,7 +1341,6 @@ HCIMPL0(void, IL_Rethrow)

FC_GC_POLL_NOT_NEEDED(); // throws always open up for GC

#ifdef FEATURE_EH_FUNCLETS
Thread *pThread = GetThread();

SoftwareExceptionFrame exceptionFrame;
Expand All @@ -1349,12 +1351,13 @@ HCIMPL0(void, IL_Rethrow)
#endif
exceptionFrame.InitAndLink(pThread);

FC_CAN_TRIGGER_GC();

#ifdef FEATURE_EH_FUNCLETS
ExInfo *pActiveExInfo = (ExInfo*)pThread->GetExceptionState()->GetCurrentExceptionTracker();

ExInfo exInfo(pThread, pActiveExInfo->m_ptrs.ExceptionRecord, exceptionFrame.GetContext(), ExKind::None);

FC_CAN_TRIGGER_GC();

GCPROTECT_BEGIN(exInfo.m_exception);
PREPARE_NONVIRTUAL_CALLSITE(METHOD__EH__RH_RETHROW);
DECLARE_ARGHOLDER_ARRAY(args, 2);
Expand All @@ -1367,12 +1370,9 @@ HCIMPL0(void, IL_Rethrow)
//Ex.RhRethrow(ref ExInfo activeExInfo, ref ExInfo exInfo)
CALL_MANAGED_METHOD_NORET(args)
GCPROTECT_END();

FC_CAN_TRIGGER_GC_END();
UNREACHABLE();
#endif

HELPER_METHOD_FRAME_BEGIN_ATTRIB_NOPOLL(Frame::FRAME_ATTR_EXCEPTION); // Set up a frame
#elif defined(TARGET_X86)
INSTALL_MANAGED_EXCEPTION_DISPATCHER;
INSTALL_UNWIND_AND_CONTINUE_HANDLER;

OBJECTREF throwable = GetThread()->GetThrowable();
if (throwable != NULL)
Expand All @@ -1386,11 +1386,18 @@ HCIMPL0(void, IL_Rethrow)
RealCOMPlusThrow(kInvalidProgramException, (UINT)IDS_EE_RETHROW_NOT_ALLOWED);
}

HELPER_METHOD_FRAME_END();
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
#else // FEATURE_EH_FUNCLETS
PORTABILITY_ASSERT("IL_Rethrow");
#endif // FEATURE_EH_FUNCLETS

FC_CAN_TRIGGER_GC_END();
UNREACHABLE();
}
HCIMPLEND

#if defined(TARGET_X86) && defined(FEATURE_EH_FUNCLETS)
#if defined(TARGET_X86)
EXTERN_C FCDECL1(void, IL_ThrowExact, Object* obj);
EXTERN_C HCIMPL2(void, IL_ThrowExact_x86, Object* obj, TransitionBlock* transitionBlock)
#else
Expand All @@ -1407,7 +1414,6 @@ HCIMPL1(void, IL_ThrowExact, Object* obj)
OBJECTREF oref = ObjectToOBJECTREF(obj);
GetThread()->GetExceptionState()->SetRaisingForeignException();

#ifdef FEATURE_EH_FUNCLETS
Thread *pThread = GetThread();

SoftwareExceptionFrame exceptionFrame;
Expand All @@ -1419,19 +1425,27 @@ HCIMPL1(void, IL_ThrowExact, Object* obj)
exceptionFrame.InitAndLink(pThread);

FC_CAN_TRIGGER_GC();

#ifdef FEATURE_EH_FUNCLETS
DispatchManagedException(oref, exceptionFrame.GetContext());
FC_CAN_TRIGGER_GC_END();
UNREACHABLE();
#else
HELPER_METHOD_FRAME_BEGIN_ATTRIB_NOPOLL(Frame::FRAME_ATTR_EXCEPTION); // Set up a frame
#elif defined(TARGET_X86)
INSTALL_MANAGED_EXCEPTION_DISPATCHER;
INSTALL_UNWIND_AND_CONTINUE_HANDLER;

#if defined(_DEBUG) && defined(TARGET_X86)
__helperframe.EnsureInit(NULL);
g_ExceptionEIP = (LPVOID)__helperframe.GetReturnAddress();
g_ExceptionEIP = (PVOID)transitionBlock->m_ReturnAddress;
#endif // defined(_DEBUG) && defined(TARGET_X86)

RaiseTheExceptionInternalOnly(oref, FALSE);
HELPER_METHOD_FRAME_END();
#endif

UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
#else // FEATURE_EH_FUNCLETS
PORTABILITY_ASSERT("IL_ThrowExact");
#endif // FEATURE_EH_FUNCLETS

FC_CAN_TRIGGER_GC_END();
UNREACHABLE();
}
HCIMPLEND

Expand Down
Loading