8069034: gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java nightly failure

When checking for humongous objects to reclaim, we dirty cards that might belong to freed regions. Fixed by checking the region before dirtying.

Reviewed-by: tschatzl, brutisso
This commit is contained in:
Stefan Johansson 2015-02-03 15:50:06 +01:00
parent 9cc24cf76e
commit dc5a35154d

View File

@ -3525,9 +3525,14 @@ class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
size_t card_index;
while (hrrs.has_next(card_index)) {
jbyte* card_ptr = (jbyte*)bs->byte_for_index(card_index);
if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
*card_ptr = CardTableModRefBS::dirty_card_val();
_dcq.enqueue(card_ptr);
// The remembered set might contain references to already freed
// regions. Filter out such entries to avoid failing card table
// verification.
if (!g1h->heap_region_containing(bs->addr_for(card_ptr))->is_free()) {
if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
*card_ptr = CardTableModRefBS::dirty_card_val();
_dcq.enqueue(card_ptr);
}
}
}
r->rem_set()->clear_locked();