hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp
changeset 26313 9baebbfc62dd
parent 26160 aba6b01cb988
child 26322 3e4ef23b8ee3
equal deleted inserted replaced
26185:f179c0827318 26313:9baebbfc62dd
    28 #include "memory/space.hpp"
    28 #include "memory/space.hpp"
    29 #include "oops/oop.inline.hpp"
    29 #include "oops/oop.inline.hpp"
    30 #include "runtime/java.hpp"
    30 #include "runtime/java.hpp"
    31 #include "services/memTracker.hpp"
    31 #include "services/memTracker.hpp"
    32 
    32 
    33 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
    33 
    34 
    34 
    35 void G1BlockOffsetSharedArrayMappingChangedListener::on_commit(uint start_idx, size_t num_regions) {
    35 void G1BlockOffsetSharedArrayMappingChangedListener::on_commit(uint start_idx, size_t num_regions) {
    36   // Nothing to do. The BOT is hard-wired to be part of the HeapRegion, and we cannot
    36   // Nothing to do. The BOT is hard-wired to be part of the HeapRegion, and we cannot
    37   // retrieve it here since this would cause firing of several asserts. The code
    37   // retrieve it here since this would cause firing of several asserts. The code
    38   // executed after commit of a region already needs to do some re-initialization of
    38   // executed after commit of a region already needs to do some re-initialization of
    57   storage->set_mapping_changed_listener(&_listener);
    57   storage->set_mapping_changed_listener(&_listener);
    58 
    58 
    59   if (TraceBlockOffsetTable) {
    59   if (TraceBlockOffsetTable) {
    60     gclog_or_tty->print_cr("G1BlockOffsetSharedArray::G1BlockOffsetSharedArray: ");
    60     gclog_or_tty->print_cr("G1BlockOffsetSharedArray::G1BlockOffsetSharedArray: ");
    61     gclog_or_tty->print_cr("  "
    61     gclog_or_tty->print_cr("  "
    62                   "  rs.base(): " INTPTR_FORMAT
    62                   "  rs.base(): " PTR_FORMAT
    63                   "  rs.size(): " INTPTR_FORMAT
    63                   "  rs.size(): " SIZE_FORMAT
    64                   "  rs end(): " INTPTR_FORMAT,
    64                   "  rs end(): " PTR_FORMAT,
    65                   bot_reserved.start(), bot_reserved.byte_size(), bot_reserved.end());
    65                   p2i(bot_reserved.start()), bot_reserved.byte_size(), p2i(bot_reserved.end()));
    66   }
    66   }
    67 }
    67 }
    68 
    68 
    69 bool G1BlockOffsetSharedArray::is_card_boundary(HeapWord* p) const {
    69 bool G1BlockOffsetSharedArray::is_card_boundary(HeapWord* p) const {
    70   assert(p >= _reserved.start(), "just checking");
    70   assert(p >= _reserved.start(), "just checking");
   379   HeapWord* next_boundary = _array->address_for_index(n_index) +
   379   HeapWord* next_boundary = _array->address_for_index(n_index) +
   380                             (n_index == next_index ? 0 : N_words);
   380                             (n_index == next_index ? 0 : N_words);
   381   assert(next_boundary <= _array->_end,
   381   assert(next_boundary <= _array->_end,
   382          err_msg("next_boundary is beyond the end of the covered region "
   382          err_msg("next_boundary is beyond the end of the covered region "
   383                  " next_boundary " PTR_FORMAT " _array->_end " PTR_FORMAT,
   383                  " next_boundary " PTR_FORMAT " _array->_end " PTR_FORMAT,
   384                  next_boundary, _array->_end));
   384                  p2i(next_boundary), p2i(_array->_end)));
   385   if (addr >= gsp()->top()) return gsp()->top();
   385   if (addr >= gsp()->top()) return gsp()->top();
   386   while (next_boundary < addr) {
   386   while (next_boundary < addr) {
   387     while (n <= next_boundary) {
   387     while (n <= next_boundary) {
   388       q = n;
   388       q = n;
   389       oop obj = oop(q);
   389       oop obj = oop(q);
   520          err_msg("offset array should have been set - "
   520          err_msg("offset array should have been set - "
   521                   "orig_index offset: %u, "
   521                   "orig_index offset: %u, "
   522                   "blk_start: " PTR_FORMAT ", "
   522                   "blk_start: " PTR_FORMAT ", "
   523                   "boundary: " PTR_FORMAT,
   523                   "boundary: " PTR_FORMAT,
   524                   (uint)_array->offset_array(orig_index),
   524                   (uint)_array->offset_array(orig_index),
   525                   blk_start, boundary));
   525                   p2i(blk_start), p2i(boundary)));
   526   for (size_t j = orig_index + 1; j <= end_index; j++) {
   526   for (size_t j = orig_index + 1; j <= end_index; j++) {
   527     assert(_array->offset_array(j) > 0 &&
   527     assert(_array->offset_array(j) > 0 &&
   528            _array->offset_array(j) <=
   528            _array->offset_array(j) <=
   529              (u_char) (N_words+BlockOffsetArray::N_powers-1),
   529              (u_char) (N_words+BlockOffsetArray::N_powers-1),
   530            err_msg("offset array should have been set - "
   530            err_msg("offset array should have been set - "
   554       gclog_or_tty->print_cr("block start: "PTR_FORMAT" is incorrect - "
   554       gclog_or_tty->print_cr("block start: "PTR_FORMAT" is incorrect - "
   555                              "card index: "SIZE_FORMAT" "
   555                              "card index: "SIZE_FORMAT" "
   556                              "card addr: "PTR_FORMAT" BOT entry: %u "
   556                              "card addr: "PTR_FORMAT" BOT entry: %u "
   557                              "obj: "PTR_FORMAT" word size: "SIZE_FORMAT" "
   557                              "obj: "PTR_FORMAT" word size: "SIZE_FORMAT" "
   558                              "cards: ["SIZE_FORMAT","SIZE_FORMAT"]",
   558                              "cards: ["SIZE_FORMAT","SIZE_FORMAT"]",
   559                              block_start, card, card_addr,
   559                              p2i(block_start), card, p2i(card_addr),
   560                              _array->offset_array(card),
   560                              _array->offset_array(card),
   561                              obj_start, word_size, first_card, last_card);
   561                              p2i(obj_start), word_size, first_card, last_card);
   562       return false;
   562       return false;
   563     }
   563     }
   564   }
   564   }
   565   return true;
   565   return true;
   566 }
   566 }
   570 G1BlockOffsetArray::print_on(outputStream* out) {
   570 G1BlockOffsetArray::print_on(outputStream* out) {
   571   size_t from_index = _array->index_for(_bottom);
   571   size_t from_index = _array->index_for(_bottom);
   572   size_t to_index = _array->index_for(_end);
   572   size_t to_index = _array->index_for(_end);
   573   out->print_cr(">> BOT for area ["PTR_FORMAT","PTR_FORMAT") "
   573   out->print_cr(">> BOT for area ["PTR_FORMAT","PTR_FORMAT") "
   574                 "cards ["SIZE_FORMAT","SIZE_FORMAT")",
   574                 "cards ["SIZE_FORMAT","SIZE_FORMAT")",
   575                 _bottom, _end, from_index, to_index);
   575                 p2i(_bottom), p2i(_end), from_index, to_index);
   576   for (size_t i = from_index; i < to_index; ++i) {
   576   for (size_t i = from_index; i < to_index; ++i) {
   577     out->print_cr("  entry "SIZE_FORMAT_W(8)" | "PTR_FORMAT" : %3u",
   577     out->print_cr("  entry "SIZE_FORMAT_W(8)" | "PTR_FORMAT" : %3u",
   578                   i, _array->address_for_index(i),
   578                   i, p2i(_array->address_for_index(i)),
   579                   (uint) _array->offset_array(i));
   579                   (uint) _array->offset_array(i));
   580   }
   580   }
   581 }
   581 }
   582 #endif // !PRODUCT
   582 #endif // !PRODUCT
   583 
   583 
   661 
   661 
   662 #ifndef PRODUCT
   662 #ifndef PRODUCT
   663 void
   663 void
   664 G1BlockOffsetArrayContigSpace::print_on(outputStream* out) {
   664 G1BlockOffsetArrayContigSpace::print_on(outputStream* out) {
   665   G1BlockOffsetArray::print_on(out);
   665   G1BlockOffsetArray::print_on(out);
   666   out->print_cr("  next offset threshold: "PTR_FORMAT, _next_offset_threshold);
   666   out->print_cr("  next offset threshold: "PTR_FORMAT, p2i(_next_offset_threshold));
   667   out->print_cr("  next offset index:     "SIZE_FORMAT, _next_offset_index);
   667   out->print_cr("  next offset index:     "SIZE_FORMAT, _next_offset_index);
   668 }
   668 }
   669 #endif // !PRODUCT
   669 #endif // !PRODUCT