# HG changeset patch # User simonis # Date 1420827442 -3600 # Fri Jan 09 19:17:22 2015 +0100 # Node ID 06931eedd92dc611cb9f2baf9de8f1385fbdd759 # Parent b32eb9966732187422f1c9c7b653cc474c67ca01 8068739: G1CollectorPolicy uses uninitialized field '_sigma' in the constructor Reviewed-by: simonis Contributed-by: johannes.scheerer@sap.com diff --git a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -153,14 +153,6 @@ _inc_cset_predicted_elapsed_time_ms(0.0), _inc_cset_predicted_elapsed_time_ms_diffs(0.0), -#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away -#pragma warning( disable:4355 ) // 'this' : used in base member initializer list -#endif // _MSC_VER - - _short_lived_surv_rate_group(new SurvRateGroup(this, "Short Lived", - G1YoungSurvRateNumRegionsSummary)), - _survivor_surv_rate_group(new SurvRateGroup(this, "Survivor", - G1YoungSurvRateNumRegionsSummary)), // add here any more surv rate groups _recorded_survivor_regions(0), _recorded_survivor_head(NULL), @@ -169,6 +161,22 @@ _gc_overhead_perc(0.0) { + uintx confidence_perc = G1ConfidencePercent; + // Put an artificial ceiling on this so that it's not set to a silly value. + if (confidence_perc > 100) { + confidence_perc = 100; + warning("G1ConfidencePercent is set to a value that is too large, " + "it's been updated to %u", confidence_perc); + } + // '_sigma' must be initialized before the SurvRateGroups below because they + // indirecty access '_sigma' trough the 'this' pointer in their constructor. + _sigma = (double) confidence_perc / 100.0; + + _short_lived_surv_rate_group = + new SurvRateGroup(this, "Short Lived", G1YoungSurvRateNumRegionsSummary); + _survivor_surv_rate_group = + new SurvRateGroup(this, "Survivor", G1YoungSurvRateNumRegionsSummary); + // Set up the region size and associated fields. Given that the // policy is created before the heap, we have to set this up here, // so it's done as soon as possible. @@ -283,15 +291,6 @@ double time_slice = (double) GCPauseIntervalMillis / 1000.0; _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time); - uintx confidence_perc = G1ConfidencePercent; - // Put an artificial ceiling on this so that it's not set to a silly value. - if (confidence_perc > 100) { - confidence_perc = 100; - warning("G1ConfidencePercent is set to a value that is too large, " - "it's been updated to %u", confidence_perc); - } - _sigma = (double) confidence_perc / 100.0; - // start conservatively (around 50ms is about right) _concurrent_mark_remark_times_ms->add(0.05); _concurrent_mark_cleanup_times_ms->add(0.20);