Skip to content

Commit

Permalink
change from java_lang_VirtualThread::is_instance(thread_oop) to hread…
Browse files Browse the repository at this point in the history
…_oop->is_a(vmClasses::BaseVirtualThread_klass()) in Threads::get_pending_threads()
  • Loading branch information
sendaoYan committed May 30, 2024
1 parent ea28c23 commit 83521f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions src/hotspot/share/prims/jvmtiEnvBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,6 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec
ResourceMark rm(current_thread);
GrowableArray<JavaThread*>* wantList = nullptr;

jint nWant_Skip = 0;
if (mark.has_monitor()) {
mon = mark.monitor();
assert(mon != nullptr, "must have monitor");
Expand All @@ -1515,13 +1514,6 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec
// Get the actual set of threads trying to enter, or re-enter, the monitor.
wantList = Threads::get_pending_threads(tlh.list(), nWant + nWait, (address)mon);
nWant = wantList->length();
for(jint 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++;
}
}
} else {
// this object has a lightweight monitor
}
Expand All @@ -1544,7 +1536,7 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec
nWait++;
}
}
ret.waiter_count = nWant - nWant_Skip;
ret.waiter_count = nWant;
ret.notify_waiter_count = nWait - skipped;

// Allocate memory for heavyweight and lightweight monitor.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
if (!p->can_call_java()) continue;

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

0 comments on commit 83521f4

Please sign in to comment.