< prev index next >

src/hotspot/share/gc/shared/gcArguments.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as

@@ -31,10 +31,12 @@
 #include "runtime/globals.hpp"
 #include "runtime/globals_extension.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/macros.hpp"
 
+size_t MinHeapSize = 0;
+
 size_t HeapAlignment = 0;
 size_t SpaceAlignment = 0;
 
 void GCArguments::initialize() {
   if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) {

@@ -118,11 +120,11 @@
 
 void GCArguments::assert_size_info() {
   assert(MaxHeapSize >= MinHeapSize, "Ergonomics decided on incompatible minimum and maximum heap sizes");
   assert(InitialHeapSize >= MinHeapSize, "Ergonomics decided on incompatible initial and minimum heap sizes");
   assert(MaxHeapSize >= InitialHeapSize, "Ergonomics decided on incompatible initial and maximum heap sizes");
-  assert(MinHeapSize % HeapAlignment == 0, "MinHeapSize alignment");
+  assert(MaxHeapSize % HeapAlignment == 0, "MinHeapSize alignment");
   assert(InitialHeapSize % HeapAlignment == 0, "InitialHeapSize alignment");
   assert(MaxHeapSize % HeapAlignment == 0, "MaxHeapSize alignment");
 }
 #endif // ASSERT
 

@@ -145,11 +147,11 @@
 
   if (FLAG_IS_CMDLINE(MaxHeapSize)) {
     if (FLAG_IS_CMDLINE(InitialHeapSize) && InitialHeapSize > MaxHeapSize) {
       vm_exit_during_initialization("Initial heap size set to a larger value than the maximum heap size");
     }
-    if (FLAG_IS_CMDLINE(MinHeapSize) && MaxHeapSize < MinHeapSize) {
+    if (MinHeapSize != 0 && MaxHeapSize < MinHeapSize) {
       vm_exit_during_initialization("Incompatible minimum and maximum heap sizes specified");
     }
   }
 
   // Check heap parameter properties

@@ -162,38 +164,34 @@
   if (MinHeapSize < M) {
     vm_exit_during_initialization("Too small minimum heap");
   }
 
   // User inputs from -Xmx and -Xms must be aligned
+  MinHeapSize = align_up(MinHeapSize, HeapAlignment);
+  size_t aligned_initial_heap_size = align_up(InitialHeapSize, HeapAlignment);
+  size_t aligned_max_heap_size = align_up(MaxHeapSize, HeapAlignment);
+
   // Write back to flags if the values changed
-  if (!is_aligned(MinHeapSize, HeapAlignment)) {
-    FLAG_SET_ERGO(MinHeapSize, align_up(MinHeapSize, HeapAlignment));
-  }
-  if (!is_aligned(InitialHeapSize, HeapAlignment)) {
-    FLAG_SET_ERGO(InitialHeapSize, align_up(InitialHeapSize, HeapAlignment));
+  if (aligned_initial_heap_size != InitialHeapSize) {
+    FLAG_SET_ERGO(InitialHeapSize, aligned_initial_heap_size);
   }
-  if (!is_aligned(MaxHeapSize, HeapAlignment)) {
-    FLAG_SET_ERGO(MaxHeapSize, align_up(MaxHeapSize, HeapAlignment));
+  if (aligned_max_heap_size != MaxHeapSize) {
+    FLAG_SET_ERGO(MaxHeapSize, aligned_max_heap_size);
   }
 
-  if (FLAG_IS_CMDLINE(InitialHeapSize) && FLAG_IS_CMDLINE(MinHeapSize) &&
+  if (FLAG_IS_CMDLINE(InitialHeapSize) && MinHeapSize != 0 &&
       InitialHeapSize < MinHeapSize) {
     vm_exit_during_initialization("Incompatible minimum and initial heap sizes specified");
   }
-
   if (!FLAG_IS_DEFAULT(InitialHeapSize) && InitialHeapSize > MaxHeapSize) {
     FLAG_SET_ERGO(MaxHeapSize, InitialHeapSize);
   } else if (!FLAG_IS_DEFAULT(MaxHeapSize) && InitialHeapSize > MaxHeapSize) {
     FLAG_SET_ERGO(InitialHeapSize, MaxHeapSize);
     if (InitialHeapSize < MinHeapSize) {
-      FLAG_SET_ERGO(MinHeapSize, InitialHeapSize);
+      MinHeapSize = InitialHeapSize;
     }
   }
 
-  if (FLAG_IS_DEFAULT(SoftMaxHeapSize)) {
-    FLAG_SET_ERGO(SoftMaxHeapSize, MaxHeapSize);
-  }
-
   FLAG_SET_ERGO(MinHeapDeltaBytes, align_up(MinHeapDeltaBytes, SpaceAlignment));
 
   DEBUG_ONLY(assert_flags();)
 }
< prev index next >