RFR: 8350983: JShell LocalExecutionControl only needs stopCheck() on backward branches
Chen Liang
liach at openjdk.org
Mon Mar 3 04:44:58 UTC 2025
On Sat, 1 Mar 2025 03:14:20 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
> 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 👍
src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControl.java line 102:
> 100: return (cob, coe) -> {
> 101: switch (coe) {
> 102: case BranchInstruction branch:
Can we use switch with `->` instead of `:` to avoid the error-prone breaks?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23850#discussion_r1976864784
More information about the kulla-dev
mailing list