Skip to content

Commit c7f071c

Browse files
author
Thomas Schatzl
committed
8343189: [REDO] JDK-8295269 G1: Improve slow startup due to predictor initialization
Reviewed-by: iwalulya, sjohanss
1 parent a9e53bb commit c7f071c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/hotspot/share/gc/g1/g1AnalyticsSequences.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class G1Predictions;
3535
// Container for TruncatedSeqs that need separate predictors by GC phase.
3636
class G1PhaseDependentSeq {
3737
TruncatedSeq _young_only_seq;
38+
double _initial_value;
3839
TruncatedSeq _mixed_seq;
3940

4041
NONCOPYABLE(G1PhaseDependentSeq);

src/hotspot/share/gc/g1/g1AnalyticsSequences.inline.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ bool G1PhaseDependentSeq::enough_samples_to_use_mixed_seq() const {
3434

3535
G1PhaseDependentSeq::G1PhaseDependentSeq(int length) :
3636
_young_only_seq(length),
37+
_initial_value(0.0),
3738
_mixed_seq(length)
3839
{ }
3940

@@ -42,7 +43,7 @@ TruncatedSeq* G1PhaseDependentSeq::seq_raw(bool use_young_only_phase_seq) {
4243
}
4344

4445
void G1PhaseDependentSeq::set_initial(double value) {
45-
_young_only_seq.add(value);
46+
_initial_value = value;
4647
}
4748

4849
void G1PhaseDependentSeq::add(double value, bool for_young_only_phase) {
@@ -51,8 +52,12 @@ void G1PhaseDependentSeq::add(double value, bool for_young_only_phase) {
5152

5253
double G1PhaseDependentSeq::predict(const G1Predictions* predictor, bool use_young_only_phase_seq) const {
5354
if (use_young_only_phase_seq || !enough_samples_to_use_mixed_seq()) {
55+
if (_young_only_seq.num() == 0) {
56+
return _initial_value;
57+
}
5458
return predictor->predict(&_young_only_seq);
5559
} else {
60+
assert(_mixed_seq.num() > 0, "must not ask this with no samples");
5661
return predictor->predict(&_mixed_seq);
5762
}
5863
}

0 commit comments

Comments
 (0)