8000311: G1: ParallelGCThreads==0 broken

Divide by zero error, if ParallelGCThreads is 0, when adjusting the PLAB size.

Reviewed-by: jmasa, jcoomes
This commit is contained in:
John Cuthbertson 2012-10-04 10:04:13 -07:00
parent 3506d44c57
commit ed98ea0a88
5 changed files with 30 additions and 31 deletions

View file

@ -87,7 +87,7 @@ void ParGCAllocBuffer::flush_stats(PLABStats* stats) {
// Compute desired plab size and latch result for later
// use. This should be called once at the end of parallel
// scavenge; it clears the sensor accumulators.
void PLABStats::adjust_desired_plab_sz() {
void PLABStats::adjust_desired_plab_sz(uint no_of_gc_workers) {
assert(ResizePLAB, "Not set");
if (_allocated == 0) {
assert(_unused == 0,
@ -107,7 +107,7 @@ void PLABStats::adjust_desired_plab_sz() {
target_refills = 1;
}
_used = _allocated - _wasted - _unused;
size_t plab_sz = _used/(target_refills*ParallelGCThreads);
size_t plab_sz = _used/(target_refills*no_of_gc_workers);
if (PrintPLAB) gclog_or_tty->print(" (plab_sz = %d ", plab_sz);
// Take historical weighted average
_filter.sample(plab_sz);

View file

@ -204,7 +204,8 @@ class PLABStats VALUE_OBJ_CLASS_SPEC {
return _desired_plab_sz;
}
void adjust_desired_plab_sz(); // filter computation, latches output to
void adjust_desired_plab_sz(uint no_of_gc_workers);
// filter computation, latches output to
// _desired_plab_sz, clears sensor accumulators
void add_allocated(size_t v) {