< prev index next >

src/hotspot/share/runtime/safepoint.cpp

Print this page

  30 #include "code/codeCache.hpp"
  31 #include "code/icBuffer.hpp"
  32 #include "code/nmethod.hpp"
  33 #include "code/pcDesc.hpp"
  34 #include "code/scopeDesc.hpp"
  35 #include "compiler/compilationPolicy.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/deoptimization.hpp"
  51 #include "runtime/frame.inline.hpp"
  52 #include "runtime/handles.inline.hpp"
  53 #include "runtime/interfaceSupport.inline.hpp"
  54 #include "runtime/mutexLocker.hpp"
  55 #include "runtime/orderAccess.hpp"
  56 #include "runtime/osThread.hpp"
  57 #include "runtime/safepoint.hpp"
  58 #include "runtime/safepointMechanism.inline.hpp"
  59 #include "runtime/signature.hpp"
  60 #include "runtime/stackWatermarkSet.inline.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/threadWXSetters.inline.hpp"
  68 #include "runtime/timerTrace.hpp"
  69 #include "services/runtimeService.hpp"

 574     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_STRING_TABLE_REHASH)) {
 575       if (StringTable::needs_rehashing()) {
 576         Tracer t("rehashing string table");
 577         StringTable::rehash_table();
 578       }
 579     }
 580 
 581     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
 582       if (Dictionary::does_any_dictionary_needs_resizing()) {
 583         Tracer t("resizing system dictionaries");
 584         ClassLoaderDataGraph::resize_dictionaries();
 585       }
 586     }
 587 
 588     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP)) {
 589       // Don't bother reporting event or time for this very short operation.
 590       // To have any utility we'd also want to report whether needed.
 591       OopStorage::trigger_cleanup_if_needed();
 592     }
 593 








 594     _subtasks.all_tasks_claimed();
 595   }
 596 };
 597 
 598 // Various cleaning tasks that should be done periodically at safepoints.
 599 void SafepointSynchronize::do_cleanup_tasks() {
 600 
 601   TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
 602 
 603   CollectedHeap* heap = Universe::heap();
 604   assert(heap != NULL, "heap not initialized yet?");
 605   WorkGang* cleanup_workers = heap->safepoint_workers();
 606   if (cleanup_workers != NULL) {
 607     // Parallel cleanup using GC provided thread pool.
 608     uint num_cleanup_workers = cleanup_workers->active_workers();
 609     ParallelSPCleanupTask cleanup(num_cleanup_workers);
 610     cleanup_workers->run_task(&cleanup);
 611   } else {
 612     // Serial cleanup using VMThread.
 613     ParallelSPCleanupTask cleanup(1);

  30 #include "code/codeCache.hpp"
  31 #include "code/icBuffer.hpp"
  32 #include "code/nmethod.hpp"
  33 #include "code/pcDesc.hpp"
  34 #include "code/scopeDesc.hpp"
  35 #include "compiler/compilationPolicy.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/continuation.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/stackWatermarkSet.inline.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/threadWXSetters.inline.hpp"
  69 #include "runtime/timerTrace.hpp"
  70 #include "services/runtimeService.hpp"

 575     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_STRING_TABLE_REHASH)) {
 576       if (StringTable::needs_rehashing()) {
 577         Tracer t("rehashing string table");
 578         StringTable::rehash_table();
 579       }
 580     }
 581 
 582     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
 583       if (Dictionary::does_any_dictionary_needs_resizing()) {
 584         Tracer t("resizing system dictionaries");
 585         ClassLoaderDataGraph::resize_dictionaries();
 586       }
 587     }
 588 
 589     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP)) {
 590       // Don't bother reporting event or time for this very short operation.
 591       // To have any utility we'd also want to report whether needed.
 592       OopStorage::trigger_cleanup_if_needed();
 593     }
 594 
 595     if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_KEEPALIVES)) {
 596       const char* name = "cleaning keepalive jweak handles";
 597       EventSafepointCleanupTask event;
 598       TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
 599 
 600       post_safepoint_cleanup_task_event(event, SafepointSynchronize::safepoint_id(), name);
 601     }
 602 
 603     _subtasks.all_tasks_claimed();
 604   }
 605 };
 606 
 607 // Various cleaning tasks that should be done periodically at safepoints.
 608 void SafepointSynchronize::do_cleanup_tasks() {
 609 
 610   TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
 611 
 612   CollectedHeap* heap = Universe::heap();
 613   assert(heap != NULL, "heap not initialized yet?");
 614   WorkGang* cleanup_workers = heap->safepoint_workers();
 615   if (cleanup_workers != NULL) {
 616     // Parallel cleanup using GC provided thread pool.
 617     uint num_cleanup_workers = cleanup_workers->active_workers();
 618     ParallelSPCleanupTask cleanup(num_cleanup_workers);
 619     cleanup_workers->run_task(&cleanup);
 620   } else {
 621     // Serial cleanup using VMThread.
 622     ParallelSPCleanupTask cleanup(1);
< prev index next >