8264908: Investigate adding BOT range check in G1BlockOffsetTablePart::block_at_or_preceding
Reviewed-by: ayang, tschatzl
This commit is contained in:
parent
e92e2fd4e0
commit
99d7f9a772
@ -115,9 +115,8 @@ inline HeapWord* G1BlockOffsetTablePart::block_at_or_preceding(const void* addr)
|
|||||||
"Object crossed region boundary, found offset %u instead of 0",
|
"Object crossed region boundary, found offset %u instead of 0",
|
||||||
(uint) _bot->offset_array(_bot->index_for(_hr->bottom())));
|
(uint) _bot->offset_array(_bot->index_for(_hr->bottom())));
|
||||||
size_t index = _bot->index_for(addr);
|
size_t index = _bot->index_for(addr);
|
||||||
// We must make sure that the offset table entry we use is valid. If
|
// We must make sure that the offset table entry we use is valid.
|
||||||
// "addr" is past the end, start at the last valid index.
|
assert(index < _next_offset_index, "Precondition");
|
||||||
index = MIN2(index, _next_offset_index - 1);
|
|
||||||
|
|
||||||
HeapWord* q = _bot->address_for_index(index);
|
HeapWord* q = _bot->address_for_index(index);
|
||||||
|
|
||||||
|
@ -734,61 +734,6 @@ void HeapRegion::verify(VerifyOption vo,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapWord* the_end = end();
|
|
||||||
// Do some extra BOT consistency checking for addresses in the
|
|
||||||
// range [top, end). BOT look-ups in this range should yield
|
|
||||||
// top. No point in doing that if top == end (there's nothing there).
|
|
||||||
if (p < the_end) {
|
|
||||||
// Look up top
|
|
||||||
HeapWord* addr_1 = p;
|
|
||||||
HeapWord* b_start_1 = block_start_const(addr_1);
|
|
||||||
if (b_start_1 != p) {
|
|
||||||
log_error(gc, verify)("BOT look up for top: " PTR_FORMAT " "
|
|
||||||
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
|
|
||||||
p2i(addr_1), p2i(b_start_1), p2i(p));
|
|
||||||
*failures = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look up top + 1
|
|
||||||
HeapWord* addr_2 = p + 1;
|
|
||||||
if (addr_2 < the_end) {
|
|
||||||
HeapWord* b_start_2 = block_start_const(addr_2);
|
|
||||||
if (b_start_2 != p) {
|
|
||||||
log_error(gc, verify)("BOT look up for top + 1: " PTR_FORMAT " "
|
|
||||||
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
|
|
||||||
p2i(addr_2), p2i(b_start_2), p2i(p));
|
|
||||||
*failures = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look up an address between top and end
|
|
||||||
size_t diff = pointer_delta(the_end, p) / 2;
|
|
||||||
HeapWord* addr_3 = p + diff;
|
|
||||||
if (addr_3 < the_end) {
|
|
||||||
HeapWord* b_start_3 = block_start_const(addr_3);
|
|
||||||
if (b_start_3 != p) {
|
|
||||||
log_error(gc, verify)("BOT look up for top + diff: " PTR_FORMAT " "
|
|
||||||
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
|
|
||||||
p2i(addr_3), p2i(b_start_3), p2i(p));
|
|
||||||
*failures = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look up end - 1
|
|
||||||
HeapWord* addr_4 = the_end - 1;
|
|
||||||
HeapWord* b_start_4 = block_start_const(addr_4);
|
|
||||||
if (b_start_4 != p) {
|
|
||||||
log_error(gc, verify)("BOT look up for end - 1: " PTR_FORMAT " "
|
|
||||||
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
|
|
||||||
p2i(addr_4), p2i(b_start_4), p2i(p));
|
|
||||||
*failures = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_strong_code_roots(vo, failures);
|
verify_strong_code_roots(vo, failures);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user