< prev index next >

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

Print this page
rev 55406 : 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles


  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();


 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   void strong_roots_do_unchecked(OopClosure* cl);
 152 };
 153 
 154 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
 155 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
 156 
 157 // Evacuate all roots at a safepoint
 158 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
 159 private:
 160   ShenandoahSerialRoots          _serial_roots;
 161   ShenandoahJNIHandleRoots       _jni_roots;
 162   ShenandoahClassLoaderDataRoots _cld_roots;
 163   ShenandoahThreadRoots          _thread_roots;
 164   ShenandoahWeakRoots            _weak_roots;
 165   ShenandoahStringDedupRoots     _dedup_roots;
 166   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;

 167 
 168 public:
 169   ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 170 
 171   void roots_do(uint worker_id, OopClosure* oops);
 172 };
 173 
 174 // Update all roots at a safepoint
 175 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
 176 private:
 177   ShenandoahSerialRoots          _serial_roots;
 178   ShenandoahJNIHandleRoots       _jni_roots;
 179   ShenandoahClassLoaderDataRoots _cld_roots;
 180   ShenandoahThreadRoots          _thread_roots;
 181   ShenandoahWeakRoots            _weak_roots;
 182   ShenandoahStringDedupRoots     _dedup_roots;
 183   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 184   const bool                     _update_code_cache;
 185 
 186 public:
 187   ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
 188 
 189   template<typename IsAlive, typename KeepAlive>
 190   void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
 191 };
 192 
 193 // Adjuster all roots at a safepoint during full gc
 194 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
 195 private:
 196   ShenandoahSerialRoots          _serial_roots;
 197   ShenandoahJNIHandleRoots       _jni_roots;
 198   ShenandoahClassLoaderDataRoots _cld_roots;
 199   ShenandoahThreadRoots          _thread_roots;
 200   ShenandoahWeakRoots            _weak_roots;
 201   ShenandoahStringDedupRoots     _dedup_roots;
 202   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
 203 
 204 public:
 205   ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 206 
 207   void roots_do(uint worker_id, OopClosure* oops);
 208 };
 209 
 210 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP


  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 template <bool CONCURRENT = false>
  65 class ShenandoahJNIHandleRoots {
  66 private:
  67   OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
  68 public:
  69   ShenandoahJNIHandleRoots();
  70 
  71   template <typename T>
  72   void oops_do(T* cl, uint worker_id = 0);
  73 };
  74 
  75 class ShenandoahThreadRoots {
  76 private:
  77   const bool _is_par;
  78 public:
  79   ShenandoahThreadRoots(bool is_par);
  80   ~ShenandoahThreadRoots();
  81 
  82   void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
  83   void threads_do(ThreadClosure* tc, uint worker_id);
  84 };
  85 
  86 class ShenandoahWeakRoots {
  87 private:
  88   WeakProcessorPhaseTimes _process_timings;
  89   WeakProcessor::Task     _task;
  90 public:
  91   ShenandoahWeakRoots(uint n_workers);
  92   ~ShenandoahWeakRoots();


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