316 prepare_for_compaction(hr, end);
317 dummy_free_list.remove_all();
318 }
319
320 void G1PrepareCompactClosure::prepare_for_compaction(HeapRegion* hr, HeapWord* end) {
321 // If this is the first live region that we came across which we can compact,
322 // initialize the CompactPoint.
323 if (!is_cp_initialized()) {
324 _cp.space = hr;
325 _cp.threshold = hr->initialize_threshold();
326 }
327 prepare_for_compaction_work(&_cp, hr, end);
328 }
329
330 void G1PrepareCompactClosure::prepare_for_compaction_work(CompactPoint* cp,
331 HeapRegion* hr,
332 HeapWord* end) {
333 hr->prepare_for_compaction(cp);
334 // Also clear the part of the card table that will be unused after
335 // compaction.
336 _mrbs->clear(MemRegion(hr->compaction_top(), end));
337 }
338
339 void G1PrepareCompactClosure::update_sets() {
340 // We'll recalculate total used bytes and recreate the free list
341 // at the end of the GC, so no point in updating those values here.
342 _g1h->remove_from_old_sets(0, _humongous_regions_removed);
343 }
344
345 bool G1PrepareCompactClosure::doHeapRegion(HeapRegion* hr) {
346 if (hr->is_humongous()) {
347 oop obj = oop(hr->humongous_start_region()->bottom());
348 if (hr->is_starts_humongous() && obj->is_gc_marked()) {
349 obj->forward_to(obj);
350 }
351 if (!obj->is_gc_marked()) {
352 free_humongous_region(hr);
353 }
354 } else if (!hr->is_pinned()) {
355 prepare_for_compaction(hr, hr->end());
356 }
|
316 prepare_for_compaction(hr, end);
317 dummy_free_list.remove_all();
318 }
319
320 void G1PrepareCompactClosure::prepare_for_compaction(HeapRegion* hr, HeapWord* end) {
321 // If this is the first live region that we came across which we can compact,
322 // initialize the CompactPoint.
323 if (!is_cp_initialized()) {
324 _cp.space = hr;
325 _cp.threshold = hr->initialize_threshold();
326 }
327 prepare_for_compaction_work(&_cp, hr, end);
328 }
329
330 void G1PrepareCompactClosure::prepare_for_compaction_work(CompactPoint* cp,
331 HeapRegion* hr,
332 HeapWord* end) {
333 hr->prepare_for_compaction(cp);
334 // Also clear the part of the card table that will be unused after
335 // compaction.
336 _ct->clear(MemRegion(hr->compaction_top(), end));
337 }
338
339 void G1PrepareCompactClosure::update_sets() {
340 // We'll recalculate total used bytes and recreate the free list
341 // at the end of the GC, so no point in updating those values here.
342 _g1h->remove_from_old_sets(0, _humongous_regions_removed);
343 }
344
345 bool G1PrepareCompactClosure::doHeapRegion(HeapRegion* hr) {
346 if (hr->is_humongous()) {
347 oop obj = oop(hr->humongous_start_region()->bottom());
348 if (hr->is_starts_humongous() && obj->is_gc_marked()) {
349 obj->forward_to(obj);
350 }
351 if (!obj->is_gc_marked()) {
352 free_humongous_region(hr);
353 }
354 } else if (!hr->is_pinned()) {
355 prepare_for_compaction(hr, hr->end());
356 }
|