RFR: 8350208: CTW: GraphKit::add_safepoint_edges asserts "not enough operands for reexecution"

Quan Anh Mai qamai at openjdk.org
Tue Dec 2 10:36:42 UTC 2025


Hi,

This PR fixes the issue of the compiler crashing with "not enough operands for reexecution". The issue here is that during `Parse::catch_inline_exceptions`, the old stack is gone, and we cannot reexecute the current bytecode anymore. However, there are some places where we try to insert safepoints into the graph, such as if the handler is a backward jump, or if one of the exceptions in the handlers is not loaded. Since the `_reexecute` state of the current jvms is "undefined", it is inferred automatically that it should reexecute for some bytecodes such as `putfield`. The solution then is to explicitly set `_reexecute` to false.

I can manage to write a unit test for the case of a backward handler, for the other cases, since the exceptions that can be thrown for a bytecode that is inferred to reexecute are `NullPointerException`, `ArrayIndexOutOfBoundsException`, and `ArrayStoreException`. I find it hard to construct such a test in which one of them is not loaded.

Please kindly review, thanks a lot.

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

Commit messages:
 - Set jvms()->_reexecute to false during Parse::catch_inline_exceptions

Changes: https://git.openjdk.org/jdk/pull/28597/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28597&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8350208
  Stats: 153 lines in 3 files changed: 152 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/28597.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28597/head:pull/28597

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


More information about the hotspot-compiler-dev mailing list