< prev index next >

src/hotspot/share/memory/iterator.hpp

Print this page

 37 class ClassLoaderData;
 38 class Symbol;
 39 class Metadata;
 40 class Thread;
 41 
 42 // The following classes are C++ `closures` for iterating over objects, roots and spaces
 43 
 44 class Closure : public StackObj { };
 45 
 46 // Thread iterator
 47 class ThreadClosure {
 48  public:
 49   virtual void do_thread(Thread* thread) = 0;
 50 };
 51 
 52 // OopClosure is used for iterating through references to Java objects.
 53 class OopClosure : public Closure {
 54  public:
 55   virtual void do_oop(oop* o) = 0;
 56   virtual void do_oop(narrowOop* o) = 0;


 57 };
 58 
 59 class DoNothingClosure : public OopClosure {
 60  public:
 61   virtual void do_oop(oop* p)       {}
 62   virtual void do_oop(narrowOop* p) {}
 63 };
 64 extern DoNothingClosure do_nothing_cl;
 65 
 66 // OopIterateClosure adds extra code to be run during oop iterations.
 67 // This is needed by the GC and is extracted to a separate type to not
 68 // pollute the OopClosure interface.
 69 class OopIterateClosure : public OopClosure {
 70  private:
 71   ReferenceDiscoverer* _ref_discoverer;
 72 
 73  protected:
 74   OopIterateClosure(ReferenceDiscoverer* rd) : _ref_discoverer(rd) { }
 75   OopIterateClosure() : _ref_discoverer(nullptr) { }
 76   ~OopIterateClosure() { }

119   virtual void do_klass(Klass* k) { ShouldNotReachHere(); }
120   virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
121   virtual void do_method(Method* m) { ShouldNotReachHere(); }
122   virtual void do_nmethod(nmethod* nm) { ShouldNotReachHere(); }
123 };
124 
125 // Interface for applying an OopClosure to a set of oops.
126 class OopIterator {
127 public:
128   virtual void oops_do(OopClosure* cl) = 0;
129 };
130 
131 enum class derived_base : intptr_t;
132 enum class derived_pointer : intptr_t;
133 class DerivedOopClosure : public Closure {
134  public:
135   enum { SkipNull = true };
136   virtual void do_derived_oop(derived_base* base, derived_pointer* derived) = 0;
137 };
138 





139 class KlassClosure : public Closure {
140  public:
141   virtual void do_klass(Klass* k) = 0;
142 };
143 
144 class CLDClosure : public Closure {
145  public:
146   virtual void do_cld(ClassLoaderData* cld) = 0;
147 };
148 
149 class MetadataClosure : public Closure {
150  public:
151   virtual void do_metadata(Metadata* md) = 0;
152 };
153 
154 
155 class CLDToOopClosure : public CLDClosure {
156   OopClosure*       _oop_closure;
157   int               _cld_claim;
158 

 37 class ClassLoaderData;
 38 class Symbol;
 39 class Metadata;
 40 class Thread;
 41 
 42 // The following classes are C++ `closures` for iterating over objects, roots and spaces
 43 
 44 class Closure : public StackObj { };
 45 
 46 // Thread iterator
 47 class ThreadClosure {
 48  public:
 49   virtual void do_thread(Thread* thread) = 0;
 50 };
 51 
 52 // OopClosure is used for iterating through references to Java objects.
 53 class OopClosure : public Closure {
 54  public:
 55   virtual void do_oop(oop* o) = 0;
 56   virtual void do_oop(narrowOop* o) = 0;
 57   virtual void do_oop_no_buffering(oop* o) { do_oop(o); }
 58   virtual void do_oop_no_buffering(narrowOop* o) { do_oop(o); }
 59 };
 60 
 61 class DoNothingClosure : public OopClosure {
 62  public:
 63   virtual void do_oop(oop* p)       {}
 64   virtual void do_oop(narrowOop* p) {}
 65 };
 66 extern DoNothingClosure do_nothing_cl;
 67 
 68 // OopIterateClosure adds extra code to be run during oop iterations.
 69 // This is needed by the GC and is extracted to a separate type to not
 70 // pollute the OopClosure interface.
 71 class OopIterateClosure : public OopClosure {
 72  private:
 73   ReferenceDiscoverer* _ref_discoverer;
 74 
 75  protected:
 76   OopIterateClosure(ReferenceDiscoverer* rd) : _ref_discoverer(rd) { }
 77   OopIterateClosure() : _ref_discoverer(nullptr) { }
 78   ~OopIterateClosure() { }

121   virtual void do_klass(Klass* k) { ShouldNotReachHere(); }
122   virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
123   virtual void do_method(Method* m) { ShouldNotReachHere(); }
124   virtual void do_nmethod(nmethod* nm) { ShouldNotReachHere(); }
125 };
126 
127 // Interface for applying an OopClosure to a set of oops.
128 class OopIterator {
129 public:
130   virtual void oops_do(OopClosure* cl) = 0;
131 };
132 
133 enum class derived_base : intptr_t;
134 enum class derived_pointer : intptr_t;
135 class DerivedOopClosure : public Closure {
136  public:
137   enum { SkipNull = true };
138   virtual void do_derived_oop(derived_base* base, derived_pointer* derived) = 0;
139 };
140 
141 class BufferedValueClosure : public Closure {
142 public:
143   virtual void do_buffered_value(oop* p) = 0;
144 };
145 
146 class KlassClosure : public Closure {
147  public:
148   virtual void do_klass(Klass* k) = 0;
149 };
150 
151 class CLDClosure : public Closure {
152  public:
153   virtual void do_cld(ClassLoaderData* cld) = 0;
154 };
155 
156 class MetadataClosure : public Closure {
157  public:
158   virtual void do_metadata(Metadata* md) = 0;
159 };
160 
161 
162 class CLDToOopClosure : public CLDClosure {
163   OopClosure*       _oop_closure;
164   int               _cld_claim;
165 
< prev index next >