On Fri, 26 Apr 2024 19:34:55 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

>> Serguei Spitsyn has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   review: fixed minor issues: renamed function, corrected comment, removed 
>> typo in assert
>
> src/hotspot/share/prims/jvmtiThreadState.cpp line 366:
> 
>> 364:           attempts--;
>> 365:         }
>> 366:         DEBUG_ONLY(if (attempts == 0) break;)
> 
> Previously `_VTMS_transition_count` considered all threads at the same time. 
> Now you are iterating through the threads and looking at a flag in each one. 
> Is it guaranteed that once the `_VTMS_transition_mark` flag has been verified 
> not to be set in a thread it won't get set while still iterating in the 
> threads loop?

Thank you for the comment. It is thinking in a right direction.
Each `JavaThread` set the `VTM_transition_mark` only once and then checks for 
disable counters:
 - `_VTMS_transition_disable_for_all_count`
 - `java_lang_Thread::VTMS_transition_disable_count(vth())`
 
If any of the disable counters is not zero then each `JavaThread` clears the 
optimistically set mark and continues under protection of the 
`JvmtiVTMSTransition_lock`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18937#discussion_r1584025182

Reply via email to