src/share/vm/gc_implementation/g1/g1CardCounts.hpp

Print this page
rev 4650 : 8014408: G1: crashes with assert assert(prev_committed_card_num == _committed_max_card_num) failed
Summary: Mismatch in the card number calculation between next and previous committed sizes of the card counts table.
Reviewed-by:

@@ -92,10 +92,18 @@
     check_card_num(card_num,
                    err_msg("card num out of range: "SIZE_FORMAT, card_num));
     return (jbyte*) (_ct_bot + card_num);
   }
 
+  // Helper routine.
+  // Returns the number of cards that can be counted by the given committed
+  // table size, with a maximum of the number of cards spanned by the max
+  // capacity of the heap.
+  size_t committed_to_card_num(size_t committed_size) {
+    return MIN2(_reserved_max_card_num, committed_size / sizeof(jbyte));
+  }
+
   // Clear the counts table for the given (exclusive) index range.
   void clear_range(size_t from_card_num, size_t to_card_num);
 
  public:
   G1CardCounts(G1CollectedHeap* g1h);