Skip to content

Commit

Permalink
8345220: Serial: Refactor TenuredGeneration::promotion_attempt_is_safe
Browse files Browse the repository at this point in the history
Reviewed-by: tschatzl, mli
  • Loading branch information
albertnetymk committed Dec 2, 2024
1 parent dfcbfb5 commit 0b0f83c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/hotspot/share/gc/serial/tenuredGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,14 @@ void TenuredGeneration::update_counters() {

bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
size_t available = _the_space->free() + _virtual_space.uncommitted_size();
size_t av_promo = (size_t)_avg_promoted->padded_average();
bool res = (available >= av_promo) || (available >= max_promotion_in_bytes);

size_t avg_promoted = (size_t)_avg_promoted->padded_average();
size_t promotion_estimate = MIN2(avg_promoted, max_promotion_in_bytes);

bool res = (promotion_estimate <= available);

log_trace(gc)("Tenured: promo attempt is%s safe: available(" SIZE_FORMAT ") %s av_promo(" SIZE_FORMAT "), max_promo(" SIZE_FORMAT ")",
res? "":" not", available, res? ">=":"<", av_promo, max_promotion_in_bytes);
res? "":" not", available, res? ">=":"<", avg_promoted, max_promotion_in_bytes);

return res;
}
Expand Down

0 comments on commit 0b0f83c

Please sign in to comment.