< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page

516 void Thread::print_owned_locks_on(outputStream* st) const {
517   Mutex* cur = _owned_locks;
518   if (cur == nullptr) {
519     st->print(" (no locks) ");
520   } else {
521     st->print_cr(" Locks owned:");
522     while (cur) {
523       cur->print_on(st);
524       cur = cur->next();
525     }
526   }
527 }
528 #endif // ASSERT
529 
530 // We had to move these methods here, because vm threads get into ObjectSynchronizer::enter
531 // However, there is a note in JavaThread::is_lock_owned() about the VM threads not being
532 // used for compilation in the future. If that change is made, the need for these methods
533 // should be revisited, and they should be removed if possible.
534 
535 bool Thread::is_lock_owned(address adr) const {

536   return is_in_full_stack(adr);
537 }
538 
539 bool Thread::set_as_starting_thread() {
540   assert(_starting_thread == nullptr, "already initialized: "
541          "_starting_thread=" INTPTR_FORMAT, p2i(_starting_thread));
542   // NOTE: this must be called inside the main thread.
543   DEBUG_ONLY(_starting_thread = this;)
544   return os::create_main_thread(JavaThread::cast(this));
545 }
546 
547 // Ad-hoc mutual exclusion primitives: SpinLock
548 //
549 // We employ SpinLocks _only for low-contention, fixed-length
550 // short-duration critical sections where we're concerned
551 // about native mutex_t or HotSpot Mutex:: latency.
552 //
553 // TODO-FIXME: ListLock should be of type SpinLock.
554 // We should make this a 1st-class type, integrated into the lock
555 // hierarchy as leaf-locks.  Critically, the SpinLock structure

516 void Thread::print_owned_locks_on(outputStream* st) const {
517   Mutex* cur = _owned_locks;
518   if (cur == nullptr) {
519     st->print(" (no locks) ");
520   } else {
521     st->print_cr(" Locks owned:");
522     while (cur) {
523       cur->print_on(st);
524       cur = cur->next();
525     }
526   }
527 }
528 #endif // ASSERT
529 
530 // We had to move these methods here, because vm threads get into ObjectSynchronizer::enter
531 // However, there is a note in JavaThread::is_lock_owned() about the VM threads not being
532 // used for compilation in the future. If that change is made, the need for these methods
533 // should be revisited, and they should be removed if possible.
534 
535 bool Thread::is_lock_owned(address adr) const {
536   assert(!UseFastLocking, "should not be called with fast-locking");
537   return is_in_full_stack(adr);
538 }
539 
540 bool Thread::set_as_starting_thread() {
541   assert(_starting_thread == nullptr, "already initialized: "
542          "_starting_thread=" INTPTR_FORMAT, p2i(_starting_thread));
543   // NOTE: this must be called inside the main thread.
544   DEBUG_ONLY(_starting_thread = this;)
545   return os::create_main_thread(JavaThread::cast(this));
546 }
547 
548 // Ad-hoc mutual exclusion primitives: SpinLock
549 //
550 // We employ SpinLocks _only for low-contention, fixed-length
551 // short-duration critical sections where we're concerned
552 // about native mutex_t or HotSpot Mutex:: latency.
553 //
554 // TODO-FIXME: ListLock should be of type SpinLock.
555 // We should make this a 1st-class type, integrated into the lock
556 // hierarchy as leaf-locks.  Critically, the SpinLock structure
< prev index next >