121 } |
121 } |
122 |
122 |
123 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, |
123 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, |
124 bool clear_all_softrefs) { |
124 bool clear_all_softrefs) { |
125 // Recursively traverse all live objects and mark them |
125 // Recursively traverse all live objects and mark them |
126 GCTraceTime tm("phase 1", G1Log::fine() && Verbose, true, gc_timer()); |
126 GCTraceTime tm("phase 1", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); |
127 GenMarkSweep::trace(" 1"); |
127 GenMarkSweep::trace(" 1"); |
128 |
128 |
129 SharedHeap* sh = SharedHeap::heap(); |
129 SharedHeap* sh = SharedHeap::heap(); |
130 |
130 |
131 // Need cleared claim bits for the strong roots processing |
131 // Need cleared claim bits for the strong roots processing |
146 const ReferenceProcessorStats& stats = |
146 const ReferenceProcessorStats& stats = |
147 rp->process_discovered_references(&GenMarkSweep::is_alive, |
147 rp->process_discovered_references(&GenMarkSweep::is_alive, |
148 &GenMarkSweep::keep_alive, |
148 &GenMarkSweep::keep_alive, |
149 &GenMarkSweep::follow_stack_closure, |
149 &GenMarkSweep::follow_stack_closure, |
150 NULL, |
150 NULL, |
151 gc_timer()); |
151 gc_timer(), |
|
152 gc_tracer()->gc_id()); |
152 gc_tracer()->report_gc_reference_stats(stats); |
153 gc_tracer()->report_gc_reference_stats(stats); |
153 |
154 |
154 |
155 |
155 // This is the point where the entire marking should have completed. |
156 // This is the point where the entire marking should have completed. |
156 assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed"); |
157 assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed"); |
260 // phase2, phase3 and phase4, but the ValidateMarkSweep live oops |
261 // phase2, phase3 and phase4, but the ValidateMarkSweep live oops |
261 // tracking expects us to do so. See comment under phase4. |
262 // tracking expects us to do so. See comment under phase4. |
262 |
263 |
263 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
264 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
264 |
265 |
265 GCTraceTime tm("phase 2", G1Log::fine() && Verbose, true, gc_timer()); |
266 GCTraceTime tm("phase 2", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); |
266 GenMarkSweep::trace("2"); |
267 GenMarkSweep::trace("2"); |
267 |
268 |
268 // find the first region |
269 // find the first region |
269 HeapRegion* r = g1h->region_at(0); |
270 HeapRegion* r = g1h->region_at(0); |
270 CompactibleSpace* sp = r; |
271 CompactibleSpace* sp = r; |
297 |
298 |
298 void G1MarkSweep::mark_sweep_phase3() { |
299 void G1MarkSweep::mark_sweep_phase3() { |
299 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
300 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
300 |
301 |
301 // Adjust the pointers to reflect the new locations |
302 // Adjust the pointers to reflect the new locations |
302 GCTraceTime tm("phase 3", G1Log::fine() && Verbose, true, gc_timer()); |
303 GCTraceTime tm("phase 3", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); |
303 GenMarkSweep::trace("3"); |
304 GenMarkSweep::trace("3"); |
304 |
305 |
305 SharedHeap* sh = SharedHeap::heap(); |
306 SharedHeap* sh = SharedHeap::heap(); |
306 |
307 |
307 // Need cleared claim bits for the strong roots processing |
308 // Need cleared claim bits for the strong roots processing |
360 // in the same order in phase2, phase3 and phase4. We don't quite do that |
361 // in the same order in phase2, phase3 and phase4. We don't quite do that |
361 // here (code and comment not fixed for perm removal), so we tell the validate code |
362 // here (code and comment not fixed for perm removal), so we tell the validate code |
362 // to use a higher index (saved from phase2) when verifying perm_gen. |
363 // to use a higher index (saved from phase2) when verifying perm_gen. |
363 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
364 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
364 |
365 |
365 GCTraceTime tm("phase 4", G1Log::fine() && Verbose, true, gc_timer()); |
366 GCTraceTime tm("phase 4", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); |
366 GenMarkSweep::trace("4"); |
367 GenMarkSweep::trace("4"); |
367 |
368 |
368 G1SpaceCompactClosure blk; |
369 G1SpaceCompactClosure blk; |
369 g1h->heap_region_iterate(&blk); |
370 g1h->heap_region_iterate(&blk); |
370 |
371 |