--- old/src/hotspot/share/runtime/mutex.cpp 2018-12-07 00:51:13.729065275 -0500 +++ new/src/hotspot/share/runtime/mutex.cpp 2018-12-07 00:51:13.461051172 -0500 @@ -1076,9 +1076,9 @@ Monitor * least = get_least_ranked_lock_besides_this(Self->owned_locks()); assert(least != this, "Specification of get_least_... call above"); if (least != NULL && least->rank() <= special) { - tty->print("Attempting to wait on monitor %s/%d while holding" - " lock %s/%d -- possible deadlock", - name(), rank(), least->name(), least->rank()); + ::tty->print("Attempting to wait on monitor %s/%d while holding" + " lock %s/%d -- possible deadlock", + name(), rank(), least->name(), least->rank()); assert(false, "Shouldn't block(wait) while holding a lock of rank special"); } #endif // ASSERT --- old/src/hotspot/share/runtime/mutex.hpp 2018-12-07 00:51:14.717117267 -0500 +++ new/src/hotspot/share/runtime/mutex.hpp 2018-12-07 00:51:14.441102743 -0500 @@ -87,6 +87,8 @@ // The rank 'access' is similar to 'special' and has the same restrictions on usage. // It is reserved for locks that may be required in order to perform memory accesses // that require special barriers, e.g. SATB GC barriers, that in turn uses locks. + // The rank 'tty' is also similar to 'special' and has the same restrictions. + // It is reserved for the tty_lock. // Since memory accesses should be able to be performed pretty much anywhere // in the code, that requires locks required for performing accesses being // inherently a bit more special than even locks of the 'special' rank. @@ -104,7 +106,8 @@ enum lock_types { event, access = event + 1, - special = access + 2, + tty = access + 2, + special = tty + 1, suspend_resume = special + 1, vmweak = suspend_resume + 2, leaf = vmweak + 2, @@ -236,7 +239,7 @@ #ifndef PRODUCT void print_on(outputStream* st) const; - void print() const { print_on(tty); } + void print() const { print_on(::tty); } DEBUG_ONLY(int rank() const { return _rank; }) bool allow_vm_block() { return _allow_vm_block; } --- old/src/hotspot/share/runtime/mutexLocker.cpp 2018-12-07 00:51:15.645166102 -0500 +++ new/src/hotspot/share/runtime/mutexLocker.cpp 2018-12-07 00:51:15.385152420 -0500 @@ -199,7 +199,7 @@ // Using Padded subclasses to prevent false sharing of these global monitors and mutexes. void mutex_init() { - def(tty_lock , PaddedMutex , event, true, Monitor::_safepoint_check_never); // allow to lock in VM + def(tty_lock , PaddedMutex , tty, true, Monitor::_safepoint_check_never); // allow to lock in VM def(CGC_lock , PaddedMonitor, special, true, Monitor::_safepoint_check_never); // coordinate between fore- and background GC def(STS_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_never);