Resume after catch for interpreter via native EH#128728
Conversation
|
cc: @am11 |
|
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli, @kg |
There was a problem hiding this comment.
Pull request overview
This PR changes CoreCLR interpreter resume-after-catch handling to use native C++ exception unwinding instead of the previous libunwind/manual unwind path, adding resume-after-catch handlers at native/managed boundaries and removing stored interpreter stack-pointer state.
Changes:
- Adds
ResumeAfterCatchExceptionrethrow helpers and install/uninstall macros for native/managed boundary handling. - Updates interpreter, EH, QCall, PInvoke, prestub, VSD, and allocation helper paths to use the new propagation model.
- Removes interpreter-frame saved SP plumbing and adjusts Unix UM entry prestub personalities.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/coreclr/vm/virtualcallstub.cpp |
Wraps VSD resolve workers with resume-after-catch handlers. |
src/coreclr/vm/riscv64/asmhelpers.S |
Changes UM entry prestub personality to NoHandler. |
src/coreclr/vm/qcall.h |
Adds resume-after-catch handling around QCalls. |
src/coreclr/vm/prestub.cpp |
Adds handlers around prestub and interpreted-method execution. |
src/coreclr/vm/loongarch64/asmhelpers.S |
Changes UM entry prestub personality to NoHandler. |
src/coreclr/vm/jithelpers.cpp |
Wraps throw/rethrow helpers with context-based resume handling. |
src/coreclr/vm/interpexec.h |
Removes obsolete saved-SP comment. |
src/coreclr/vm/interpexec.cpp |
Removes saved-SP tracking and restores coop mode in resume-after-catch catch block. |
src/coreclr/vm/i386/umthunkstub.S |
Changes UM entry prestub personality to NoHandler. |
src/coreclr/vm/gchelpers.cpp |
Wraps failed allocation helper with resume-after-catch handling. |
src/coreclr/vm/frames.h |
Removes interpreter-frame saved SP field/accessors. |
src/coreclr/vm/frames.cpp |
Stops passing saved interpreter SP to floating-point register update. |
src/coreclr/vm/exceptmacros.h |
Defines new resume-after-catch handler macros. |
src/coreclr/vm/exceptionhandling.h |
Declares resume-after-catch rethrow helper. |
src/coreclr/vm/exceptionhandling.cpp |
Implements managed-frame skipping rethrow helpers and wraps hardware EH path. |
src/coreclr/vm/excep.cpp |
Generalizes native-frame propagation path and removes old resume-after-catch unwind helper. |
src/coreclr/vm/eetwain.cpp |
Simplifies interpreter resume-after-catch to throw directly. |
src/coreclr/vm/dllimport.cpp |
Wraps PInvoke import worker with resume-after-catch handling. |
src/coreclr/vm/arm64/stubs.cpp |
Makes arm64 inlined-call-frame interpreter check null-safe. |
src/coreclr/vm/arm64/asmhelpers.S |
Changes UM entry prestub personality to NoHandler. |
src/coreclr/vm/amd64/umthunkstub.S |
Changes UM entry prestub personality to NoHandler. |
|
The change was created / tested on macOS arm64. There seem to be some issues on other targets that I need to address. |
This changes the way resume after catch in interpreted code works. It removes the need to use libunwind and uses C++ exception handling to unwind the stack. This is basically the same way as we use for WASM, except for some extra handling of cases when the ResumeAfterCatchException would flow into managed frames. In those cases, we skip the managed frames using the explicit frames.
6bdd856 to
258c864
Compare
It is not worth differentiating them
|
/azp run runtime-interpreter |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-interpreter |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-interpreter |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This changes the way resume after catch in interpreted code works. It removes the need to use libunwind and uses C++ exception handling to unwind the stack.
This is basically the same way as we use for WASM, except for some extra handling of cases when the ResumeAfterCatchException would flow into managed frames. In those cases, we skip the managed frames using the explicit frames.