comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 20307:04d77ac27223

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 755930f931e3
children a08bb8e45ba1
comparison
equal deleted inserted replaced
20306:e02e18f40eae 20307:04d77ac27223
6475 return false; 6475 return false;
6476 } 6476 }
6477 6477
6478 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 6478 G1CollectedHeap* g1h = G1CollectedHeap::heap();
6479 6479
6480 oop obj = (oop)r->bottom();
6481 CMBitMap* next_bitmap = g1h->concurrent_mark()->nextMarkBitMap();
6482
6480 // The following checks whether the humongous object is live are sufficient. 6483 // The following checks whether the humongous object is live are sufficient.
6481 // The main additional check (in addition to having a reference from the roots 6484 // The main additional check (in addition to having a reference from the roots
6482 // or the young gen) is whether the humongous object has a remembered set entry. 6485 // or the young gen) is whether the humongous object has a remembered set entry.
6483 // 6486 //
6484 // A humongous object cannot be live if there is no remembered set for it 6487 // A humongous object cannot be live if there is no remembered set for it
6511 uint region_idx = r->hrs_index(); 6514 uint region_idx = r->hrs_index();
6512 if (g1h->humongous_is_live(region_idx) || 6515 if (g1h->humongous_is_live(region_idx) ||
6513 g1h->humongous_region_is_always_live(region_idx)) { 6516 g1h->humongous_region_is_always_live(region_idx)) {
6514 6517
6515 if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) { 6518 if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
6516 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", 6519 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",
6517 r->isHumongous(), 6520 r->isHumongous(),
6518 region_idx, 6521 region_idx,
6519 r->rem_set()->occupied(), 6522 r->rem_set()->occupied(),
6520 r->rem_set()->strong_code_roots_list_length(), 6523 r->rem_set()->strong_code_roots_list_length(),
6521 g1h->mark_in_progress() && !g1h->g1_policy()->during_initial_mark_pause(), 6524 next_bitmap->isMarked(r->bottom()),
6522 g1h->humongous_is_live(region_idx), 6525 g1h->humongous_is_live(region_idx),
6523 oop(r->bottom())->is_objArray() 6526 obj->is_objArray()
6524 ); 6527 );
6525 } 6528 }
6526 6529
6527 return false; 6530 return false;
6528 } 6531 }
6529 6532
6530 guarantee(!((oop)(r->bottom()))->is_objArray(), 6533 guarantee(!obj->is_objArray(),
6531 err_msg("Eagerly reclaiming object arrays is not supported, but the object "PTR_FORMAT" is.", 6534 err_msg("Eagerly reclaiming object arrays is not supported, but the object "PTR_FORMAT" is.",
6532 r->bottom())); 6535 r->bottom()));
6533 6536
6534 if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) { 6537 if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
6535 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", 6538 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",
6536 r->isHumongous(), 6539 r->isHumongous(),
6537 r->bottom(), 6540 r->bottom(),
6538 region_idx, 6541 region_idx,
6539 r->region_num(), 6542 r->region_num(),
6540 r->rem_set()->occupied(), 6543 r->rem_set()->occupied(),
6541 r->rem_set()->strong_code_roots_list_length(), 6544 r->rem_set()->strong_code_roots_list_length(),
6542 g1h->mark_in_progress() && !g1h->g1_policy()->during_initial_mark_pause(), 6545 next_bitmap->isMarked(r->bottom()),
6543 g1h->humongous_is_live(region_idx), 6546 g1h->humongous_is_live(region_idx),
6544 oop(r->bottom())->is_objArray() 6547 obj->is_objArray()
6545 ); 6548 );
6549 }
6550 // Need to clear mark bit of the humongous object if already set.
6551 if (next_bitmap->isMarked(r->bottom())) {
6552 next_bitmap->clear(r->bottom());
6546 } 6553 }
6547 _freed_bytes += r->used(); 6554 _freed_bytes += r->used();
6548 r->set_containing_set(NULL); 6555 r->set_containing_set(NULL);
6549 _humongous_regions_removed.increment(1u, r->capacity()); 6556 _humongous_regions_removed.increment(1u, r->capacity());
6550 g1h->free_humongous_region(r, _free_region_list, false); 6557 g1h->free_humongous_region(r, _free_region_list, false);