Mercurial > hg > truffle
comparison src/share/vm/memory/iterator.hpp @ 989:148e5441d916
6863023: need non-perm oops in code cache for JSR 292
Summary: Make a special root-list for those few nmethods which might contain non-perm oops.
Reviewed-by: twisti, kvn, never, jmasa, ysr
author | jrose |
---|---|
date | Tue, 15 Sep 2009 21:53:47 -0700 |
parents | 1ee8caae33af |
children | 54b3b351d6f9 |
comparison
equal
deleted
inserted
replaced
987:00977607da34 | 989:148e5441d916 |
---|---|
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; | |
27 class ReferenceProcessor; | 28 class ReferenceProcessor; |
28 | 29 |
29 // Closure provides abortability. | 30 // Closure provides abortability. |
30 | 31 |
31 class Closure : public StackObj { | 32 class Closure : public StackObj { |
55 // In support of post-processing of weak links of KlassKlass objects; | 56 // In support of post-processing of weak links of KlassKlass objects; |
56 // see KlassKlass::oop_oop_iterate(). | 57 // see KlassKlass::oop_oop_iterate(). |
57 virtual const bool should_remember_klasses() const { return false; } | 58 virtual const bool should_remember_klasses() const { return false; } |
58 virtual void remember_klass(Klass* k) { /* do nothing */ } | 59 virtual void remember_klass(Klass* k) { /* do nothing */ } |
59 | 60 |
60 // If "true", invoke on nmethods (when scanning compiled frames). | |
61 virtual const bool do_nmethods() const { return false; } | |
62 | |
63 // The methods below control how object iterations invoking this closure | 61 // The methods below control how object iterations invoking this closure |
64 // should be performed: | 62 // should be performed: |
65 | 63 |
66 // If "true", invoke on header klass field. | 64 // If "true", invoke on header klass field. |
67 bool do_header() { return true; } // Note that this is non-virtual. | 65 bool do_header() { return true; } // Note that this is non-virtual. |
153 | 151 |
154 class CompactibleSpaceClosure : public StackObj { | 152 class CompactibleSpaceClosure : public StackObj { |
155 public: | 153 public: |
156 // Called for each compactible space | 154 // Called for each compactible space |
157 virtual void do_space(CompactibleSpace* s) = 0; | 155 virtual void do_space(CompactibleSpace* s) = 0; |
156 }; | |
157 | |
158 | |
159 // CodeBlobClosure is used for iterating through code blobs | |
160 // in the code cache or on thread stacks | |
161 | |
162 class CodeBlobClosure : public Closure { | |
163 public: | |
164 // Called for each code blob. | |
165 virtual void do_code_blob(CodeBlob* cb) = 0; | |
166 }; | |
167 | |
168 | |
169 class MarkingCodeBlobClosure : public CodeBlobClosure { | |
170 public: | |
171 // Called for each code blob, but at most once per unique blob. | |
172 virtual void do_newly_marked_nmethod(CodeBlob* cb) = 0; | |
173 | |
174 virtual void do_code_blob(CodeBlob* cb); | |
175 // = { if (!nmethod(cb)->test_set_oops_do_mark()) do_newly_marked_nmethod(cb); } | |
176 | |
177 class MarkScope : public StackObj { | |
178 protected: | |
179 bool _active; | |
180 public: | |
181 MarkScope(bool activate = true); | |
182 // = { if (active) nmethod::oops_do_marking_prologue(); } | |
183 ~MarkScope(); | |
184 // = { if (active) nmethod::oops_do_marking_epilogue(); } | |
185 }; | |
186 }; | |
187 | |
188 | |
189 // Applies an oop closure to all ref fields in code blobs | |
190 // iterated over in an object iteration. | |
191 class CodeBlobToOopClosure: public MarkingCodeBlobClosure { | |
192 OopClosure* _cl; | |
193 bool _do_marking; | |
194 public: | |
195 virtual void do_newly_marked_nmethod(CodeBlob* cb); | |
196 // = { cb->oops_do(_cl); } | |
197 virtual void do_code_blob(CodeBlob* cb); | |
198 // = { if (_do_marking) super::do_code_blob(cb); else cb->oops_do(_cl); } | |
199 CodeBlobToOopClosure(OopClosure* cl, bool do_marking) | |
200 : _cl(cl), _do_marking(do_marking) {} | |
158 }; | 201 }; |
159 | 202 |
160 | 203 |
161 | 204 |
162 // MonitorClosure is used for iterating over monitors in the monitors cache | 205 // MonitorClosure is used for iterating over monitors in the monitors cache |