< prev index next >

src/hotspot/share/runtime/safepoint.cpp

Print this page




 570       }
 571     }
 572 
 573     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP)) {
 574       // Don't bother reporting event or time for this very short operation.
 575       // To have any utility we'd also want to report whether needed.
 576       OopStorage::trigger_cleanup_if_needed();
 577     }
 578 
 579     _subtasks.all_tasks_completed(_num_workers);
 580   }
 581 };
 582 
 583 // Various cleaning tasks that should be done periodically at safepoints.
 584 void SafepointSynchronize::do_cleanup_tasks() {
 585 
 586   TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
 587 
 588   CollectedHeap* heap = Universe::heap();
 589   assert(heap != NULL, "heap not initialized yet?");
 590   WorkGang* cleanup_workers = heap->get_safepoint_workers();
 591   if (cleanup_workers != NULL) {
 592     // Parallel cleanup using GC provided thread pool.
 593     uint num_cleanup_workers = cleanup_workers->active_workers();
 594     ParallelSPCleanupTask cleanup(num_cleanup_workers);
 595     cleanup_workers->run_task(&cleanup);
 596   } else {
 597     // Serial cleanup using VMThread.
 598     ParallelSPCleanupTask cleanup(1);
 599     cleanup.work(0);
 600   }
 601 
 602   // Needs to be done single threaded by the VMThread.  This walks
 603   // the thread stacks looking for references to metadata before
 604   // deciding to remove it from the metaspaces.
 605   if (ClassLoaderDataGraph::should_clean_metaspaces_and_reset()) {
 606     const char* name = "cleanup live ClassLoaderData metaspaces";
 607     TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 608     ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces();
 609   }
 610 




 570       }
 571     }
 572 
 573     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP)) {
 574       // Don't bother reporting event or time for this very short operation.
 575       // To have any utility we'd also want to report whether needed.
 576       OopStorage::trigger_cleanup_if_needed();
 577     }
 578 
 579     _subtasks.all_tasks_completed(_num_workers);
 580   }
 581 };
 582 
 583 // Various cleaning tasks that should be done periodically at safepoints.
 584 void SafepointSynchronize::do_cleanup_tasks() {
 585 
 586   TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
 587 
 588   CollectedHeap* heap = Universe::heap();
 589   assert(heap != NULL, "heap not initialized yet?");
 590   WorkGang* cleanup_workers = heap->safepoint_workers();
 591   if (cleanup_workers != NULL) {
 592     // Parallel cleanup using GC provided thread pool.
 593     uint num_cleanup_workers = cleanup_workers->active_workers();
 594     ParallelSPCleanupTask cleanup(num_cleanup_workers);
 595     cleanup_workers->run_task(&cleanup);
 596   } else {
 597     // Serial cleanup using VMThread.
 598     ParallelSPCleanupTask cleanup(1);
 599     cleanup.work(0);
 600   }
 601 
 602   // Needs to be done single threaded by the VMThread.  This walks
 603   // the thread stacks looking for references to metadata before
 604   // deciding to remove it from the metaspaces.
 605   if (ClassLoaderDataGraph::should_clean_metaspaces_and_reset()) {
 606     const char* name = "cleanup live ClassLoaderData metaspaces";
 607     TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 608     ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces();
 609   }
 610 


< prev index next >