hotspot/src/share/vm/memory/blockOffsetTable.cpp
changeset 24424 2658d7834c6e
parent 22551 9bf46d16dcc6
child 29580 a67a581cfe11
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    57     gclog_or_tty->print_cr("BlockOffsetSharedArray::BlockOffsetSharedArray: ");
    57     gclog_or_tty->print_cr("BlockOffsetSharedArray::BlockOffsetSharedArray: ");
    58     gclog_or_tty->print_cr("  "
    58     gclog_or_tty->print_cr("  "
    59                   "  rs.base(): " INTPTR_FORMAT
    59                   "  rs.base(): " INTPTR_FORMAT
    60                   "  rs.size(): " INTPTR_FORMAT
    60                   "  rs.size(): " INTPTR_FORMAT
    61                   "  rs end(): " INTPTR_FORMAT,
    61                   "  rs end(): " INTPTR_FORMAT,
    62                   rs.base(), rs.size(), rs.base() + rs.size());
    62                   p2i(rs.base()), rs.size(), p2i(rs.base() + rs.size()));
    63     gclog_or_tty->print_cr("  "
    63     gclog_or_tty->print_cr("  "
    64                   "  _vs.low_boundary(): " INTPTR_FORMAT
    64                   "  _vs.low_boundary(): " INTPTR_FORMAT
    65                   "  _vs.high_boundary(): " INTPTR_FORMAT,
    65                   "  _vs.high_boundary(): " INTPTR_FORMAT,
    66                   _vs.low_boundary(),
    66                   p2i(_vs.low_boundary()),
    67                   _vs.high_boundary());
    67                   p2i(_vs.high_boundary()));
    68   }
    68   }
    69 }
    69 }
    70 
    70 
    71 void BlockOffsetSharedArray::resize(size_t new_word_size) {
    71 void BlockOffsetSharedArray::resize(size_t new_word_size) {
    72   assert(new_word_size <= _reserved.word_size(), "Resize larger than reserved");
    72   assert(new_word_size <= _reserved.word_size(), "Resize larger than reserved");
   535     // to go back by.
   535     // to go back by.
   536     size_t n_cards_back = entry_to_cards_back(offset);
   536     size_t n_cards_back = entry_to_cards_back(offset);
   537     q -= (N_words * n_cards_back);
   537     q -= (N_words * n_cards_back);
   538     assert(q >= _sp->bottom(),
   538     assert(q >= _sp->bottom(),
   539            err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
   539            err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
   540                    q, _sp->bottom()));
   540                    p2i(q), p2i(_sp->bottom())));
   541     assert(q < _sp->end(),
   541     assert(q < _sp->end(),
   542            err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
   542            err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
   543                    q, _sp->end()));
   543                    p2i(q), p2i(_sp->end())));
   544     index -= n_cards_back;
   544     index -= n_cards_back;
   545     offset = _array->offset_array(index);
   545     offset = _array->offset_array(index);
   546   }
   546   }
   547   assert(offset < N_words, "offset too large");
   547   assert(offset < N_words, "offset too large");
   548   index--;
   548   index--;
   549   q -= offset;
   549   q -= offset;
   550   assert(q >= _sp->bottom(),
   550   assert(q >= _sp->bottom(),
   551          err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
   551          err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
   552                  q, _sp->bottom()));
   552                  p2i(q), p2i(_sp->bottom())));
   553   assert(q < _sp->end(),
   553   assert(q < _sp->end(),
   554          err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
   554          err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
   555                  q, _sp->end()));
   555                  p2i(q), p2i(_sp->end())));
   556   HeapWord* n = q;
   556   HeapWord* n = q;
   557 
   557 
   558   while (n <= addr) {
   558   while (n <= addr) {
   559     debug_only(HeapWord* last = q);   // for debugging
   559     debug_only(HeapWord* last = q);   // for debugging
   560     q = n;
   560     q = n;
   561     n += _sp->block_size(n);
   561     n += _sp->block_size(n);
   562     assert(n > q,
   562     assert(n > q,
   563            err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT","
   563            err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT","
   564                    " while querying blk_start(" PTR_FORMAT ")"
   564                    " while querying blk_start(" PTR_FORMAT ")"
   565                    " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
   565                    " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
   566                    n, last, addr, _sp->bottom(), _sp->end()));
   566                    p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end())));
   567   }
   567   }
   568   assert(q <= addr,
   568   assert(q <= addr,
   569          err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")",
   569          err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")",
   570                  q, addr));
   570                  p2i(q), p2i(addr)));
   571   assert(addr <= n,
   571   assert(addr <= n,
   572          err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")",
   572          err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")",
   573                  addr, n));
   573                  p2i(addr), p2i(n)));
   574   return q;
   574   return q;
   575 }
   575 }
   576 
   576 
   577 HeapWord* BlockOffsetArrayNonContigSpace::block_start_careful(
   577 HeapWord* BlockOffsetArrayNonContigSpace::block_start_careful(
   578   const void* addr) const {
   578   const void* addr) const {