changeset 7793:ea729fe8efd9

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
author sjohanss
date Tue, 03 Feb 2015 15:50:06 +0100
parents 92520906931c
children 5abc906fe3a8
files src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Feb 02 13:57:38 2015 +0100
+++ b/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();