Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 1610:79107c3a6bd5
6949307: G1: raise a vm error, do not core dump, if target pause time and target interval are inconsistent
Summary: First, change the guarantee to raising a vm error. Second, set the interval dynamically, and based on the pause time target, if it is not set explicitly.
Reviewed-by: ysr, johnc
author | tonyp |
---|---|
date | Fri, 07 May 2010 13:14:41 -0400 |
parents | e9ff18c4ace7 |
children | 215576b54709 |
comparison
equal
deleted
inserted
replaced
1594:b9bc732be7c0 | 1610:79107c3a6bd5 |
---|---|
272 _non_young_other_cost_per_region_ms_seq->add( | 272 _non_young_other_cost_per_region_ms_seq->add( |
273 non_young_other_cost_per_region_ms_defaults[index]); | 273 non_young_other_cost_per_region_ms_defaults[index]); |
274 | 274 |
275 // </NEW PREDICTION> | 275 // </NEW PREDICTION> |
276 | 276 |
277 // Below, we might need to calculate the pause time target based on | |
278 // the pause interval. When we do so we are going to give G1 maximum | |
279 // flexibility and allow it to do pauses when it needs to. So, we'll | |
280 // arrange that the pause interval to be pause time target + 1 to | |
281 // ensure that a) the pause time target is maximized with respect to | |
282 // the pause interval and b) we maintain the invariant that pause | |
283 // time target < pause interval. If the user does not want this | |
284 // maximum flexibility, they will have to set the pause interval | |
285 // explicitly. | |
286 | |
287 // First make sure that, if either parameter is set, its value is | |
288 // reasonable. | |
289 if (!FLAG_IS_DEFAULT(MaxGCPauseMillis)) { | |
290 if (MaxGCPauseMillis < 1) { | |
291 vm_exit_during_initialization("MaxGCPauseMillis should be " | |
292 "greater than 0"); | |
293 } | |
294 } | |
295 if (!FLAG_IS_DEFAULT(GCPauseIntervalMillis)) { | |
296 if (GCPauseIntervalMillis < 1) { | |
297 vm_exit_during_initialization("GCPauseIntervalMillis should be " | |
298 "greater than 0"); | |
299 } | |
300 } | |
301 | |
302 // Then, if the pause time target parameter was not set, set it to | |
303 // the default value. | |
304 if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) { | |
305 if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) { | |
306 // The default pause time target in G1 is 200ms | |
307 FLAG_SET_DEFAULT(MaxGCPauseMillis, 200); | |
308 } else { | |
309 // We do not allow the pause interval to be set without the | |
310 // pause time target | |
311 vm_exit_during_initialization("GCPauseIntervalMillis cannot be set " | |
312 "without setting MaxGCPauseMillis"); | |
313 } | |
314 } | |
315 | |
316 // Then, if the interval parameter was not set, set it according to | |
317 // the pause time target (this will also deal with the case when the | |
318 // pause time target is the default value). | |
319 if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) { | |
320 FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1); | |
321 } | |
322 | |
323 // Finally, make sure that the two parameters are consistent. | |
324 if (MaxGCPauseMillis >= GCPauseIntervalMillis) { | |
325 char buffer[256]; | |
326 jio_snprintf(buffer, 256, | |
327 "MaxGCPauseMillis (%u) should be less than " | |
328 "GCPauseIntervalMillis (%u)", | |
329 MaxGCPauseMillis, GCPauseIntervalMillis); | |
330 vm_exit_during_initialization(buffer); | |
331 } | |
332 | |
333 double max_gc_time = (double) MaxGCPauseMillis / 1000.0; | |
277 double time_slice = (double) GCPauseIntervalMillis / 1000.0; | 334 double time_slice = (double) GCPauseIntervalMillis / 1000.0; |
278 double max_gc_time = (double) MaxGCPauseMillis / 1000.0; | |
279 guarantee(max_gc_time < time_slice, | |
280 "Max GC time should not be greater than the time slice"); | |
281 _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time); | 335 _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time); |
282 _sigma = (double) G1ConfidencePercent / 100.0; | 336 _sigma = (double) G1ConfidencePercent / 100.0; |
283 | 337 |
284 // start conservatively (around 50ms is about right) | 338 // start conservatively (around 50ms is about right) |
285 _concurrent_mark_init_times_ms->add(0.05); | 339 _concurrent_mark_init_times_ms->add(0.05); |