src/hotspot/share/gc/g1/g1RemSet.cpp
changeset 49331 10b24a3af249
parent 49075 1fd4d6068f54
parent 49164 7e958a8ebcd3
child 49346 14e84a4edb9c
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp	Fri Mar 02 15:02:26 2018 -0800
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Fri Mar 02 21:00:12 2018 +0100
@@ -587,6 +587,20 @@
     return;
   }
 
+  // While we are processing RSet buffers during the collection, we
+  // actually don't want to scan any cards on the collection set,
+  // since we don't want to update remembered sets with entries that
+  // point into the collection set, given that live objects from the
+  // collection set are about to move and such entries will be stale
+  // very soon. This change also deals with a reliability issue which
+  // involves scanning a card in the collection set and coming across
+  // an array that was being chunked and looking malformed. Note,
+  // however, that if evacuation fails, we have to scan any objects
+  // that were not moved and create any missing entries.
+  if (r->in_collection_set()) {
+    return;
+  }
+
   // The result from the hot card cache insert call is either:
   //   * pointer to the current card
   //     (implying that the current card is not 'hot'),
@@ -611,7 +625,8 @@
 
       // Check whether the region formerly in the cache should be
       // ignored, as discussed earlier for the original card.  The
-      // region could have been freed while in the cache.
+      // region could have been freed while in the cache.  The cset is
+      // not relevant here, since we're in concurrent phase.
       if (!r->is_old_or_humongous()) {
         return;
       }