< prev index next >

src/hotspot/share/runtime/safepoint.cpp

Print this page




  31 #include "code/codeCache.hpp"
  32 #include "code/icBuffer.hpp"
  33 #include "code/nmethod.hpp"
  34 #include "code/pcDesc.hpp"
  35 #include "code/scopeDesc.hpp"
  36 #include "gc/shared/collectedHeap.hpp"
  37 #include "gc/shared/gcLocker.hpp"
  38 #include "gc/shared/oopStorage.hpp"
  39 #include "gc/shared/strongRootsScope.hpp"
  40 #include "gc/shared/workgroup.hpp"
  41 #include "interpreter/interpreter.hpp"
  42 #include "jfr/jfrEvents.hpp"
  43 #include "logging/log.hpp"
  44 #include "logging/logStream.hpp"
  45 #include "memory/resourceArea.hpp"
  46 #include "memory/universe.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/symbol.hpp"
  49 #include "runtime/atomic.hpp"
  50 #include "runtime/compilationPolicy.hpp"

  51 #include "runtime/deoptimization.hpp"
  52 #include "runtime/frame.inline.hpp"
  53 #include "runtime/handles.inline.hpp"
  54 #include "runtime/interfaceSupport.inline.hpp"
  55 #include "runtime/mutexLocker.hpp"
  56 #include "runtime/orderAccess.hpp"
  57 #include "runtime/osThread.hpp"
  58 #include "runtime/safepoint.hpp"
  59 #include "runtime/safepointMechanism.inline.hpp"
  60 #include "runtime/signature.hpp"
  61 #include "runtime/stubCodeGenerator.hpp"
  62 #include "runtime/stubRoutines.hpp"
  63 #include "runtime/sweeper.hpp"
  64 #include "runtime/synchronizer.hpp"
  65 #include "runtime/thread.inline.hpp"
  66 #include "runtime/threadSMR.hpp"
  67 #include "runtime/timerTrace.hpp"
  68 #include "services/runtimeService.hpp"
  69 #include "utilities/events.hpp"
  70 #include "utilities/macros.hpp"


 632         post_safepoint_cleanup_task_event(event, safepoint_id, name);
 633       }
 634     }
 635 
 636     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
 637       if (Dictionary::does_any_dictionary_needs_resizing()) {
 638         const char* name = "resizing system dictionaries";
 639         EventSafepointCleanupTask event;
 640         TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 641         ClassLoaderDataGraph::resize_dictionaries();
 642 
 643         post_safepoint_cleanup_task_event(event, safepoint_id, name);
 644       }
 645     }
 646 
 647     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP)) {
 648       // Don't bother reporting event or time for this very short operation.
 649       // To have any utility we'd also want to report whether needed.
 650       OopStorage::trigger_cleanup_if_needed();
 651     }









 652 
 653     _subtasks.all_tasks_completed(_num_workers);
 654   }
 655 };
 656 
 657 // Various cleaning tasks that should be done periodically at safepoints.
 658 void SafepointSynchronize::do_cleanup_tasks() {
 659 
 660   TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
 661 
 662   // Prepare for monitor deflation.
 663   DeflateMonitorCounters deflate_counters;
 664   ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
 665 
 666   CollectedHeap* heap = Universe::heap();
 667   assert(heap != NULL, "heap not initialized yet?");
 668   WorkGang* cleanup_workers = heap->get_safepoint_workers();
 669   if (cleanup_workers != NULL) {
 670     // Parallel cleanup using GC provided thread pool.
 671     uint num_cleanup_workers = cleanup_workers->active_workers();




  31 #include "code/codeCache.hpp"
  32 #include "code/icBuffer.hpp"
  33 #include "code/nmethod.hpp"
  34 #include "code/pcDesc.hpp"
  35 #include "code/scopeDesc.hpp"
  36 #include "gc/shared/collectedHeap.hpp"
  37 #include "gc/shared/gcLocker.hpp"
  38 #include "gc/shared/oopStorage.hpp"
  39 #include "gc/shared/strongRootsScope.hpp"
  40 #include "gc/shared/workgroup.hpp"
  41 #include "interpreter/interpreter.hpp"
  42 #include "jfr/jfrEvents.hpp"
  43 #include "logging/log.hpp"
  44 #include "logging/logStream.hpp"
  45 #include "memory/resourceArea.hpp"
  46 #include "memory/universe.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/symbol.hpp"
  49 #include "runtime/atomic.hpp"
  50 #include "runtime/compilationPolicy.hpp"
  51 #include "runtime/continuation.hpp"
  52 #include "runtime/deoptimization.hpp"
  53 #include "runtime/frame.inline.hpp"
  54 #include "runtime/handles.inline.hpp"
  55 #include "runtime/interfaceSupport.inline.hpp"
  56 #include "runtime/mutexLocker.hpp"
  57 #include "runtime/orderAccess.hpp"
  58 #include "runtime/osThread.hpp"
  59 #include "runtime/safepoint.hpp"
  60 #include "runtime/safepointMechanism.inline.hpp"
  61 #include "runtime/signature.hpp"
  62 #include "runtime/stubCodeGenerator.hpp"
  63 #include "runtime/stubRoutines.hpp"
  64 #include "runtime/sweeper.hpp"
  65 #include "runtime/synchronizer.hpp"
  66 #include "runtime/thread.inline.hpp"
  67 #include "runtime/threadSMR.hpp"
  68 #include "runtime/timerTrace.hpp"
  69 #include "services/runtimeService.hpp"
  70 #include "utilities/events.hpp"
  71 #include "utilities/macros.hpp"


 633         post_safepoint_cleanup_task_event(event, safepoint_id, name);
 634       }
 635     }
 636 
 637     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
 638       if (Dictionary::does_any_dictionary_needs_resizing()) {
 639         const char* name = "resizing system dictionaries";
 640         EventSafepointCleanupTask event;
 641         TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 642         ClassLoaderDataGraph::resize_dictionaries();
 643 
 644         post_safepoint_cleanup_task_event(event, safepoint_id, name);
 645       }
 646     }
 647 
 648     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP)) {
 649       // Don't bother reporting event or time for this very short operation.
 650       // To have any utility we'd also want to report whether needed.
 651       OopStorage::trigger_cleanup_if_needed();
 652     }
 653 
 654    if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_KEEPALIVES)) {
 655      const char* name = "cleaning keepalive jweak handles";
 656      EventSafepointCleanupTask event;
 657      TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 658      Continuations::cleanup_keepalives();
 659 
 660      post_safepoint_cleanup_task_event(event, safepoint_id, name);
 661    }
 662 
 663     _subtasks.all_tasks_completed(_num_workers);
 664   }
 665 };
 666 
 667 // Various cleaning tasks that should be done periodically at safepoints.
 668 void SafepointSynchronize::do_cleanup_tasks() {
 669 
 670   TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
 671 
 672   // Prepare for monitor deflation.
 673   DeflateMonitorCounters deflate_counters;
 674   ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
 675 
 676   CollectedHeap* heap = Universe::heap();
 677   assert(heap != NULL, "heap not initialized yet?");
 678   WorkGang* cleanup_workers = heap->get_safepoint_workers();
 679   if (cleanup_workers != NULL) {
 680     // Parallel cleanup using GC provided thread pool.
 681     uint num_cleanup_workers = cleanup_workers->active_workers();


< prev index next >