Skip to content

Commit 767be2a

Browse files
authored
Enable thread abort support in the interpreter (#121446)
This change adds check for thread abort to the INTOP_SAFEPOINT and also to the code resuming after catch. This makes all the libraries controlled execution tests pass.
1 parent c2e6bff commit 767be2a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/coreclr/vm/interpexec.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,15 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr
12471247
case INTOP_SAFEPOINT:
12481248
if (g_TrapReturningThreads)
12491249
{
1250+
Thread *pThread = GetThread();
1251+
if (pThread->IsAbortRequested())
1252+
{
1253+
CallWithSEHWrapper(
1254+
[&pThread]() {
1255+
pThread->HandleThreadAbort();
1256+
return 0;
1257+
});
1258+
}
12501259
// Transition into preemptive mode to allow the GC to suspend us
12511260
GCX_PREEMP();
12521261
}
@@ -3609,6 +3618,15 @@ do \
36093618
pThreadContext->pStackPointer = pFrame->pStack + pMethod->allocaSize;
36103619

36113620
pInterpreterFrame->SetIsFaulting(false);
3621+
3622+
Thread *pThread = GetThread();
3623+
if (pThread->IsAbortRequested())
3624+
{
3625+
// Record the resume IP in the pFrame so that the exception handling unwinds from there
3626+
pFrame->ip = ip;
3627+
DispatchManagedException(kThreadAbortException);
3628+
}
3629+
36123630
goto MAIN_LOOP;
36133631
}
36143632

0 commit comments

Comments
 (0)