g1CollectorPolicy.cpp revision 1086
0N/A#include "incls/_g1CollectorPolicy.cpp.incl"
0N/A#define PREDICTIONS_VERBOSE 0
0N/Astatic double rs_length_diff_defaults[] = {
0N/Astatic double cost_per_card_ms_defaults[] = {
0N/Astatic double cost_per_scan_only_region_ms_defaults[] = {
0N/Astatic double fully_young_cards_per_entry_ratio_defaults[] = {
0N/Astatic double cost_per_entry_ms_defaults[] = {
0N/Astatic double cost_per_byte_ms_defaults[] = {
0N/Astatic double constant_other_time_ms_defaults[] = {
0N/Astatic double young_other_cost_per_region_ms_defaults[] = {
0N/Astatic double non_young_other_cost_per_region_ms_defaults[] = {
0N/A _num_cc_clears(0L),
0N/A _in_young_gc_mode(false),
0N/A _full_young_gcs(true),
0N/A _during_marking(false),
0N/A _in_marking_window(false),
0N/A _in_marking_window_im(false),
_num_markings(0),
_n_marks(0),
_conc_mark_initiated(false),
_should_initiate_conc_mark(false),
_should_revert_to_full_young_gcs(false),
_last_full_young_gc(false),
_survivors_age_table(true)
int index;
if (ParallelGCThreads == 0)
index = 0;
if (G1UseSurvivorSpaces) {
i++; if (i == len) i = 0;
if (G1Gen) {
_in_young_gc_mode = true;
if (G1YoungGenSize == 0) {
set_adaptive_young_list_length(false);
_in_young_gc_mode = false;
if (!adaptive_young_list_length())
if (adaptive_young_list_length()) {
if (full_young_gcs())
if (!G1UseScanOnlyPrefix)
if (full_young_gcs())
so_length = i;
double survivor_regions_evac_time =
if (G1UseScanOnlyPrefix) {
min_so_length = 0;
max_so_length = 0;
min_so_length = 0;
max_so_length = 0;
min_so_length = 0;
min_so_length = 0;
max_so_length = 0;
if (full_young_gcs())
} pass_type_t;
bool done = false;
while (!done) {
#ifdef TRACE_CALC_YOUNG_CONFIG
bool gc_eff_set = false;
double base_time_with_so_ms =
double min_gc_eff;
bool min_ok;
++calculations;
&min_gc_eff);
if (min_ok) {
bool max_ok = false;
++calculations;
&max_gc_eff);
if (max_ok) {
min_ok = true;
gc_eff_set = true;
if (!gc_eff_set)
done = true;
#ifdef TRACE_CALC_YOUNG_CONFIG
if (!gc_eff_set) {
done = true;
if (final_so_length == 0) {
done = true;
#ifdef TRACE_CALC_YOUNG_CONFIG
if (!gc_eff_set)
done = true;
final_so_length = 0;
#ifdef TRACE_CALC_YOUNG_CONFIG
#ifdef TRACE_CALC_YOUNG_CONFIG
#ifdef TRACE_CALC_YOUNG_CONFIG
double base_time_ms,
double* ret_gc_eff,
double* ret_pause_time_ms) {
if (so_length > 0)
double accum_surv_rate =
double young_other_time_ms =
double pause_time_ms =
double base_time_with_so_ms,
double target_pause_time_ms,
double* ret_gc_eff) {
if (so_length > 0)
double accum_surv_rate =
double young_other_time_ms =
double pause_time_ms =
r = r->get_next_young_region()) {
return survivor_regions_evac_time;
bool is_tlab,
bool* gc_overhead_limit_was_exceeded) {
return NULL;
bool is_tlab) {
return NULL;
#ifndef PRODUCT
bool ret = true;
ret = false;
if (age < 0) {
ret = false;
ret = false;
return ret;
set_full_young_gcs(true);
_last_full_young_gc = false;
_should_revert_to_full_young_gcs = false;
_should_initiate_conc_mark = false;
_known_garbage_bytes = 0;
_in_marking_window = false;
_in_marking_window_im = false;
if (PrintGCDetails) {
if (in_young_gc_mode())
#ifdef DEBUG
for (int i = 0; i < _parallel_gc_threads; ++i) {
for (int i = 0; i < _aux_num; ++i) {
_cur_aux_times_set[i] = false;
_satb_drain_time_set = false;
if (in_young_gc_mode())
_last_young_gc_full = false;
if (G1UseSurvivorSpaces) {
if (finished_short_lived)
finished_short_lived = true;
if (finished_short_lived)
_during_marking = true;
_should_initiate_conc_mark = false;
_during_marking = false;
if (G1PolicyVerbose > 0)
_conc_mark_initiated = false;
if (in_young_gc_mode()) {
_should_revert_to_full_young_gcs = false;
_last_full_young_gc = true;
_in_marking_window = false;
if (adaptive_young_list_length())
T sum = (T)0;
int j = (start + i) % N;
return sum;
const char* str,
double* data,
bool summary) {
for (j = 0; j < level; ++j)
if (summary) {
for (j = 0; j < level; ++j)
const char* str,
double* data,
bool summary) {
for (j = 0; j < level; ++j)
if (summary) {
for (j = 0; j < level; ++j)
const char* str,
double value) {
for (int j = 0; j < level; ++j)
const char* str,
int value) {
for (int j = 0; j < level; ++j)
if (ParallelGCThreads > 0) {
return data[0];
if (ParallelGCThreads > 0) {
return ret;
return data[0];
if (ParallelGCThreads > 0) {
return sum;
return data[0];
double* data2) {
if (ParallelGCThreads > 0) {
return ret;
bool last_pause_included_initial_mark = false;
#ifndef PRODUCT
if (G1YoungSurvRateVerbose) {
if (in_young_gc_mode()) {
_should_initiate_conc_mark = true;
end_time_sec, false);
double survival_fraction =
(double)surviving_bytes/
(double)_collection_set_bytes_used_before;
_n_pauses++;
if (update_stats) {
double app_time_ms =
double interval_ms =
#ifndef PRODUCT
if (abandoned) {
double scan_only_regions_scanned =
double update_rs_processed_buffers =
if (update_stats) {
if (_satb_drain_time_set)
if (parallel) {
rs_size);
if (!abandoned) {
if (_satb_drain_time_set)
if (parallel)
if (PrintGCDetails) {
if (!abandoned) {
if (_satb_drain_time_set) {
if (_last_satb_drain_processed_buffers >= 0) {
if (parallel) {
(int)update_rs_processed_buffers);
#ifndef PRODUCT
if (_num_cc_clears > 0) {
for (int i = 0; i < _aux_num; ++i) {
if (_cur_aux_times_set[i]) {
if (PrintGCDetails)
if (PrintGCDetails)
if (update_stats) {
for (int i = 0; i < _aux_num; ++i)
if (_cur_aux_times_set[i])
bool new_in_marking_window_im = false;
if (_should_initiate_conc_mark) {
new_in_marking_window = true;
new_in_marking_window_im = true;
if (in_young_gc_mode()) {
if (_last_full_young_gc) {
set_full_young_gcs(false);
_last_full_young_gc = false;
if ( !_last_young_gc_full ) {
if ( _should_revert_to_full_young_gcs ||
set_full_young_gcs(true);
_should_revert_to_full_young_gcs = false;
if (update_stats) {
if (_pending_cards > 0) {
if (_last_young_gc_full)
if (_max_rs_lengths > 0) {
double cards_per_entry_ratio =
if (_last_young_gc_full)
if (rs_length_diff >= 0)
if (copied_bytes > 0) {
if (_in_marking_window)
if (_recorded_young_regions > 0) {
(double) _recorded_young_regions);
if (_recorded_non_young_regions > 0) {
(double) _recorded_non_young_regions);
if (_bytes_in_collection_set_before_gc > 0) {
(double) _bytes_in_collection_set_before_gc;
double expensive_region_limit_ms =
if (PREDICTIONS_VERBOSE) {
if (G1PolicyVerbose > 0) {
if (young_num == 0)
if (full_young_gcs())
double accum_yg_surv_rate =
if (full_young_gcs())
bool young) {
if (full_young_gcs())
double region_elapsed_time_ms =
if (young)
return region_elapsed_time_ms;
return bytes_to_copy;
_recorded_rs_lengths = 0;
if (young) {
if (young) {
if (full_young_gcs())
if (!in_young_gc_mode()) {
set_full_young_gcs(true);
_should_initiate_conc_mark = true;
_should_revert_to_full_young_gcs = true;
double elapsed_ms) {
return recent_survival_rate;
return last_survival_rate;
double latest) {
return res;
return expand_bytes;
const char* str,
const char* str,
bool should_print = false;
should_print = true;
should_print = true;
should_print = true;
should_print = true;
if (should_print)
if (parallel) {
if (parallel) {
print_indent(0);
bool printed = false;
printed = true;
if (!printed) {
print_indent(0);
if (TraceGen0Time) {
for (int i = 0; i < _aux_num; ++i) {
if (TraceGen1Time) {
#ifndef PRODUCT
bool ret;
if (G1FixedEdenSize) {
ret = true;
ret = false;
return ret;
#ifndef PRODUCT
return buffer;
switch (purpose) {
case GCAllocForSurvived:
return _max_survivor_regions;
case GCAllocForTenured:
return REGIONS_UNLIMITED;
return REGIONS_UNLIMITED;
if (!G1UseSurvivorSpaces) {
if (G1FixedSurvivorSpaceSize == 0) {
if (G1FixedTenuringThreshold) {
word_size) {
if (G1FixedEdenSize) {
if (in_young_gc_mode()) {
if (reached_target_length) {
#ifndef PRODUCT
if (!r->continuesHumongous()) {
if (!r->in_collection_set()) {
_res = r;
if (r->is_marked()) {
int _worker;
int _invokes;
void get_new_chunk() {
int worker) :
_invokes(0)
_invokes++;
if (r->is_marked()) {
add_region(r);
void work(int i) {
if (G1PrintParCleanupStats) {
double start;
double clear_marked_end;
if (G1PrintParCleanupStats) {
if (ParallelGCThreads > 0) {
(int) ChunkSize);
double known_garbage_end;
if (G1PrintParCleanupStats) {
double sort_end;
if (G1PrintParCleanupStats) {
double work2_end;
if (G1PrintParCleanupStats) {
void G1CollectorPolicy::
if (G1PrintRegions) {
double non_young_start_time_sec;
_within_target = false;
_within_target = true;
_collection_set_size = 0;
if (in_young_gc_mode()) {
if (G1PolicyVerbose > 0) {
_young_cset_length = 0;
if (_last_young_gc_full)
if (G1PolicyVerbose > 0) {
max_live_bytes/K);
bool should_continue = true;
if (G1PolicyVerbose > 0) {
max_live_bytes/K);
} while (should_continue);
if (!adaptive_young_list_length() &&
_should_revert_to_full_young_gcs = true;