< prev index next >

src/hotspot/share/runtime/serviceThread.cpp

Print this page
rev 54612 : Checkpoint latest preliminary review patches for full OpenJDK review; merge with 8222295.patch.

@@ -124,10 +124,11 @@
     bool symboltable_work = false;
     bool resolved_method_table_work = false;
     bool protection_domain_table_work = false;
     bool oopstorage_work = false;
     bool oopstorages_cleanup[oopstorage_count] = {}; // Zero (false) initialize.
+    bool deflate_idle_monitors = false;
     JvmtiDeferredEvent jvmti_event;
     {
       // Need state transition ThreadBlockInVM so that this thread
       // will be handled by safepoint correctly when this thread is
       // notified at a safepoint.

@@ -151,13 +152,13 @@
               (symboltable_work = SymbolTable::has_work()) |
               (resolved_method_table_work = ResolvedMethodTable::has_work()) |
               (protection_domain_table_work = SystemDictionary::pd_cache_table()->has_work()) |
               (oopstorage_work = needs_oopstorage_cleanup(oopstorages,
                                                           oopstorages_cleanup,
-                                                          oopstorage_count)))
-
-             == 0) {
+                                                          oopstorage_count)) |
+              (deflate_idle_monitors = ObjectSynchronizer::gOmShouldDeflateIdleMonitors())
+             ) == 0) {
         // Wait until notified that there is some work to do.
         ml.wait(Mutex::_no_safepoint_check_flag);
       }
 
       if (has_jvmti_events) {

@@ -198,10 +199,17 @@
     }
 
     if (oopstorage_work) {
       cleanup_oopstorages(oopstorages, oopstorages_cleanup, oopstorage_count);
     }
+
+    if (deflate_idle_monitors) {
+      // Deflate any global idle monitors.
+      // deflate_per_thread_idle_monitors_using_JT() is called by
+      // each JavaThread from ObjectSynchronizer::omAlloc() as needed.
+      ObjectSynchronizer::deflate_global_idle_monitors_using_JT();
+    }
   }
 }
 
 bool ServiceThread::is_service_thread(Thread* thread) {
   return thread == _instance;
< prev index next >