8129573: CollectedHeap::fill_with_objects() needs to use multiple arrays in 32 bit mode too
authortschatzl
Thu, 25 Jun 2015 09:06:35 +0200
changeset 31603 4bd3b4863e10
parent 31602 5eb5efabf50b
child 31604 5d0a8a6d6570
8129573: CollectedHeap::fill_with_objects() needs to use multiple arrays in 32 bit mode too Summary: In JDK-8042668 we introduced a custom fill threshold for G1. This leads to CollectedHeap::fill_with_objects create too large objects in G1 when using it in 32 bit mode, as the code to create multiple filler objects is IFDEF'ed out on 32 bit. Enable this code on 32 bit too. Reviewed-by: tonyp, mgerdin, tbenson
hotspot/src/share/vm/gc/shared/collectedHeap.cpp
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Thu Jun 25 09:04:28 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Thu Jun 25 09:06:35 2015 +0200
@@ -488,19 +488,17 @@
   DEBUG_ONLY(fill_args_check(start, words);)
   HandleMark hm;  // Free handles before leaving.
 
-#ifdef _LP64
-  // A single array can fill ~8G, so multiple objects are needed only in 64-bit.
-  // First fill with arrays, ensuring that any remaining space is big enough to
-  // fill.  The remainder is filled with a single object.
+  // Multiple objects may be required depending on the filler array maximum size. Fill
+  // the range up to that with objects that are filler_array_max_size sized. The
+  // remainder is filled with a single object.
   const size_t min = min_fill_size();
   const size_t max = filler_array_max_size();
   while (words > max) {
-    const size_t cur = words - max >= min ? max : max - min;
+    const size_t cur = (words - max) >= min ? max : max - min;
     fill_with_array(start, cur, zap);
     start += cur;
     words -= cur;
   }
-#endif
 
   fill_with_object_impl(start, words, zap);
 }