Skip to content

Commit

Permalink
8264908: Investigate adding BOT range check in G1BlockOffsetTablePart…
Browse files Browse the repository at this point in the history
…::block_at_or_preceding

Reviewed-by: ayang, tschatzl
  • Loading branch information
Ivan Walulya committed Jul 15, 2021
1 parent e92e2fd commit 99d7f9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 58 deletions.
5 changes: 2 additions & 3 deletions src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
55 changes: 0 additions & 55 deletions src/hotspot/share/gc/g1/heapRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

1 comment on commit 99d7f9a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.