< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 57232 : v2.00 -> v2.08 (CR8/v2.08/11-for-jdk14) patches combined into one; merge with jdk-14+25 snapshot; merge with jdk-14+26 snapshot.
rev 57233 : See CR8-to-CR9-changes; merge with 8230876.patch (2019.11.15); merge with jdk-14+25 snapshot; fuzzy merge with jdk-14+26 snapshot.


4652     thread->metadata_handles_do(_f);
4653   }
4654 };
4655 
4656 void Threads::metadata_handles_do(void f(Metadata*)) {
4657   // Only walk the Handles in Thread.
4658   ThreadHandlesClosure handles_closure(f);
4659   threads_do(&handles_closure);
4660 }
4661 
4662 // Get count Java threads that are waiting to enter the specified monitor.
4663 GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
4664                                                          int count,
4665                                                          address monitor) {
4666   GrowableArray<JavaThread*>* result = new GrowableArray<JavaThread*>(count);
4667 
4668   int i = 0;
4669   DO_JAVA_THREADS(t_list, p) {
4670     if (!p->can_call_java()) continue;
4671 




4672     ObjectMonitorHandle omh;
4673     address pending = (address)p->current_pending_monitor(&omh);
4674     if (pending == monitor) {             // found a match
4675       if (i < count) result->append(p);   // save the first count matches
4676       i++;
4677     }
4678   }
4679 
4680   return result;
4681 }
4682 
4683 
4684 JavaThread *Threads::owning_thread_from_monitor_owner(ThreadsList * t_list,
4685                                                       address owner) {
4686   // NULL owner means not locked so we can skip the search
4687   if (owner == NULL) return NULL;
4688 
4689   DO_JAVA_THREADS(t_list, p) {
4690     // first, see if owner is the address of a Java thread
4691     if (owner == (address)p) return p;




4652     thread->metadata_handles_do(_f);
4653   }
4654 };
4655 
4656 void Threads::metadata_handles_do(void f(Metadata*)) {
4657   // Only walk the Handles in Thread.
4658   ThreadHandlesClosure handles_closure(f);
4659   threads_do(&handles_closure);
4660 }
4661 
4662 // Get count Java threads that are waiting to enter the specified monitor.
4663 GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
4664                                                          int count,
4665                                                          address monitor) {
4666   GrowableArray<JavaThread*>* result = new GrowableArray<JavaThread*>(count);
4667 
4668   int i = 0;
4669   DO_JAVA_THREADS(t_list, p) {
4670     if (!p->can_call_java()) continue;
4671 
4672     // This current_pending_monitor() call site only uses the returned
4673     // ObjectMonitor* for matching purposes and does not try to fetch
4674     // the object reference so this ObjectMonitorHandle is not strictly
4675     // necessary.
4676     ObjectMonitorHandle omh;
4677     address pending = (address)p->current_pending_monitor(&omh);
4678     if (pending == monitor) {             // found a match
4679       if (i < count) result->append(p);   // save the first count matches
4680       i++;
4681     }
4682   }
4683 
4684   return result;
4685 }
4686 
4687 
4688 JavaThread *Threads::owning_thread_from_monitor_owner(ThreadsList * t_list,
4689                                                       address owner) {
4690   // NULL owner means not locked so we can skip the search
4691   if (owner == NULL) return NULL;
4692 
4693   DO_JAVA_THREADS(t_list, p) {
4694     // first, see if owner is the address of a Java thread
4695     if (owner == (address)p) return p;


< prev index next >