RFR: 8289613: Drop use of Thread.stop in jshell [v4]
ExE Boss
duke at openjdk.org
Wed Sep 7 19:54:45 UTC 2022
On Tue, 6 Sep 2022 09:14:47 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> LocalExecutionControl in jdk.jshell actually uses Thread::stop to cancel execution of (long-running or infinite loops) user code in JShell, however Thread::stop is deprecated and planned for removal.
>>
>> Proposed patch instruments all user code to call LocalExecutionControl::stopCheck method before every branch instruction.
>> Thread::stop call is replaced by setting global field LocalExecutionControl.allStop to true and stopCheck method then throws ThreadDead when called from the instrumented code.
>>
>> Proposed patch requires jdk.jshell access to java.base jdk.internal.org.objectweb.asm package.
>>
>> Please review.
>>
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>
> Minor formating fixes
src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControl.java line 51:
> 49: private boolean userCodeRunning = false;
> 50: private ThreadGroup execThreadGroup;
> 51: private Field allStop = null;
It might be better to use a `VarHandle` for this (as it doesn’t need boxing or access checks on every access).
-------------
PR: https://git.openjdk.org/jdk/pull/10166
More information about the core-libs-dev
mailing list