On Sun, 26 May 2024 17:02:33 GMT, SendaoYan <s...@openjdk.org> wrote:
> > > That would mean it's not tested. I suspect the > > > java_lang_VirtualThread::is_instance checks will need to be changed to > > > test with is_a(vmClasses::BaseVirtualThread_klass()) to allow for the > > > alternative implementation. > > > > > > Do you mean change like this: > > No, I meant in JvmtiEnvBase::get_object_monitor_usage that you'll need to go > through all places where it tests if the thread is a virtual thread, they > will need to be changed to support the alternative implementation. Hi, using `is_a(vmClasses::BaseVirtualThread_klass()) ` only fix half failed results of this testcase. The `JvmtiEnvBase::get_object_monitor_usage` does not take the vthread into consideration when calculating nWant(mon->contentions()). I wonder if it needs to add some code like: ```c++ nWant = wantList->length(); for(int i = 0; i < nWant; i++) { JavaThread* w = wantList->at(i); oop thread_oop = get_vthread_or_thread_oop(w); if (thread_oop->is_a(vmClasses::BaseVirtualThread_klass())) { nWant_Skip++; } } // ... ret.waiter_count = nWant - nWant_Skip; ------------- PR Comment: https://git.openjdk.org/jdk/pull/19405#issuecomment-2133099822