< prev index next >

src/hotspot/share/runtime/serviceThread.cpp

Print this page
rev 56776 : v2.00 -> v2.07 (CR7/v2.07/10-for-jdk14) patches combined into one; merge with 8230876.patch (2019.10.17) and jdk-14+21.

@@ -103,10 +103,11 @@
     bool symboltable_work = false;
     bool resolved_method_table_work = false;
     bool thread_id_table_work = false;
     bool protection_domain_table_work = false;
     bool oopstorage_work = false;
+    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.

@@ -129,14 +130,18 @@
               (stringtable_work = StringTable::has_work()) |
               (symboltable_work = SymbolTable::has_work()) |
               (resolved_method_table_work = ResolvedMethodTable::has_work()) |
               (thread_id_table_work = ThreadIdTable::has_work()) |
               (protection_domain_table_work = SystemDictionary::pd_cache_table()->has_work()) |
-              (oopstorage_work = OopStorage::has_cleanup_work_and_reset())
+              (oopstorage_work = OopStorage::has_cleanup_work_and_reset()) |
+              (deflate_idle_monitors = ObjectSynchronizer::is_async_deflation_needed())
              ) == 0) {
         // Wait until notified that there is some work to do.
-        ml.wait();
+        // If AsyncDeflateIdleMonitors, then we wait for
+        // GuaranteedSafepointInterval so that is_async_deflation_needed()
+        // is checked at the same interval.
+        ml.wait(AsyncDeflateIdleMonitors ? GuaranteedSafepointInterval : 0);
       }
 
       if (has_jvmti_events) {
         jvmti_event = JvmtiDeferredEventQueue::dequeue();
       }

@@ -181,10 +186,14 @@
     }
 
     if (oopstorage_work) {
       cleanup_oopstorages();
     }
+
+    if (deflate_idle_monitors) {
+      ObjectSynchronizer::deflate_idle_monitors_using_JT();
+    }
   }
 }
 
 bool ServiceThread::is_service_thread(Thread* thread) {
   return thread == _instance;
< prev index next >