Skip to content

Commit 51b2f80

Browse files
SendaoYanJiawei Tang
authored and
Serguei Spitsyn
committedJun 1, 2024
8332923: ObjectMonitorUsage.java failed with unexpected waiter_count
Co-authored-by: Jiawei Tang <jwtang@openjdk.org> Reviewed-by: sspitsyn, alanb, amitkumar
1 parent d29d5bf commit 51b2f80

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎src/hotspot/share/prims/jvmtiEnvBase.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec
14751475
owning_thread = ObjectSynchronizer::get_lock_owner(tlh.list(), hobj);
14761476
if (owning_thread != nullptr) {
14771477
oop thread_oop = get_vthread_or_thread_oop(owning_thread);
1478-
bool is_virtual = java_lang_VirtualThread::is_instance(thread_oop);
1478+
bool is_virtual = thread_oop->is_a(vmClasses::BaseVirtualThread_klass());
14791479
if (is_virtual) {
14801480
thread_oop = nullptr;
14811481
}
@@ -1522,7 +1522,7 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec
15221522
waiter = mon->next_waiter(waiter)) {
15231523
JavaThread *w = mon->thread_of_waiter(waiter);
15241524
oop thread_oop = get_vthread_or_thread_oop(w);
1525-
if (java_lang_VirtualThread::is_instance(thread_oop)) {
1525+
if (thread_oop->is_a(vmClasses::BaseVirtualThread_klass())) {
15261526
skipped++;
15271527
}
15281528
nWait++;
@@ -1572,9 +1572,9 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec
15721572
for (int i = 0; i < nWait; i++) {
15731573
JavaThread *w = mon->thread_of_waiter(waiter);
15741574
oop thread_oop = get_vthread_or_thread_oop(w);
1575-
bool is_virtual = java_lang_VirtualThread::is_instance(thread_oop);
1575+
bool is_virtual = thread_oop->is_a(vmClasses::BaseVirtualThread_klass());
15761576
assert(w != nullptr, "sanity check");
1577-
if (java_lang_VirtualThread::is_instance(thread_oop)) {
1577+
if (is_virtual) {
15781578
skipped++;
15791579
} else {
15801580
// If the thread was found on the ObjectWaiter list, then

‎src/hotspot/share/runtime/threads.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
11961196
if (!p->can_call_java()) continue;
11971197

11981198
oop thread_oop = JvmtiEnvBase::get_vthread_or_thread_oop(p);
1199-
if (java_lang_VirtualThread::is_instance(thread_oop)) {
1199+
if (thread_oop->is_a(vmClasses::BaseVirtualThread_klass())) {
12001200
continue;
12011201
}
12021202
// The first stage of async deflation does not affect any field

0 commit comments

Comments
 (0)
Please sign in to comment.