< prev index next >

src/hotspot/share/gc/shared/genOopClosures.hpp

Print this page

 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_SHARED_GENOOPCLOSURES_HPP
 26 #define SHARE_GC_SHARED_GENOOPCLOSURES_HPP
 27 
 28 #include "memory/iterator.hpp"
 29 #include "oops/oop.hpp"
 30 
 31 class Generation;
 32 class CardTableRS;
 33 class CardTableBarrierSet;
 34 class DefNewGeneration;
 35 class KlassRemSet;


 36 
 37 #if INCLUDE_SERIALGC
 38 
 39 // Super closure class for scanning DefNewGeneration.
 40 //
 41 // - Derived: The derived type provides necessary barrier
 42 //            after an oop has been updated.
 43 template <typename Derived>
 44 class FastScanClosure : public BasicOopIterateClosure {
 45 private:
 46   DefNewGeneration* _young_gen;
 47   HeapWord*         _young_gen_end;
 48 
 49   template <typename T>
 50   void do_oop_work(T* p);
 51 
 52 protected:
 53   FastScanClosure(DefNewGeneration* g);
 54 
 55 public:

 99   void do_cld(ClassLoaderData* cld);
100 };
101 
102 #endif // INCLUDE_SERIALGC
103 
104 class FilteringClosure: public OopIterateClosure {
105  private:
106   HeapWord*   _boundary;
107   OopIterateClosure* _cl;
108  protected:
109   template <class T> inline void do_oop_work(T* p);
110  public:
111   FilteringClosure(HeapWord* boundary, OopIterateClosure* cl) :
112     OopIterateClosure(cl->ref_discoverer()), _boundary(boundary),
113     _cl(cl) {}
114   virtual void do_oop(oop* p);
115   virtual void do_oop(narrowOop* p);
116   virtual bool do_metadata()            { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; }
117   virtual void do_klass(Klass*)         { ShouldNotReachHere(); }
118   virtual void do_cld(ClassLoaderData*) { ShouldNotReachHere(); }


119 };
120 
121 #if INCLUDE_SERIALGC
122 
123 // Closure for scanning DefNewGeneration's weak references.
124 //  -- weak references are processed all at once,
125 //  with no notion of which generation they were in.
126 class ScanWeakRefClosure: public OopClosure {
127  protected:
128   DefNewGeneration* _g;
129   HeapWord*         _boundary;
130   template <class T> inline void do_oop_work(T* p);
131  public:
132   ScanWeakRefClosure(DefNewGeneration* g);
133   virtual void do_oop(oop* p);
134   virtual void do_oop(narrowOop* p);
135 };
136 
137 #endif // INCLUDE_SERIALGC
138 

 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_SHARED_GENOOPCLOSURES_HPP
 26 #define SHARE_GC_SHARED_GENOOPCLOSURES_HPP
 27 
 28 #include "memory/iterator.hpp"
 29 #include "oops/oop.hpp"
 30 
 31 class Generation;
 32 class CardTableRS;
 33 class CardTableBarrierSet;
 34 class DefNewGeneration;
 35 class KlassRemSet;
 36 class Method;
 37 class nmethod;
 38 
 39 #if INCLUDE_SERIALGC
 40 
 41 // Super closure class for scanning DefNewGeneration.
 42 //
 43 // - Derived: The derived type provides necessary barrier
 44 //            after an oop has been updated.
 45 template <typename Derived>
 46 class FastScanClosure : public BasicOopIterateClosure {
 47 private:
 48   DefNewGeneration* _young_gen;
 49   HeapWord*         _young_gen_end;
 50 
 51   template <typename T>
 52   void do_oop_work(T* p);
 53 
 54 protected:
 55   FastScanClosure(DefNewGeneration* g);
 56 
 57 public:

101   void do_cld(ClassLoaderData* cld);
102 };
103 
104 #endif // INCLUDE_SERIALGC
105 
106 class FilteringClosure: public OopIterateClosure {
107  private:
108   HeapWord*   _boundary;
109   OopIterateClosure* _cl;
110  protected:
111   template <class T> inline void do_oop_work(T* p);
112  public:
113   FilteringClosure(HeapWord* boundary, OopIterateClosure* cl) :
114     OopIterateClosure(cl->ref_discoverer()), _boundary(boundary),
115     _cl(cl) {}
116   virtual void do_oop(oop* p);
117   virtual void do_oop(narrowOop* p);
118   virtual bool do_metadata()            { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; }
119   virtual void do_klass(Klass*)         { ShouldNotReachHere(); }
120   virtual void do_cld(ClassLoaderData*) { ShouldNotReachHere(); }
121   virtual void do_method(Method*)       { ShouldNotReachHere(); }
122   virtual void do_nmethod(nmethod*)     { ShouldNotReachHere(); }
123 };
124 
125 #if INCLUDE_SERIALGC
126 
127 // Closure for scanning DefNewGeneration's weak references.
128 //  -- weak references are processed all at once,
129 //  with no notion of which generation they were in.
130 class ScanWeakRefClosure: public OopClosure {
131  protected:
132   DefNewGeneration* _g;
133   HeapWord*         _boundary;
134   template <class T> inline void do_oop_work(T* p);
135  public:
136   ScanWeakRefClosure(DefNewGeneration* g);
137   virtual void do_oop(oop* p);
138   virtual void do_oop(narrowOop* p);
139 };
140 
141 #endif // INCLUDE_SERIALGC
142 
< prev index next >