src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp

Print this page
rev 3849 : 7194633: G1: Assertion and guarantee failures in block offset table
Summary: Add detailed error messages to assertions and guarantees in G1's block offset table.
Reviewed-by:

@@ -300,20 +300,32 @@
   }
   guarantee(_array->offset_array(start_card) == N_words, "Wrong value in second card");
   for (size_t c = start_card + 1; c <= end_card; c++ /* yeah! */) {
     u_char entry = _array->offset_array(c);
     if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) {
-      guarantee(entry > N_words, "Should be in logarithmic region");
+      guarantee(entry > N_words,
+                err_msg("Should be in logarithmic region - "
+                        "entry: "UINT32_FORMAT", "
+                        "_array->offset_array(c): "UINT32_FORMAT", "
+                        "N_words: "UINT32_FORMAT,
+                        entry, _array->offset_array(c), N_words));
     }
     size_t backskip = BlockOffsetArray::entry_to_cards_back(entry);
     size_t landing_card = c - backskip;
     guarantee(landing_card >= (start_card - 1), "Inv");
     if (landing_card >= start_card) {
-      guarantee(_array->offset_array(landing_card) <= entry, "monotonicity");
+      guarantee(_array->offset_array(landing_card) <= entry,
+                err_msg("Monotonicity - landing_card offset: "UINT32_FORMAT", "
+                        "entry: "UINT32_FORMAT,
+                        _array->offset_array(landing_card), entry));
     } else {
       guarantee(landing_card == start_card - 1, "Tautology");
-      guarantee(_array->offset_array(landing_card) <= N_words, "Offset value");
+      // Note that N_words is the maximum offset value
+      guarantee(_array->offset_array(landing_card) <= N_words,
+                err_msg("landing card offset: "UINT32_FORMAT", "
+                        "N_words: "UINT32_FORMAT,
+                        _array->offset_array(landing_card), N_words));
     }
   }
 }
 
 // The range [blk_start, blk_end) represents a single contiguous block

@@ -539,16 +551,25 @@
   HeapWord* boundary    = _array->address_for_index(start_index);
   assert((_array->offset_array(orig_index) == 0 &&
           blk_start == boundary) ||
           (_array->offset_array(orig_index) > 0 &&
          _array->offset_array(orig_index) <= N_words),
-         "offset array should have been set");
+         err_msg("offset array should have been set - "
+                  "orig_index offset: "UINT32_FORMAT", "
+                  "blk_start: "PTR_FORMAT", "
+                  "boundary: "PTR_FORMAT,
+                  _array->offset_array(orig_index),
+                  blk_start, boundary));
   for (size_t j = orig_index + 1; j <= end_index; j++) {
     assert(_array->offset_array(j) > 0 &&
            _array->offset_array(j) <=
              (u_char) (N_words+BlockOffsetArray::N_powers-1),
-           "offset array should have been set");
+           err_msg("offset array should have been set - "
+                   UINT32_FORMAT" not > 0 OR "UINT32_FORMAT" not <= "UINT32_FORMAT,
+                   _array->offset_array(j),
+                   _array->offset_array(j),
+                   (u_char) (N_words+BlockOffsetArray::N_powers-1)));
   }
 #endif
 }
 
 bool