# HG changeset patch # User sjohanss # Date 1422883382 -3600 # Mon Feb 02 14:23:02 2015 +0100 # Node ID 5f967ff3dc8e9f0a5cd9dc00dabe01cbdcfec2d6 # Parent 6c671819cfd1b64a3ed16dcd072c5afb73416666 8069034: gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java nightly failure Summary: 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: diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3525,9 +3525,14 @@ 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();