RFR: 8298720: Insufficient error handling when CodeBuffer is exhausted [v3]

Tobias Hartmann thartmann at openjdk.org
Thu Jan 5 06:52:55 UTC 2023


> This patch fixes various places in C1 and C2 on Aarch64 and RISC-V that miss proper error handling when the code buffer is exhausted, leading to crashes. Similar but incomplete patches went in with [JDK-8130309](https://bugs.openjdk.org/browse/JDK-8130309), [JDK-8248411](https://bugs.openjdk.org/browse/JDK-8248411) and [JDK-8272094](https://bugs.openjdk.org/browse/JDK-8272094) in the past. 
> 
> These issues are extremely hard to reproduce, even with the `-XX:+StressCodeBuffers` option, because code buffer expansion needs to fail at the exact moment when a specific (unhandled) instruction is emitted. Even with the stress option, we expand the code buffer such that multiple instructions will fit and in addition, chances are high that we simply bail out from compilation before emitting the problematic instruction. I attached a patch to [JDK-8298720](https://bugs.openjdk.org/browse/JDK-8298720), that makes `-XX:+StressCodeBuffers` randomized and more aggressive. With that, I can reproduce the issue reliably but it's extremely slow and therefore not well suited for integration.
> 
> I now went over all usages of `CodeBuffer::expand` to make sure that we have proper error handling in place and found some remaining issues in JVMCI code. I filed [JDK-8299570](https://bugs.openjdk.org/browse/JDK-8299570) to address them.
> 
> I would need help to test the RISC-V specific changes.
> 
> Thanks,
> Tobias

Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:

  Bail out from C1 MacroAssembler

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11839/files
  - new: https://git.openjdk.org/jdk/pull/11839/files/25a4cf22..60921e18

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11839&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11839&range=01-02

  Stats: 48 lines in 3 files changed: 7 ins; 11 del; 30 mod
  Patch: https://git.openjdk.org/jdk/pull/11839.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11839/head:pull/11839

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


More information about the hotspot-dev mailing list