Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1OopClosures.hpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | a2f7274eb6ef |
children | 190899198332 |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
116 template <class T> void do_oop_nv(T* p); | 116 template <class T> void do_oop_nv(T* p); |
117 virtual void do_oop(oop* p) { do_oop_nv(p); } | 117 virtual void do_oop(oop* p) { do_oop_nv(p); } |
118 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } | 118 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
119 }; | 119 }; |
120 | 120 |
121 // Add back base class for metadata | |
122 class G1ParCopyHelper : public G1ParClosureSuper { | |
123 Klass* _scanned_klass; | |
124 | |
125 public: | |
126 G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : | |
127 _scanned_klass(NULL), | |
128 G1ParClosureSuper(g1, par_scan_state) {} | |
129 | |
130 void set_scanned_klass(Klass* k) { _scanned_klass = k; } | |
131 template <class T> void do_klass_barrier(T* p, oop new_obj); | |
132 }; | |
133 | |
121 template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object> | 134 template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object> |
122 class G1ParCopyClosure : public G1ParClosureSuper { | 135 class G1ParCopyClosure : public G1ParCopyHelper { |
123 G1ParScanClosure _scanner; | 136 G1ParScanClosure _scanner; |
124 template <class T> void do_oop_work(T* p); | 137 template <class T> void do_oop_work(T* p); |
125 | 138 |
126 protected: | 139 protected: |
127 // Mark the object if it's not already marked. This is used to mark | 140 // Mark the object if it's not already marked. This is used to mark |
138 | 151 |
139 public: | 152 public: |
140 G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, | 153 G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, |
141 ReferenceProcessor* rp) : | 154 ReferenceProcessor* rp) : |
142 _scanner(g1, par_scan_state, rp), | 155 _scanner(g1, par_scan_state, rp), |
143 G1ParClosureSuper(g1, par_scan_state) { | 156 G1ParCopyHelper(g1, par_scan_state) { |
144 assert(_ref_processor == NULL, "sanity"); | 157 assert(_ref_processor == NULL, "sanity"); |
145 } | 158 } |
146 | 159 |
147 G1ParScanClosure* scanner() { return &_scanner; } | 160 G1ParScanClosure* scanner() { return &_scanner; } |
148 | 161 |
152 virtual void do_oop(oop* p) { do_oop_nv(p); } | 165 virtual void do_oop(oop* p) { do_oop_nv(p); } |
153 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } | 166 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
154 }; | 167 }; |
155 | 168 |
156 typedef G1ParCopyClosure<false, G1BarrierNone, false> G1ParScanExtRootClosure; | 169 typedef G1ParCopyClosure<false, G1BarrierNone, false> G1ParScanExtRootClosure; |
157 typedef G1ParCopyClosure<true, G1BarrierNone, false> G1ParScanPermClosure; | 170 typedef G1ParCopyClosure<false, G1BarrierKlass, false> G1ParScanMetadataClosure; |
171 | |
158 | 172 |
159 typedef G1ParCopyClosure<false, G1BarrierNone, true> G1ParScanAndMarkExtRootClosure; | 173 typedef G1ParCopyClosure<false, G1BarrierNone, true> G1ParScanAndMarkExtRootClosure; |
160 typedef G1ParCopyClosure<true, G1BarrierNone, true> G1ParScanAndMarkPermClosure; | 174 typedef G1ParCopyClosure<true, G1BarrierNone, true> G1ParScanAndMarkClosure; |
175 typedef G1ParCopyClosure<false, G1BarrierKlass, true> G1ParScanAndMarkMetadataClosure; | |
161 | 176 |
162 // The following closure types are no longer used but are retained | 177 // The following closure types are no longer used but are retained |
163 // for historical reasons: | 178 // for historical reasons: |
164 // typedef G1ParCopyClosure<false, G1BarrierRS, false> G1ParScanHeapRSClosure; | 179 // typedef G1ParCopyClosure<false, G1BarrierRS, false> G1ParScanHeapRSClosure; |
165 // typedef G1ParCopyClosure<false, G1BarrierRS, true> G1ParScanAndMarkHeapRSClosure; | 180 // typedef G1ParCopyClosure<false, G1BarrierRS, true> G1ParScanAndMarkHeapRSClosure; |
174 // (since that closure no longer assumes that the references it | 189 // (since that closure no longer assumes that the references it |
175 // handles point into the collection set). | 190 // handles point into the collection set). |
176 | 191 |
177 typedef G1ParCopyClosure<false, G1BarrierEvac, false> G1ParScanHeapEvacFailureClosure; | 192 typedef G1ParCopyClosure<false, G1BarrierEvac, false> G1ParScanHeapEvacFailureClosure; |
178 | 193 |
179 class FilterIntoCSClosure: public OopClosure { | 194 class FilterIntoCSClosure: public ExtendedOopClosure { |
180 G1CollectedHeap* _g1; | 195 G1CollectedHeap* _g1; |
181 OopClosure* _oc; | 196 OopClosure* _oc; |
182 DirtyCardToOopClosure* _dcto_cl; | 197 DirtyCardToOopClosure* _dcto_cl; |
183 public: | 198 public: |
184 FilterIntoCSClosure( DirtyCardToOopClosure* dcto_cl, | 199 FilterIntoCSClosure( DirtyCardToOopClosure* dcto_cl, |
188 | 203 |
189 template <class T> void do_oop_nv(T* p); | 204 template <class T> void do_oop_nv(T* p); |
190 virtual void do_oop(oop* p) { do_oop_nv(p); } | 205 virtual void do_oop(oop* p) { do_oop_nv(p); } |
191 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } | 206 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
192 bool apply_to_weak_ref_discovered_field() { return true; } | 207 bool apply_to_weak_ref_discovered_field() { return true; } |
193 bool do_header() { return false; } | 208 }; |
194 }; | 209 |
195 | 210 class FilterOutOfRegionClosure: public ExtendedOopClosure { |
196 class FilterOutOfRegionClosure: public OopClosure { | |
197 HeapWord* _r_bottom; | 211 HeapWord* _r_bottom; |
198 HeapWord* _r_end; | 212 HeapWord* _r_end; |
199 OopClosure* _oc; | 213 OopClosure* _oc; |
200 public: | 214 public: |
201 FilterOutOfRegionClosure(HeapRegion* r, OopClosure* oc); | 215 FilterOutOfRegionClosure(HeapRegion* r, OopClosure* oc); |
202 template <class T> void do_oop_nv(T* p); | 216 template <class T> void do_oop_nv(T* p); |
203 virtual void do_oop(oop* p) { do_oop_nv(p); } | 217 virtual void do_oop(oop* p) { do_oop_nv(p); } |
204 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } | 218 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
205 bool apply_to_weak_ref_discovered_field() { return true; } | 219 bool apply_to_weak_ref_discovered_field() { return true; } |
206 bool do_header() { return false; } | |
207 }; | 220 }; |
208 | 221 |
209 // Closure for iterating over object fields during concurrent marking | 222 // Closure for iterating over object fields during concurrent marking |
210 class G1CMOopClosure : public OopClosure { | 223 class G1CMOopClosure : public ExtendedOopClosure { |
211 private: | 224 private: |
212 G1CollectedHeap* _g1h; | 225 G1CollectedHeap* _g1h; |
213 ConcurrentMark* _cm; | 226 ConcurrentMark* _cm; |
214 CMTask* _task; | 227 CMTask* _task; |
215 public: | 228 public: |
218 virtual void do_oop( oop* p) { do_oop_nv(p); } | 231 virtual void do_oop( oop* p) { do_oop_nv(p); } |
219 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } | 232 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
220 }; | 233 }; |
221 | 234 |
222 // Closure to scan the root regions during concurrent marking | 235 // Closure to scan the root regions during concurrent marking |
223 class G1RootRegionScanClosure : public OopClosure { | 236 class G1RootRegionScanClosure : public ExtendedOopClosure { |
224 private: | 237 private: |
225 G1CollectedHeap* _g1h; | 238 G1CollectedHeap* _g1h; |
226 ConcurrentMark* _cm; | 239 ConcurrentMark* _cm; |
227 uint _worker_id; | 240 uint _worker_id; |
228 public: | 241 public: |
237 // Closure that applies the given two closures in sequence. | 250 // Closure that applies the given two closures in sequence. |
238 // Used by the RSet refinement code (when updating RSets | 251 // Used by the RSet refinement code (when updating RSets |
239 // during an evacuation pause) to record cards containing | 252 // during an evacuation pause) to record cards containing |
240 // pointers into the collection set. | 253 // pointers into the collection set. |
241 | 254 |
242 class G1Mux2Closure : public OopClosure { | 255 class G1Mux2Closure : public ExtendedOopClosure { |
243 OopClosure* _c1; | 256 OopClosure* _c1; |
244 OopClosure* _c2; | 257 OopClosure* _c2; |
245 public: | 258 public: |
246 G1Mux2Closure(OopClosure *c1, OopClosure *c2); | 259 G1Mux2Closure(OopClosure *c1, OopClosure *c2); |
247 template <class T> void do_oop_nv(T* p); | 260 template <class T> void do_oop_nv(T* p); |
250 }; | 263 }; |
251 | 264 |
252 // A closure that returns true if it is actually applied | 265 // A closure that returns true if it is actually applied |
253 // to a reference | 266 // to a reference |
254 | 267 |
255 class G1TriggerClosure : public OopClosure { | 268 class G1TriggerClosure : public ExtendedOopClosure { |
256 bool _triggered; | 269 bool _triggered; |
257 public: | 270 public: |
258 G1TriggerClosure(); | 271 G1TriggerClosure(); |
259 bool triggered() const { return _triggered; } | 272 bool triggered() const { return _triggered; } |
260 template <class T> void do_oop_nv(T* p); | 273 template <class T> void do_oop_nv(T* p); |
263 }; | 276 }; |
264 | 277 |
265 // A closure which uses a triggering closure to determine | 278 // A closure which uses a triggering closure to determine |
266 // whether to apply an oop closure. | 279 // whether to apply an oop closure. |
267 | 280 |
268 class G1InvokeIfNotTriggeredClosure: public OopClosure { | 281 class G1InvokeIfNotTriggeredClosure: public ExtendedOopClosure { |
269 G1TriggerClosure* _trigger_cl; | 282 G1TriggerClosure* _trigger_cl; |
270 OopClosure* _oop_cl; | 283 OopClosure* _oop_cl; |
271 public: | 284 public: |
272 G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t, OopClosure* oc); | 285 G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t, OopClosure* oc); |
273 template <class T> void do_oop_nv(T* p); | 286 template <class T> void do_oop_nv(T* p); |
274 virtual void do_oop(oop* p) { do_oop_nv(p); } | 287 virtual void do_oop(oop* p) { do_oop_nv(p); } |
275 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } | 288 virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
276 }; | 289 }; |
277 | 290 |
278 class G1UpdateRSOrPushRefOopClosure: public OopClosure { | 291 class G1UpdateRSOrPushRefOopClosure: public ExtendedOopClosure { |
279 G1CollectedHeap* _g1; | 292 G1CollectedHeap* _g1; |
280 G1RemSet* _g1_rem_set; | 293 G1RemSet* _g1_rem_set; |
281 HeapRegion* _from; | 294 HeapRegion* _from; |
282 OopsInHeapRegionClosure* _push_ref_cl; | 295 OopsInHeapRegionClosure* _push_ref_cl; |
283 bool _record_refs_into_cset; | 296 bool _record_refs_into_cset; |