< prev index next >

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

Print this page
rev 55429 : 8226413: Shenandoah: Separate root scanner for SH::object_iterate()


  97 
  98 class ShenandoahStringDedupRoots {
  99 public:
 100   ShenandoahStringDedupRoots();
 101   ~ShenandoahStringDedupRoots();
 102 
 103   void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
 104 };
 105 
 106 template <typename ITR>
 107 class ShenandoahCodeCacheRoots {
 108 private:
 109   ITR _coderoots_iterator;
 110 public:
 111   ShenandoahCodeCacheRoots();
 112   ~ShenandoahCodeCacheRoots();
 113 
 114   void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
 115 };
 116 

 117 class ShenandoahClassLoaderDataRoots {
 118 public:
 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<false /*concurrent*/>  _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<false /*concurrent*/>            _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<false /*concurrent*/>            _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<false /*concurrent*/>           _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


  97 
  98 class ShenandoahStringDedupRoots {
  99 public:
 100   ShenandoahStringDedupRoots();
 101   ~ShenandoahStringDedupRoots();
 102 
 103   void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
 104 };
 105 
 106 template <typename ITR>
 107 class ShenandoahCodeCacheRoots {
 108 private:
 109   ITR _coderoots_iterator;
 110 public:
 111   ShenandoahCodeCacheRoots();
 112   ~ShenandoahCodeCacheRoots();
 113 
 114   void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
 115 };
 116 
 117 template <bool SINGLE_THREADED>
 118 class ShenandoahClassLoaderDataRoots {
 119 public:
 120   ShenandoahClassLoaderDataRoots();
 121 
 122   void clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id);
 123 };
 124 
 125 class ShenandoahRootProcessor : public StackObj {
 126 private:
 127   ShenandoahHeap* const               _heap;
 128   const ShenandoahPhaseTimings::Phase _phase;
 129 public:
 130   ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
 131   ~ShenandoahRootProcessor();
 132 
 133   ShenandoahHeap* heap() const { return _heap; }
 134 };
 135 
 136 template <typename ITR>
 137 class ShenandoahRootScanner : public ShenandoahRootProcessor {
 138 private:
 139   ShenandoahSerialRoots                                     _serial_roots;


 140   ShenandoahThreadRoots                                     _thread_roots;
 141   ShenandoahCodeCacheRoots<ITR>                             _code_roots;
 142   ShenandoahJNIHandleRoots<false /*concurrent*/ >           _jni_roots;
 143   ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
 144 public:
 145   ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 146 
 147   // Apply oops, clds and blobs to all strongly reachable roots in the system,
 148   // during class unloading cycle
 149   void strong_roots_do(uint worker_id, OopClosure* cl);
 150   void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
 151 
 152   // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
 153   // roots when class unloading is disabled during this cycle
 154   void roots_do(uint worker_id, OopClosure* cl);
 155   void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);



 156 };
 157 
 158 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
 159 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
 160 
 161 // This scanner is only for SH::object_iteration() and only supports single-threaded
 162 // root scanning
 163 class ShenandoahHeapIterationRootScanner : public ShenandoahRootProcessor {
 164 private:
 165   ShenandoahSerialRoots                                    _serial_roots;
 166   ShenandoahThreadRoots                                    _thread_roots;
 167   ShenandoahJNIHandleRoots<false /*concurrent*/>           _jni_roots;
 168   ShenandoahClassLoaderDataRoots<true /*single threaded*/> _cld_roots;
 169   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
 170 
 171 public:
 172   ShenandoahHeapIterationRootScanner();
 173 
 174   void roots_do(OopClosure* cl);
 175   void strong_roots_do(OopClosure* cl);
 176 };
 177 
 178 // Evacuate all roots at a safepoint
 179 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
 180 private:
 181   ShenandoahSerialRoots                                     _serial_roots;
 182   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 183   ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
 184   ShenandoahThreadRoots                                     _thread_roots;
 185   ShenandoahWeakRoots                                       _weak_roots;
 186   ShenandoahStringDedupRoots                                _dedup_roots;
 187   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 188   bool                                                      _include_concurrent_roots;
 189 
 190 public:
 191   ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
 192 
 193   void roots_do(uint worker_id, OopClosure* oops);
 194 };
 195 
 196 // Update all roots at a safepoint
 197 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
 198 private:
 199   ShenandoahSerialRoots                                     _serial_roots;
 200   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 201   ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
 202   ShenandoahThreadRoots                                     _thread_roots;
 203   ShenandoahWeakRoots                                       _weak_roots;
 204   ShenandoahStringDedupRoots                                _dedup_roots;
 205   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 206   const bool                                                _update_code_cache;
 207 
 208 public:
 209   ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
 210 
 211   template<typename IsAlive, typename KeepAlive>
 212   void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
 213 };
 214 
 215 // Adjuster all roots at a safepoint during full gc
 216 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
 217 private:
 218   ShenandoahSerialRoots                                     _serial_roots;
 219   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 220   ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
 221   ShenandoahThreadRoots                                     _thread_roots;
 222   ShenandoahWeakRoots                                       _weak_roots;
 223   ShenandoahStringDedupRoots                                _dedup_roots;
 224   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
 225 
 226 public:
 227   ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 228 
 229   void roots_do(uint worker_id, OopClosure* oops);
 230 };
 231 
 232 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
< prev index next >