hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
changeset 17394 156f30e1d09a
parent 17327 4bd0581aa231
child 18496 78b3897aa229
equal deleted inserted replaced
17393:7e99f263902c 17394:156f30e1d09a
    99 
    99 
   100   assert(_committed_size ==
   100   assert(_committed_size ==
   101          ReservedSpace::allocation_align_size_up(_committed_size),
   101          ReservedSpace::allocation_align_size_up(_committed_size),
   102          err_msg("Unaligned? committed_size: " SIZE_FORMAT, _committed_size));
   102          err_msg("Unaligned? committed_size: " SIZE_FORMAT, _committed_size));
   103 
   103 
   104   // Verify that the committed space for the card counts
   104   // Verify that the committed space for the card counts matches our
   105   // matches our committed max card num.
   105   // committed max card num. Note for some allocation alignments, the
       
   106   // amount of space actually committed for the counts table will be able
       
   107   // to span more cards than the number spanned by the maximum heap.
   106   size_t prev_committed_size = _committed_size;
   108   size_t prev_committed_size = _committed_size;
   107   size_t prev_committed_card_num = prev_committed_size / sizeof(jbyte);
   109   size_t prev_committed_card_num = committed_to_card_num(prev_committed_size);
       
   110 
   108   assert(prev_committed_card_num == _committed_max_card_num,
   111   assert(prev_committed_card_num == _committed_max_card_num,
   109          err_msg("Card mismatch: "
   112          err_msg("Card mismatch: "
   110                  "prev: " SIZE_FORMAT ", "
   113                  "prev: " SIZE_FORMAT ", "
   111                  "committed: "SIZE_FORMAT,
   114                  "committed: "SIZE_FORMAT", "
   112                  prev_committed_card_num, _committed_max_card_num));
   115                  "reserved: "SIZE_FORMAT,
       
   116                  prev_committed_card_num, _committed_max_card_num, _reserved_max_card_num));
   113 
   117 
   114   size_t new_size = (heap_capacity >> CardTableModRefBS::card_shift) * sizeof(jbyte);
   118   size_t new_size = (heap_capacity >> CardTableModRefBS::card_shift) * sizeof(jbyte);
   115   size_t new_committed_size = ReservedSpace::allocation_align_size_up(new_size);
   119   size_t new_committed_size = ReservedSpace::allocation_align_size_up(new_size);
   116   size_t new_committed_card_num =
   120   size_t new_committed_card_num = committed_to_card_num(new_committed_size);
   117                 MIN2(_reserved_max_card_num, new_committed_size / sizeof(jbyte));
       
   118 
   121 
   119   if (_committed_max_card_num < new_committed_card_num) {
   122   if (_committed_max_card_num < new_committed_card_num) {
   120     // we need to expand the backing store for the card counts
   123     // we need to expand the backing store for the card counts
   121     size_t expand_size = new_committed_size - prev_committed_size;
   124     size_t expand_size = new_committed_size - prev_committed_size;
   122 
   125