--- old/src/hotspot/share/runtime/synchronizer.cpp 2019-08-28 15:01:54.410961760 -0400 +++ new/src/hotspot/share/runtime/synchronizer.cpp 2019-08-28 15:01:54.238961766 -0400 @@ -1095,6 +1095,9 @@ void ObjectSynchronizer::list_oops_do(ObjectMonitor* list, OopClosure* f) { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); + // The oops_do() phase does not overlap with monitor deflation + // so no need to update the ObjectMonitor's ref_count for this + // ObjectMonitor* use. ObjectMonitor* mid; for (mid = list; mid != NULL; mid = mid->_next_om) { if (mid->object() != NULL) { @@ -2082,7 +2085,9 @@ // mid is old (is not newly allocated and is not newly freed). if (mid->object() != NULL && mid->is_old() && deflate_monitor_using_JT(mid, free_head_p, free_tail_p)) { - // Deflation succeeded so update the in-use list. + // Deflation succeeded and already updated free_head_p and + // free_tail_p as needed. Finish the move to the local free list + // by unlinking mid from the global or per-thread in-use list. if (mid == *list_p) { *list_p = mid->_next_om; } else if (cur_mid_in_use != NULL) { @@ -2250,7 +2255,7 @@ deflated_count += local_deflated_count; if (free_head_p != NULL) { - // Move the scavenged ObjectMonitors to the global free list. + // Move the deflated ObjectMonitors to the global free list. guarantee(free_tail_p != NULL && local_deflated_count > 0, "free_tail_p=" INTPTR_FORMAT ", local_deflated_count=%d", p2i(free_tail_p), local_deflated_count); assert(free_tail_p->_next_om == NULL, "invariant");