< prev index next >

src/share/vm/runtime/safepoint.cpp

Print this page




 580 
 581     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_DEFLATE_MONITORS)) {
 582       const char* name = "deflating idle monitors";
 583       EventSafepointCleanupTask event;
 584       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 585       ObjectSynchronizer::deflate_idle_monitors(_counters);
 586       event_safepoint_cleanup_task_commit(event, name);
 587     }
 588 
 589     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_UPDATE_INLINE_CACHES)) {
 590       const char* name = "updating inline caches";
 591       EventSafepointCleanupTask event;
 592       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 593       InlineCacheBuffer::update_inline_caches();
 594       event_safepoint_cleanup_task_commit(event, name);
 595     }
 596 
 597     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_COMPILATION_POLICY)) {
 598       const char* name = "compilation policy safepoint handler";
 599       EventSafepointCleanupTask event;
 600       TraceTime timer("compilation policy safepoint handler", TRACETIME_LOG(Info, safepoint, cleanup));
 601       CompilationPolicy::policy()->do_safepoint_work();
 602       event_safepoint_cleanup_task_commit(event, name);
 603     }
 604 
 605     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_SYMBOL_TABLE_REHASH)) {
 606       if (SymbolTable::needs_rehashing()) {
 607         const char* name = "rehashing symbol table";
 608         EventSafepointCleanupTask event;
 609         TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 610         SymbolTable::rehash_table();
 611         event_safepoint_cleanup_task_commit(event, name);
 612       }
 613     }
 614 
 615     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_STRING_TABLE_REHASH)) {
 616       if (StringTable::needs_rehashing()) {
 617         const char* name = "rehashing string table";
 618         EventSafepointCleanupTask event;
 619         TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 620         StringTable::rehash_table();
 621         event_safepoint_cleanup_task_commit(event, name);
 622       }
 623     }
 624 
 625     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_CLD_PURGE)) {
 626       // CMS delays purging the CLDG until the beginning of the next safepoint and to
 627       // make sure concurrent sweep is done
 628       const char* name = "purging class loader data graph";
 629       EventSafepointCleanupTask event;
 630       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 631       ClassLoaderDataGraph::purge_if_needed();
 632       event_safepoint_cleanup_task_commit(event, name);
 633     }
 634     _subtasks.all_tasks_completed(_num_workers);
 635   }
 636 };
 637 
 638 // Various cleaning tasks that should be done periodically at safepoints.
 639 void SafepointSynchronize::do_cleanup_tasks() {


 640 
 641   // Prepare for monitor deflation.
 642   DeflateMonitorCounters deflate_counters;
 643   ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
 644 
 645   CollectedHeap* heap = Universe::heap();
 646   assert(heap != NULL, "heap not initialized yet?");
 647   WorkGang* cleanup_workers = heap->get_safepoint_workers();
 648   if (cleanup_workers != NULL) {
 649     // Parallel cleanup using GC provided thread pool.
 650     uint num_cleanup_workers = cleanup_workers->active_workers();
 651     ParallelSPCleanupTask cleanup(num_cleanup_workers, &deflate_counters);
 652     StrongRootsScope srs(num_cleanup_workers);
 653     cleanup_workers->run_task(&cleanup);
 654   } else {
 655     // Serial cleanup using VMThread.
 656     ParallelSPCleanupTask cleanup(1, &deflate_counters);
 657     StrongRootsScope srs(1);
 658     cleanup.work(0);
 659   }




 580 
 581     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_DEFLATE_MONITORS)) {
 582       const char* name = "deflating idle monitors";
 583       EventSafepointCleanupTask event;
 584       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 585       ObjectSynchronizer::deflate_idle_monitors(_counters);
 586       event_safepoint_cleanup_task_commit(event, name);
 587     }
 588 
 589     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_UPDATE_INLINE_CACHES)) {
 590       const char* name = "updating inline caches";
 591       EventSafepointCleanupTask event;
 592       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 593       InlineCacheBuffer::update_inline_caches();
 594       event_safepoint_cleanup_task_commit(event, name);
 595     }
 596 
 597     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_COMPILATION_POLICY)) {
 598       const char* name = "compilation policy safepoint handler";
 599       EventSafepointCleanupTask event;
 600       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 601       CompilationPolicy::policy()->do_safepoint_work();
 602       event_safepoint_cleanup_task_commit(event, name);
 603     }
 604 
 605     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_SYMBOL_TABLE_REHASH)) {
 606       if (SymbolTable::needs_rehashing()) {
 607         const char* name = "rehashing symbol table";
 608         EventSafepointCleanupTask event;
 609         TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 610         SymbolTable::rehash_table();
 611         event_safepoint_cleanup_task_commit(event, name);
 612       }
 613     }
 614 
 615     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_STRING_TABLE_REHASH)) {
 616       if (StringTable::needs_rehashing()) {
 617         const char* name = "rehashing string table";
 618         EventSafepointCleanupTask event;
 619         TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 620         StringTable::rehash_table();
 621         event_safepoint_cleanup_task_commit(event, name);
 622       }
 623     }
 624 
 625     if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_CLD_PURGE)) {
 626       // CMS delays purging the CLDG until the beginning of the next safepoint and to
 627       // make sure concurrent sweep is done
 628       const char* name = "purging class loader data graph";
 629       EventSafepointCleanupTask event;
 630       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 631       ClassLoaderDataGraph::purge_if_needed();
 632       event_safepoint_cleanup_task_commit(event, name);
 633     }
 634     _subtasks.all_tasks_completed(_num_workers);
 635   }
 636 };
 637 
 638 // Various cleaning tasks that should be done periodically at safepoints.
 639 void SafepointSynchronize::do_cleanup_tasks() {
 640 
 641   TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
 642 
 643   // Prepare for monitor deflation.
 644   DeflateMonitorCounters deflate_counters;
 645   ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
 646 
 647   CollectedHeap* heap = Universe::heap();
 648   assert(heap != NULL, "heap not initialized yet?");
 649   WorkGang* cleanup_workers = heap->get_safepoint_workers();
 650   if (cleanup_workers != NULL) {
 651     // Parallel cleanup using GC provided thread pool.
 652     uint num_cleanup_workers = cleanup_workers->active_workers();
 653     ParallelSPCleanupTask cleanup(num_cleanup_workers, &deflate_counters);
 654     StrongRootsScope srs(num_cleanup_workers);
 655     cleanup_workers->run_task(&cleanup);
 656   } else {
 657     // Serial cleanup using VMThread.
 658     ParallelSPCleanupTask cleanup(1, &deflate_counters);
 659     StrongRootsScope srs(1);
 660     cleanup.work(0);
 661   }


< prev index next >