< prev index next >
src/hotspot/share/runtime/objectMonitor.cpp
Print this page
rev 54572 : Checkpoint latest preliminary review patches for full OpenJDK review; merge with 8222295.patch.
rev 54573 : imported patch dcubed.monitor_deflate_conc.v2.01
rev 54574 : imported patch dcubed.monitor_deflate_conc.v2.02
@@ -2097,17 +2097,21 @@
if (AsyncDeflateIdleMonitors) {
// Race here if monitor is not owned! The above ref_count bump
// will cause subsequent async deflation to skip it. However,
// previous or concurrent async deflation is a race.
if (om_ptr->_owner == DEFLATER_MARKER && om_ptr->_contentions <= 0) {
- // Async deflation is in progress. Attempt to restore the
- // header/dmw to the object's header so that we only retry once
- // if the deflater thread happens to be slow.
+ // Async deflation is in progress.
+ if (om_ptr->ref_count() <= 0) {
+ // And our ref_count increment above lost the race to async
+ // deflation. Attempt to restore the header/dmw to the
+ // object's header so that we only retry once if the deflater
+ // thread happens to be slow.
om_ptr->install_displaced_markword_in_object(object);
om_ptr->dec_ref_count();
return false;
}
+ }
// The ObjectMonitor could have been deflated and reused for
// another object before we bumped the ref_count so make sure
// our object still refers to this ObjectMonitor.
const markOop tmp = object->mark();
if (!tmp->has_monitor() || tmp->monitor() != om_ptr) {
< prev index next >