< prev index next >

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

Print this page




  90 class G1ScanEvacuatedObjClosure : public G1ScanClosureBase {
  91 public:
  92   G1ScanEvacuatedObjClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
  93     G1ScanClosureBase(g1, par_scan_state) { }
  94 
  95   template <class T> void do_oop_nv(T* p);
  96   virtual void do_oop(oop* p)          { do_oop_nv(p); }
  97   virtual void do_oop(narrowOop* p)    { do_oop_nv(p); }
  98 
  99   void set_ref_processor(ReferenceProcessor* rp) {
 100     set_ref_processor_internal(rp);
 101   }
 102 };
 103 
 104 // Add back base class for metadata
 105 class G1ParCopyHelper : public OopClosure {
 106 protected:
 107   G1CollectedHeap* _g1;
 108   G1ParScanThreadState* _par_scan_state;
 109   uint _worker_id;              // Cache value from par_scan_state.
 110   Klass* _scanned_klass;
 111   G1ConcurrentMark* _cm;
 112 
 113   // Mark the object if it's not already marked. This is used to mark
 114   // objects pointed to by roots that are guaranteed not to move
 115   // during the GC (i.e., non-CSet objects). It is MT-safe.
 116   inline void mark_object(oop obj);
 117 
 118   // Mark the object if it's not already marked. This is used to mark
 119   // objects pointed to by roots that have been forwarded during a
 120   // GC. It is MT-safe.
 121   inline void mark_forwarded_object(oop from_obj, oop to_obj);
 122 
 123   G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state);
 124   ~G1ParCopyHelper() { }
 125 
 126  public:
 127   void set_scanned_klass(Klass* k) { _scanned_klass = k; }
 128   template <class T> inline void do_klass_barrier(T* p, oop new_obj);

 129 };
 130 
 131 enum G1Barrier {
 132   G1BarrierNone,
 133   G1BarrierKlass
 134 };
 135 
 136 enum G1Mark {
 137   G1MarkNone,
 138   G1MarkFromRoot,
 139   G1MarkPromotedFromRoot
 140 };
 141 
 142 template <G1Barrier barrier, G1Mark do_mark_object, bool use_ext>
 143 class G1ParCopyClosure : public G1ParCopyHelper {
 144 public:
 145   G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
 146       G1ParCopyHelper(g1, par_scan_state) { }
 147 
 148   template <class T> void do_oop_work(T* p);
 149   virtual void do_oop(oop* p)       { do_oop_work(p); }
 150   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
 151 };
 152 
 153 class G1KlassScanClosure : public KlassClosure {
 154  G1ParCopyHelper* _closure;
 155  bool             _process_only_dirty;

 156  int              _count;
 157  public:
 158   G1KlassScanClosure(G1ParCopyHelper* closure, bool process_only_dirty)
 159       : _process_only_dirty(process_only_dirty), _closure(closure), _count(0) {}
 160   void do_klass(Klass* klass);

 161 };
 162 
 163 // Closure for iterating over object fields during concurrent marking
 164 class G1CMOopClosure : public MetadataAwareOopClosure {
 165 protected:
 166   G1ConcurrentMark*  _cm;
 167 private:
 168   G1CollectedHeap*   _g1h;
 169   G1CMTask*          _task;
 170 public:
 171   G1CMOopClosure(G1CollectedHeap* g1h, G1ConcurrentMark* cm, G1CMTask* task);
 172   template <class T> void do_oop_nv(T* p);
 173   virtual void do_oop(      oop* p) { do_oop_nv(p); }
 174   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
 175 };
 176 
 177 // Closure to scan the root regions during concurrent marking
 178 class G1RootRegionScanClosure : public MetadataAwareOopClosure {
 179 private:
 180   G1CollectedHeap* _g1h;




  90 class G1ScanEvacuatedObjClosure : public G1ScanClosureBase {
  91 public:
  92   G1ScanEvacuatedObjClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
  93     G1ScanClosureBase(g1, par_scan_state) { }
  94 
  95   template <class T> void do_oop_nv(T* p);
  96   virtual void do_oop(oop* p)          { do_oop_nv(p); }
  97   virtual void do_oop(narrowOop* p)    { do_oop_nv(p); }
  98 
  99   void set_ref_processor(ReferenceProcessor* rp) {
 100     set_ref_processor_internal(rp);
 101   }
 102 };
 103 
 104 // Add back base class for metadata
 105 class G1ParCopyHelper : public OopClosure {
 106 protected:
 107   G1CollectedHeap* _g1;
 108   G1ParScanThreadState* _par_scan_state;
 109   uint _worker_id;              // Cache value from par_scan_state.
 110   ClassLoaderData* _scanned_cld;
 111   G1ConcurrentMark* _cm;
 112 
 113   // Mark the object if it's not already marked. This is used to mark
 114   // objects pointed to by roots that are guaranteed not to move
 115   // during the GC (i.e., non-CSet objects). It is MT-safe.
 116   inline void mark_object(oop obj);
 117 
 118   // Mark the object if it's not already marked. This is used to mark
 119   // objects pointed to by roots that have been forwarded during a
 120   // GC. It is MT-safe.
 121   inline void mark_forwarded_object(oop from_obj, oop to_obj);
 122 
 123   G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state);
 124   ~G1ParCopyHelper() { }
 125 
 126  public:
 127   void set_scanned_cld(ClassLoaderData* cld) { _scanned_cld = cld; }
 128   inline void do_cld_barrier(oop new_obj);
 129   G1CollectedHeap* g1() { return _g1; }
 130 };
 131 
 132 enum G1Barrier {
 133   G1BarrierNone,
 134   G1BarrierCLD
 135 };
 136 
 137 enum G1Mark {
 138   G1MarkNone,
 139   G1MarkFromRoot,
 140   G1MarkPromotedFromRoot
 141 };
 142 
 143 template <G1Barrier barrier, G1Mark do_mark_object, bool use_ext>
 144 class G1ParCopyClosure : public G1ParCopyHelper {
 145 public:
 146   G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
 147       G1ParCopyHelper(g1, par_scan_state) { }
 148 
 149   template <class T> void do_oop_work(T* p);
 150   virtual void do_oop(oop* p)       { do_oop_work(p); }
 151   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
 152 };
 153 
 154 class G1CLDScanClosure : public CLDClosure {
 155  G1ParCopyHelper* _closure;
 156  bool             _process_only_dirty;
 157  bool             _must_claim;
 158  int              _count;
 159  public:
 160   G1CLDScanClosure(G1ParCopyHelper* closure, 
 161                    bool process_only_dirty, bool must_claim)
 162       : _process_only_dirty(process_only_dirty), _must_claim(must_claim), _closure(closure), _count(0) {}
 163   void do_cld(ClassLoaderData* cld);
 164 };
 165 
 166 // Closure for iterating over object fields during concurrent marking
 167 class G1CMOopClosure : public MetadataAwareOopClosure {
 168 protected:
 169   G1ConcurrentMark*  _cm;
 170 private:
 171   G1CollectedHeap*   _g1h;
 172   G1CMTask*          _task;
 173 public:
 174   G1CMOopClosure(G1CollectedHeap* g1h, G1ConcurrentMark* cm, G1CMTask* task);
 175   template <class T> void do_oop_nv(T* p);
 176   virtual void do_oop(      oop* p) { do_oop_nv(p); }
 177   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
 178 };
 179 
 180 // Closure to scan the root regions during concurrent marking
 181 class G1RootRegionScanClosure : public MetadataAwareOopClosure {
 182 private:
 183   G1CollectedHeap* _g1h;


< prev index next >