< prev index next >

src/hotspot/share/gc/g1/g1OopClosures.hpp

Print this page
rev 52316 : imported patch 8212911-unify-reference-handling-during-gc
rev 52317 : imported patch 8212911-stefanj-review


  26 #define SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
  27 
  28 #include "gc/g1/g1InCSetState.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "oops/markOop.hpp"
  31 
  32 class HeapRegion;
  33 class G1CollectedHeap;
  34 class G1RemSet;
  35 class G1ConcurrentMark;
  36 class DirtyCardToOopClosure;
  37 class G1CMBitMap;
  38 class G1ParScanThreadState;
  39 class G1CMTask;
  40 class ReferenceProcessor;
  41 
  42 class G1ScanClosureBase : public BasicOopIterateClosure {
  43 protected:
  44   G1CollectedHeap* _g1h;
  45   G1ParScanThreadState* _par_scan_state;
  46   HeapRegion* _from;
  47 
  48   G1ScanClosureBase(G1CollectedHeap* g1h, G1ParScanThreadState* par_scan_state);
  49   ~G1ScanClosureBase() { }
  50 
  51   template <class T>
  52   inline void prefetch_and_push(T* p, oop const obj);
  53 
  54   template <class T>
  55   inline void handle_non_cset_obj_common(InCSetState const state, T* p, oop const obj);
  56 public:
  57   virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
  58 
  59   void set_region(HeapRegion* from) { _from = from; }
  60 
  61   inline void trim_queue_partially();
  62 };
  63 
  64 // Used during the Update RS phase to refine remaining cards in the DCQ during garbage collection.
  65 class G1ScanObjsDuringUpdateRSClosure: public G1ScanClosureBase {
  66   uint _worker_i;
  67 
  68 public:
  69   G1ScanObjsDuringUpdateRSClosure(G1CollectedHeap* g1h,
  70                                   G1ParScanThreadState* pss,
  71                                   uint worker_i) :
  72     G1ScanClosureBase(g1h, pss), _worker_i(worker_i) { }
  73 
  74   template <class T> void do_oop_work(T* p);
  75   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
  76   virtual void do_oop(oop* p) { do_oop_work(p); }
  77 };
  78 
  79 // Used during the Scan RS phase to scan cards from the remembered set during garbage collection.
  80 class G1ScanObjsDuringScanRSClosure : public G1ScanClosureBase {
  81 public:
  82   G1ScanObjsDuringScanRSClosure(G1CollectedHeap* g1h,
  83                                 G1ParScanThreadState* par_scan_state):
  84     G1ScanClosureBase(g1h, par_scan_state) { }
  85 
  86   template <class T> void do_oop_work(T* p);
  87   virtual void do_oop(oop* p)          { do_oop_work(p); }
  88   virtual void do_oop(narrowOop* p)    { do_oop_work(p); }
  89 };
  90 
  91 // This closure is applied to the fields of the objects that have just been copied during evacuation.
  92 class G1ScanEvacuatedObjClosure : public G1ScanClosureBase {


  93 public:
  94   G1ScanEvacuatedObjClosure(G1CollectedHeap* g1h, G1ParScanThreadState* par_scan_state) :
  95     G1ScanClosureBase(g1h, par_scan_state) { }


  96 
  97   template <class T> void do_oop_work(T* p);
  98   virtual void do_oop(oop* p)          { do_oop_work(p); }
  99   virtual void do_oop(narrowOop* p)    { do_oop_work(p); }
 100 
 101   // We need to do reference discovery while processing evacuated objects.
 102   virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERED_AND_DISCOVERY; }
 103 
 104   void set_ref_discoverer(ReferenceDiscoverer* rd) {
 105     set_ref_discoverer_internal(rd);
 106   }
 107 };
 108 
 109 // Add back base class for metadata
 110 class G1ParCopyHelper : public OopClosure {
 111 protected:
 112   G1CollectedHeap* _g1h;
 113   G1ParScanThreadState* _par_scan_state;
 114   uint _worker_id;              // Cache value from par_scan_state.
 115   ClassLoaderData* _scanned_cld;




  26 #define SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
  27 
  28 #include "gc/g1/g1InCSetState.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "oops/markOop.hpp"
  31 
  32 class HeapRegion;
  33 class G1CollectedHeap;
  34 class G1RemSet;
  35 class G1ConcurrentMark;
  36 class DirtyCardToOopClosure;
  37 class G1CMBitMap;
  38 class G1ParScanThreadState;
  39 class G1CMTask;
  40 class ReferenceProcessor;
  41 
  42 class G1ScanClosureBase : public BasicOopIterateClosure {
  43 protected:
  44   G1CollectedHeap* _g1h;
  45   G1ParScanThreadState* _par_scan_state;

  46 
  47   G1ScanClosureBase(G1CollectedHeap* g1h, G1ParScanThreadState* par_scan_state);
  48   ~G1ScanClosureBase() { }
  49 
  50   template <class T>
  51   inline void prefetch_and_push(T* p, oop const obj);
  52 
  53   template <class T>
  54   inline void handle_non_cset_obj_common(InCSetState const state, T* p, oop const obj);
  55 public:
  56   virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
  57 


  58   inline void trim_queue_partially();
  59 };
  60 
  61 // Used during the Update RS phase to refine remaining cards in the DCQ during garbage collection.
  62 class G1ScanObjsDuringUpdateRSClosure : public G1ScanClosureBase {


  63 public:
  64   G1ScanObjsDuringUpdateRSClosure(G1CollectedHeap* g1h,
  65                                   G1ParScanThreadState* pss) :
  66     G1ScanClosureBase(g1h, pss) { }

  67 
  68   template <class T> void do_oop_work(T* p);
  69   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
  70   virtual void do_oop(oop* p)       { do_oop_work(p); }
  71 };
  72 
  73 // Used during the Scan RS phase to scan cards from the remembered set during garbage collection.
  74 class G1ScanObjsDuringScanRSClosure : public G1ScanClosureBase {
  75 public:
  76   G1ScanObjsDuringScanRSClosure(G1CollectedHeap* g1h,
  77                                 G1ParScanThreadState* par_scan_state):
  78     G1ScanClosureBase(g1h, par_scan_state) { }
  79 
  80   template <class T> void do_oop_work(T* p);
  81   virtual void do_oop(oop* p)          { do_oop_work(p); }
  82   virtual void do_oop(narrowOop* p)    { do_oop_work(p); }
  83 };
  84 
  85 // This closure is applied to the fields of the objects that have just been copied during evacuation.
  86 class G1ScanEvacuatedObjClosure : public G1ScanClosureBase {
  87   bool _scanning_in_young;
  88 
  89 public:
  90   G1ScanEvacuatedObjClosure(G1CollectedHeap* g1h, G1ParScanThreadState* par_scan_state) :
  91     G1ScanClosureBase(g1h, par_scan_state), _scanning_in_young(false) { }
  92 
  93   void set_scanning_in_young(bool scanning_in_young) { _scanning_in_young = scanning_in_young; }
  94 
  95   template <class T> void do_oop_work(T* p);
  96   virtual void do_oop(oop* p)          { do_oop_work(p); }
  97   virtual void do_oop(narrowOop* p)    { do_oop_work(p); }
  98 
  99   // We need to do reference discovery while processing evacuated objects.
 100   virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERED_AND_DISCOVERY; }
 101 
 102   void set_ref_discoverer(ReferenceDiscoverer* rd) {
 103     set_ref_discoverer_internal(rd);
 104   }
 105 };
 106 
 107 // Add back base class for metadata
 108 class G1ParCopyHelper : public OopClosure {
 109 protected:
 110   G1CollectedHeap* _g1h;
 111   G1ParScanThreadState* _par_scan_state;
 112   uint _worker_id;              // Cache value from par_scan_state.
 113   ClassLoaderData* _scanned_cld;


< prev index next >