On Fri, 10 May 2024 22:09:01 GMT, Daniel D. Daugherty <dcu...@openjdk.org> wrote:
> Perhaps this is not what Chris had in mind, but I'm wondering what happens in > some > Thread-A when it is checked and passed by but then Thread-A sets the flag in > itself > after the for-loop has passed it by. Does that Thread-A flag value get lost? Thank you for the question. The Thread-A sets the flag optimistically and then re-checks if `sync_protocol_enabled()` and any disabler exists. It can be global disbaler (`_VTMS_transition_disable_for_all_count > 0`) or disabler of `Thread-A` only (`java_lang_Thread::VTMS_transition_disable_count(vth()) > 0`). If any disabler exists then `Thread-A` clears the optimistic settings and goes with the pessimistic approach under protection of `JvmtiVTMSTransition_lock`. Please, let me know if you still have questions. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18937#discussion_r1600987604