< prev index next >

src/hotspot/share/gc/g1/g1RootProcessor.cpp

Print this page




  27 #include "classfile/classLoaderDataGraph.hpp"
  28 #include "classfile/stringTable.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "gc/g1/g1BarrierSet.hpp"
  32 #include "gc/g1/g1CodeBlobClosure.hpp"
  33 #include "gc/g1/g1CollectedHeap.inline.hpp"
  34 #include "gc/g1/g1CollectorState.hpp"
  35 #include "gc/g1/g1GCPhaseTimes.hpp"
  36 #include "gc/g1/g1ParScanThreadState.inline.hpp"
  37 #include "gc/g1/g1Policy.hpp"
  38 #include "gc/g1/g1RootClosures.hpp"
  39 #include "gc/g1/g1RootProcessor.hpp"
  40 #include "gc/g1/heapRegion.inline.hpp"
  41 #include "gc/shared/referenceProcessor.hpp"
  42 #include "memory/allocation.inline.hpp"
  43 #include "memory/universe.hpp"
  44 #include "runtime/mutex.hpp"
  45 #include "services/management.hpp"
  46 #include "utilities/macros.hpp"



  47 
  48 void G1RootProcessor::worker_has_discovered_all_strong_classes() {
  49   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
  50 
  51   uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
  52   if (new_value == n_workers()) {
  53     // This thread is last. Notify the others.
  54     MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
  55     _lock.notify_all();
  56   }
  57 }
  58 
  59 void G1RootProcessor::wait_until_all_strong_classes_discovered() {
  60   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
  61 
  62   if ((uint)_n_workers_discovered_strong_classes != n_workers()) {
  63     MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
  64     while ((uint)_n_workers_discovered_strong_classes != n_workers()) {
  65       ml.wait(0);
  66     }


 237 
 238   {
 239     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i);
 240     if (_process_strong_tasks.try_claim_task(G1RP_PS_Management_oops_do)) {
 241       Management::oops_do(strong_roots);
 242     }
 243   }
 244 
 245   {
 246     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i);
 247     if (_process_strong_tasks.try_claim_task(G1RP_PS_jvmti_oops_do)) {
 248       JvmtiExport::oops_do(strong_roots);
 249     }
 250   }
 251 
 252 #if INCLUDE_AOT
 253   if (UseAOT) {
 254     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::AOTCodeRoots, worker_i);
 255     if (_process_strong_tasks.try_claim_task(G1RP_PS_aot_oops_do)) {
 256         AOTLoader::oops_do(strong_roots);









 257     }
 258   }
 259 #endif
 260 
 261   {
 262     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i);
 263     if (_process_strong_tasks.try_claim_task(G1RP_PS_SystemDictionary_oops_do)) {
 264       SystemDictionary::oops_do(strong_roots);
 265     }
 266   }
 267 }
 268 
 269 void G1RootProcessor::process_code_cache_roots(CodeBlobClosure* code_closure,
 270                                                G1GCPhaseTimes* phase_times,
 271                                                uint worker_i) {
 272   if (_process_strong_tasks.try_claim_task(G1RP_PS_CodeCache_oops_do)) {
 273     CodeCache::blobs_do(code_closure);
 274   }
 275 }
 276 


  27 #include "classfile/classLoaderDataGraph.hpp"
  28 #include "classfile/stringTable.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "gc/g1/g1BarrierSet.hpp"
  32 #include "gc/g1/g1CodeBlobClosure.hpp"
  33 #include "gc/g1/g1CollectedHeap.inline.hpp"
  34 #include "gc/g1/g1CollectorState.hpp"
  35 #include "gc/g1/g1GCPhaseTimes.hpp"
  36 #include "gc/g1/g1ParScanThreadState.inline.hpp"
  37 #include "gc/g1/g1Policy.hpp"
  38 #include "gc/g1/g1RootClosures.hpp"
  39 #include "gc/g1/g1RootProcessor.hpp"
  40 #include "gc/g1/heapRegion.inline.hpp"
  41 #include "gc/shared/referenceProcessor.hpp"
  42 #include "memory/allocation.inline.hpp"
  43 #include "memory/universe.hpp"
  44 #include "runtime/mutex.hpp"
  45 #include "services/management.hpp"
  46 #include "utilities/macros.hpp"
  47 #if INCLUDE_JVMCI
  48 #include "jvmci/jvmci.hpp"
  49 #endif
  50 
  51 void G1RootProcessor::worker_has_discovered_all_strong_classes() {
  52   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
  53 
  54   uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
  55   if (new_value == n_workers()) {
  56     // This thread is last. Notify the others.
  57     MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
  58     _lock.notify_all();
  59   }
  60 }
  61 
  62 void G1RootProcessor::wait_until_all_strong_classes_discovered() {
  63   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
  64 
  65   if ((uint)_n_workers_discovered_strong_classes != n_workers()) {
  66     MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
  67     while ((uint)_n_workers_discovered_strong_classes != n_workers()) {
  68       ml.wait(0);
  69     }


 240 
 241   {
 242     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i);
 243     if (_process_strong_tasks.try_claim_task(G1RP_PS_Management_oops_do)) {
 244       Management::oops_do(strong_roots);
 245     }
 246   }
 247 
 248   {
 249     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i);
 250     if (_process_strong_tasks.try_claim_task(G1RP_PS_jvmti_oops_do)) {
 251       JvmtiExport::oops_do(strong_roots);
 252     }
 253   }
 254 
 255 #if INCLUDE_AOT
 256   if (UseAOT) {
 257     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::AOTCodeRoots, worker_i);
 258     if (_process_strong_tasks.try_claim_task(G1RP_PS_aot_oops_do)) {
 259         AOTLoader::oops_do(strong_roots);
 260     }
 261   }
 262 #endif
 263 
 264 #if INCLUDE_JVMCI
 265   if (EnableJVMCI) {
 266     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMCIRoots, worker_i);
 267     if (_process_strong_tasks.try_claim_task(G1RP_PS_JVMCI_oops_do)) {
 268       JVMCI::oops_do(strong_roots);
 269     }
 270   }
 271 #endif
 272 
 273   {
 274     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i);
 275     if (_process_strong_tasks.try_claim_task(G1RP_PS_SystemDictionary_oops_do)) {
 276       SystemDictionary::oops_do(strong_roots);
 277     }
 278   }
 279 }
 280 
 281 void G1RootProcessor::process_code_cache_roots(CodeBlobClosure* code_closure,
 282                                                G1GCPhaseTimes* phase_times,
 283                                                uint worker_i) {
 284   if (_process_strong_tasks.try_claim_task(G1RP_PS_CodeCache_oops_do)) {
 285     CodeCache::blobs_do(code_closure);
 286   }
 287 }
 288 
< prev index next >