539 ParallelSPCleanupThreadClosure _cleanup_threads_cl;
540 uint _num_workers;
541 DeflateMonitorCounters* _counters;
542 public:
543 ParallelSPCleanupTask(uint num_workers, DeflateMonitorCounters* counters) :
544 AbstractGangTask("Parallel Safepoint Cleanup"),
545 _subtasks(SubTasksDone(SafepointSynchronize::SAFEPOINT_CLEANUP_NUM_TASKS)),
546 _cleanup_threads_cl(ParallelSPCleanupThreadClosure(counters)),
547 _num_workers(num_workers),
548 _counters(counters) {}
549
550 void work(uint worker_id) {
551 uint64_t safepoint_id = SafepointSynchronize::safepoint_counter();
552 // All threads deflate monitors and mark nmethods (if necessary).
553 Threads::possibly_parallel_threads_do(true, &_cleanup_threads_cl);
554
555 if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_DEFLATE_MONITORS)) {
556 const char* name = "deflating global idle monitors";
557 EventSafepointCleanupTask event;
558 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
559 ObjectSynchronizer::deflate_idle_monitors(_counters);
560
561 post_safepoint_cleanup_task_event(event, safepoint_id, name);
562 }
563
564 if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_UPDATE_INLINE_CACHES)) {
565 const char* name = "updating inline caches";
566 EventSafepointCleanupTask event;
567 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
568 InlineCacheBuffer::update_inline_caches();
569
570 post_safepoint_cleanup_task_event(event, safepoint_id, name);
571 }
572
573 if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_COMPILATION_POLICY)) {
574 const char* name = "compilation policy safepoint handler";
575 EventSafepointCleanupTask event;
576 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
577 CompilationPolicy::policy()->do_safepoint_work();
578
579 post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
539 ParallelSPCleanupThreadClosure _cleanup_threads_cl;
540 uint _num_workers;
541 DeflateMonitorCounters* _counters;
542 public:
543 ParallelSPCleanupTask(uint num_workers, DeflateMonitorCounters* counters) :
544 AbstractGangTask("Parallel Safepoint Cleanup"),
545 _subtasks(SubTasksDone(SafepointSynchronize::SAFEPOINT_CLEANUP_NUM_TASKS)),
546 _cleanup_threads_cl(ParallelSPCleanupThreadClosure(counters)),
547 _num_workers(num_workers),
548 _counters(counters) {}
549
550 void work(uint worker_id) {
551 uint64_t safepoint_id = SafepointSynchronize::safepoint_counter();
552 // All threads deflate monitors and mark nmethods (if necessary).
553 Threads::possibly_parallel_threads_do(true, &_cleanup_threads_cl);
554
555 if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_DEFLATE_MONITORS)) {
556 const char* name = "deflating global idle monitors";
557 EventSafepointCleanupTask event;
558 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
559 // AsyncDeflateIdleMonitors only uses DeflateMonitorCounters
560 // when a special cleanup has been requested.
561 // Note: This logging output will include global idle monitor
562 // elapsed times, but not global idle monitor deflation count.
563 ObjectSynchronizer::do_safepoint_work(!AsyncDeflateIdleMonitors ? _counters : NULL);
564
565 post_safepoint_cleanup_task_event(event, safepoint_id, name);
566 }
567
568 if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_UPDATE_INLINE_CACHES)) {
569 const char* name = "updating inline caches";
570 EventSafepointCleanupTask event;
571 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
572 InlineCacheBuffer::update_inline_caches();
573
574 post_safepoint_cleanup_task_event(event, safepoint_id, name);
575 }
576
577 if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_COMPILATION_POLICY)) {
578 const char* name = "compilation policy safepoint handler";
579 EventSafepointCleanupTask event;
580 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
581 CompilationPolicy::policy()->do_safepoint_work();
582
583 post_safepoint_cleanup_task_event(event, safepoint_id, name);
|