On Fri, 2 May 2025 20:53:30 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:

>> This fixes the issue with lack of synchronization between JVMTI thread 
>> suspend and resume functions in a self-suspend case. More detailed fix 
>> description is in the first PR comment.
>> 
>> Testing: Ran mach5 tiers 1-6.
>
> Serguei Spitsyn has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   review: patch from Patricio with alternate approach

Thanks for adopting the suggestion Serguei!

src/hotspot/share/prims/jvmtiEnv.cpp line 1124:

> 1122:       oop carrier_thread = 
> java_lang_VirtualThread::carrier_thread(thread_oop);
> 1123:       java_thread = carrier_thread == nullptr ? nullptr : 
> java_lang_Thread::thread(carrier_thread);
> 1124:     }      

Nit: extra spaces at the end. There are a couple of other instances of this in 
this file shown by jcheck.

src/hotspot/share/prims/jvmtiEnvBase.cpp line 1798:

> 1796:       return JVMTI_ERROR_THREAD_SUSPENDED;
> 1797:     }
> 1798:     if (!java_thread->java_suspend(single_suspend)) {

We could use `is_virtual && single_suspend` (same in resume) and change 
`_handshakee->is_vthread_mounted()` to be an assert in 
`HandshakeState::set_suspended()`.

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

PR Review: https://git.openjdk.org/jdk/pull/24269#pullrequestreview-2815125142
PR Review Comment: https://git.openjdk.org/jdk/pull/24269#discussion_r2073621313
PR Review Comment: https://git.openjdk.org/jdk/pull/24269#discussion_r2073634025

Reply via email to