From 8fb94fd4fe46bc12885c7cc0c7ebbbc10fba47e5 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Mon, 6 Nov 2023 11:06:42 +0000 Subject: [PATCH] 8319379: G1: gc/logging/TestUnifiedLoggingSwitchStress.java crashes after JDK-8318894 Reviewed-by: tschatzl, sjohanss --- src/hotspot/share/gc/g1/g1SurvRateGroup.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hotspot/share/gc/g1/g1SurvRateGroup.hpp b/src/hotspot/share/gc/g1/g1SurvRateGroup.hpp index 036834b412e..1e1cc049caf 100644 --- a/src/hotspot/share/gc/g1/g1SurvRateGroup.hpp +++ b/src/hotspot/share/gc/g1/g1SurvRateGroup.hpp @@ -86,6 +86,9 @@ public: double surv_rate_pred(G1Predictions const& predictor, uint age) const { assert(is_valid_age(age), "must be"); + // _stats_arrays_length might not be in sync with _num_added_regions in Cleanup pause. + age = MIN2(age, _stats_arrays_length - 1); + return predictor.predict_in_unit_interval(_surv_rate_predictors[age]); }