RFR: 8289613: Drop use of Thread.stop in jshell [v3]

Adam Sotona asotona at openjdk.org
Mon Sep 5 19:23:30 UTC 2022


> 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 two additional commits since the last revision:

 - allStop field and stopCheck method moved to synthetic REPL.$Cancel$
 - Revert "alternative implementation where instrumented code is directly checking Thread::interrupted"
   
   This reverts commit 0f0e0dd17c121955e7806073bb8cc78da1f133ea.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10166/files
  - new: https://git.openjdk.org/jdk/pull/10166/files/0f0e0dd1..30c34b6a

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

  Stats: 43 lines in 1 file changed: 33 ins; 7 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/10166.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10166/head:pull/10166

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


More information about the core-libs-dev mailing list