< prev index next >

src/hotspot/share/runtime/objectMonitor.cpp

Print this page
*** 598,10 ***
--- 598,26 ---
    // We leave owner == DEFLATER_MARKER and contentions < 0
    // to force any racing threads to retry.
    return true;  // Success, ObjectMonitor has been deflated.
  }
  
+ // We might access the dead object headers for parsable heap walk, make sure
+ // headers are in correct shape, e.g. monitors deflated.
+ void ObjectMonitor::maybe_deflate_dead(oop* p) {
+   oop obj = *p;
+   assert(obj != NULL, "must not yet been cleared");
+   markWord mark = obj->mark();
+   if (mark.has_monitor()) {
+     ObjectMonitor* monitor = mark.monitor();
+     if (p == monitor->_object.ptr_raw()) {
+       assert(monitor->object_peek() == obj, "lock object must match");
+       markWord dmw = monitor->header();
+       obj->set_mark(dmw);
+     }
+   }
+ }
+ 
  // Install the displaced mark word (dmw) of a deflating ObjectMonitor
  // into the header of the object associated with the monitor. This
  // idempotent method is called by a thread that is deflating a
  // monitor and by other threads that have detected a race with the
  // deflation process.
< prev index next >