8271930: Simplify end_card calculation in G1BlockOffsetTablePart::verify

Reviewed-by: tschatzl, iwalulya
This commit is contained in:
Albert Mingkun Yang 2021-08-24 12:14:07 +00:00
parent 7f80683cfe
commit 928b9724c9
3 changed files with 6 additions and 17 deletions

View File

@ -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;
}

View File

@ -134,9 +134,6 @@ private:
// 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 @@ public:
void reset_bot() {
zero_bottom_entry_raw();
initialize_threshold_raw();
initialize_threshold();
}
// Return the next threshold, the point at which the table should be

View File

@ -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();
}