< prev index next >

src/share/vm/gc/shared/blockOffsetTable.cpp

Print this page




 526          "addr must be covered by this Array");
 527   // Must read this exactly once because it can be modified by parallel
 528   // allocation.
 529   HeapWord* ub = _unallocated_block;
 530   if (BlockOffsetArrayUseUnallocatedBlock && addr >= ub) {
 531     assert(ub < _end, "tautology (see above)");
 532     return ub;
 533   }
 534 
 535   // Otherwise, find the block start using the table.
 536   size_t index = _array->index_for(addr);
 537   HeapWord* q = _array->address_for_index(index);
 538 
 539   uint offset = _array->offset_array(index);    // Extend u_char to uint.
 540   while (offset >= N_words) {
 541     // The excess of the offset from N_words indicates a power of Base
 542     // to go back by.
 543     size_t n_cards_back = entry_to_cards_back(offset);
 544     q -= (N_words * n_cards_back);
 545     assert(q >= _sp->bottom(),
 546            err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
 547                    p2i(q), p2i(_sp->bottom())));
 548     assert(q < _sp->end(),
 549            err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
 550                    p2i(q), p2i(_sp->end())));
 551     index -= n_cards_back;
 552     offset = _array->offset_array(index);
 553   }
 554   assert(offset < N_words, "offset too large");
 555   index--;
 556   q -= offset;
 557   assert(q >= _sp->bottom(),
 558          err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
 559                  p2i(q), p2i(_sp->bottom())));
 560   assert(q < _sp->end(),
 561          err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
 562                  p2i(q), p2i(_sp->end())));
 563   HeapWord* n = q;
 564 
 565   while (n <= addr) {
 566     debug_only(HeapWord* last = q);   // for debugging
 567     q = n;
 568     n += _sp->block_size(n);
 569     assert(n > q,
 570            err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT ","
 571                    " while querying blk_start(" PTR_FORMAT ")"
 572                    " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
 573                    p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end())));
 574   }
 575   assert(q <= addr,
 576          err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")",
 577                  p2i(q), p2i(addr)));
 578   assert(addr <= n,
 579          err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")",
 580                  p2i(addr), p2i(n)));
 581   return q;
 582 }
 583 
 584 HeapWord* BlockOffsetArrayNonContigSpace::block_start_careful(
 585   const void* addr) const {
 586   assert(_array->offset_array(0) == 0, "objects can't cross covered areas");
 587 
 588   assert(_bottom <= addr && addr < _end,
 589          "addr must be covered by this Array");
 590   // Must read this exactly once because it can be modified by parallel
 591   // allocation.
 592   HeapWord* ub = _unallocated_block;
 593   if (BlockOffsetArrayUseUnallocatedBlock && addr >= ub) {
 594     assert(ub < _end, "tautology (see above)");
 595     return ub;
 596   }
 597 
 598   // Otherwise, find the block start using the table, but taking
 599   // care (cf block_start_unsafe() above) not to parse any objects/blocks
 600   // on the cards themselves.




 526          "addr must be covered by this Array");
 527   // Must read this exactly once because it can be modified by parallel
 528   // allocation.
 529   HeapWord* ub = _unallocated_block;
 530   if (BlockOffsetArrayUseUnallocatedBlock && addr >= ub) {
 531     assert(ub < _end, "tautology (see above)");
 532     return ub;
 533   }
 534 
 535   // Otherwise, find the block start using the table.
 536   size_t index = _array->index_for(addr);
 537   HeapWord* q = _array->address_for_index(index);
 538 
 539   uint offset = _array->offset_array(index);    // Extend u_char to uint.
 540   while (offset >= N_words) {
 541     // The excess of the offset from N_words indicates a power of Base
 542     // to go back by.
 543     size_t n_cards_back = entry_to_cards_back(offset);
 544     q -= (N_words * n_cards_back);
 545     assert(q >= _sp->bottom(),
 546            "q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
 547            p2i(q), p2i(_sp->bottom()));
 548     assert(q < _sp->end(),
 549            "q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
 550            p2i(q), p2i(_sp->end()));
 551     index -= n_cards_back;
 552     offset = _array->offset_array(index);
 553   }
 554   assert(offset < N_words, "offset too large");
 555   index--;
 556   q -= offset;
 557   assert(q >= _sp->bottom(),
 558          "q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
 559          p2i(q), p2i(_sp->bottom()));
 560   assert(q < _sp->end(),
 561          "q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
 562          p2i(q), p2i(_sp->end()));
 563   HeapWord* n = q;
 564 
 565   while (n <= addr) {
 566     debug_only(HeapWord* last = q);   // for debugging
 567     q = n;
 568     n += _sp->block_size(n);
 569     assert(n > q,
 570            "Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT ","
 571            " while querying blk_start(" PTR_FORMAT ")"
 572            " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
 573            p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end()));
 574   }
 575   assert(q <= addr,
 576          "wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")",
 577          p2i(q), p2i(addr));
 578   assert(addr <= n,
 579          "wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")",
 580          p2i(addr), p2i(n));
 581   return q;
 582 }
 583 
 584 HeapWord* BlockOffsetArrayNonContigSpace::block_start_careful(
 585   const void* addr) const {
 586   assert(_array->offset_array(0) == 0, "objects can't cross covered areas");
 587 
 588   assert(_bottom <= addr && addr < _end,
 589          "addr must be covered by this Array");
 590   // Must read this exactly once because it can be modified by parallel
 591   // allocation.
 592   HeapWord* ub = _unallocated_block;
 593   if (BlockOffsetArrayUseUnallocatedBlock && addr >= ub) {
 594     assert(ub < _end, "tautology (see above)");
 595     return ub;
 596   }
 597 
 598   // Otherwise, find the block start using the table, but taking
 599   // care (cf block_start_unsafe() above) not to parse any objects/blocks
 600   // on the cards themselves.


< prev index next >