Both _recent_avg_pause_time_ratio and _last_pause_time_ratio are missing from the initialization list, and in effect will leave these fields uninitialized.
The following is a potential use before initialization situation:
---
{
size_t expand_bytes = _heap_sizing_policy->expansion_amount(); // USED HERE
if (expand_bytes > 0) {
size_t bytes_before = capacity();
// No need for an ergo logging here,
// expansion_amount() does this when it returns a value > 0.
double expand_ms;
if (!expand(expand_bytes, _workers, &expand_ms)) {
// We failed to expand the heap. Cannot do anything about it.
}
g1_policy()->phase_times()->record_expand_heap_time(expand_ms);
}
}
// We redo the verification but now wrt to the new CSet which
// has just got initialized after the previous CSet was freed.
_cm->verify_no_cset_oops();
// This timing is only used by the ergonomics to handle our pause target.
// It is unclear why this should not include the full pause. We will
// investigate this in CR 7178365.
double sample_end_time_sec = os::elapsedTime();
double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
size_t total_cards_scanned = per_thread_states.total_cards_scanned();
g1_policy()->record_collection_pause_end(pause_time_ms, total_cards_scanned, heap_used_bytes_before_gc); // SET HERE
---
do_collection_pause_at_safepoint
record_collection_pause_end
compute_pause_time_ratio
sets _recent_avg_pause_time_ratio
---
do_collection_pause_at_safepoint
expansion_amount
reads _recent_avg_pause_time_ratio
_recent_avg_pause_time_ratio(),
_last_pause_time_ratio()
The following is a potential use before initialization situation:
---
{
size_t expand_bytes = _heap_sizing_policy->expansion_amount(); // USED HERE
if (expand_bytes > 0) {
size_t bytes_before = capacity();
// No need for an ergo logging here,
// expansion_amount() does this when it returns a value > 0.
double expand_ms;
if (!expand(expand_bytes, _workers, &expand_ms)) {
// We failed to expand the heap. Cannot do anything about it.
}
g1_policy()->phase_times()->record_expand_heap_time(expand_ms);
}
}
// We redo the verification but now wrt to the new CSet which
// has just got initialized after the previous CSet was freed.
_cm->verify_no_cset_oops();
// This timing is only used by the ergonomics to handle our pause target.
// It is unclear why this should not include the full pause. We will
// investigate this in CR 7178365.
double sample_end_time_sec = os::elapsedTime();
double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
size_t total_cards_scanned = per_thread_states.total_cards_scanned();
g1_policy()->record_collection_pause_end(pause_time_ms, total_cards_scanned, heap_used_bytes_before_gc); // SET HERE
---
do_collection_pause_at_safepoint
record_collection_pause_end
compute_pause_time_ratio
sets _recent_avg_pause_time_ratio
---
do_collection_pause_at_safepoint
expansion_amount
reads _recent_avg_pause_time_ratio
_recent_avg_pause_time_ratio(),
_last_pause_time_ratio()