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:


  77   }
  78 
  79   size_t ptr_2_card_num(const jbyte* card_ptr) {
  80     assert(card_ptr >= _ct_bot,
  81            err_msg("Inavalied card pointer: "
  82                    "card_ptr: " PTR_FORMAT ", "
  83                    "_ct_bot: " PTR_FORMAT,
  84                    card_ptr, _ct_bot));
  85     size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte));
  86     check_card_num(card_num,
  87                    err_msg("card pointer out of range: " PTR_FORMAT, card_ptr));
  88     return card_num;
  89   }
  90 
  91   jbyte* card_num_2_ptr(size_t card_num) {
  92     check_card_num(card_num,
  93                    err_msg("card num out of range: "SIZE_FORMAT, card_num));
  94     return (jbyte*) (_ct_bot + card_num);
  95   }
  96 








  97   // Clear the counts table for the given (exclusive) index range.
  98   void clear_range(size_t from_card_num, size_t to_card_num);
  99 
 100  public:
 101   G1CardCounts(G1CollectedHeap* g1h);
 102   ~G1CardCounts();
 103 
 104   void initialize();
 105 
 106   // Resize the committed space for the card counts table in
 107   // response to a resize of the committed space for the heap.
 108   void resize(size_t heap_capacity);
 109 
 110   // Increments the refinement count for the given card.
 111   // Returns the pre-increment count value.
 112   uint add_card_count(jbyte* card_ptr);
 113 
 114   // Returns true if the given count is high enough to be considered
 115   // 'hot'; false otherwise.
 116   bool is_hot(uint count);


  77   }
  78 
  79   size_t ptr_2_card_num(const jbyte* card_ptr) {
  80     assert(card_ptr >= _ct_bot,
  81            err_msg("Inavalied card pointer: "
  82                    "card_ptr: " PTR_FORMAT ", "
  83                    "_ct_bot: " PTR_FORMAT,
  84                    card_ptr, _ct_bot));
  85     size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte));
  86     check_card_num(card_num,
  87                    err_msg("card pointer out of range: " PTR_FORMAT, card_ptr));
  88     return card_num;
  89   }
  90 
  91   jbyte* card_num_2_ptr(size_t card_num) {
  92     check_card_num(card_num,
  93                    err_msg("card num out of range: "SIZE_FORMAT, card_num));
  94     return (jbyte*) (_ct_bot + card_num);
  95   }
  96 
  97   // Helper routine.
  98   // Returns the number of cards that can be counted by the given committed
  99   // table size, with a maximum of the number of cards spanned by the max
 100   // capacity of the heap.
 101   size_t committed_to_card_num(size_t committed_size) {
 102     return MIN2(_reserved_max_card_num, committed_size / sizeof(jbyte));
 103   }
 104 
 105   // Clear the counts table for the given (exclusive) index range.
 106   void clear_range(size_t from_card_num, size_t to_card_num);
 107 
 108  public:
 109   G1CardCounts(G1CollectedHeap* g1h);
 110   ~G1CardCounts();
 111 
 112   void initialize();
 113 
 114   // Resize the committed space for the card counts table in
 115   // response to a resize of the committed space for the heap.
 116   void resize(size_t heap_capacity);
 117 
 118   // Increments the refinement count for the given card.
 119   // Returns the pre-increment count value.
 120   uint add_card_count(jbyte* card_ptr);
 121 
 122   // Returns true if the given count is high enough to be considered
 123   // 'hot'; false otherwise.
 124   bool is_hot(uint count);