comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 20298:83ea089a5c64

8051973: Eager reclaim leaves marks of marked but reclaimed objects on the next bitmap Summary: Eager reclaim also needs to clear marks of eagerly reclaimed regions if they have already been marked during concurrent mark. Reviewed-by: jmasa
author tschatzl
date Thu, 31 Jul 2014 09:23:24 +0200
parents a3953c777565
children c3c9eee55fce
comparison
equal deleted inserted replaced
20297:ca8b8e21e2ca 20298:83ea089a5c64
6576 return false; 6576 return false;
6577 } 6577 }
6578 6578
6579 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 6579 G1CollectedHeap* g1h = G1CollectedHeap::heap();
6580 6580
6581 oop obj = (oop)r->bottom();
6582 CMBitMap* next_bitmap = g1h->concurrent_mark()->nextMarkBitMap();
6583
6581 // The following checks whether the humongous object is live are sufficient. 6584 // The following checks whether the humongous object is live are sufficient.
6582 // The main additional check (in addition to having a reference from the roots 6585 // The main additional check (in addition to having a reference from the roots
6583 // or the young gen) is whether the humongous object has a remembered set entry. 6586 // or the young gen) is whether the humongous object has a remembered set entry.
6584 // 6587 //
6585 // A humongous object cannot be live if there is no remembered set for it 6588 // A humongous object cannot be live if there is no remembered set for it
6612 uint region_idx = r->hrs_index(); 6615 uint region_idx = r->hrs_index();
6613 if (g1h->humongous_is_live(region_idx) || 6616 if (g1h->humongous_is_live(region_idx) ||
6614 g1h->humongous_region_is_always_live(region_idx)) { 6617 g1h->humongous_region_is_always_live(region_idx)) {
6615 6618
6616 if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) { 6619 if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
6617 gclog_or_tty->print_cr("Live humongous %d region %d with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is dead-bitmap %d live-other %d obj array %d", 6620 gclog_or_tty->print_cr("Live humongous %d region %d with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d",
6618 r->isHumongous(), 6621 r->isHumongous(),
6619 region_idx, 6622 region_idx,
6620 r->rem_set()->occupied(), 6623 r->rem_set()->occupied(),
6621 r->rem_set()->strong_code_roots_list_length(), 6624 r->rem_set()->strong_code_roots_list_length(),
6622 g1h->mark_in_progress() && !g1h->g1_policy()->during_initial_mark_pause(), 6625 next_bitmap->isMarked(r->bottom()),
6623 g1h->humongous_is_live(region_idx), 6626 g1h->humongous_is_live(region_idx),
6624 oop(r->bottom())->is_objArray() 6627 obj->is_objArray()
6625 ); 6628 );
6626 } 6629 }
6627 6630
6628 return false; 6631 return false;
6629 } 6632 }
6630 6633
6631 guarantee(!((oop)(r->bottom()))->is_objArray(), 6634 guarantee(!obj->is_objArray(),
6632 err_msg("Eagerly reclaiming object arrays is not supported, but the object "PTR_FORMAT" is.", 6635 err_msg("Eagerly reclaiming object arrays is not supported, but the object "PTR_FORMAT" is.",
6633 r->bottom())); 6636 r->bottom()));
6634 6637
6635 if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) { 6638 if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
6636 gclog_or_tty->print_cr("Reclaim humongous region %d start "PTR_FORMAT" region %d length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is dead-bitmap %d live-other %d obj array %d", 6639 gclog_or_tty->print_cr("Reclaim humongous region %d start "PTR_FORMAT" region %d length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d",
6637 r->isHumongous(), 6640 r->isHumongous(),
6638 r->bottom(), 6641 r->bottom(),
6639 region_idx, 6642 region_idx,
6640 r->region_num(), 6643 r->region_num(),
6641 r->rem_set()->occupied(), 6644 r->rem_set()->occupied(),
6642 r->rem_set()->strong_code_roots_list_length(), 6645 r->rem_set()->strong_code_roots_list_length(),
6643 g1h->mark_in_progress() && !g1h->g1_policy()->during_initial_mark_pause(), 6646 next_bitmap->isMarked(r->bottom()),
6644 g1h->humongous_is_live(region_idx), 6647 g1h->humongous_is_live(region_idx),
6645 oop(r->bottom())->is_objArray() 6648 obj->is_objArray()
6646 ); 6649 );
6650 }
6651 // Need to clear mark bit of the humongous object if already set.
6652 if (next_bitmap->isMarked(r->bottom())) {
6653 next_bitmap->clear(r->bottom());
6647 } 6654 }
6648 _freed_bytes += r->used(); 6655 _freed_bytes += r->used();
6649 r->set_containing_set(NULL); 6656 r->set_containing_set(NULL);
6650 _humongous_regions_removed.increment(1u, r->capacity()); 6657 _humongous_regions_removed.increment(1u, r->capacity());
6651 g1h->free_humongous_region(r, _free_region_list, false); 6658 g1h->free_humongous_region(r, _free_region_list, false);