src/share/vm/runtime/mutex.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs24 Sdiff src/share/vm/runtime

src/share/vm/runtime/mutex.cpp

Print this page
rev 4145 : 8006563: Remove unused ProfileVM_lock
Reviewed-by: duke


1295                     // Mutex::set_owner_implementation is a friend of Thread
1296 
1297       assert(this->rank() >= 0, "bad lock rank");
1298 
1299       // Deadlock avoidance rules require us to acquire Mutexes only in
1300       // a global total order. For example m1 is the lowest ranked mutex
1301       // that the thread holds and m2 is the mutex the thread is trying
1302       // to acquire, then  deadlock avoidance rules require that the rank
1303       // of m2 be less  than the rank of m1.
1304       // The rank Mutex::native  is an exception in that it is not subject
1305       // to the verification rules.
1306       // Here are some further notes relating to mutex acquisition anomalies:
1307       // . under Solaris, the interrupt lock gets acquired when doing
1308       //   profiling, so any lock could be held.
1309       // . it is also ok to acquire Safepoint_lock at the very end while we
1310       //   already hold Terminator_lock - may happen because of periodic safepoints
1311       if (this->rank() != Mutex::native &&
1312           this->rank() != Mutex::suspend_resume &&
1313           locks != NULL && locks->rank() <= this->rank() &&
1314           !SafepointSynchronize::is_at_safepoint() &&
1315           this != Interrupt_lock && this != ProfileVM_lock &&
1316           !(this == Safepoint_lock && contains(locks, Terminator_lock) &&
1317             SafepointSynchronize::is_synchronizing())) {
1318         new_owner->print_owned_locks();
1319         fatal(err_msg("acquiring lock %s/%d out of order with lock %s/%d -- "
1320                       "possible deadlock", this->name(), this->rank(),
1321                       locks->name(), locks->rank()));
1322       }
1323 
1324       this->_next = new_owner->_owned_locks;
1325       new_owner->_owned_locks = this;
1326     #endif
1327 
1328   } else {
1329     // the thread is releasing this lock
1330 
1331     Thread* old_owner = _owner;
1332     debug_only(_last_owner = old_owner);
1333 
1334     assert(old_owner != NULL, "removing the owner thread of an unowned mutex");
1335     assert(old_owner == Thread::current(), "removing the owner thread of an unowned mutex");




1295                     // Mutex::set_owner_implementation is a friend of Thread
1296 
1297       assert(this->rank() >= 0, "bad lock rank");
1298 
1299       // Deadlock avoidance rules require us to acquire Mutexes only in
1300       // a global total order. For example m1 is the lowest ranked mutex
1301       // that the thread holds and m2 is the mutex the thread is trying
1302       // to acquire, then  deadlock avoidance rules require that the rank
1303       // of m2 be less  than the rank of m1.
1304       // The rank Mutex::native  is an exception in that it is not subject
1305       // to the verification rules.
1306       // Here are some further notes relating to mutex acquisition anomalies:
1307       // . under Solaris, the interrupt lock gets acquired when doing
1308       //   profiling, so any lock could be held.
1309       // . it is also ok to acquire Safepoint_lock at the very end while we
1310       //   already hold Terminator_lock - may happen because of periodic safepoints
1311       if (this->rank() != Mutex::native &&
1312           this->rank() != Mutex::suspend_resume &&
1313           locks != NULL && locks->rank() <= this->rank() &&
1314           !SafepointSynchronize::is_at_safepoint() &&
1315           this != Interrupt_lock && 
1316           !(this == Safepoint_lock && contains(locks, Terminator_lock) && 
1317             SafepointSynchronize::is_synchronizing())) {
1318         new_owner->print_owned_locks();
1319         fatal(err_msg("acquiring lock %s/%d out of order with lock %s/%d -- "
1320                       "possible deadlock", this->name(), this->rank(),
1321                       locks->name(), locks->rank()));
1322       }
1323 
1324       this->_next = new_owner->_owned_locks;
1325       new_owner->_owned_locks = this;
1326     #endif
1327 
1328   } else {
1329     // the thread is releasing this lock
1330 
1331     Thread* old_owner = _owner;
1332     debug_only(_last_owner = old_owner);
1333 
1334     assert(old_owner != NULL, "removing the owner thread of an unowned mutex");
1335     assert(old_owner == Thread::current(), "removing the owner thread of an unowned mutex");


src/share/vm/runtime/mutex.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File