< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 58110 : v2.09a with 8235795, 8235931 and 8236035 extracted; rebased to jdk-14+28; merge with 8236035.patch.cr1; merge with 8235795.patch.cr1; merge with 8236035.patch.cr2; merge with 8235795.patch.cr2; merge with 8235795.patch.cr3.


4667     thread->metadata_handles_do(_f);
4668   }
4669 };
4670 
4671 void Threads::metadata_handles_do(void f(Metadata*)) {
4672   // Only walk the Handles in Thread.
4673   ThreadHandlesClosure handles_closure(f);
4674   threads_do(&handles_closure);
4675 }
4676 
4677 // Get count Java threads that are waiting to enter the specified monitor.
4678 GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
4679                                                          int count,
4680                                                          address monitor) {
4681   GrowableArray<JavaThread*>* result = new GrowableArray<JavaThread*>(count);
4682 
4683   int i = 0;
4684   DO_JAVA_THREADS(t_list, p) {
4685     if (!p->can_call_java()) continue;
4686 
4687     address pending = (address)p->current_pending_monitor();





4688     if (pending == monitor) {             // found a match
4689       if (i < count) result->append(p);   // save the first count matches
4690       i++;
4691     }
4692   }
4693 
4694   return result;
4695 }
4696 
4697 
4698 JavaThread *Threads::owning_thread_from_monitor_owner(ThreadsList * t_list,
4699                                                       address owner) {
4700   // NULL owner means not locked so we can skip the search
4701   if (owner == NULL) return NULL;
4702 
4703   DO_JAVA_THREADS(t_list, p) {
4704     // first, see if owner is the address of a Java thread
4705     if (owner == (address)p) return p;
4706   }
4707 




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


< prev index next >