RFR: 8289613: Drop use of Thread.stop in jshell

2022-09-05 Thread Adam Sotona
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

Re: RFR: 8289613: Drop use of Thread.stop in jshell

2022-09-05 Thread Alan Bateman
On Mon, 5 Sep 2022 12:39:41 GMT, Adam Sotona 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 u

Re: RFR: 8289613: Drop use of Thread.stop in jshell

2022-09-05 Thread Rémi Forax
On Mon, 5 Sep 2022 12:39:41 GMT, Adam Sotona 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 u

Re: RFR: 8289613: Drop use of Thread.stop in jshell

2022-09-05 Thread Jan Lahoda
On Mon, 5 Sep 2022 12:39:41 GMT, Adam Sotona 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 u

Re: RFR: 8289613: Drop use of Thread.stop in jshell

2022-09-05 Thread Rémi Forax
On Mon, 5 Sep 2022 12:39:41 GMT, Adam Sotona 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 u

Re: RFR: 8289613: Drop use of Thread.stop in jshell

2022-09-05 Thread Adam Sotona
On Mon, 5 Sep 2022 13:18:08 GMT, Alan Bateman 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

Re: RFR: 8289613: Drop use of Thread.stop in jshell

2022-09-05 Thread Rémi Forax
On Mon, 5 Sep 2022 14:42:56 GMT, Adam Sotona wrote: >> This is the last usage of Thread.stop in the JDK so this change is welcome. >> >> The instrumentation to check a flag at jump instrumentation looks >> reasonable, and works here because the method is public on a public class in >> an expor

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

2022-09-05 Thread Adam Sotona
> 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 m

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

2022-09-05 Thread Adam Sotona
On Mon, 5 Sep 2022 15:53:32 GMT, Adam Sotona 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

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

2022-09-05 Thread Alan Bateman
On Mon, 5 Sep 2022 15:53:32 GMT, Adam Sotona 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

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

2022-09-05 Thread Adam Sotona
> 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 m

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

2022-09-05 Thread Adam Sotona
On Mon, 5 Sep 2022 19:23:30 GMT, Adam Sotona 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

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

2022-09-06 Thread Adam Sotona
On Tue, 6 Sep 2022 08:04:07 GMT, Rémi Forax wrote: >> 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 instru

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

2022-09-06 Thread Adam Sotona
> 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 m

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

2022-09-06 Thread Adam Sotona
On Tue, 6 Sep 2022 08:06:13 GMT, Rémi Forax wrote: >> 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 instru

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

2022-09-07 Thread Alan Bateman
On Tue, 6 Sep 2022 09:14:47 GMT, Adam Sotona 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

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

2022-09-07 Thread Jan Lahoda
On Tue, 6 Sep 2022 09:14:47 GMT, Adam Sotona 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

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

2022-09-07 Thread Jan Lahoda
On Wed, 7 Sep 2022 18:22:21 GMT, Alan Bateman wrote: > Would it be possible to summarize how the loader delegate work in jshell? > Instrumenting the code to invoke REPL/$Cancel$.stopCheck looks reasonable but > I can't immediately see how the generated REPL/$Cancel$ has access to > LocalExecut

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

2022-09-07 Thread Alan Bateman
On Wed, 7 Sep 2022 18:35:37 GMT, Jan Lahoda wrote: > Not sure what you mean - as far as I can tell, neither the generated class, > nor the snippets access `LocalExecutionControl.allStop`. Okay, I see it now. REPL.$Cancel$.allStop is public so there is no issue accessing it from LEC.invoke. -

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

2022-09-07 Thread ExE Boss
On Tue, 6 Sep 2022 09:14:47 GMT, Adam Sotona 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

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

2022-09-08 Thread Adam Sotona
On Wed, 7 Sep 2022 19:48:56 GMT, ExE Boss wrote: >> 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:

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

2022-09-08 Thread Adam Sotona
On Tue, 6 Sep 2022 09:05:53 GMT, Adam Sotona wrote: >> src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControl.java >> line 200: >> >>> 198: allStop.set(null, true); >>> 199: } catch (IllegalArgumentException| IllegalAccessException >>> ex) { >>> 200

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

2022-09-08 Thread Alan Bateman
On Thu, 8 Sep 2022 08:34:59 GMT, Adam Sotona wrote: > According to javadoc VarHandle of static field "effectively ignore the > volatile declaration". > Volatility of REPL.$Cancel.allStop field is critical for this use case. VarHandles defines xxxVolatile so it would be feasible but I don't see

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

2022-09-08 Thread Jan Lahoda
On Tue, 6 Sep 2022 09:14:47 GMT, Adam Sotona 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