--- old/src/hotspot/share/runtime/objectMonitor.hpp 2019-05-02 15:04:26.038393078 -0400 +++ new/src/hotspot/share/runtime/objectMonitor.hpp 2019-05-02 15:04:25.586393094 -0400 @@ -168,13 +168,15 @@ volatile jint _contentions; // Number of active contentions in enter(). It is used by is_busy() // along with other fields to determine if an ObjectMonitor can be - // deflated. See ObjectSynchronizer::deflate_monitor(). + // deflated. See ObjectSynchronizer::deflate_monitor() and + // ObjectSynchronizer::deflate_monitor_using_JT(). protected: ObjectWaiter * volatile _WaitSet; // LL of threads wait()ing on the monitor volatile jint _waiters; // number of waiting threads private: volatile int _WaitSetLock; // protects Wait Queue - simple spinlock - volatile jint _ref_count; // ref count for ObjectMonitor* + volatile jint _ref_count; // ref count for ObjectMonitor* and used by the async deflation + // protocol. See ObjectSynchronizer::deflate_monitor_using_JT(). typedef enum { Free = 0, // Free must be 0 for monitor to be free after memset(..,0,..). New, @@ -249,16 +251,13 @@ return _contentions|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList); } - // Version of is_busy() that accounts for special values in - // _contentions and _owner when AsyncDeflateIdleMonitors is enabled. + // Version of is_busy() that accounts for the special value in + // _owner when AsyncDeflateIdleMonitors is enabled. intptr_t is_busy_async() const { - intptr_t ret_code = _waiters | intptr_t(_cxq) | intptr_t(_EntryList); + intptr_t ret_code = _contentions | _waiters | intptr_t(_cxq) | intptr_t(_EntryList); if (!AsyncDeflateIdleMonitors) { - ret_code |= _contentions | intptr_t(_owner); + ret_code |= intptr_t(_owner); } else { - if (_contentions > 0) { - ret_code |= _contentions; - } if (_owner != DEFLATER_MARKER) { ret_code |= intptr_t(_owner); } @@ -326,7 +325,7 @@ void clear(); void clear_using_JT(); - bool enter(TRAPS); // Returns false if monitor is being async deflated and caller should retry locking the object. + void enter(TRAPS); void exit(bool not_suspended, TRAPS); void wait(jlong millis, bool interruptable, TRAPS); void notify(TRAPS); @@ -334,7 +333,7 @@ // Use the following at your own risk intptr_t complete_exit(TRAPS); - bool reenter(intptr_t recursions, TRAPS); // Returns false if monitor is being async deflated and caller should retry locking the object. + void reenter(intptr_t recursions, TRAPS); private: void AddWaiter(ObjectWaiter * waiter);