200 void G1MarkSweep::mark_sweep_phase2() {
201 // Now all live objects are marked, compute the new object addresses.
202
203 // It is not required that we traverse spaces in the same order in
204 // phase2, phase3 and phase4, but the ValidateMarkSweep live oops
205 // tracking expects us to do so. See comment under phase4.
206
207 GCTraceTime(Info, gc, phases) tm("Phase 2: Compute new object addresses", gc_timer());
208
209 prepare_compaction();
210 }
211
212 class G1AdjustPointersClosure: public HeapRegionClosure {
213 public:
214 bool doHeapRegion(HeapRegion* r) {
215 if (r->is_humongous()) {
216 if (r->is_starts_humongous()) {
217 // We must adjust the pointers on the single H object.
218 oop obj = oop(r->bottom());
219 // point all the oops to the new location
220 obj->oop_iterate(&MarkSweep::adjust_pointer_closure);
221 }
222 } else if (!r->is_pinned()) {
223 // This really ought to be "as_CompactibleSpace"...
224 r->adjust_pointers();
225 }
226 return false;
227 }
228 };
229
230 void G1MarkSweep::mark_sweep_phase3() {
231 G1CollectedHeap* g1h = G1CollectedHeap::heap();
232
233 // Adjust the pointers to reflect the new locations
234 GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer());
235
236 // Need cleared claim bits for the roots processing
237 ClassLoaderDataGraph::clear_claimed_marks();
238
239 CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations);
240 {
|
200 void G1MarkSweep::mark_sweep_phase2() {
201 // Now all live objects are marked, compute the new object addresses.
202
203 // It is not required that we traverse spaces in the same order in
204 // phase2, phase3 and phase4, but the ValidateMarkSweep live oops
205 // tracking expects us to do so. See comment under phase4.
206
207 GCTraceTime(Info, gc, phases) tm("Phase 2: Compute new object addresses", gc_timer());
208
209 prepare_compaction();
210 }
211
212 class G1AdjustPointersClosure: public HeapRegionClosure {
213 public:
214 bool doHeapRegion(HeapRegion* r) {
215 if (r->is_humongous()) {
216 if (r->is_starts_humongous()) {
217 // We must adjust the pointers on the single H object.
218 oop obj = oop(r->bottom());
219 // point all the oops to the new location
220 MarkSweep::adjust_pointers(obj);
221 }
222 } else if (!r->is_pinned()) {
223 // This really ought to be "as_CompactibleSpace"...
224 r->adjust_pointers();
225 }
226 return false;
227 }
228 };
229
230 void G1MarkSweep::mark_sweep_phase3() {
231 G1CollectedHeap* g1h = G1CollectedHeap::heap();
232
233 // Adjust the pointers to reflect the new locations
234 GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer());
235
236 // Need cleared claim bits for the roots processing
237 ClassLoaderDataGraph::clear_claimed_marks();
238
239 CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations);
240 {
|