-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix IP adjustment for interpreter EH #117055
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
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 |
---|---|---|
|
@@ -1737,12 +1737,14 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr | |
{ | ||
throwable = LOCAL_VAR(ip[1], OBJECTREF); | ||
} | ||
pInterpreterFrame->SetIsFaulting(true); | ||
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. Shouldn't this flag also be set for the other sources of exception throwing in the interp method execution ? Conv ovf opcodes for example 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. No, these are all handled in the UnwindAndContinueRethrowHelperAfterCatch 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. That one is called in the |
||
DispatchManagedException(throwable); | ||
UNREACHABLE(); | ||
break; | ||
} | ||
case INTOP_RETHROW: | ||
{ | ||
pInterpreterFrame->SetIsFaulting(true); | ||
DispatchRethrownManagedException(); | ||
UNREACHABLE(); | ||
break; | ||
|
@@ -2220,6 +2222,8 @@ do { \ | |
pMethod = pFrame->startIp->Method; | ||
assert(pMethod->CheckIntegrity()); | ||
pThreadContext->pStackPointer = pFrame->pStack + pMethod->allocaSize; | ||
|
||
pInterpreterFrame->SetIsFaulting(false); | ||
goto MAIN_LOOP; | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
How does exactly setting this flag end up preventing the ip adjustment ? Seems not obvious from searching in the code.
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.
The EH doesn't do adjustment for frames that are marked as faulting. In the JIT/AOT case, these are frames of hardware exceptions where the IP is the IP of the faulting instruction. For the interpreter, the throwing IR opcodes behave the same way. Setting this flag results in setting the m_crawl.isFaulting and m_crawl.isInterrupted to true. The SfiInit and SfiNext perform the IP adjustment only when the isFaulting is not set.
E.g. for the SfiInit, you can see it here:
runtime/src/coreclr/vm/exceptionhandling.cpp
Lines 3863 to 3866 in 50be35a