Repository navigation
Bring RV64 and LA64 EH helpers to x64/arm64 plan - #137200
Conversation
|
Azure Pipelines: Successfully started running 7 pipeline(s). 8 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @agocke |
8167f2f to
5ae7e2f
Compare
Funclets on riscv64 and loongarch64 now save only RA, like arm64. The runtime helpers that call
funclets save all callee-saved registers instead.
- JIT: the funclet frame is RA plus the outgoing argument space, and the funclet frame info is shared
by all 64-bit targets.
- CallEHFunclet and CallEHFilterFunclet live in runtime/{riscv64,loongarch64}/EHHelpers.S and are
shared by CoreCLR and NativeAOT, following the arm64 template.
- NativeAOT pops the ExInfos in arch-neutral code and resumes after a catch through
RhpResumeAfterCatch. The unused RhpCallPropagateExceptionCallback is removed from these
architectures since FEATURE_OBJCMARSHAL is Apple-only.
- With all 64-bit targets on the shared helpers, the AMD64/ARM64 conditions become TARGET_64BIT.
Co-authored-by: Cursor <[email protected]>
d9bd953 to
5501160
Compare
|
Could you please update the comment at the R2R version bump to apply to all platforms https://github.com/dotnet/runtime/pull/137168/changes#diff-629b3f51fac4e86af46c243083bf13c2bae37e0f11fa23b2958ad86535d9c557R89 ? I think it is fine to piggyback on the one R2R version bump even though the work is split into multiple PRs. |
|
Have you done any testing on this? |
Co-authored-by: Cursor <[email protected]>
AOT smoke tests were passing on Sunday: CoreCLR test suite is running https://github.com/am11/CrossRepoCITesting/actions/runs/42829608082 but this leg usually fails under QEMU. |
There was a problem hiding this comment.
🟡 Changes recommended
LoongArch64 funclet restores can load unrelated or uninitialized floating-point values by assuming a LASX context layout, while NativeAOT TLS helpers on both architectures lack required unwind metadata.
3 open issues
What changed in this PR
Extends the ARM64 funclet model from #137168 to RISC-V64 and LoongArch64, sharing exception-handling helpers between CoreCLR and NativeAOT.
Changes:
- Simplifies funclet frames to the return address and outgoing argument space, moving register preservation into runtime helpers.
- Updates NativeAOT catch resumption and stack unwinding for the shared helpers.
- Consolidates 64-bit conditions and expands the ReadyToRun version 34 ABI comment.
| File | Description |
|---|---|
| src/coreclr/vm/riscv64/AsmMacros_Shared.h | Adds parent-context register loads. |
| src/coreclr/vm/riscv64/asmhelpers.S | Removes superseded funclet helpers. |
| src/coreclr/vm/riscv64/asmconstants.h | Defines the floating-point context offset. |
| src/coreclr/vm/loongarch64/AsmMacros_Shared.h | Adds parent-context register loads. |
| src/coreclr/vm/loongarch64/asmhelpers.S | Removes superseded funclet helpers. |
| src/coreclr/vm/loongarch64/asmconstants.h | Defines the floating-point context offset. |
| src/coreclr/vm/eetwain.cpp | Uses context-based filter calls on all 64-bit targets. |
| src/coreclr/vm/CMakeLists.txt | Includes the shared helpers in CoreCLR builds. |
| src/coreclr/runtime/riscv64/EHHelpers.S | Adds shared RISC-V64 funclet helpers. |
| src/coreclr/runtime/loongarch64/EHHelpers.S | Adds shared LoongArch64 funclet helpers. |
| src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp | Adapts unwinding to the new helper frames. |
| src/coreclr/nativeaot/Runtime/riscv64/ExceptionHandling.S | Replaces legacy helpers with catch resumption. |
| src/coreclr/nativeaot/Runtime/riscv64/AsmMacros_Shared.h | Adds register-display loads and write-back. |
| src/coreclr/nativeaot/Runtime/loongarch64/ExceptionHandling.S | Replaces legacy helpers with catch resumption. |
| src/coreclr/nativeaot/Runtime/loongarch64/AsmMacros_Shared.h | Adds register-display loads and write-back. |
| src/coreclr/nativeaot/Runtime/CMakeLists.txt | Includes shared helpers for both architectures. |
| src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/InternalCalls.cs | Extends shared helper imports to all 64-bit targets. |
| src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs | Routes 64-bit dispatch through shared helpers. |
| src/coreclr/jit/codegenriscv64.cpp | Simplifies funclet prologs, epilogs, and frame sizing. |
| src/coreclr/jit/codegenloongarch64.cpp | Simplifies funclet prologs, epilogs, and frame sizing. |
| src/coreclr/jit/codegenarm64.cpp | Adopts the common frame-size field name. |
| src/coreclr/jit/codegen.h | Consolidates 64-bit funclet frame information. |
| src/coreclr/inc/readytorun.h | Expands the ABI comment to include both architectures. |
Review effort: Balanced
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Reusing ReadyToRun major version 34 lets older RV64/LA64 runtimes accept ABI-incompatible images and risk callee-saved register corruption, requiring a fresh major version synchronized across all three version constants.
1 open issue
3 resolved since last review
Review effort: Balanced
|
/ba-g osx deadletter |
|
Thanks very much! |
|
@jkotas, with a checked runtime, I ran these suites on riscv64 hardware:
With #137318, they all passed. That PR fixes a pre-existing JIT bug in the riscv64 CAS codegen that isn't related to the EH changes; the Lock assertions in checked builds caught it. |
Fix the building error for cfi_rel_offset by #137200.
LoongArch64-Debian-OS: Checked-mode: Debug-mode: LoongArch64-Alpine-OS: Checked-mode: Debug-mode: The failed cases are: |


Built on top of #137168.
Funclets on riscv64 and loongarch64 now save only RA, like arm64. The runtime helpers that call
funclets save all callee-saved registers instead.
shared by CoreCLR and NativeAOT, following the arm64 template.
RhpResumeAfterCatch. The unused RhpCallPropagateExceptionCallback is removed from these
architectures since FEATURE_OBJCMARSHAL is Apple-only.