diff src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp @ 6819:2e6857353b2c

8000311: G1: ParallelGCThreads==0 broken Summary: Divide by zero error, if ParallelGCThreads is 0, when adjusting the PLAB size. Reviewed-by: jmasa, jcoomes
author johnc
date Thu, 04 Oct 2012 10:04:13 -0700
parents b2ef234911c9
children 63a4eb8bcd23 cfd4aac53239
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Wed Oct 03 20:31:41 2012 +0200
+++ b/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Thu Oct 04 10:04:13 2012 -0700
@@ -87,7 +87,7 @@
 // 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 @@
     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);