On Sat, 3 Jun 2023 10:53:04 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:
> When a virtual thread is mounted, the carrier thread should be reported as > "waiting" until the virtual thread unmounts. Right now, GetThreadState > reports a state based the JavaThread status when it should return > JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY. > The fix adds: > - a special case for passive carrier threads > - necessary test coverage to the existing JVMTI test: > `serviceability/jvmti/vthread/ThreadStateTest`. > > Testing: > - tested with the updated test: > `serviceability/jvmti/vthread/ThreadStateTest` > - submitted mach5 tiers 1-5 > - TBD: to submit mach5 tier 6 src/hotspot/share/prims/jvmtiEnvBase.cpp line 764: > 762: > 763: if (is_passive_carrier_thread(jt, thread_oop)) { > 764: state |= (JVMTI_THREAD_STATE_WAITING | > JVMTI_THREAD_STATE_WAITING_INDEFINITELY); This is testing if the jt is carrying thread_oop and it's okay for the JVMTI state to reported as WAITING when waiting for something other than Object.wait. One thing that is a bit confusing is the function name "is_passive_carrier_thread". A platform thread is either a carrier or not. Maybe for a different PR but I think is_passive_carrier_thread should be renamed to avoid the use of the word "passive". ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14298#discussion_r1216368303