--- old/src/hotspot/share/runtime/objectMonitor.inline.hpp 2019-04-25 12:04:43.264813917 -0400 +++ new/src/hotspot/share/runtime/objectMonitor.inline.hpp 2019-04-25 12:04:42.556813929 -0400 @@ -163,7 +163,9 @@ // The decrement only needs to be MO_ACQ_REL since the reference // counter is volatile. Atomic::dec(&_ref_count); - guarantee(_ref_count >= 0, "sanity check: ref_count=%d", _ref_count); + // Can be negative as part of async deflation protocol. + guarantee(AsyncDeflateIdleMonitors || _ref_count >= 0, + "sanity check: ref_count=%d", _ref_count); } inline void ObjectMonitor::inc_ref_count() { @@ -171,7 +173,9 @@ // counter update is seen as soon as possible in a race with the // async deflation protocol. Atomic::inc(&_ref_count); - guarantee(_ref_count > 0, "sanity check: ref_count=%d", _ref_count); + // Can be negative as part of async deflation protocol. + guarantee(AsyncDeflateIdleMonitors || _ref_count > 0, + "sanity check: ref_count=%d", _ref_count); } inline jint ObjectMonitor::ref_count() const {