src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp

Print this page
rev 7622 : 8068739: G1CollectorPolicy uses uninitialized field '_sigma' in the constructor
Reviewed-by: simonis
Contributed-by: johannes.scheerer@sap.com


 136   _heap_capacity_bytes_before_gc(0),
 137 
 138   _eden_cset_region_length(0),
 139   _survivor_cset_region_length(0),
 140   _old_cset_region_length(0),
 141 
 142   _collection_set(NULL),
 143   _collection_set_bytes_used_before(0),
 144 
 145   // Incremental CSet attributes
 146   _inc_cset_build_state(Inactive),
 147   _inc_cset_head(NULL),
 148   _inc_cset_tail(NULL),
 149   _inc_cset_bytes_used_before(0),
 150   _inc_cset_max_finger(NULL),
 151   _inc_cset_recorded_rs_lengths(0),
 152   _inc_cset_recorded_rs_lengths_diffs(0),
 153   _inc_cset_predicted_elapsed_time_ms(0.0),
 154   _inc_cset_predicted_elapsed_time_ms_diffs(0.0),
 155 
 156 #ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away
 157 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
 158 #endif // _MSC_VER
 159 
 160   _short_lived_surv_rate_group(new SurvRateGroup(this, "Short Lived",
 161                                                  G1YoungSurvRateNumRegionsSummary)),
 162   _survivor_surv_rate_group(new SurvRateGroup(this, "Survivor",
 163                                               G1YoungSurvRateNumRegionsSummary)),
 164   // add here any more surv rate groups
 165   _recorded_survivor_regions(0),
 166   _recorded_survivor_head(NULL),
 167   _recorded_survivor_tail(NULL),
 168   _survivors_age_table(true),
 169 
 170   _gc_overhead_perc(0.0) {
 171 
















 172   // Set up the region size and associated fields. Given that the
 173   // policy is created before the heap, we have to set this up here,
 174   // so it's done as soon as possible.
 175 
 176   // It would have been natural to pass initial_heap_byte_size() and
 177   // max_heap_byte_size() to setup_heap_region_size() but those have
 178   // not been set up at this point since they should be aligned with
 179   // the region size. So, there is a circular dependency here. We base
 180   // the region size on the heap size, but the heap size should be
 181   // aligned with the region size. To get around this we use the
 182   // unaligned values for the heap.
 183   HeapRegion::setup_heap_region_size(InitialHeapSize, MaxHeapSize);
 184   HeapRegionRemSet::setup_remset_size();
 185 
 186   G1ErgoVerbose::initialize();
 187   if (PrintAdaptiveSizePolicy) {
 188     // Currently, we only use a single switch for all the heuristics.
 189     G1ErgoVerbose::set_enabled(true);
 190     // Given that we don't currently have a verboseness level
 191     // parameter, we'll hardcode this to high. This can be easily


 265   // Then, if the interval parameter was not set, set it according to
 266   // the pause time target (this will also deal with the case when the
 267   // pause time target is the default value).
 268   if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
 269     FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1);
 270   }
 271 
 272   // Finally, make sure that the two parameters are consistent.
 273   if (MaxGCPauseMillis >= GCPauseIntervalMillis) {
 274     char buffer[256];
 275     jio_snprintf(buffer, 256,
 276                  "MaxGCPauseMillis (%u) should be less than "
 277                  "GCPauseIntervalMillis (%u)",
 278                  MaxGCPauseMillis, GCPauseIntervalMillis);
 279     vm_exit_during_initialization(buffer);
 280   }
 281 
 282   double max_gc_time = (double) MaxGCPauseMillis / 1000.0;
 283   double time_slice  = (double) GCPauseIntervalMillis / 1000.0;
 284   _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time);
 285 
 286   uintx confidence_perc = G1ConfidencePercent;
 287   // Put an artificial ceiling on this so that it's not set to a silly value.
 288   if (confidence_perc > 100) {
 289     confidence_perc = 100;
 290     warning("G1ConfidencePercent is set to a value that is too large, "
 291             "it's been updated to %u", confidence_perc);
 292   }
 293   _sigma = (double) confidence_perc / 100.0;
 294 
 295   // start conservatively (around 50ms is about right)
 296   _concurrent_mark_remark_times_ms->add(0.05);
 297   _concurrent_mark_cleanup_times_ms->add(0.20);
 298   _tenuring_threshold = MaxTenuringThreshold;
 299   // _max_survivor_regions will be calculated by
 300   // update_young_list_target_length() during initialization.
 301   _max_survivor_regions = 0;
 302 
 303   assert(GCTimeRatio > 0,
 304          "we should have set it to a default value set_g1_gc_flags() "
 305          "if a user set it to 0");
 306   _gc_overhead_perc = 100.0 * (1.0 / (1.0 + GCTimeRatio));
 307 
 308   uintx reserve_perc = G1ReservePercent;
 309   // Put an artificial ceiling on this so that it's not set to a silly value.
 310   if (reserve_perc > 50) {
 311     reserve_perc = 50;
 312     warning("G1ReservePercent is set to a value that is too large, "
 313             "it's been updated to %u", reserve_perc);




 136   _heap_capacity_bytes_before_gc(0),
 137 
 138   _eden_cset_region_length(0),
 139   _survivor_cset_region_length(0),
 140   _old_cset_region_length(0),
 141 
 142   _collection_set(NULL),
 143   _collection_set_bytes_used_before(0),
 144 
 145   // Incremental CSet attributes
 146   _inc_cset_build_state(Inactive),
 147   _inc_cset_head(NULL),
 148   _inc_cset_tail(NULL),
 149   _inc_cset_bytes_used_before(0),
 150   _inc_cset_max_finger(NULL),
 151   _inc_cset_recorded_rs_lengths(0),
 152   _inc_cset_recorded_rs_lengths_diffs(0),
 153   _inc_cset_predicted_elapsed_time_ms(0.0),
 154   _inc_cset_predicted_elapsed_time_ms_diffs(0.0),
 155 








 156   // add here any more surv rate groups
 157   _recorded_survivor_regions(0),
 158   _recorded_survivor_head(NULL),
 159   _recorded_survivor_tail(NULL),
 160   _survivors_age_table(true),
 161 
 162   _gc_overhead_perc(0.0) {
 163 
 164   uintx confidence_perc = G1ConfidencePercent;
 165   // Put an artificial ceiling on this so that it's not set to a silly value.
 166   if (confidence_perc > 100) {
 167     confidence_perc = 100;
 168     warning("G1ConfidencePercent is set to a value that is too large, "
 169             "it's been updated to %u", confidence_perc);
 170   }
 171   // '_sigma' must be initialized before the SurvRateGroups below because they
 172   // indirecty access '_sigma' trough the 'this' pointer in their constructor.
 173   _sigma = (double) confidence_perc / 100.0;
 174 
 175   _short_lived_surv_rate_group =
 176     new SurvRateGroup(this, "Short Lived", G1YoungSurvRateNumRegionsSummary);
 177   _survivor_surv_rate_group =
 178     new SurvRateGroup(this, "Survivor", G1YoungSurvRateNumRegionsSummary);
 179 
 180   // Set up the region size and associated fields. Given that the
 181   // policy is created before the heap, we have to set this up here,
 182   // so it's done as soon as possible.
 183 
 184   // It would have been natural to pass initial_heap_byte_size() and
 185   // max_heap_byte_size() to setup_heap_region_size() but those have
 186   // not been set up at this point since they should be aligned with
 187   // the region size. So, there is a circular dependency here. We base
 188   // the region size on the heap size, but the heap size should be
 189   // aligned with the region size. To get around this we use the
 190   // unaligned values for the heap.
 191   HeapRegion::setup_heap_region_size(InitialHeapSize, MaxHeapSize);
 192   HeapRegionRemSet::setup_remset_size();
 193 
 194   G1ErgoVerbose::initialize();
 195   if (PrintAdaptiveSizePolicy) {
 196     // Currently, we only use a single switch for all the heuristics.
 197     G1ErgoVerbose::set_enabled(true);
 198     // Given that we don't currently have a verboseness level
 199     // parameter, we'll hardcode this to high. This can be easily


 273   // Then, if the interval parameter was not set, set it according to
 274   // the pause time target (this will also deal with the case when the
 275   // pause time target is the default value).
 276   if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
 277     FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1);
 278   }
 279 
 280   // Finally, make sure that the two parameters are consistent.
 281   if (MaxGCPauseMillis >= GCPauseIntervalMillis) {
 282     char buffer[256];
 283     jio_snprintf(buffer, 256,
 284                  "MaxGCPauseMillis (%u) should be less than "
 285                  "GCPauseIntervalMillis (%u)",
 286                  MaxGCPauseMillis, GCPauseIntervalMillis);
 287     vm_exit_during_initialization(buffer);
 288   }
 289 
 290   double max_gc_time = (double) MaxGCPauseMillis / 1000.0;
 291   double time_slice  = (double) GCPauseIntervalMillis / 1000.0;
 292   _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time);









 293 
 294   // start conservatively (around 50ms is about right)
 295   _concurrent_mark_remark_times_ms->add(0.05);
 296   _concurrent_mark_cleanup_times_ms->add(0.20);
 297   _tenuring_threshold = MaxTenuringThreshold;
 298   // _max_survivor_regions will be calculated by
 299   // update_young_list_target_length() during initialization.
 300   _max_survivor_regions = 0;
 301 
 302   assert(GCTimeRatio > 0,
 303          "we should have set it to a default value set_g1_gc_flags() "
 304          "if a user set it to 0");
 305   _gc_overhead_perc = 100.0 * (1.0 / (1.0 + GCTimeRatio));
 306 
 307   uintx reserve_perc = G1ReservePercent;
 308   // Put an artificial ceiling on this so that it's not set to a silly value.
 309   if (reserve_perc > 50) {
 310     reserve_perc = 50;
 311     warning("G1ReservePercent is set to a value that is too large, "
 312             "it's been updated to %u", reserve_perc);