-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Lazy sync of Thread::m_LastThrownObjectHandle from ExInfo::m_exception #127649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
faa1887
54ea628
e0fbfd5
70188bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3186,12 +3186,9 @@ void CallCatchFunclet(OBJECTREF throwable, BYTE* pHandlerIP, REGDISPLAY* pvRegDi | |
|
|
||
| if (!pThread->GetExceptionState()->IsExceptionInProgress()) | ||
| { | ||
| pThread->SafeSetLastThrownObject(NULL); | ||
| pThread->SetLastThrownObject(NULL); | ||
| } | ||
|
|
||
| // Sync managed exception state, for the managed thread, based upon any active exception tracker | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this going to cause a behavior change in things like the windbg Before this change,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (It would be nice if we can fix this without short-lived GCHandle allocation.) |
||
| pThread->SyncManagedExceptionState(false); | ||
|
|
||
| ExInfo::UpdateNonvolatileRegisters(pvRegDisplay->pCurrentContext, pvRegDisplay, FALSE); | ||
| if (pHandlerIP != NULL) | ||
| { | ||
|
|
@@ -3596,7 +3593,6 @@ static void NotifyExceptionPassStarted(StackFrameIterator *pThis, Thread *pThrea | |
| if (pExInfo->m_passNumber == 1) | ||
| { | ||
| GCX_COOP(); | ||
| pThread->SafeSetThrowables(pExInfo->m_exception); | ||
| FirstChanceExceptionNotification(); | ||
| EEToProfilerExceptionInterfaceWrapper::ExceptionThrown(pThread); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,13 +98,21 @@ void ExInfo::ReleaseResources() | |
| // static | ||
| void ExInfo::PopExInfos(Thread *pThread, void *targetSp) | ||
| { | ||
| CONTRACTL | ||
| { | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
| MODE_COOPERATIVE; | ||
|
max-charlamb marked this conversation as resolved.
|
||
| } | ||
| CONTRACTL_END; | ||
|
|
||
| STRESS_LOG1(LF_EH, LL_INFO100, "Popping ExInfos below SP=%p\n", targetSp); | ||
|
|
||
| ExInfo *pExInfo = (PTR_ExInfo)pThread->GetExceptionState()->GetCurrentExceptionTracker(); | ||
| #if defined(DEBUGGING_SUPPORTED) | ||
| DWORD_PTR dwInterceptStackFrame = 0; | ||
|
|
||
| // This method may be called on an unmanaged thread, in which case no interception can be done. | ||
| // If there is no current ExInfo, there is nothing to inspect for interception. | ||
| if (pExInfo) | ||
| { | ||
| ThreadExceptionState* pExState = pThread->GetExceptionState(); | ||
|
|
@@ -131,6 +139,14 @@ void ExInfo::PopExInfos(Thread *pThread, void *targetSp) | |
| } | ||
| #endif // DEBUGGING_SUPPORTED | ||
|
|
||
| // Set LTO from the exception being destroyed so that post-ExInfo consumers | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should do this only when it is actually going to be needed. For example, in a simple |
||
| // (EX_CATCH via CLRLastThrownObjectException, ProcessCLRException bridging) | ||
| // can find the exception object after the ExInfo is gone. | ||
| if (pExInfo->m_exception != NULL) | ||
| { | ||
| pThread->SetLastThrownObject(pExInfo->m_exception); | ||
| } | ||
|
max-charlamb marked this conversation as resolved.
|
||
|
|
||
| pExInfo->ReleaseResources(); | ||
| pExInfo = (PTR_ExInfo)pExInfo->m_pPrevNestedInfo; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.