8133553: Running with -XX:+UseParallelGC -XX:OldSize=30k crashes jvm
authordavid
Mon, 17 Aug 2015 10:43:11 +0200
changeset 32362 a487889ff52d
parent 32361 3de9a2e1e2d0
child 32364 be09a00c9e75
8133553: Running with -XX:+UseParallelGC -XX:OldSize=30k crashes jvm Reviewed-by: jwilhelm, sjohanss
hotspot/src/share/vm/gc/shared/collectorPolicy.cpp
hotspot/src/share/vm/gc/shared/collectorPolicy.hpp
--- a/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp	Mon Jun 29 11:11:12 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp	Mon Aug 17 10:43:11 2015 +0200
@@ -225,6 +225,10 @@
   return align_size_up(3 * _space_alignment, _gen_alignment);
 }
 
+size_t GenCollectorPolicy::old_gen_size_lower_bound() {
+  return align_size_up(_space_alignment, _gen_alignment);
+}
+
 #ifdef ASSERT
 void GenCollectorPolicy::assert_flags() {
   CollectorPolicy::assert_flags();
@@ -284,7 +288,7 @@
 
   // Make sure the heap is large enough for two generations
   size_t smallest_new_size = young_gen_size_lower_bound();
-  size_t smallest_heap_size = align_size_up(smallest_new_size + align_size_up(_space_alignment, _gen_alignment),
+  size_t smallest_heap_size = align_size_up(smallest_new_size + old_gen_size_lower_bound(),
                                            _heap_alignment);
   if (MaxHeapSize < smallest_heap_size) {
     FLAG_SET_ERGO(size_t, MaxHeapSize, smallest_heap_size);
@@ -356,6 +360,7 @@
     vm_exit_during_initialization("Invalid young gen ratio specified");
   }
 
+  OldSize = MAX2(OldSize, old_gen_size_lower_bound());
   if (!is_size_aligned(OldSize, _gen_alignment)) {
     // Setting OldSize directly to preserve information about the possible
     // setting of OldSize on the command line.
--- a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp	Mon Jun 29 11:11:12 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp	Mon Aug 17 10:43:11 2015 +0200
@@ -282,6 +282,8 @@
 
   size_t young_gen_size_lower_bound();
 
+  size_t old_gen_size_lower_bound();
+
   HeapWord* mem_allocate_work(size_t size,
                               bool is_tlab,
                               bool* gc_overhead_limit_was_exceeded);