8069034: gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java nightly failure
authorsjohanss
Tue, 03 Feb 2015 15:50:06 +0100
changeset 28835 2e467a95d04c
parent 28834 4925a7f447b0
child 28836 d9c497544bf3
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: tschatzl, brutisso
hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Feb 02 13:57:38 2015 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Feb 03 15:50:06 2015 +0100
@@ -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();