mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 00:54:38 +02:00
7043891: CMS: assert(_whole_heap.contains(p)) failed: out of bounds access to card marking array
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
This commit is contained in:
parent
953f34d325
commit
c40a4d6878
3 changed files with 25 additions and 6 deletions
|
@ -351,7 +351,7 @@ process_chunk_boundaries(Space* sp,
|
|||
// covers.
|
||||
const uintptr_t last_chunk_index_to_check = addr_to_chunk_index(last_block + last_block_size - 1)
|
||||
- lowest_non_clean_base_chunk_index;
|
||||
DEBUG_ONLY(const uintptr_t last_chunk_index = addr_to_chunk_index(used.end())
|
||||
DEBUG_ONLY(const uintptr_t last_chunk_index = addr_to_chunk_index(used.last())
|
||||
- lowest_non_clean_base_chunk_index;)
|
||||
assert(last_chunk_index_to_check <= last_chunk_index,
|
||||
err_msg("Out of bounds: last_chunk_index_to_check " INTPTR_FORMAT
|
||||
|
|
|
@ -541,20 +541,33 @@ HeapWord* BlockOffsetArrayNonContigSpace::block_start_unsafe(
|
|||
// to go back by.
|
||||
size_t n_cards_back = entry_to_cards_back(offset);
|
||||
q -= (N_words * n_cards_back);
|
||||
assert(q >= _sp->bottom(), "Went below bottom!");
|
||||
assert(q >= _sp->bottom(),
|
||||
err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
|
||||
q, _sp->bottom()));
|
||||
assert(q < _sp->end(),
|
||||
err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
|
||||
q, _sp->end()));
|
||||
index -= n_cards_back;
|
||||
offset = _array->offset_array(index);
|
||||
}
|
||||
assert(offset < N_words, "offset too large");
|
||||
index--;
|
||||
q -= offset;
|
||||
assert(q >= _sp->bottom(),
|
||||
err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
|
||||
q, _sp->bottom()));
|
||||
assert(q < _sp->end(),
|
||||
err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
|
||||
q, _sp->end()));
|
||||
HeapWord* n = q;
|
||||
|
||||
while (n <= addr) {
|
||||
debug_only(HeapWord* last = q); // for debugging
|
||||
q = n;
|
||||
n += _sp->block_size(n);
|
||||
assert(n > q, err_msg("Looping at: " INTPTR_FORMAT, n));
|
||||
assert(n > q,
|
||||
err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT " _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
|
||||
n, last, _sp->bottom(), _sp->end()));
|
||||
}
|
||||
assert(q <= addr, err_msg("wrong order for current (" INTPTR_FORMAT ") <= arg (" INTPTR_FORMAT ")", q, addr));
|
||||
assert(addr <= n, err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", addr, n));
|
||||
|
|
|
@ -150,7 +150,9 @@ class CardTableModRefBS: public ModRefBarrierSet {
|
|||
// Mapping from address to card marking array entry
|
||||
jbyte* byte_for(const void* p) const {
|
||||
assert(_whole_heap.contains(p),
|
||||
"out of bounds access to card marking array");
|
||||
err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
|
||||
" card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
|
||||
p, _whole_heap.start(), _whole_heap.end()));
|
||||
jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
|
||||
assert(result >= _byte_map && result < _byte_map + _byte_map_size,
|
||||
"out of bounds accessor for card marking array");
|
||||
|
@ -451,14 +453,18 @@ public:
|
|||
size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte));
|
||||
HeapWord* result = (HeapWord*) (delta << card_shift);
|
||||
assert(_whole_heap.contains(result),
|
||||
"out of bounds accessor from card marking array");
|
||||
err_msg("Returning result = "PTR_FORMAT" out of bounds of "
|
||||
" card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
|
||||
result, _whole_heap.start(), _whole_heap.end()));
|
||||
return result;
|
||||
}
|
||||
|
||||
// Mapping from address to card marking array index.
|
||||
size_t index_for(void* p) {
|
||||
assert(_whole_heap.contains(p),
|
||||
"out of bounds access to card marking array");
|
||||
err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
|
||||
" card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
|
||||
p, _whole_heap.start(), _whole_heap.end()));
|
||||
return byte_for(p) - _byte_map;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue