< prev index next >

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

Print this page
rev 55477 : 8226310: Shenandoah: Concurrent evacuation of CLDG


 173 
 174 class ShenandoahStringDedupRoots {
 175 public:
 176   ShenandoahStringDedupRoots();
 177   ~ShenandoahStringDedupRoots();
 178 
 179   void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
 180 };
 181 
 182 template <typename ITR>
 183 class ShenandoahCodeCacheRoots {
 184 private:
 185   ITR _coderoots_iterator;
 186 public:
 187   ShenandoahCodeCacheRoots();
 188   ~ShenandoahCodeCacheRoots();
 189 
 190   void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
 191 };
 192 
 193 template <bool SINGLE_THREADED>
 194 class ShenandoahClassLoaderDataRoots {
 195 public:
 196   ShenandoahClassLoaderDataRoots();

 197 
 198   void always_strong_cld_do(CLDClosure* clds, uint worker_id);
 199   void cld_do(CLDClosure* clds, uint worker_id);
 200 };
 201 
 202 class ShenandoahRootProcessor : public StackObj {
 203 private:
 204   ShenandoahHeap* const               _heap;
 205   const ShenandoahPhaseTimings::Phase _phase;
 206 public:
 207   ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
 208   ~ShenandoahRootProcessor();
 209 
 210   ShenandoahHeap* heap() const { return _heap; }
 211 };
 212 
 213 template <typename ITR>
 214 class ShenandoahRootScanner : public ShenandoahRootProcessor {
 215 private:
 216   ShenandoahSerialRoots                                     _serial_roots;
 217   ShenandoahThreadRoots                                     _thread_roots;
 218   ShenandoahCodeCacheRoots<ITR>                             _code_roots;
 219   ShenandoahJNIHandleRoots<false /*concurrent*/ >           _jni_roots;
 220   ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;

 221 public:
 222   ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 223 
 224   // Apply oops, clds and blobs to all strongly reachable roots in the system,
 225   // during class unloading cycle
 226   void strong_roots_do(uint worker_id, OopClosure* cl);
 227   void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
 228 
 229   // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
 230   // roots when class unloading is disabled during this cycle
 231   void roots_do(uint worker_id, OopClosure* cl);
 232   void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
 233 };
 234 
 235 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
 236 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
 237 
 238 // This scanner is only for SH::object_iteration() and only supports single-threaded
 239 // root scanning
 240 class ShenandoahHeapIterationRootScanner : public ShenandoahRootProcessor {
 241 private:
 242   ShenandoahSerialRoots                                    _serial_roots;
 243   ShenandoahThreadRoots                                    _thread_roots;
 244   ShenandoahJNIHandleRoots<false /*concurrent*/>           _jni_roots;
 245   ShenandoahClassLoaderDataRoots<true /*single threaded*/> _cld_roots;

 246   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
 247 
 248 public:
 249   ShenandoahHeapIterationRootScanner();
 250 
 251   void roots_do(OopClosure* cl);
 252   void strong_roots_do(OopClosure* cl);
 253 };
 254 
 255 // Evacuate all roots at a safepoint
 256 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
 257 private:
 258   ShenandoahSerialRoots                                     _serial_roots;
 259   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 260   ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;

 261   ShenandoahThreadRoots                                     _thread_roots;
 262   ShenandoahSerialWeakRoots                                 _serial_weak_roots;
 263   ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
 264   ShenandoahStringDedupRoots                                _dedup_roots;
 265   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 266   bool                                                      _include_concurrent_roots;
 267 
 268 public:
 269   ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
 270 
 271   void roots_do(uint worker_id, OopClosure* oops);
 272 };
 273 
 274 // Update all roots at a safepoint
 275 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
 276 private:
 277   ShenandoahSerialRoots                                     _serial_roots;
 278   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 279   ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;

 280   ShenandoahThreadRoots                                     _thread_roots;
 281   ShenandoahSerialWeakRoots                                 _serial_weak_roots;
 282   ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
 283   ShenandoahStringDedupRoots                                _dedup_roots;
 284   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 285   const bool                                                _update_code_cache;
 286 
 287 public:
 288   ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
 289 
 290   template<typename IsAlive, typename KeepAlive>
 291   void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
 292 };
 293 
 294 // Adjuster all roots at a safepoint during full gc
 295 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
 296 private:
 297   ShenandoahSerialRoots                                     _serial_roots;
 298   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 299   ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;

 300   ShenandoahThreadRoots                                     _thread_roots;
 301   ShenandoahSerialWeakRoots                                 _serial_weak_roots;
 302   ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
 303   ShenandoahStringDedupRoots                                _dedup_roots;
 304   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
 305 
 306 public:
 307   ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 308 
 309   void roots_do(uint worker_id, OopClosure* oops);
 310 };
 311 
 312 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP


 173 
 174 class ShenandoahStringDedupRoots {
 175 public:
 176   ShenandoahStringDedupRoots();
 177   ~ShenandoahStringDedupRoots();
 178 
 179   void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
 180 };
 181 
 182 template <typename ITR>
 183 class ShenandoahCodeCacheRoots {
 184 private:
 185   ITR _coderoots_iterator;
 186 public:
 187   ShenandoahCodeCacheRoots();
 188   ~ShenandoahCodeCacheRoots();
 189 
 190   void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
 191 };
 192 
 193 template <bool CONCURRENT, bool SINGLE_THREADED>
 194 class ShenandoahClassLoaderDataRoots {
 195 public:
 196   ShenandoahClassLoaderDataRoots();
 197   ~ShenandoahClassLoaderDataRoots();
 198 
 199   void always_strong_cld_do(CLDClosure* clds, uint worker_id = 0);
 200   void cld_do(CLDClosure* clds, uint worker_id = 0);
 201 };
 202 
 203 class ShenandoahRootProcessor : public StackObj {
 204 private:
 205   ShenandoahHeap* const               _heap;
 206   const ShenandoahPhaseTimings::Phase _phase;
 207 public:
 208   ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
 209   ~ShenandoahRootProcessor();
 210 
 211   ShenandoahHeap* heap() const { return _heap; }
 212 };
 213 
 214 template <typename ITR>
 215 class ShenandoahRootScanner : public ShenandoahRootProcessor {
 216 private:
 217   ShenandoahSerialRoots                                     _serial_roots;
 218   ShenandoahThreadRoots                                     _thread_roots;
 219   ShenandoahCodeCacheRoots<ITR>                             _code_roots;
 220   ShenandoahJNIHandleRoots<false /*concurrent*/ >           _jni_roots;
 221   ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
 222                                                             _cld_roots;
 223 public:
 224   ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 225 
 226   // Apply oops, clds and blobs to all strongly reachable roots in the system,
 227   // during class unloading cycle
 228   void strong_roots_do(uint worker_id, OopClosure* cl);
 229   void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
 230 
 231   // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
 232   // roots when class unloading is disabled during this cycle
 233   void roots_do(uint worker_id, OopClosure* cl);
 234   void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
 235 };
 236 
 237 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
 238 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
 239 
 240 // This scanner is only for SH::object_iteration() and only supports single-threaded
 241 // root scanning
 242 class ShenandoahHeapIterationRootScanner : public ShenandoahRootProcessor {
 243 private:
 244   ShenandoahSerialRoots                                    _serial_roots;
 245   ShenandoahThreadRoots                                    _thread_roots;
 246   ShenandoahJNIHandleRoots<false /*concurrent*/>           _jni_roots;
 247   ShenandoahClassLoaderDataRoots<false /*concurrent*/, true /*single threaded*/>
 248                                                            _cld_roots;
 249   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
 250 
 251 public:
 252   ShenandoahHeapIterationRootScanner();
 253 
 254   void roots_do(OopClosure* cl);
 255   void strong_roots_do(OopClosure* cl);
 256 };
 257 
 258 // Evacuate all roots at a safepoint
 259 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
 260 private:
 261   ShenandoahSerialRoots                                     _serial_roots;
 262   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 263   ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
 264                                                             _cld_roots;
 265   ShenandoahThreadRoots                                     _thread_roots;
 266   ShenandoahSerialWeakRoots                                 _serial_weak_roots;
 267   ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
 268   ShenandoahStringDedupRoots                                _dedup_roots;
 269   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 270   bool                                                      _include_concurrent_roots;
 271 
 272 public:
 273   ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
 274 
 275   void roots_do(uint worker_id, OopClosure* oops);
 276 };
 277 
 278 // Update all roots at a safepoint
 279 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
 280 private:
 281   ShenandoahSerialRoots                                     _serial_roots;
 282   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 283   ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
 284                                                             _cld_roots;
 285   ShenandoahThreadRoots                                     _thread_roots;
 286   ShenandoahSerialWeakRoots                                 _serial_weak_roots;
 287   ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
 288   ShenandoahStringDedupRoots                                _dedup_roots;
 289   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
 290   const bool                                                _update_code_cache;
 291 
 292 public:
 293   ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
 294 
 295   template<typename IsAlive, typename KeepAlive>
 296   void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
 297 };
 298 
 299 // Adjuster all roots at a safepoint during full gc
 300 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
 301 private:
 302   ShenandoahSerialRoots                                     _serial_roots;
 303   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
 304   ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
 305                                                             _cld_roots;
 306   ShenandoahThreadRoots                                     _thread_roots;
 307   ShenandoahSerialWeakRoots                                 _serial_weak_roots;
 308   ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
 309   ShenandoahStringDedupRoots                                _dedup_roots;
 310   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
 311 
 312 public:
 313   ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 314 
 315   void roots_do(uint worker_id, OopClosure* oops);
 316 };
 317 
 318 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
< prev index next >