541 // The excess of the offset from N_words indicates a power of Base |
541 // The excess of the offset from N_words indicates a power of Base |
542 // to go back by. |
542 // to go back by. |
543 size_t n_cards_back = entry_to_cards_back(offset); |
543 size_t n_cards_back = entry_to_cards_back(offset); |
544 q -= (N_words * n_cards_back); |
544 q -= (N_words * n_cards_back); |
545 assert(q >= _sp->bottom(), |
545 assert(q >= _sp->bottom(), |
546 err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, |
546 "q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, |
547 p2i(q), p2i(_sp->bottom()))); |
547 p2i(q), p2i(_sp->bottom())); |
548 assert(q < _sp->end(), |
548 assert(q < _sp->end(), |
549 err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, |
549 "q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, |
550 p2i(q), p2i(_sp->end()))); |
550 p2i(q), p2i(_sp->end())); |
551 index -= n_cards_back; |
551 index -= n_cards_back; |
552 offset = _array->offset_array(index); |
552 offset = _array->offset_array(index); |
553 } |
553 } |
554 assert(offset < N_words, "offset too large"); |
554 assert(offset < N_words, "offset too large"); |
555 index--; |
555 index--; |
556 q -= offset; |
556 q -= offset; |
557 assert(q >= _sp->bottom(), |
557 assert(q >= _sp->bottom(), |
558 err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, |
558 "q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, |
559 p2i(q), p2i(_sp->bottom()))); |
559 p2i(q), p2i(_sp->bottom())); |
560 assert(q < _sp->end(), |
560 assert(q < _sp->end(), |
561 err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, |
561 "q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, |
562 p2i(q), p2i(_sp->end()))); |
562 p2i(q), p2i(_sp->end())); |
563 HeapWord* n = q; |
563 HeapWord* n = q; |
564 |
564 |
565 while (n <= addr) { |
565 while (n <= addr) { |
566 debug_only(HeapWord* last = q); // for debugging |
566 debug_only(HeapWord* last = q); // for debugging |
567 q = n; |
567 q = n; |
568 n += _sp->block_size(n); |
568 n += _sp->block_size(n); |
569 assert(n > q, |
569 assert(n > q, |
570 err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT "," |
570 "Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT "," |
571 " while querying blk_start(" PTR_FORMAT ")" |
571 " while querying blk_start(" PTR_FORMAT ")" |
572 " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")", |
572 " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")", |
573 p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end()))); |
573 p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end())); |
574 } |
574 } |
575 assert(q <= addr, |
575 assert(q <= addr, |
576 err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")", |
576 "wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")", |
577 p2i(q), p2i(addr))); |
577 p2i(q), p2i(addr)); |
578 assert(addr <= n, |
578 assert(addr <= n, |
579 err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", |
579 "wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", |
580 p2i(addr), p2i(n))); |
580 p2i(addr), p2i(n)); |
581 return q; |
581 return q; |
582 } |
582 } |
583 |
583 |
584 HeapWord* BlockOffsetArrayNonContigSpace::block_start_careful( |
584 HeapWord* BlockOffsetArrayNonContigSpace::block_start_careful( |
585 const void* addr) const { |
585 const void* addr) const { |