< prev index next >

src/hotspot/share/runtime/synchronizer.cpp

Print this page
rev 56044 : imported patch 8230184.patch
rev 56046 : v2.00 -> v2.05 (CR5/v2.05/8-for-jdk13) patches combined into one; merge with 8229212.patch; merge with jdk-14+11; merge with 8230184.patch.
rev 56047 : renames, comment cleanups and additions, whitespace and indent fixes; add PaddedObjectMonitor typdef to make 'PaddedEnd<ObjectMonitor' cleanups easier; add a couple of missing 'private' decls; delete unused next() function; merge pieces from dcubed.monitor_deflate_conc.v2.06d in dcubed.monitor_deflate_conc.v2.06[ac]; merge with 8229212.patch; merge with jdk-14+11; merge with 8230184.patch.

@@ -1093,10 +1093,13 @@
   list_oops_do(thread->om_in_use_list, f);
 }
 
 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) {
       f->do_oop((oop*)mid->object_addr());
     }

@@ -2080,11 +2083,13 @@
   while (mid != NULL) {
     // Only try to deflate if there is an associated Java object and if
     // 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) {
         // Maintain the current in-use list.
         cur_mid_in_use->_next_om = mid->_next_om;

@@ -2248,11 +2253,11 @@
       self->om_in_use_count -= local_deflated_count;
     }
     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");
 
       if (!is_global) {
         Thread::muxAcquire(&gListLock, "deflate_per_thread_idle_monitors_using_JT(2)");
< prev index next >