@@ -68,13 +68,26 @@ void G1SurvRateGroup::stop_adding_regions() {
68
68
_accum_surv_rate_pred = REALLOC_C_HEAP_ARRAY (double , _accum_surv_rate_pred, _num_added_regions, mtGC);
69
69
_surv_rate_predictors = REALLOC_C_HEAP_ARRAY (TruncatedSeq*, _surv_rate_predictors, _num_added_regions, mtGC);
70
70
71
+ // Assume that the prediction for the newly added regions is the same as the
72
+ // ones at the (current) end of the array. Particularly predictions at the end
73
+ // of this array fairly seldom get updated, so having a better initial value
74
+ // that is at least somewhat related to the actual application is preferable.
75
+ double new_pred = _stats_arrays_length > 1
76
+ ? _accum_surv_rate_pred[_stats_arrays_length - 1 ] - _accum_surv_rate_pred[_stats_arrays_length - 2 ]
77
+ : InitialSurvivorRate;
78
+
71
79
for (size_t i = _stats_arrays_length; i < _num_added_regions; ++i) {
72
80
// Initialize predictors and accumulated survivor rate predictions.
73
81
_surv_rate_predictors[i] = new TruncatedSeq (10 );
74
- _surv_rate_predictors[i]->add (InitialSurvivorRate);
75
- _accum_surv_rate_pred[i] = ((i == 0 ) ? 0.0 : _accum_surv_rate_pred[i-1 ]) + InitialSurvivorRate;
82
+ if (i == 0 ) {
83
+ _surv_rate_predictors[i]->add (InitialSurvivorRate);
84
+ _accum_surv_rate_pred[i] = 0.0 ;
85
+ } else {
86
+ _surv_rate_predictors[i]->add (_surv_rate_predictors[i-1 ]->last ());
87
+ _accum_surv_rate_pred[i] = _accum_surv_rate_pred[i-1 ] + new_pred;
88
+ }
76
89
}
77
- _last_pred = InitialSurvivorRate ;
90
+ _last_pred = new_pred ;
78
91
79
92
_stats_arrays_length = _num_added_regions;
80
93
}
0 commit comments