comparison src/share/vm/memory/blockOffsetTable.cpp @ 3359:7d64aa23eb96

7043891: CMS: assert(_whole_heap.contains(p)) failed: out of bounds access to card marking array Summary: Fixed assertion checking code that was attempting to translate addresses past end of space for card-table slot. Also elaborated some assertion checking messages. Reviewed-by: iveresov, jmasa, tonyp
author ysr
date Wed, 11 May 2011 15:47:12 -0700
parents f95d63e2154a
children 8cbcd406c42e
comparison
equal deleted inserted replaced
3358:97b64f73103b 3359:7d64aa23eb96
539 while (offset >= N_words) { 539 while (offset >= N_words) {
540 // The excess of the offset from N_words indicates a power of Base 540 // The excess of the offset from N_words indicates a power of Base
541 // to go back by. 541 // to go back by.
542 size_t n_cards_back = entry_to_cards_back(offset); 542 size_t n_cards_back = entry_to_cards_back(offset);
543 q -= (N_words * n_cards_back); 543 q -= (N_words * n_cards_back);
544 assert(q >= _sp->bottom(), "Went below bottom!"); 544 assert(q >= _sp->bottom(),
545 err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
546 q, _sp->bottom()));
547 assert(q < _sp->end(),
548 err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
549 q, _sp->end()));
545 index -= n_cards_back; 550 index -= n_cards_back;
546 offset = _array->offset_array(index); 551 offset = _array->offset_array(index);
547 } 552 }
548 assert(offset < N_words, "offset too large"); 553 assert(offset < N_words, "offset too large");
549 index--; 554 index--;
550 q -= offset; 555 q -= offset;
556 assert(q >= _sp->bottom(),
557 err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
558 q, _sp->bottom()));
559 assert(q < _sp->end(),
560 err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
561 q, _sp->end()));
551 HeapWord* n = q; 562 HeapWord* n = q;
552 563
553 while (n <= addr) { 564 while (n <= addr) {
554 debug_only(HeapWord* last = q); // for debugging 565 debug_only(HeapWord* last = q); // for debugging
555 q = n; 566 q = n;
556 n += _sp->block_size(n); 567 n += _sp->block_size(n);
557 assert(n > q, err_msg("Looping at: " INTPTR_FORMAT, n)); 568 assert(n > q,
569 err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT " _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
570 n, last, _sp->bottom(), _sp->end()));
558 } 571 }
559 assert(q <= addr, err_msg("wrong order for current (" INTPTR_FORMAT ") <= arg (" INTPTR_FORMAT ")", q, addr)); 572 assert(q <= addr, err_msg("wrong order for current (" INTPTR_FORMAT ") <= arg (" INTPTR_FORMAT ")", q, addr));
560 assert(addr <= n, err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", addr, n)); 573 assert(addr <= n, err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", addr, n));
561 return q; 574 return q;
562 } 575 }