RFR: 8350983: JShell LocalExecutionControl only needs stopCheck() on backward branches

Archie Cobbs acobbs at openjdk.org
Sat Mar 1 03:19:29 UTC 2025


JShell's `LocalExecutionControl` ensures a running eval thread can be stopped by `JShell.stop()` by inserting an invocation of `stopCheck()` at every branch point in the bytecode of loaded classfiles.

However, this same guarantee can be provided by invoking `stopCheck()` only at backward branches and not at forward branches. By doing this, the performance and size impact on the executing code can be reduced.

Fortunately the new ClassFile API makes this kind of modification easy 👍

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

Commit messages:
 - Only invoke stopCheck() at backward branches.

Changes: https://git.openjdk.org/jdk/pull/23850/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23850&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8350983
  Stats: 23 lines in 1 file changed: 17 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/23850.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23850/head:pull/23850

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


More information about the kulla-dev mailing list