8264908: Investigate adding BOT range check in G1BlockOffsetTablePart::block_at_or_preceding

Reviewed-by: ayang, tschatzl
This commit is contained in:
Ivan Walulya 2021-07-15 08:49:23 +00:00
parent e92e2fd4e0
commit 99d7f9a772
2 changed files with 2 additions and 58 deletions

View File

@ -115,9 +115,8 @@ inline HeapWord* G1BlockOffsetTablePart::block_at_or_preceding(const void* addr)
"Object crossed region boundary, found offset %u instead of 0",
(uint) _bot->offset_array(_bot->index_for(_hr->bottom())));
size_t index = _bot->index_for(addr);
// We must make sure that the offset table entry we use is valid. If
// "addr" is past the end, start at the last valid index.
index = MIN2(index, _next_offset_index - 1);
// We must make sure that the offset table entry we use is valid.
assert(index < _next_offset_index, "Precondition");
HeapWord* q = _bot->address_for_index(index);

View File

@ -734,61 +734,6 @@ void HeapRegion::verify(VerifyOption vo,
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);
}