--- old/src/hotspot/share/runtime/mutexLocker.hpp 2019-08-21 22:08:20.839707895 -0400 +++ new/src/hotspot/share/runtime/mutexLocker.hpp 2019-08-21 22:08:20.639707902 -0400 @@ -142,7 +142,7 @@ extern Mutex* ClassLoaderDataGraph_lock; // protects CLDG list, needed for concurrent unloading -extern Monitor* CodeHeapStateAnalytics_lock; // lock print functions against concurrent analyze functions. +extern Mutex* CodeHeapStateAnalytics_lock; // lock print functions against concurrent analyze functions. // Only used locally in PrintCodeCacheLayout processing. #if INCLUDE_JVMCI @@ -171,9 +171,9 @@ // for debugging: check that we're already owning this lock (or are at a safepoint) #ifdef ASSERT -void assert_locked_or_safepoint(const Monitor * lock); -void assert_locked_or_safepoint_weak(const Monitor * lock); -void assert_lock_strong(const Monitor * lock); +void assert_locked_or_safepoint(const Mutex* lock); +void assert_locked_or_safepoint_weak(const Mutex* lock); +void assert_lock_strong(const Mutex* lock); #else #define assert_locked_or_safepoint(lock) #define assert_locked_or_safepoint_weak(lock) @@ -182,10 +182,10 @@ class MutexLocker: public StackObj { protected: - Monitor* _mutex; + Mutex* _mutex; private: public: - MutexLocker(Monitor* mutex, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) : + MutexLocker(Mutex* mutex, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) : _mutex(mutex) { bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag; if (_mutex != NULL) { @@ -199,7 +199,7 @@ } } - MutexLocker(Monitor* mutex, Thread* thread, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) : + MutexLocker(Mutex* mutex, Thread* thread, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) : _mutex(mutex) { bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag; if (_mutex != NULL) { @@ -227,35 +227,36 @@ class MonitorLocker: public MutexLocker { Mutex::SafepointCheckFlag _flag; + Monitor* _monitor; public: MonitorLocker(Monitor* monitor, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) : - MutexLocker(monitor, flag), _flag(flag) { + MutexLocker(monitor, flag), _flag(flag), _monitor(monitor) { // Superclass constructor did locking - assert(_mutex != NULL, "NULL monitor not allowed"); + assert(_monitor != NULL, "NULL monitor not allowed"); } MonitorLocker(Monitor* monitor, Thread* thread, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) : - MutexLocker(monitor, thread, flag), _flag(flag) { + MutexLocker(monitor, thread, flag), _flag(flag), _monitor(monitor) { // Superclass constructor did locking - assert(_mutex != NULL, "NULL monitor not allowed"); + assert(_monitor != NULL, "NULL monitor not allowed"); } bool wait(long timeout = 0, bool as_suspend_equivalent = !Mutex::_as_suspend_equivalent_flag) { if (_flag == Mutex::_safepoint_check_flag) { - return _mutex->wait(timeout, as_suspend_equivalent); + return _monitor->wait(timeout, as_suspend_equivalent); } else { - return _mutex->wait_without_safepoint_check(timeout); + return _monitor->wait_without_safepoint_check(timeout); } return false; } void notify_all() { - _mutex->notify_all(); + _monitor->notify_all(); } void notify() { - _mutex->notify(); + _monitor->notify(); } }; @@ -268,10 +269,10 @@ class GCMutexLocker: public StackObj { private: - Monitor* _mutex; + Mutex* _mutex; bool _locked; public: - GCMutexLocker(Monitor* mutex); + GCMutexLocker(Mutex* mutex); ~GCMutexLocker() { if (_locked) _mutex->unlock(); } }; @@ -280,11 +281,11 @@ class MutexUnlocker: StackObj { private: - Monitor* _mutex; + Mutex* _mutex; bool _no_safepoint_check; public: - MutexUnlocker(Monitor* mutex, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) : + MutexUnlocker(Mutex* mutex, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) : _mutex(mutex), _no_safepoint_check(flag) { _mutex->unlock();