8231825: ZGC: Remove ZMaxHeapSize and ZMaxHeapSizeShift
authorpliden
Mon, 07 Oct 2019 07:53:38 +0200
changeset 58468 97cd0aa39787
parent 58467 72ef2c0faf47
child 58469 ccbb5a2bf3ab
8231825: ZGC: Remove ZMaxHeapSize and ZMaxHeapSizeShift Reviewed-by: tschatzl, eosterlund
src/hotspot/cpu/aarch64/gc/z/zGlobals_aarch64.hpp
src/hotspot/cpu/x86/gc/z/zGlobals_x86.hpp
src/hotspot/share/gc/z/zArguments.cpp
src/hotspot/share/gc/z/zGlobals.hpp
src/hotspot/share/gc/z/zVirtualMemory.cpp
--- a/src/hotspot/cpu/aarch64/gc/z/zGlobals_aarch64.hpp	Sun Oct 06 13:08:58 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/z/zGlobals_aarch64.hpp	Mon Oct 07 07:53:38 2019 +0200
@@ -36,7 +36,6 @@
 //  ------------------------------------------------------------------
 //
 const size_t ZPlatformGranuleSizeShift      = 21; // 2MB
-const size_t ZPlatformMaxHeapSizeShift      = 44; // 16TB
 const size_t ZPlatformNMethodDisarmedOffset = 4;
 const size_t ZPlatformCacheLineSize         = 64;
 
--- a/src/hotspot/cpu/x86/gc/z/zGlobals_x86.hpp	Sun Oct 06 13:08:58 2019 -0400
+++ b/src/hotspot/cpu/x86/gc/z/zGlobals_x86.hpp	Mon Oct 07 07:53:38 2019 +0200
@@ -36,7 +36,6 @@
 //  ------------------------------------------------------------------
 //
 const size_t ZPlatformGranuleSizeShift      = 21; // 2MB
-const size_t ZPlatformMaxHeapSizeShift      = 44; // 16TB
 const size_t ZPlatformNMethodDisarmedOffset = 4;
 const size_t ZPlatformCacheLineSize         = 64;
 
--- a/src/hotspot/share/gc/z/zArguments.cpp	Sun Oct 06 13:08:58 2019 -0400
+++ b/src/hotspot/share/gc/z/zArguments.cpp	Mon Oct 07 07:53:38 2019 +0200
@@ -37,11 +37,6 @@
 void ZArguments::initialize() {
   GCArguments::initialize();
 
-  // Check max heap size
-  if (MaxHeapSize > ZMaxHeapSize) {
-    vm_exit_during_initialization("Java heap too large");
-  }
-
   // Enable NUMA by default
   if (FLAG_IS_DEFAULT(UseNUMA)) {
     FLAG_SET_DEFAULT(UseNUMA, true);
--- a/src/hotspot/share/gc/z/zGlobals.hpp	Sun Oct 06 13:08:58 2019 -0400
+++ b/src/hotspot/share/gc/z/zGlobals.hpp	Mon Oct 07 07:53:38 2019 +0200
@@ -44,10 +44,6 @@
 const size_t      ZGranuleSizeShift             = ZPlatformGranuleSizeShift;
 const size_t      ZGranuleSize                  = (size_t)1 << ZGranuleSizeShift;
 
-// Max heap size shift/size
-const size_t      ZMaxHeapSizeShift             = ZPlatformMaxHeapSizeShift;
-const size_t      ZMaxHeapSize                  = (size_t)1 << ZMaxHeapSizeShift;
-
 // Page types
 const uint8_t     ZPageTypeSmall                = 0;
 const uint8_t     ZPageTypeMedium               = 1;
--- a/src/hotspot/share/gc/z/zVirtualMemory.cpp	Sun Oct 06 13:08:58 2019 -0400
+++ b/src/hotspot/share/gc/z/zVirtualMemory.cpp	Mon Oct 07 07:53:38 2019 +0200
@@ -31,6 +31,13 @@
     _manager(),
     _initialized(false) {
 
+  // Check max supported heap size
+  if (max_capacity > ZAddressOffsetMax) {
+    log_error(gc)("Java heap too large (max supported heap size is " SIZE_FORMAT "G)",
+                  ZAddressOffsetMax / G);
+    return;
+  }
+
   log_info(gc, init)("Address Space: " SIZE_FORMAT "T", ZAddressOffsetMax / K / G);
 
   // Reserve address space