< prev index next >

src/hotspot/share/runtime/safepoint.cpp

Print this page
rev 60025 : 8246476: remove AsyncDeflateIdleMonitors option and the safepoint based deflation mechanism

@@ -488,65 +488,35 @@
 
   post_safepoint_end_event(event, safepoint_id());
 }
 
 bool SafepointSynchronize::is_cleanup_needed() {
-  // Need a cleanup safepoint if there are too many monitors in use
-  // and the monitor deflation needs to be done at a safepoint.
-  if (ObjectSynchronizer::is_safepoint_deflation_needed()) return true;
   // Need a safepoint if some inline cache buffers is non-empty
   if (!InlineCacheBuffer::is_empty()) return true;
   if (StringTable::needs_rehashing()) return true;
   if (SymbolTable::needs_rehashing()) return true;
   return false;
 }
 
-class ParallelSPCleanupThreadClosure : public ThreadClosure {
-private:
-  DeflateMonitorCounters* _counters;
-
-public:
-  ParallelSPCleanupThreadClosure(DeflateMonitorCounters* counters) :
-    _counters(counters) {}
-
-  void do_thread(Thread* thread) {
-    // deflate_thread_local_monitors() handles or requests deflation of
-    // this thread's idle monitors. If !AsyncDeflateIdleMonitors or if
-    // there is a special cleanup request, deflation is handled now.
-    // Otherwise, async deflation is requested via a flag.
-    ObjectSynchronizer::deflate_thread_local_monitors(thread, _counters);
-  }
-};
-
 class ParallelSPCleanupTask : public AbstractGangTask {
 private:
   SubTasksDone _subtasks;
-  ParallelSPCleanupThreadClosure _cleanup_threads_cl;
   uint _num_workers;
-  DeflateMonitorCounters* _counters;
 public:
-  ParallelSPCleanupTask(uint num_workers, DeflateMonitorCounters* counters) :
+  ParallelSPCleanupTask(uint num_workers) :
     AbstractGangTask("Parallel Safepoint Cleanup"),
     _subtasks(SafepointSynchronize::SAFEPOINT_CLEANUP_NUM_TASKS),
-    _cleanup_threads_cl(ParallelSPCleanupThreadClosure(counters)),
-    _num_workers(num_workers),
-    _counters(counters) {}
+    _num_workers(num_workers) {}
 
   void work(uint worker_id) {
     uint64_t safepoint_id = SafepointSynchronize::safepoint_id();
-    // All threads deflate monitors and mark nmethods (if necessary).
-    Threads::possibly_parallel_threads_do(true, &_cleanup_threads_cl);
 
     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_DEFLATE_MONITORS)) {
-      const char* name = "deflating global idle monitors";
+      const char* name = "deflating idle monitors";
       EventSafepointCleanupTask event;
       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
-      // AsyncDeflateIdleMonitors only uses DeflateMonitorCounters
-      // when a special cleanup has been requested.
-      // Note: This logging output will include global idle monitor
-      // elapsed times, but not global idle monitor deflation count.
-      ObjectSynchronizer::do_safepoint_work(_counters);
+      ObjectSynchronizer::do_safepoint_work();
 
       post_safepoint_cleanup_task_event(event, safepoint_id, name);
     }
 
     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_UPDATE_INLINE_CACHES)) {

@@ -613,27 +583,21 @@
 // Various cleaning tasks that should be done periodically at safepoints.
 void SafepointSynchronize::do_cleanup_tasks() {
 
   TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
 
-  // Prepare for monitor deflation.
-  DeflateMonitorCounters deflate_counters;
-  ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
-
   CollectedHeap* heap = Universe::heap();
   assert(heap != NULL, "heap not initialized yet?");
   WorkGang* cleanup_workers = heap->get_safepoint_workers();
   if (cleanup_workers != NULL) {
     // Parallel cleanup using GC provided thread pool.
     uint num_cleanup_workers = cleanup_workers->active_workers();
-    ParallelSPCleanupTask cleanup(num_cleanup_workers, &deflate_counters);
-    StrongRootsScope srs(num_cleanup_workers);
+    ParallelSPCleanupTask cleanup(num_cleanup_workers);
     cleanup_workers->run_task(&cleanup);
   } else {
     // Serial cleanup using VMThread.
-    ParallelSPCleanupTask cleanup(1, &deflate_counters);
-    StrongRootsScope srs(1);
+    ParallelSPCleanupTask cleanup(1);
     cleanup.work(0);
   }
 
   // Needs to be done single threaded by the VMThread.  This walks
   // the thread stacks looking for references to metadata before

@@ -642,13 +606,10 @@
     const char* name = "cleanup live ClassLoaderData metaspaces";
     TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
     ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces();
   }
 
-  // Finish monitor deflation.
-  ObjectSynchronizer::finish_deflate_idle_monitors(&deflate_counters);
-
   assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
 }
 
 // Methods for determining if a JavaThread is safepoint safe.
 
< prev index next >