277
278 void GenMarkSweep::mark_sweep_phase3(int level) {
279 GenCollectedHeap* gch = GenCollectedHeap::heap();
280
281 // Adjust the pointers to reflect the new locations
282 GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer);
283 trace("3");
284
285 // Need new claim bits for the pointer adjustment tracing.
286 ClassLoaderDataGraph::clear_claimed_marks();
287
288 // Because the closure below is created statically, we cannot
289 // use OopsInGenClosure constructor which takes a generation,
290 // as the Universe has not been created when the static constructors
291 // are run.
292 adjust_pointer_closure.set_orig_generation(gch->get_gen(level));
293
294 gch->gen_process_strong_roots(level,
295 false, // Younger gens are not roots.
296 true, // activate StrongRootsScope
297 SharedHeap::SO_AllClasses | SharedHeap::SO_AllCodeCache,
298 &adjust_pointer_closure,
299 &adjust_pointer_closure,
300 &adjust_klass_closure);
301
302 gch->gen_process_weak_roots(&adjust_pointer_closure);
303
304 adjust_marks();
305 GenAdjustPointersClosure blk;
306 gch->generation_iterate(&blk, true);
307 }
308
309 class GenCompactClosure: public GenCollectedHeap::GenClosure {
310 public:
311 void do_generation(Generation* gen) {
312 gen->compact();
313 }
314 };
315
316 void GenMarkSweep::mark_sweep_phase4() {
317 // All pointers are now adjusted, move objects accordingly
|
277
278 void GenMarkSweep::mark_sweep_phase3(int level) {
279 GenCollectedHeap* gch = GenCollectedHeap::heap();
280
281 // Adjust the pointers to reflect the new locations
282 GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer);
283 trace("3");
284
285 // Need new claim bits for the pointer adjustment tracing.
286 ClassLoaderDataGraph::clear_claimed_marks();
287
288 // Because the closure below is created statically, we cannot
289 // use OopsInGenClosure constructor which takes a generation,
290 // as the Universe has not been created when the static constructors
291 // are run.
292 adjust_pointer_closure.set_orig_generation(gch->get_gen(level));
293
294 gch->gen_process_strong_roots(level,
295 false, // Younger gens are not roots.
296 true, // activate StrongRootsScope
297 SharedHeap::SO_AllClasses | SharedHeap::SO_Strings | SharedHeap::SO_AllCodeCache,
298 &adjust_pointer_closure,
299 &adjust_pointer_closure,
300 &adjust_klass_closure);
301
302 gch->gen_process_weak_roots(&adjust_pointer_closure);
303
304 adjust_marks();
305 GenAdjustPointersClosure blk;
306 gch->generation_iterate(&blk, true);
307 }
308
309 class GenCompactClosure: public GenCollectedHeap::GenClosure {
310 public:
311 void do_generation(Generation* gen) {
312 gen->compact();
313 }
314 };
315
316 void GenMarkSweep::mark_sweep_phase4() {
317 // All pointers are now adjusted, move objects accordingly
|