Skip to content
Permalink
Browse files
8270540: G1: Refactor range checking in G1BlockOffsetTablePart::block…
…_start* to asserts

Reviewed-by: ayang, tschatzl
  • Loading branch information
Ivan Walulya committed Jul 16, 2021
1 parent 90c219f commit 1d8d72d2c24764ab32741dd5220a6c1a980656e2
Showing 1 changed file with 7 additions and 13 deletions.
@@ -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 {

1 comment on commit 1d8d72d

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 1d8d72d Jul 16, 2021

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.