On Tue, 6 May 2025 04:35:27 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:

>> Thank you for suggestion. Let me check if I understand you right.
>> We can rename the parameter `update_vthread_list` to `register_vthread_SR` 
>> and pass `is_virtual && single_suspend` instead of `single_suspend` to 
>> `java_suspend()` and `java_resume()`.
>> We also want to change the `HandshakeState::set_suspended()` as below:
>> 
>> void HandshakeState::set_suspended(bool is_suspend, bool 
>> register_vthread_SR) {
>> #if INCLUDE_JVMTI
>>   if (register_vthread_SR) {
>>     assert(_handshakee->is_vthread_mounted(), "sanity check");
>>     if (is_suspend) {
>>       JvmtiVTSuspender::register_vthread_suspend(_handshakee->vthread());
>>     } else {
>>       JvmtiVTSuspender::register_vthread_resume(_handshakee->vthread());
>>     }
>>   }
>> #endif
>>   Atomic::store(&_suspended, is_suspend);
>> }
>> 
>> 
>> Is this correct? If so, then I think it is a good suggestion.
>
> It feels like all the `HandshakeState` SR code can be moved from 
> `handshake.?pp` to` jvmtiEnvBase.?pp` as it seems to be a little bit 
> unnatural for `HandshakeState`. The `JvmtiThreadState_lock` or some other 
> lock can be used for waiting in the suspended state. Then some attempts to 
> simplify this code could be made. But it does not look as very important at 
> this point in time.

I've pushed the fix suggested above. Please, let me know if it looks right or 
not.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24269#discussion_r2074995937

Reply via email to