< prev index next >

src/hotspot/share/runtime/objectMonitor.inline.hpp

Print this page
rev 55489 : Checkpoint latest preliminary review patches for full OpenJDK review; merge with 8222295.patch.
rev 55490 : imported patch dcubed.monitor_deflate_conc.v2.01
rev 55491 : imported patch dcubed.monitor_deflate_conc.v2.02
rev 55492 : imported patch dcubed.monitor_deflate_conc.v2.03
rev 55494 : imported patch dcubed.monitor_deflate_conc.v2.05

@@ -53,14 +53,21 @@
 inline void* ObjectMonitor::owner() const {
   void* owner = _owner;
   return owner != DEFLATER_MARKER ? owner : NULL;
 }
 
+// Returns true if owner field == DEFLATER_MARKER and false otherwise.
+// This accessor is called when we really need to know if the owner
+// field == DEFLATER_MARKER and any non-NULL value won't do the trick.
+inline bool ObjectMonitor::owner_is_DEFLATER_MARKER() {
+  return OrderAccess::load_acquire(&_owner) == DEFLATER_MARKER;
+}
+
 inline void ObjectMonitor::clear() {
   assert(_header != NULL, "must be non-NULL");
   assert(_owner == NULL, "must be NULL: owner=" INTPTR_FORMAT, p2i(_owner));
-  assert(_ref_count == 0, "must be 0: ref_count=%d", _ref_count);
+  assert(ref_count() == 0, "must be 0: ref_count=%d", ref_count());
 
   _header = NULL;
 
   clear_using_JT();
 }

@@ -79,11 +86,11 @@
     // in the last part of the deflation protocol so we cannot check
     // its value here.
     guarantee(_owner == NULL || _owner == DEFLATER_MARKER,
               "must be NULL or DEFLATER_MARKER: owner=" INTPTR_FORMAT,
               p2i(_owner));
-    guarantee(_ref_count <= 0, "must be <= 0: ref_count=%d", _ref_count);
+    guarantee(ref_count() <= 0, "must be <= 0: ref_count=%d", ref_count());
   }
   assert(_contentions == 0, "must be 0: contentions=%d", _contentions);
   assert(_waiters == 0, "must be 0: waiters=%d", _waiters);
   assert(_recursions == 0, "must be 0: recursions=" INTPTR_FORMAT, _recursions);
   assert(_object != NULL, "must be non-NULL");

@@ -153,22 +160,22 @@
 inline void ObjectMonitor::dec_ref_count() {
   // The decrement only needs to be MO_ACQ_REL since the reference
   // counter is volatile.
   Atomic::dec(&_ref_count);
   // Can be negative as part of async deflation protocol.
-  guarantee(AsyncDeflateIdleMonitors || _ref_count >= 0,
-            "sanity check: ref_count=%d", _ref_count);
+  ADIM_guarantee(AsyncDeflateIdleMonitors || ref_count() >= 0,
+                 "sanity check: ref_count=%d", ref_count());
 }
 
 inline void ObjectMonitor::inc_ref_count() {
   // The increment needs to be MO_SEQ_CST so that the reference
   // counter update is seen as soon as possible in a race with the
   // async deflation protocol.
   Atomic::inc(&_ref_count);
   // Can be negative as part of async deflation protocol.
-  guarantee(AsyncDeflateIdleMonitors || _ref_count > 0,
-            "sanity check: ref_count=%d", _ref_count);
+  ADIM_guarantee(AsyncDeflateIdleMonitors || ref_count() > 0,
+                 "sanity check: ref_count=%d", ref_count());
 }
 
 inline jint ObjectMonitor::ref_count() const {
   return OrderAccess::load_acquire(&_ref_count);
 }
< prev index next >