8081629: CMS split_block() does not correctly fix up block-offset-table for large blocks
authorjmasa
Mon, 25 May 2015 19:26:23 -0700
changeset 32746 11ab01b37e82
parent 32745 d238cd8170fc
child 32747 51960ef64fa4
8081629: CMS split_block() does not correctly fix up block-offset-table for large blocks Reviewed-by: tschatzl, ysr
hotspot/src/share/vm/gc/shared/blockOffsetTable.cpp
--- a/hotspot/src/share/vm/gc/shared/blockOffsetTable.cpp	Fri Sep 11 13:20:05 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/blockOffsetTable.cpp	Mon May 25 19:26:23 2015 -0700
@@ -447,14 +447,16 @@
       } else {
         // Unilaterally fix the first (num_pref_cards - 1) following
         // the "offset card" in the suffix block.
+        const size_t right_most_fixed_index = suff_index + num_pref_cards - 1;
         set_remainder_to_point_to_start_incl(suff_index + 1,
-          suff_index + num_pref_cards - 1, true /* reducing */);
+          right_most_fixed_index, true /* reducing */);
         // Fix the appropriate cards in the remainder of the
         // suffix block -- these are the last num_pref_cards
         // cards in each power block of the "new" range plumbed
         // from suff_addr.
         bool more = true;
         uint i = 1;
+        // Fix the first power block with  back_by > num_pref_cards.
         while (more && (i < N_powers)) {
           size_t back_by = power_to_cards_back(i);
           size_t right_index = suff_index + back_by - 1;
@@ -463,6 +465,9 @@
             right_index = end_index - 1;
             more = false;
           }
+          if (left_index <= right_most_fixed_index) {
+                left_index = right_most_fixed_index + 1;
+          }
           if (back_by > num_pref_cards) {
             // Fill in the remainder of this "power block", if it
             // is non-null.
@@ -471,12 +476,14 @@
                                      N_words + i - 1, true /* reducing */);
             } else {
               more = false; // we are done
+              assert((end_index - 1) == right_index, "Must be at the end.");
             }
             i++;
             break;
           }
           i++;
         }
+        // Fix the rest of the power blocks.
         while (more && (i < N_powers)) {
           size_t back_by = power_to_cards_back(i);
           size_t right_index = suff_index + back_by - 1;