summaryrefslogtreecommitdiff
path: root/src/vm/virtualcallstub.cpp
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-09-08 11:23:13 (GMT)
committerJan Vorlicek <janvorli@microsoft.com>2015-09-08 11:42:29 (GMT)
commit468666bc8bd0c58268187cea5749cef63479b30e (patch)
tree4627399a7dd80737b91bb5375d87d46faea78878 /src/vm/virtualcallstub.cpp
parent1165038551b7ca20f230d867dc5fd2357ede14fe (diff)
downloadcoreclr-468666bc8bd0c58268187cea5749cef63479b30e.zip
coreclr-468666bc8bd0c58268187cea5749cef63479b30e.tar.gz
coreclr-468666bc8bd0c58268187cea5749cef63479b30e.tar.bz2
Fix managed exception dispatching
The managed exception dispatching is initiated from the UNINSTALL_MANAGED_EXCEPTION_DISPATCHER macro and it should be used only at the border between managed and native code, when managed code calls native one. This macro is part of the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE macro. However, it turns out that the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE (or the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER that uses it) is also used at places where there is no managed / native border. In that case, the managed dispatching results incorrectly in skipping native frames that would otherwise handle the exception. The fix removes the INSTALL_MANAGED_EXCEPTION_DISPATCHER / UNINSTALL_MANAGED_EXCEPTION_DISPATCHER from the INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE / UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE and puts them to specific places where INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE / UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE and INSTALL_UNWIND_AND_CONTINUE_HANDLER / UNINSTALL_UNWIND_AND_CONTINUE_HANDLER are used at the border between managed and native code.
Diffstat (limited to 'src/vm/virtualcallstub.cpp')
-rw-r--r--src/vm/virtualcallstub.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vm/virtualcallstub.cpp b/src/vm/virtualcallstub.cpp
index c234e8c..729d90c 100644
--- a/src/vm/virtualcallstub.cpp
+++ b/src/vm/virtualcallstub.cpp
@@ -1228,6 +1228,7 @@ extern "C" PCODE STDCALL StubDispatchFixupWorker(TransitionBlock * pTransitionBl
pSDFrame->SetCallSite(pModule, pIndirectCell);
pSDFrame->Push(CURRENT_THREAD);
+ INSTALL_MANAGED_EXCEPTION_DISPATCHER;
INSTALL_UNWIND_AND_CONTINUE_HANDLER;
PEImageLayout *pNativeImage = pModule->GetNativeOrReadyToRunImage();
@@ -1296,6 +1297,7 @@ extern "C" PCODE STDCALL StubDispatchFixupWorker(TransitionBlock * pTransitionBl
// Ready to return
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
+ UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
pSDFrame->Pop(CURRENT_THREAD);
return pTarget;
@@ -1575,6 +1577,7 @@ PCODE VSD_ResolveWorker(TransitionBlock * pTransitionBlock,
pSDFrame->SetRepresentativeSlot(pRepresentativeMT, representativeToken.GetSlotNumber());
pSDFrame->Push(CURRENT_THREAD);
+ INSTALL_MANAGED_EXCEPTION_DISPATCHER;
INSTALL_UNWIND_AND_CONTINUE_HANDLER;
// For Virtual Delegates the m_siteAddr is a field of a managed object
@@ -1604,6 +1607,7 @@ PCODE VSD_ResolveWorker(TransitionBlock * pTransitionBlock,
GCPROTECT_END();
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
+ UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
pSDFrame->Pop(CURRENT_THREAD);
return target;