src/hotspot/share/gc/shared/genArguments.cpp
changeset 59221 cc3a82fc7bcb
parent 58060 44f3609f46af
--- a/src/hotspot/share/gc/shared/genArguments.cpp	Fri Nov 22 10:03:38 2019 +0100
+++ b/src/hotspot/share/gc/shared/genArguments.cpp	Fri Nov 22 10:03:38 2019 +0100
@@ -229,7 +229,7 @@
     // yield a size that is too small) and bound it by MaxNewSize above.
     // Ergonomics plays here by previously calculating the desired
     // NewSize and MaxNewSize.
-    max_young_size = MIN2(MAX2(max_young_size, NewSize), MaxNewSize);
+    max_young_size = clamp(max_young_size, NewSize, MaxNewSize);
   }
 
   // Given the maximum young size, determine the initial and
@@ -260,7 +260,7 @@
       // NewSize as the floor, because if NewRatio is overly large, the resulting
       // size can be too small.
       initial_young_size =
-        MIN2(max_young_size, MAX2(scale_by_NewRatio_aligned(InitialHeapSize, GenAlignment), NewSize));
+        clamp(scale_by_NewRatio_aligned(InitialHeapSize, GenAlignment), NewSize, max_young_size);
     }
   }
 
@@ -285,7 +285,7 @@
     // the minimum, maximum and initial sizes consistent
     // with the young sizes and the overall heap sizes.
     MinOldSize = GenAlignment;
-    initial_old_size = MIN2(MaxOldSize, MAX2(InitialHeapSize - initial_young_size, MinOldSize));
+    initial_old_size = clamp(InitialHeapSize - initial_young_size, MinOldSize, MaxOldSize);
     // MaxOldSize has already been made consistent above.
   } else {
     // OldSize has been explicitly set on the command line. Use it