353 } 354 355 void G1PrepareCompactClosure::prepare_for_compaction_work(CompactPoint* cp, 356 HeapRegion* hr, 357 HeapWord* end) { 358 hr->prepare_for_compaction(cp); 359 // Also clear the part of the card table that will be unused after 360 // compaction. 361 _mrbs->clear(MemRegion(hr->compaction_top(), end)); 362 } 363 364 void G1PrepareCompactClosure::update_sets() { 365 // We'll recalculate total used bytes and recreate the free list 366 // at the end of the GC, so no point in updating those values here. 367 HeapRegionSetCount empty_set; 368 _g1h->remove_from_old_sets(empty_set, _humongous_regions_removed); 369 } 370 371 bool G1PrepareCompactClosure::doHeapRegion(HeapRegion* hr) { 372 if (hr->is_humongous()) { 373 oop obj; 374 if (hr->is_starts_humongous()) { 375 obj = oop(hr->bottom()); 376 if (obj->is_gc_marked()) { 377 obj->forward_to(obj); 378 } else { 379 free_humongous_region(hr); 380 } 381 } else { 382 assert(hr->is_continues_humongous(), "Invalid humongous."); 383 obj = oop(hr->humongous_start_region()->bottom()); 384 if (!obj->is_gc_marked()) { 385 free_humongous_region(hr); 386 } 387 } 388 } else if (!hr->is_pinned()) { 389 prepare_for_compaction(hr, hr->end()); 390 } 391 return false; 392 } | 353 } 354 355 void G1PrepareCompactClosure::prepare_for_compaction_work(CompactPoint* cp, 356 HeapRegion* hr, 357 HeapWord* end) { 358 hr->prepare_for_compaction(cp); 359 // Also clear the part of the card table that will be unused after 360 // compaction. 361 _mrbs->clear(MemRegion(hr->compaction_top(), end)); 362 } 363 364 void G1PrepareCompactClosure::update_sets() { 365 // We'll recalculate total used bytes and recreate the free list 366 // at the end of the GC, so no point in updating those values here. 367 HeapRegionSetCount empty_set; 368 _g1h->remove_from_old_sets(empty_set, _humongous_regions_removed); 369 } 370 371 bool G1PrepareCompactClosure::doHeapRegion(HeapRegion* hr) { 372 if (hr->is_humongous()) { 373 oop obj = oop(hr->humongous_start_region()->bottom()); 374 if (hr->is_starts_humongous() && obj->is_gc_marked()) { 375 obj->forward_to(obj); 376 } 377 if (!obj->is_gc_marked()) { 378 free_humongous_region(hr); 379 } 380 } else if (!hr->is_pinned()) { 381 prepare_for_compaction(hr, hr->end()); 382 } 383 return false; 384 } |