Skip to content

Commit ef5210f

Browse files
author
Thomas Schatzl
committed
8295149: Misnomer for_young_gc instead of for_young_only_phase in G1Analytics
Reviewed-by: kbarrett, iwalulya
1 parent 64813f4 commit ef5210f

7 files changed

+51
-51
lines changed

src/hotspot/share/gc/g1/g1Analytics.cpp

+22-22
Original file line numberDiff line numberDiff line change
@@ -172,32 +172,32 @@ void G1Analytics::report_dirtied_cards_rate_ms(double cards_per_ms) {
172172
_dirtied_cards_rate_ms_seq->add(cards_per_ms);
173173
}
174174

175-
void G1Analytics::report_cost_per_card_scan_ms(double cost_per_card_ms, bool for_young_gc) {
176-
if (for_young_gc) {
175+
void G1Analytics::report_cost_per_card_scan_ms(double cost_per_card_ms, bool for_young_only_phase) {
176+
if (for_young_only_phase) {
177177
_young_cost_per_card_scan_ms_seq->add(cost_per_card_ms);
178178
} else {
179179
_mixed_cost_per_card_scan_ms_seq->add(cost_per_card_ms);
180180
}
181181
}
182182

183-
void G1Analytics::report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_gc) {
184-
if (for_young_gc) {
183+
void G1Analytics::report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_only_phase) {
184+
if (for_young_only_phase) {
185185
_young_cost_per_card_merge_ms_seq->add(cost_per_card_ms);
186186
} else {
187187
_mixed_cost_per_card_merge_ms_seq->add(cost_per_card_ms);
188188
}
189189
}
190190

191-
void G1Analytics::report_card_merge_to_scan_ratio(double merge_to_scan_ratio, bool for_young_gc) {
192-
if (for_young_gc) {
191+
void G1Analytics::report_card_merge_to_scan_ratio(double merge_to_scan_ratio, bool for_young_only_phase) {
192+
if (for_young_only_phase) {
193193
_young_card_merge_to_scan_ratio_seq->add(merge_to_scan_ratio);
194194
} else {
195195
_mixed_card_merge_to_scan_ratio_seq->add(merge_to_scan_ratio);
196196
}
197197
}
198198

199-
void G1Analytics::report_rs_length_diff(double rs_length_diff, bool for_young_gc) {
200-
if (for_young_gc) {
199+
void G1Analytics::report_rs_length_diff(double rs_length_diff, bool for_young_only_phase) {
200+
if (for_young_only_phase) {
201201
_young_rs_length_diff_seq->add(rs_length_diff);
202202
} else {
203203
_mixed_rs_length_diff_seq->add(rs_length_diff);
@@ -224,16 +224,16 @@ void G1Analytics::report_constant_other_time_ms(double constant_other_time_ms) {
224224
_constant_other_time_ms_seq->add(constant_other_time_ms);
225225
}
226226

227-
void G1Analytics::report_pending_cards(double pending_cards, bool for_young_gc) {
228-
if (for_young_gc) {
227+
void G1Analytics::report_pending_cards(double pending_cards, bool for_young_only_phase) {
228+
if (for_young_only_phase) {
229229
_young_pending_cards_seq->add(pending_cards);
230230
} else {
231231
_mixed_pending_cards_seq->add(pending_cards);
232232
}
233233
}
234234

235-
void G1Analytics::report_rs_length(double rs_length, bool for_young_gc) {
236-
if (for_young_gc) {
235+
void G1Analytics::report_rs_length(double rs_length, bool for_young_only_phase) {
236+
if (for_young_only_phase) {
237237
_young_rs_length_seq->add(rs_length);
238238
} else {
239239
_mixed_rs_length_seq->add(rs_length);
@@ -256,24 +256,24 @@ double G1Analytics::predict_dirtied_cards_rate_ms() const {
256256
return predict_zero_bounded(_dirtied_cards_rate_ms_seq);
257257
}
258258

259-
size_t G1Analytics::predict_scan_card_num(size_t rs_length, bool for_young_gc) const {
260-
if (for_young_gc || !enough_samples_available(_mixed_card_merge_to_scan_ratio_seq)) {
259+
size_t G1Analytics::predict_scan_card_num(size_t rs_length, bool for_young_only_phase) const {
260+
if (for_young_only_phase || !enough_samples_available(_mixed_card_merge_to_scan_ratio_seq)) {
261261
return (size_t)(rs_length * predict_in_unit_interval(_young_card_merge_to_scan_ratio_seq));
262262
} else {
263263
return (size_t)(rs_length * predict_in_unit_interval(_mixed_card_merge_to_scan_ratio_seq));
264264
}
265265
}
266266

267-
double G1Analytics::predict_card_merge_time_ms(size_t card_num, bool for_young_gc) const {
268-
if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_merge_ms_seq)) {
267+
double G1Analytics::predict_card_merge_time_ms(size_t card_num, bool for_young_only_phase) const {
268+
if (for_young_only_phase || !enough_samples_available(_mixed_cost_per_card_merge_ms_seq)) {
269269
return card_num * predict_zero_bounded(_young_cost_per_card_merge_ms_seq);
270270
} else {
271271
return card_num * predict_zero_bounded(_mixed_cost_per_card_merge_ms_seq);
272272
}
273273
}
274274

275-
double G1Analytics::predict_card_scan_time_ms(size_t card_num, bool for_young_gc) const {
276-
if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_scan_ms_seq)) {
275+
double G1Analytics::predict_card_scan_time_ms(size_t card_num, bool for_young_only_phase) const {
276+
if (for_young_only_phase || !enough_samples_available(_mixed_cost_per_card_scan_ms_seq)) {
277277
return card_num * predict_zero_bounded(_young_cost_per_card_scan_ms_seq);
278278
} else {
279279
return card_num * predict_zero_bounded(_mixed_cost_per_card_scan_ms_seq);
@@ -316,16 +316,16 @@ double G1Analytics::predict_cleanup_time_ms() const {
316316
return predict_zero_bounded(_concurrent_mark_cleanup_times_ms);
317317
}
318318

319-
size_t G1Analytics::predict_rs_length(bool for_young_gc) const {
320-
if (for_young_gc || !enough_samples_available(_mixed_rs_length_seq)) {
319+
size_t G1Analytics::predict_rs_length(bool for_young_only_phase) const {
320+
if (for_young_only_phase || !enough_samples_available(_mixed_rs_length_seq)) {
321321
return predict_size(_young_rs_length_seq) + predict_size(_young_rs_length_diff_seq);
322322
} else {
323323
return predict_size(_mixed_rs_length_seq) + predict_size(_mixed_rs_length_diff_seq);
324324
}
325325
}
326326

327-
size_t G1Analytics::predict_pending_cards(bool for_young_gc) const {
328-
if (for_young_gc || !enough_samples_available(_mixed_pending_cards_seq)) {
327+
size_t G1Analytics::predict_pending_cards(bool for_young_only_phase) const {
328+
if (for_young_only_phase || !enough_samples_available(_mixed_pending_cards_seq)) {
329329
return predict_size(_young_pending_cards_seq);
330330
} else {
331331
return predict_size(_mixed_pending_cards_seq);

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,16 @@ class G1Analytics: public CHeapObj<mtGC> {
126126
void report_alloc_rate_ms(double alloc_rate);
127127
void report_concurrent_refine_rate_ms(double cards_per_ms);
128128
void report_dirtied_cards_rate_ms(double cards_per_ms);
129-
void report_cost_per_card_scan_ms(double cost_per_remset_card_ms, bool for_young_gc);
130-
void report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_gc);
131-
void report_card_merge_to_scan_ratio(double cards_per_entry_ratio, bool for_young_gc);
132-
void report_rs_length_diff(double rs_length_diff, bool for_young_gc);
129+
void report_cost_per_card_scan_ms(double cost_per_remset_card_ms, bool for_young_only_phase);
130+
void report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_only_phase);
131+
void report_card_merge_to_scan_ratio(double cards_per_entry_ratio, bool for_young_only_phase);
132+
void report_rs_length_diff(double rs_length_diff, bool for_young_only_phase);
133133
void report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress);
134134
void report_young_other_cost_per_region_ms(double other_cost_per_region_ms);
135135
void report_non_young_other_cost_per_region_ms(double other_cost_per_region_ms);
136136
void report_constant_other_time_ms(double constant_other_time_ms);
137-
void report_pending_cards(double pending_cards, bool for_young_gc);
138-
void report_rs_length(double rs_length, bool for_young_gc);
137+
void report_pending_cards(double pending_cards, bool for_young_only_phase);
138+
void report_rs_length(double rs_length, bool for_young_only_phase);
139139

140140
double predict_alloc_rate_ms() const;
141141
int num_alloc_rate_ms() const;
@@ -145,10 +145,10 @@ class G1Analytics: public CHeapObj<mtGC> {
145145

146146
// Predict how many of the given remembered set of length rs_length will add to
147147
// the number of total cards scanned.
148-
size_t predict_scan_card_num(size_t rs_length, bool for_young_gc) const;
148+
size_t predict_scan_card_num(size_t rs_length, bool for_young_only_phase) const;
149149

150-
double predict_card_merge_time_ms(size_t card_num, bool for_young_gc) const;
151-
double predict_card_scan_time_ms(size_t card_num, bool for_young_gc) const;
150+
double predict_card_merge_time_ms(size_t card_num, bool for_young_only_phase) const;
151+
double predict_card_scan_time_ms(size_t card_num, bool for_young_only_phase) const;
152152

153153
double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const;
154154

@@ -164,8 +164,8 @@ class G1Analytics: public CHeapObj<mtGC> {
164164

165165
double predict_cleanup_time_ms() const;
166166

167-
size_t predict_rs_length(bool for_young_gc) const;
168-
size_t predict_pending_cards(bool for_young_gc) const;
167+
size_t predict_rs_length(bool for_young_only_phase) const;
168+
size_t predict_pending_cards(bool for_young_only_phase) const;
169169

170170
// Add a new GC of the given duration and end time to the record.
171171
void update_recent_gc_times(double end_time_sec, double elapsed_ms);

src/hotspot/share/gc/g1/g1Policy.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ uint G1Policy::calculate_desired_eden_length_by_mmu() const {
194194
}
195195

196196
void G1Policy::update_young_length_bounds() {
197-
bool for_young_gc = collector_state()->in_young_only_phase();
198-
update_young_length_bounds(_analytics->predict_pending_cards(for_young_gc),
199-
_analytics->predict_rs_length(for_young_gc));
197+
bool for_young_only_phase = collector_state()->in_young_only_phase();
198+
update_young_length_bounds(_analytics->predict_pending_cards(for_young_only_phase),
199+
_analytics->predict_rs_length(for_young_only_phase));
200200
}
201201

202202
void G1Policy::update_young_length_bounds(size_t pending_cards, size_t rs_length) {
@@ -487,7 +487,7 @@ uint G1Policy::calculate_desired_eden_length_before_mixed(double base_time_ms,
487487
double predicted_region_evac_time_ms = base_time_ms;
488488
for (uint i = candidates->cur_idx(); i < min_old_regions_end; i++) {
489489
HeapRegion* r = candidates->at(i);
490-
predicted_region_evac_time_ms += predict_region_total_time_ms(r, false /* for_young_gc */);
490+
predicted_region_evac_time_ms += predict_region_total_time_ms(r, false /* for_young_only_phase */);
491491
}
492492
uint desired_eden_length_by_min_cset_length =
493493
calculate_desired_eden_length_before_young_only(predicted_region_evac_time_ms,
@@ -533,8 +533,8 @@ void G1Policy::revise_young_list_target_length_if_necessary(size_t rs_length) {
533533
}
534534

535535
void G1Policy::update_rs_length_prediction() {
536-
bool for_young_gc = collector_state()->in_young_only_phase();
537-
update_rs_length_prediction(_analytics->predict_rs_length(for_young_gc));
536+
bool for_young_only_phase = collector_state()->in_young_only_phase();
537+
update_rs_length_prediction(_analytics->predict_rs_length(for_young_only_phase));
538538
}
539539

540540
void G1Policy::update_rs_length_prediction(size_t prediction) {
@@ -1033,8 +1033,8 @@ double G1Policy::predict_base_time_ms(size_t pending_cards,
10331033
}
10341034

10351035
double G1Policy::predict_base_time_ms(size_t pending_cards) const {
1036-
bool for_young_gc = collector_state()->in_young_only_phase();
1037-
size_t rs_length = _analytics->predict_rs_length(for_young_gc);
1036+
bool for_young_only_phase = collector_state()->in_young_only_phase();
1037+
size_t rs_length = _analytics->predict_rs_length(for_young_only_phase);
10381038
return predict_base_time_ms(pending_cards, rs_length);
10391039
}
10401040

@@ -1065,9 +1065,9 @@ double G1Policy::predict_region_copy_time_ms(HeapRegion* hr) const {
10651065
}
10661066

10671067
double G1Policy::predict_region_non_copy_time_ms(HeapRegion* hr,
1068-
bool for_young_gc) const {
1068+
bool for_young_only_phase) const {
10691069
size_t rs_length = hr->rem_set()->occupied();
1070-
size_t scan_card_num = _analytics->predict_scan_card_num(rs_length, for_young_gc);
1070+
size_t scan_card_num = _analytics->predict_scan_card_num(rs_length, for_young_only_phase);
10711071

10721072
double region_elapsed_time_ms =
10731073
_analytics->predict_card_merge_time_ms(rs_length, collector_state()->in_young_only_phase()) +
@@ -1083,8 +1083,8 @@ double G1Policy::predict_region_non_copy_time_ms(HeapRegion* hr,
10831083
return region_elapsed_time_ms;
10841084
}
10851085

1086-
double G1Policy::predict_region_total_time_ms(HeapRegion* hr, bool for_young_gc) const {
1087-
return predict_region_non_copy_time_ms(hr, for_young_gc) + predict_region_copy_time_ms(hr);
1086+
double G1Policy::predict_region_total_time_ms(HeapRegion* hr, bool for_young_only_phase) const {
1087+
return predict_region_non_copy_time_ms(hr, for_young_only_phase) + predict_region_copy_time_ms(hr);
10881088
}
10891089

10901090
bool G1Policy::should_allocate_mutator_region() const {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ class G1Policy: public CHeapObj<mtGC> {
147147
public:
148148

149149
double predict_eden_copy_time_ms(uint count, size_t* bytes_to_copy = NULL) const;
150-
double predict_region_non_copy_time_ms(HeapRegion* hr, bool for_young_gc) const;
151-
double predict_region_total_time_ms(HeapRegion* hr, bool for_young_gc) const;
150+
double predict_region_non_copy_time_ms(HeapRegion* hr, bool for_young_only_phase) const;
151+
double predict_region_total_time_ms(HeapRegion* hr, bool for_young_only_phase) const;
152152

153153
void cset_regions_freed() {
154154
bool update = should_update_surv_rate_group_predictors();

src/hotspot/share/gc/g1/g1YoungGCEvacFailureInjector.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void G1YoungGCEvacFailureInjector::select_evac_failure_regions() {
5757
g1h->collection_set_iterate_all(&closure);
5858
}
5959

60-
bool G1YoungGCEvacFailureInjector::arm_if_needed_for_gc_type(bool for_young_gc,
60+
bool G1YoungGCEvacFailureInjector::arm_if_needed_for_gc_type(bool for_young_only_phase,
6161
bool during_concurrent_start,
6262
bool mark_or_rebuild_in_progress) {
6363
bool res = false;
@@ -67,7 +67,7 @@ bool G1YoungGCEvacFailureInjector::arm_if_needed_for_gc_type(bool for_young_gc,
6767
if (during_concurrent_start) {
6868
res |= G1EvacuationFailureALotDuringConcurrentStart;
6969
}
70-
if (for_young_gc) {
70+
if (for_young_only_phase) {
7171
res |= G1EvacuationFailureALotDuringYoungGC;
7272
} else {
7373
// GCs are mixed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class G1YoungGCEvacFailureInjector {
6161
CHeapBitMap _evac_failure_regions;
6262
#endif
6363

64-
bool arm_if_needed_for_gc_type(bool for_young_gc,
64+
bool arm_if_needed_for_gc_type(bool for_young_only_phase,
6565
bool during_concurrent_start,
6666
bool mark_or_rebuild_in_progress) EVAC_FAILURE_INJECTOR_RETURN_( return false; );
6767

src/hotspot/share/gc/g1/heapRegion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void HeapRegion::calc_gc_efficiency() {
147147
// Retrieve a prediction of the elapsed time for this region for
148148
// a mixed gc because the region will only be evacuated during a
149149
// mixed gc.
150-
double region_elapsed_time_ms = policy->predict_region_total_time_ms(this, false /* for_young_gc */);
150+
double region_elapsed_time_ms = policy->predict_region_total_time_ms(this, false /* for_young_only_phase */);
151151
_gc_efficiency = (double) reclaimable_bytes() / region_elapsed_time_ms;
152152
}
153153

0 commit comments

Comments
 (0)