RFR: JDK-8264899: C1: -XX:AbortVMOnException does not work if all methods in the call stack are compiled with C1 and there are no exception handlers

Damon Fenacci duke at openjdk.org
Wed Jun 14 08:38:35 UTC 2023


# Problem
The `AbortVMOnException` flag prints the stack trace instead of aborting when the code gets compiled with C1.
This only happens when the exception gets unwound, all methods in the call stack are compiled with C1 and there are no exception handlers for that exception.
This happens here (for x86. Other platform's implementations are similar):

https://github.com/openjdk/jdk/blob/4d4706967d44b6908406818bb135f94130f373a0/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp#L1209-L1215

# Solution
To catch this situation, if `AbortVMOnException` is set, a call to check if there is a match is added when unwinding the exception. This is done in the `void Runtime1::generate_unwind_exception` which is the sole call of the `unwind_exception_id` case.

A regression test is added as well.

# Testing
This fix includes changes for x86_32/64 and aarch64, which I could test thoroughly but also for **arm**, **ppc**, **riscv**, and **s390** for which I would **need some help with testing**.

-------------

Commit messages:
 - JDK-8264899: fix RISC-V macroassembler
 - JDK-8264899: fix PPC macroassembler
 - JDK-8264899: move AbortVMOnException to generate_unwind_exception
 - Merge branch 'master' into JDK-8264899
 - JDK-8264899: use call_VM_leaf for check_abort_on_vm_exception and improve test
 - JDK-8264899: use JRT_LEAF for check_abort_on_vm_exception call and avoid using Handle
 - Merge branch 'master' into JDK-8264899
 - JDK-8264899: explicit enter/leave instead of StubFrame to avoid ret instruction
 - JDK-8264899: remove does_not_return argument
 - JDK-8264899: update copyright year
 - ... and 12 more: https://git.openjdk.org/jdk/compare/4d66d977...3a02c877

Changes: https://git.openjdk.org/jdk/pull/14240/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14240&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8264899
  Stats: 151 lines in 9 files changed: 149 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/14240.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14240/head:pull/14240

PR: https://git.openjdk.org/jdk/pull/14240


More information about the hotspot-dev mailing list