Skip to content

Commit

Permalink
8270540: G1: Refactor range checking in G1BlockOffsetTablePart::block…
Browse files Browse the repository at this point in the history
…_start* to asserts

Reviewed-by: ayang, tschatzl
  • Loading branch information
Ivan Walulya committed Jul 16, 2021
1 parent 90c219f commit 1d8d72d
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,16 @@
#include "runtime/atomic.hpp"

inline HeapWord* G1BlockOffsetTablePart::block_start(const void* addr) {
if (addr >= _hr->bottom() && addr < _hr->end()) {
HeapWord* q = block_at_or_preceding(addr);
return forward_to_block_containing_addr(q, addr);
} else {
return NULL;
}
assert(addr >= _hr->bottom() && addr < _hr->top(), "invalid address");
HeapWord* q = block_at_or_preceding(addr);
return forward_to_block_containing_addr(q, addr);
}

inline HeapWord* G1BlockOffsetTablePart::block_start_const(const void* addr) const {
if (addr >= _hr->bottom() && addr < _hr->end()) {
HeapWord* q = block_at_or_preceding(addr);
HeapWord* n = q + block_size(q);
return forward_to_block_containing_addr_const(q, n, addr);
} else {
return NULL;
}
assert(addr >= _hr->bottom() && addr < _hr->top(), "invalid address");
HeapWord* q = block_at_or_preceding(addr);
HeapWord* n = q + block_size(q);
return forward_to_block_containing_addr_const(q, n, addr);
}

u_char G1BlockOffsetTable::offset_array(size_t index) const {
Expand Down

1 comment on commit 1d8d72d

@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.