Skip to content
Permalink
Browse files
8271930: Simplify end_card calculation in G1BlockOffsetTablePart::verify
Reviewed-by: tschatzl, iwalulya
  • Loading branch information
albertnetymk committed Aug 24, 2021
1 parent 7f80683 commit 928b9724c98c3377f96f5c3786ef2d8d79485dfe
Showing with 6 additions and 17 deletions.
  1. +3 −12 src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp
  2. +1 −4 src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp
  3. +2 −1 src/hotspot/share/gc/g1/heapRegion.cpp
@@ -337,8 +337,8 @@ void G1BlockOffsetTablePart::verify() const {
assert(_hr->bottom() < _hr->top(), "Only non-empty regions should be verified.");
size_t start_card = _bot->index_for(_hr->bottom());
// Do not verify beyond the BOT allocation threshold.
size_t next_offset_index = _bot->index_for_raw(_next_offset_threshold);
size_t end_card = MIN2(_bot->index_for(_hr->top() - 1), next_offset_index - 1);
assert(_hr->top() <= _next_offset_threshold, "invariant");
size_t end_card = _bot->index_for(_hr->top() - 1);

for (size_t current_card = start_card; current_card < end_card; current_card++) {
u_char entry = _bot->offset_array(current_card);
@@ -398,13 +398,6 @@ void G1BlockOffsetTablePart::print_on(outputStream* out) {
}
#endif // !PRODUCT

HeapWord* G1BlockOffsetTablePart::initialize_threshold_raw() {
size_t next_offset_index = _bot->index_for_raw(_hr->bottom()) + 1;
_next_offset_threshold =
_bot->address_for_index_raw(next_offset_index);
return _next_offset_threshold;
}

void G1BlockOffsetTablePart::zero_bottom_entry_raw() {
size_t bottom_index = _bot->index_for_raw(_hr->bottom());
assert(_bot->address_for_index_raw(bottom_index) == _hr->bottom(),
@@ -413,9 +406,7 @@ void G1BlockOffsetTablePart::zero_bottom_entry_raw() {
}

HeapWord* G1BlockOffsetTablePart::initialize_threshold() {
size_t next_offset_index = _bot->index_for(_hr->bottom()) + 1 ;
_next_offset_threshold =
_bot->address_for_index(next_offset_index);
_next_offset_threshold = _hr->bottom() + BOTConstants::N_words;
return _next_offset_threshold;
}

@@ -134,9 +134,6 @@ class G1BlockOffsetTablePart {
// Zero out the entry for _bottom (offset will be zero). Does not check for availability of the
// memory first.
void zero_bottom_entry_raw();
// Variant of initialize_threshold that does not check for availability of the
// memory first.
HeapWord* initialize_threshold_raw();

inline size_t block_size(const HeapWord* p) const;

@@ -200,7 +197,7 @@ class G1BlockOffsetTablePart {

void reset_bot() {
zero_bottom_entry_raw();
initialize_threshold_raw();
initialize_threshold();
}

// Return the next threshold, the point at which the table should be
@@ -714,7 +714,8 @@ void HeapRegion::verify(VerifyOption vo,
p += obj_size;
}

if (!is_empty()) {
// Only regions in old generation contain valid BOT.
if (!is_empty() && !is_young()) {
_bot_part.verify();
}

1 comment on commit 928b972

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 928b972 Aug 24, 2021

Please sign in to comment.