comparison src/share/vm/memory/iterator.hpp @ 1000:a1423fe86a18

Merge
author trims
date Fri, 09 Oct 2009 15:18:52 -0700
parents 89e0543e1737 753cf9794df9
children 4788266644c1
comparison
equal deleted inserted replaced
984:6ddec5389232 1000:a1423fe86a18
22 * 22 *
23 */ 23 */
24 24
25 // The following classes are C++ `closures` for iterating over objects, roots and spaces 25 // The following classes are C++ `closures` for iterating over objects, roots and spaces
26 26
27 class CodeBlob;
28 class nmethod;
27 class ReferenceProcessor; 29 class ReferenceProcessor;
28 class DataLayout; 30 class DataLayout;
29 31
30 // Closure provides abortability. 32 // Closure provides abortability.
31 33
67 // ProfileData (MethodDataOop) objects; see, for example, 69 // ProfileData (MethodDataOop) objects; see, for example,
68 // VirtualCallData::oop_iterate(). 70 // VirtualCallData::oop_iterate().
69 virtual const bool should_remember_mdo() const { return false; } 71 virtual const bool should_remember_mdo() const { return false; }
70 virtual void remember_mdo(DataLayout* v) { /* do nothing */ } 72 virtual void remember_mdo(DataLayout* v) { /* do nothing */ }
71 73
72 // If "true", invoke on nmethods (when scanning compiled frames).
73 virtual const bool do_nmethods() const { return false; }
74
75 // The methods below control how object iterations invoking this closure 74 // The methods below control how object iterations invoking this closure
76 // should be performed: 75 // should be performed:
77 76
78 // If "true", invoke on header klass field. 77 // If "true", invoke on header klass field.
79 bool do_header() { return true; } // Note that this is non-virtual. 78 bool do_header() { return true; } // Note that this is non-virtual.
171 170
172 class CompactibleSpaceClosure : public StackObj { 171 class CompactibleSpaceClosure : public StackObj {
173 public: 172 public:
174 // Called for each compactible space 173 // Called for each compactible space
175 virtual void do_space(CompactibleSpace* s) = 0; 174 virtual void do_space(CompactibleSpace* s) = 0;
175 };
176
177
178 // CodeBlobClosure is used for iterating through code blobs
179 // in the code cache or on thread stacks
180
181 class CodeBlobClosure : public Closure {
182 public:
183 // Called for each code blob.
184 virtual void do_code_blob(CodeBlob* cb) = 0;
185 };
186
187
188 class MarkingCodeBlobClosure : public CodeBlobClosure {
189 public:
190 // Called for each code blob, but at most once per unique blob.
191 virtual void do_newly_marked_nmethod(nmethod* nm) = 0;
192
193 virtual void do_code_blob(CodeBlob* cb);
194 // = { if (!nmethod(cb)->test_set_oops_do_mark()) do_newly_marked_nmethod(cb); }
195
196 class MarkScope : public StackObj {
197 protected:
198 bool _active;
199 public:
200 MarkScope(bool activate = true);
201 // = { if (active) nmethod::oops_do_marking_prologue(); }
202 ~MarkScope();
203 // = { if (active) nmethod::oops_do_marking_epilogue(); }
204 };
205 };
206
207
208 // Applies an oop closure to all ref fields in code blobs
209 // iterated over in an object iteration.
210 class CodeBlobToOopClosure: public MarkingCodeBlobClosure {
211 OopClosure* _cl;
212 bool _do_marking;
213 public:
214 virtual void do_newly_marked_nmethod(nmethod* cb);
215 // = { cb->oops_do(_cl); }
216 virtual void do_code_blob(CodeBlob* cb);
217 // = { if (_do_marking) super::do_code_blob(cb); else cb->oops_do(_cl); }
218 CodeBlobToOopClosure(OopClosure* cl, bool do_marking)
219 : _cl(cl), _do_marking(do_marking) {}
176 }; 220 };
177 221
178 222
179 223
180 // MonitorClosure is used for iterating over monitors in the monitors cache 224 // MonitorClosure is used for iterating over monitors in the monitors cache