8224247: AllocateOldGenAt fires assertion failure
authorkkharbas
Mon, 03 Jun 2019 11:04:24 -0700
changeset 55161 1a7f82c98eee
parent 55160 a8ee59471f55
child 55162 030c32236ba3
8224247: AllocateOldGenAt fires assertion failure Summary: Split the heap_reserved_size_bytes() into two methods - one for use during heap initialization and other for at later stages. Reviewed-by: sangheki, tschatzl
src/hotspot/share/gc/g1/g1Arguments.cpp
src/hotspot/share/gc/g1/g1Arguments.hpp
src/hotspot/share/gc/g1/heapRegionManager.cpp
src/hotspot/share/gc/parallel/adjoiningGenerationsForHeteroHeap.cpp
src/hotspot/share/gc/parallel/parallelArguments.cpp
src/hotspot/share/gc/parallel/parallelArguments.hpp
src/hotspot/share/prims/whitebox.cpp
--- a/src/hotspot/share/gc/g1/g1Arguments.cpp	Mon Jun 03 14:15:11 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1Arguments.cpp	Mon Jun 03 11:04:24 2019 -0700
@@ -256,3 +256,7 @@
 size_t G1Arguments::heap_reserved_size_bytes() {
   return (is_heterogeneous_heap() ? 2 : 1) * MaxHeapSize;
 }
+
+size_t G1Arguments::heap_max_size_bytes() {
+  return MaxHeapSize;
+}
\ No newline at end of file
--- a/src/hotspot/share/gc/g1/g1Arguments.hpp	Mon Jun 03 14:15:11 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1Arguments.hpp	Mon Jun 03 11:04:24 2019 -0700
@@ -53,6 +53,7 @@
   static bool is_heterogeneous_heap();
   static size_t reasonable_max_memory_for_young();
   static size_t heap_reserved_size_bytes();
+  static size_t heap_max_size_bytes();
 };
 
 #endif // SHARE_GC_G1_G1ARGUMENTS_HPP
--- a/src/hotspot/share/gc/g1/heapRegionManager.cpp	Mon Jun 03 14:15:11 2019 -0700
+++ b/src/hotspot/share/gc/g1/heapRegionManager.cpp	Mon Jun 03 11:04:24 2019 -0700
@@ -70,7 +70,7 @@
 
 HeapRegionManager* HeapRegionManager::create_manager(G1CollectedHeap* heap) {
   if (G1Arguments::is_heterogeneous_heap()) {
-    return new HeterogeneousHeapRegionManager((uint)(G1Arguments::heap_reserved_size_bytes() / HeapRegion::GrainBytes) /*heap size as num of regions*/);
+    return new HeterogeneousHeapRegionManager((uint)(G1Arguments::heap_max_size_bytes() / HeapRegion::GrainBytes) /*heap size as num of regions*/);
   }
   return new HeapRegionManager();
 }
--- a/src/hotspot/share/gc/parallel/adjoiningGenerationsForHeteroHeap.cpp	Mon Jun 03 14:15:11 2019 -0700
+++ b/src/hotspot/share/gc/parallel/adjoiningGenerationsForHeteroHeap.cpp	Mon Jun 03 11:04:24 2019 -0700
@@ -38,7 +38,7 @@
 // create ASPSOldGen and ASPSYoungGen the same way as in base class
 
 AdjoiningGenerationsForHeteroHeap::AdjoiningGenerationsForHeteroHeap(ReservedSpace old_young_rs) :
-  _total_size_limit(ParallelArguments::heap_reserved_size_bytes()) {
+  _total_size_limit(ParallelArguments::heap_max_size_bytes()) {
   size_t init_old_byte_size = OldSize;
   size_t min_old_byte_size = MinOldSize;
   size_t max_old_byte_size = MaxOldSize;
@@ -85,9 +85,9 @@
 
 size_t AdjoiningGenerationsForHeteroHeap::required_reserved_memory() {
   // This is the size that young gen can grow to, when AdaptiveGCBoundary is true.
-  size_t max_yg_size = ParallelArguments::heap_reserved_size_bytes() - MinOldSize;
+  size_t max_yg_size = ParallelArguments::heap_max_size_bytes() - MinOldSize;
   // This is the size that old gen can grow to, when AdaptiveGCBoundary is true.
-  size_t max_old_size = ParallelArguments::heap_reserved_size_bytes() - MinNewSize;
+  size_t max_old_size = ParallelArguments::heap_max_size_bytes() - MinNewSize;
 
   return max_yg_size + max_old_size;
 }
--- a/src/hotspot/share/gc/parallel/parallelArguments.cpp	Mon Jun 03 14:15:11 2019 -0700
+++ b/src/hotspot/share/gc/parallel/parallelArguments.cpp	Mon Jun 03 11:04:24 2019 -0700
@@ -214,6 +214,10 @@
   return max_yg_size + max_old_size;
 }
 
+size_t ParallelArguments::heap_max_size_bytes() {
+  return MaxHeapSize;
+}
+
 CollectedHeap* ParallelArguments::create_heap() {
   return new ParallelScavengeHeap();
 }
--- a/src/hotspot/share/gc/parallel/parallelArguments.hpp	Mon Jun 03 14:15:11 2019 -0700
+++ b/src/hotspot/share/gc/parallel/parallelArguments.hpp	Mon Jun 03 11:04:24 2019 -0700
@@ -46,6 +46,7 @@
   // Heterogeneous heap support
   static bool is_heterogeneous_heap();
   static size_t heap_reserved_size_bytes();
+  static size_t heap_max_size_bytes();
 };
 
 #endif // SHARE_GC_PARALLEL_PARALLELARGUMENTS_HPP
--- a/src/hotspot/share/prims/whitebox.cpp	Mon Jun 03 14:15:11 2019 -0700
+++ b/src/hotspot/share/prims/whitebox.cpp	Mon Jun 03 11:04:24 2019 -0700
@@ -518,7 +518,7 @@
       uint end_region = HeterogeneousHeapRegionManager::manager()->end_index_of_dram();
       return (jlong)(g1h->base() + (end_region + 1) * HeapRegion::GrainBytes - 1);
     } else {
-      return (jlong)g1h->base() + G1Arguments::heap_reserved_size_bytes();
+      return (jlong)g1h->base() + G1Arguments::heap_max_size_bytes();
     }
   }
 #endif // INCLUDE_G1GC