493 }
494
495 // Wake up all threads, so they are ready to resume execution after the safepoint
496 // operation has been carried out
497 void SafepointSynchronize::end() {
498 assert(Threads_lock->owned_by_self(), "must hold Threads_lock");
499 EventSafepointEnd event;
500 uint64_t safepoint_id = _safepoint_counter;
501 assert(Thread::current()->is_VM_thread(), "Only VM thread can execute a safepoint");
502
503 disarm_safepoint();
504
505 Universe::heap()->safepoint_synchronize_end();
506
507 SafepointTracing::end();
508
509 post_safepoint_end_event(event, safepoint_id);
510 }
511
512 bool SafepointSynchronize::is_cleanup_needed() {
513 // Need a safepoint if there are many monitors to deflate.
514 if (ObjectSynchronizer::is_cleanup_needed()) return true;
515 // Need a safepoint if some inline cache buffers is non-empty
516 if (!InlineCacheBuffer::is_empty()) return true;
517 if (StringTable::needs_rehashing()) return true;
518 if (SymbolTable::needs_rehashing()) return true;
519 return false;
520 }
521
522 class ParallelSPCleanupThreadClosure : public ThreadClosure {
523 private:
524 CodeBlobClosure* _nmethod_cl;
525 DeflateMonitorCounters* _counters;
526
527 public:
528 ParallelSPCleanupThreadClosure(DeflateMonitorCounters* counters) :
529 _nmethod_cl(UseCodeAging ? NMethodSweeper::prepare_reset_hotness_counters() : NULL),
530 _counters(counters) {}
531
532 void do_thread(Thread* thread) {
533 // deflate_thread_local_monitors() handles or requests deflation of
534 // this thread's idle monitors. If !AsyncDeflateIdleMonitors or if
|
493 }
494
495 // Wake up all threads, so they are ready to resume execution after the safepoint
496 // operation has been carried out
497 void SafepointSynchronize::end() {
498 assert(Threads_lock->owned_by_self(), "must hold Threads_lock");
499 EventSafepointEnd event;
500 uint64_t safepoint_id = _safepoint_counter;
501 assert(Thread::current()->is_VM_thread(), "Only VM thread can execute a safepoint");
502
503 disarm_safepoint();
504
505 Universe::heap()->safepoint_synchronize_end();
506
507 SafepointTracing::end();
508
509 post_safepoint_end_event(event, safepoint_id);
510 }
511
512 bool SafepointSynchronize::is_cleanup_needed() {
513 // Need a cleanup safepoint if there are too many monitors in use
514 // and the monitor deflation needs to be done at a safepoint.
515 if (ObjectSynchronizer::is_safepoint_deflation_needed()) return true;
516 // Need a safepoint if some inline cache buffers is non-empty
517 if (!InlineCacheBuffer::is_empty()) return true;
518 if (StringTable::needs_rehashing()) return true;
519 if (SymbolTable::needs_rehashing()) return true;
520 return false;
521 }
522
523 class ParallelSPCleanupThreadClosure : public ThreadClosure {
524 private:
525 CodeBlobClosure* _nmethod_cl;
526 DeflateMonitorCounters* _counters;
527
528 public:
529 ParallelSPCleanupThreadClosure(DeflateMonitorCounters* counters) :
530 _nmethod_cl(UseCodeAging ? NMethodSweeper::prepare_reset_hotness_counters() : NULL),
531 _counters(counters) {}
532
533 void do_thread(Thread* thread) {
534 // deflate_thread_local_monitors() handles or requests deflation of
535 // this thread's idle monitors. If !AsyncDeflateIdleMonitors or if
|