< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp

Print this page




  39 class ShenandoahSerialRoot {
  40 public:
  41   typedef void (*OopsDo)(OopClosure*);
  42 private:
  43   volatile bool                             _claimed;
  44   const OopsDo                              _oops_do;
  45   const ShenandoahPhaseTimings::GCParPhases _phase;
  46 
  47 public:
  48   ShenandoahSerialRoot(OopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
  49   void oops_do(OopClosure* cl, uint worker_id);
  50 };
  51 
  52 class ShenandoahSerialRoots {
  53 private:
  54   ShenandoahSerialRoot  _universe_root;
  55   ShenandoahSerialRoot  _object_synchronizer_root;
  56   ShenandoahSerialRoot  _management_root;
  57   ShenandoahSerialRoot  _system_dictionary_root;
  58   ShenandoahSerialRoot  _jvmti_root;

  59 public:
  60   ShenandoahSerialRoots();
  61   void oops_do(OopClosure* cl, uint worker_id);
  62 };
  63 
  64 class ShenandoahJNIHandleRoots : public ShenandoahSerialRoot {
  65 public:
  66   ShenandoahJNIHandleRoots();
  67 };
  68 
  69 class ShenandoahThreadRoots {
  70 private:
  71   const bool _is_par;
  72 public:
  73   ShenandoahThreadRoots(bool is_par);
  74   ~ShenandoahThreadRoots();
  75 
  76   void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
  77   void threads_do(ThreadClosure* tc, uint worker_id);
  78 };
  79 
  80 class ShenandoahWeakRoots {
  81 private:
  82   WeakProcessorPhaseTimes _process_timings;
  83   WeakProcessor::Task     _task;
  84 public:
  85   ShenandoahWeakRoots(uint n_workers);
  86   ~ShenandoahWeakRoots();
  87 
  88   template <typename IsAlive, typename KeepAlive>


 113   ShenandoahClassLoaderDataRoots();
 114 
 115   void clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id);
 116 };
 117 
 118 class ShenandoahRootProcessor : public StackObj {
 119 private:
 120   ShenandoahHeap* const               _heap;
 121   const ShenandoahPhaseTimings::Phase _phase;
 122 public:
 123   ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
 124   ~ShenandoahRootProcessor();
 125 
 126   ShenandoahHeap* heap() const { return _heap; }
 127 };
 128 
 129 template <typename ITR>
 130 class ShenandoahRootScanner : public ShenandoahRootProcessor {
 131 private:
 132   ShenandoahSerialRoots          _serial_roots;
 133   ShenandoahJNIHandleRoots       _jni_roots;
 134   ShenandoahClassLoaderDataRoots _cld_roots;
 135   ShenandoahThreadRoots          _thread_roots;
 136   ShenandoahCodeCacheRoots<ITR>  _code_roots;
 137 public:
 138   ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 139 
 140   // Apply oops, clds and blobs to all strongly reachable roots in the system,
 141   // during class unloading cycle
 142   void strong_roots_do(uint worker_id, OopClosure* cl);
 143   void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
 144 
 145   // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
 146   // roots when class unloading is disabled during this cycle
 147   void roots_do(uint worker_id, OopClosure* cl);
 148   void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
 149   // For heap object iteration
 150   void roots_do_unchecked(OopClosure* cl);
 151 };
 152 
 153 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
 154 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
 155 
 156 // Evacuate all roots at a safepoint
 157 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
 158 private:
 159   ShenandoahSerialRoots          _serial_roots;
 160   ShenandoahJNIHandleRoots       _jni_roots;
 161   ShenandoahClassLoaderDataRoots _cld_roots;
 162   ShenandoahThreadRoots          _thread_roots;
 163   ShenandoahWeakRoots            _weak_roots;
 164   ShenandoahStringDedupRoots     _dedup_roots;
 165   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 166 
 167 public:
 168   ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 169 
 170   void roots_do(uint worker_id, OopClosure* oops);
 171 };
 172 
 173 // Update all roots at a safepoint
 174 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
 175 private:
 176   ShenandoahSerialRoots          _serial_roots;
 177   ShenandoahJNIHandleRoots       _jni_roots;
 178   ShenandoahClassLoaderDataRoots _cld_roots;
 179   ShenandoahThreadRoots          _thread_roots;
 180   ShenandoahWeakRoots            _weak_roots;
 181   ShenandoahStringDedupRoots     _dedup_roots;
 182   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 183   const bool                     _update_code_cache;
 184 
 185 public:
 186   ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
 187 
 188   template<typename IsAlive, typename KeepAlive>
 189   void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
 190 };
 191 
 192 // Adjuster all roots at a safepoint during full gc
 193 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
 194 private:
 195   ShenandoahSerialRoots          _serial_roots;
 196   ShenandoahJNIHandleRoots       _jni_roots;
 197   ShenandoahClassLoaderDataRoots _cld_roots;
 198   ShenandoahThreadRoots          _thread_roots;
 199   ShenandoahWeakRoots            _weak_roots;
 200   ShenandoahStringDedupRoots     _dedup_roots;
 201   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
 202 
 203 public:
 204   ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 205 
 206   void roots_do(uint worker_id, OopClosure* oops);
 207 };
 208 
 209 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP


  39 class ShenandoahSerialRoot {
  40 public:
  41   typedef void (*OopsDo)(OopClosure*);
  42 private:
  43   volatile bool                             _claimed;
  44   const OopsDo                              _oops_do;
  45   const ShenandoahPhaseTimings::GCParPhases _phase;
  46 
  47 public:
  48   ShenandoahSerialRoot(OopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
  49   void oops_do(OopClosure* cl, uint worker_id);
  50 };
  51 
  52 class ShenandoahSerialRoots {
  53 private:
  54   ShenandoahSerialRoot  _universe_root;
  55   ShenandoahSerialRoot  _object_synchronizer_root;
  56   ShenandoahSerialRoot  _management_root;
  57   ShenandoahSerialRoot  _system_dictionary_root;
  58   ShenandoahSerialRoot  _jvmti_root;
  59   ShenandoahSerialRoot  _jni_handle_root;
  60 public:
  61   ShenandoahSerialRoots();
  62   void oops_do(OopClosure* cl, uint worker_id);
  63 };
  64 





  65 class ShenandoahThreadRoots {
  66 private:
  67   const bool _is_par;
  68 public:
  69   ShenandoahThreadRoots(bool is_par);
  70   ~ShenandoahThreadRoots();
  71 
  72   void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
  73   void threads_do(ThreadClosure* tc, uint worker_id);
  74 };
  75 
  76 class ShenandoahWeakRoots {
  77 private:
  78   WeakProcessorPhaseTimes _process_timings;
  79   WeakProcessor::Task     _task;
  80 public:
  81   ShenandoahWeakRoots(uint n_workers);
  82   ~ShenandoahWeakRoots();
  83 
  84   template <typename IsAlive, typename KeepAlive>


 109   ShenandoahClassLoaderDataRoots();
 110 
 111   void clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id);
 112 };
 113 
 114 class ShenandoahRootProcessor : public StackObj {
 115 private:
 116   ShenandoahHeap* const               _heap;
 117   const ShenandoahPhaseTimings::Phase _phase;
 118 public:
 119   ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
 120   ~ShenandoahRootProcessor();
 121 
 122   ShenandoahHeap* heap() const { return _heap; }
 123 };
 124 
 125 template <typename ITR>
 126 class ShenandoahRootScanner : public ShenandoahRootProcessor {
 127 private:
 128   ShenandoahSerialRoots          _serial_roots;

 129   ShenandoahClassLoaderDataRoots _cld_roots;
 130   ShenandoahThreadRoots          _thread_roots;
 131   ShenandoahCodeCacheRoots<ITR>  _code_roots;
 132 public:
 133   ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 134 
 135   // Apply oops, clds and blobs to all strongly reachable roots in the system,
 136   // during class unloading cycle
 137   void strong_roots_do(uint worker_id, OopClosure* cl);
 138   void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
 139 
 140   // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
 141   // roots when class unloading is disabled during this cycle
 142   void roots_do(uint worker_id, OopClosure* cl);
 143   void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);


 144 };
 145 
 146 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
 147 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
 148 
 149 // Evacuate all roots at a safepoint
 150 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
 151 private:
 152   ShenandoahSerialRoots          _serial_roots;

 153   ShenandoahClassLoaderDataRoots _cld_roots;
 154   ShenandoahThreadRoots          _thread_roots;
 155   ShenandoahWeakRoots            _weak_roots;
 156   ShenandoahStringDedupRoots     _dedup_roots;
 157   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 158 
 159 public:
 160   ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 161 
 162   void roots_do(uint worker_id, OopClosure* oops);
 163 };
 164 
 165 // Update all roots at a safepoint
 166 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
 167 private:
 168   ShenandoahSerialRoots          _serial_roots;

 169   ShenandoahClassLoaderDataRoots _cld_roots;
 170   ShenandoahThreadRoots          _thread_roots;
 171   ShenandoahWeakRoots            _weak_roots;
 172   ShenandoahStringDedupRoots     _dedup_roots;
 173   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 174   const bool                     _update_code_cache;
 175 
 176 public:
 177   ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
 178 
 179   template<typename IsAlive, typename KeepAlive>
 180   void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
 181 };
 182 
 183 // Adjuster all roots at a safepoint during full gc
 184 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
 185 private:
 186   ShenandoahSerialRoots          _serial_roots;

 187   ShenandoahClassLoaderDataRoots _cld_roots;
 188   ShenandoahThreadRoots          _thread_roots;
 189   ShenandoahWeakRoots            _weak_roots;
 190   ShenandoahStringDedupRoots     _dedup_roots;
 191   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
 192 
 193 public:
 194   ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 195 
 196   void roots_do(uint worker_id, OopClosure* oops);
 197 };
 198 
 199 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
< prev index next >