< prev index next >

src/share/vm/gc_implementation/g1/g1RootProcessor.hpp

Print this page
rev 7992 : G1RootProcessor
rev 7993 : Convert G1 to G1RootProcessor
rev 7997 : imported patch rename-done_with_threads
rev 7998 : imported patch thomas-comments
rev 7999 : imported patch eriks-comments


  33 class CodeBlobClosure;
  34 class G1CollectedHeap;
  35 class G1ParPushHeapRSClosure;
  36 class Monitor;
  37 class OopClosure;
  38 class SubTasksDone;
  39 
  40 // Scoped object to assist in applying oop, CLD and code blob closures to
  41 // root locations. Handles claiming of different root scanning tasks
  42 // and takes care of global state for root scanning via a StrongRootsScope.
  43 // In the parallel case there is a shared G1RootProcessor object where all
  44 // worker thread call the process_roots methods.
  45 class G1RootProcessor : public StackObj {
  46   G1CollectedHeap* _g1h;
  47   SubTasksDone* _process_strong_tasks;
  48   SharedHeap::StrongRootsScope _srs;
  49 
  50   // Used to implement the Thread work barrier.
  51   Monitor _lock;
  52   volatile jint _n_workers_discovered_strong_classes;
  53   const bool _trace_metadata;
  54 
  55   enum G1H_process_roots_tasks {
  56     G1RP_PS_Universe_oops_do,
  57     G1RP_PS_JNIHandles_oops_do,
  58     G1RP_PS_ObjectSynchronizer_oops_do,
  59     G1RP_PS_FlatProfiler_oops_do,
  60     G1RP_PS_Management_oops_do,
  61     G1RP_PS_SystemDictionary_oops_do,
  62     G1RP_PS_ClassLoaderDataGraph_oops_do,
  63     G1RP_PS_jvmti_oops_do,
  64     G1RP_PS_CodeCache_oops_do,
  65     G1RP_PS_filter_satb_buffers,
  66     G1RP_PS_refProcessor_oops_do,
  67     // Leave this one last.
  68     G1RP_PS_NumElements
  69   };
  70 
  71   void worker_has_discovered_all_strong_classes();
  72   void wait_until_all_strong_classes_discovered();
  73 
  74   void process_java_roots(OopClosure* scan_non_heap_roots,
  75                           CLDClosure* thread_stack_clds,
  76                           CLDClosure* scan_strong_clds,
  77                           CLDClosure* scan_weak_clds,
  78                           CodeBlobClosure* scan_strong_code);
  79 
  80   void process_vm_roots(OopClosure* scan_non_heap_roots,
  81                         OopClosure* scan_non_heap_weak_roots);
  82 
  83 public:
  84   G1RootProcessor(G1CollectedHeap* g1h, bool trace_metadata);
  85 
  86   // Apply closures to the strongly and weakly reachable roots in the system
  87   // in a single pass.
  88   // Record and report timing measurements for sub phases using the worker_i
  89   void evacuate_roots(OopClosure* scan_non_heap_roots,
  90                       OopClosure* scan_non_heap_weak_roots,
  91                       CLDClosure* scan_strong_clds,
  92                       CLDClosure* scan_weak_clds,

  93                       uint worker_i);
  94 
  95   // Apply oops, clds and blobs to all strongly reachable roots in the system
  96   void process_strong_roots(OopClosure* oops,
  97                             CLDClosure* clds,
  98                             CodeBlobClosure* blobs);
  99 
 100   // Apply oops, clds and blobs to strongly and weakly reachable roots in the system
 101   void process_all_roots(OopClosure* oops,
 102                          CLDClosure* clds,
 103                          CodeBlobClosure* blobs);
 104 
 105   // Apply scan_rs to all locations in the union of the remembered sets for all
 106   // regions in the collection set
 107   // (having done "set_region" to indicate the region in which the root resides),
 108   void scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
 109                             OopClosure* scan_non_heap_weak_roots,
 110                             uint worker_i);
 111 
 112   // Inform the root processor about the number of worker threads


  33 class CodeBlobClosure;
  34 class G1CollectedHeap;
  35 class G1ParPushHeapRSClosure;
  36 class Monitor;
  37 class OopClosure;
  38 class SubTasksDone;
  39 
  40 // Scoped object to assist in applying oop, CLD and code blob closures to
  41 // root locations. Handles claiming of different root scanning tasks
  42 // and takes care of global state for root scanning via a StrongRootsScope.
  43 // In the parallel case there is a shared G1RootProcessor object where all
  44 // worker thread call the process_roots methods.
  45 class G1RootProcessor : public StackObj {
  46   G1CollectedHeap* _g1h;
  47   SubTasksDone* _process_strong_tasks;
  48   SharedHeap::StrongRootsScope _srs;
  49 
  50   // Used to implement the Thread work barrier.
  51   Monitor _lock;
  52   volatile jint _n_workers_discovered_strong_classes;

  53 
  54   enum G1H_process_roots_tasks {
  55     G1RP_PS_Universe_oops_do,
  56     G1RP_PS_JNIHandles_oops_do,
  57     G1RP_PS_ObjectSynchronizer_oops_do,
  58     G1RP_PS_FlatProfiler_oops_do,
  59     G1RP_PS_Management_oops_do,
  60     G1RP_PS_SystemDictionary_oops_do,
  61     G1RP_PS_ClassLoaderDataGraph_oops_do,
  62     G1RP_PS_jvmti_oops_do,
  63     G1RP_PS_CodeCache_oops_do,
  64     G1RP_PS_filter_satb_buffers,
  65     G1RP_PS_refProcessor_oops_do,
  66     // Leave this one last.
  67     G1RP_PS_NumElements
  68   };
  69 
  70   void worker_has_discovered_all_strong_classes();
  71   void wait_until_all_strong_classes_discovered();
  72 
  73   void process_java_roots(OopClosure* scan_non_heap_roots,
  74                           CLDClosure* thread_stack_clds,
  75                           CLDClosure* scan_strong_clds,
  76                           CLDClosure* scan_weak_clds,
  77                           CodeBlobClosure* scan_strong_code);
  78 
  79   void process_vm_roots(OopClosure* scan_non_heap_roots,
  80                         OopClosure* scan_non_heap_weak_roots);
  81 
  82 public:
  83   G1RootProcessor(G1CollectedHeap* g1h);
  84 
  85   // Apply closures to the strongly and weakly reachable roots in the system
  86   // in a single pass.
  87   // Record and report timing measurements for sub phases using the worker_i
  88   void evacuate_roots(OopClosure* scan_non_heap_roots,
  89                       OopClosure* scan_non_heap_weak_roots,
  90                       CLDClosure* scan_strong_clds,
  91                       CLDClosure* scan_weak_clds,
  92                       bool trace_metadata,
  93                       uint worker_i);
  94 
  95   // Apply oops, clds and blobs to all strongly reachable roots in the system
  96   void process_strong_roots(OopClosure* oops,
  97                             CLDClosure* clds,
  98                             CodeBlobClosure* blobs);
  99 
 100   // Apply oops, clds and blobs to strongly and weakly reachable roots in the system
 101   void process_all_roots(OopClosure* oops,
 102                          CLDClosure* clds,
 103                          CodeBlobClosure* blobs);
 104 
 105   // Apply scan_rs to all locations in the union of the remembered sets for all
 106   // regions in the collection set
 107   // (having done "set_region" to indicate the region in which the root resides),
 108   void scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
 109                             OopClosure* scan_non_heap_weak_roots,
 110                             uint worker_i);
 111 
 112   // Inform the root processor about the number of worker threads
< prev index next >