RFR: 8297431: [JVMCI] HotSpotJVMCIRuntime.encodeThrowable should not throw an exception
Doug Simon
dnsimon at openjdk.org
Tue Nov 22 14:38:25 UTC 2022
JVMCI has a mechanism for translating exceptions from libjvmci to HotSpot and vice versa. This is important for proper error handling when a thread calls between these 2 runtime heaps.
This translation mechanism itself needs to be robust in the context of resource limits, especially heap limits, as it may be translating an OutOfMemoryError from HotSpot back into libjvmci. The existing code in [`HotSpotJVMCIRuntime.encodeThrowable`](https://github.com/graalvm/labs-openjdk-17/blob/f6b18b596fa5acb1ab7efa10e284d106669040a6/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java#L237) and [`TranslatedException.encodeThrowable`](https://github.com/graalvm/labs-openjdk-17/blob/f6b18b596fa5acb1ab7efa10e284d106669040a6/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/TranslatedException.java#L153) is designed to handle translation failures by falling back to non-allocating code. However, we still occasionally see [an OOME that breaks the translation mechanism](https://github.com/oracle/graal/issues/5470#issuecomment-1321749688). One speculated possibility for this is an OOME re-materializing oops duri
ng a deoptimization causing an unexpected execution path. This PR increases the robustness of the exception translation code in light of such issues.
-------------
Commit messages:
- be more robust translating exceptions between HotSpot and libjvmci
Changes: https://git.openjdk.org/jdk/pull/11286/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11286&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8297431
Stats: 25 lines in 3 files changed: 16 ins; 2 del; 7 mod
Patch: https://git.openjdk.org/jdk/pull/11286.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11286/head:pull/11286
PR: https://git.openjdk.org/jdk/pull/11286
More information about the hotspot-compiler-dev
mailing list