< prev index next >

src/hotspot/share/gc/z/zHeuristics.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * 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
  * published by the Free Software Foundation.

@@ -26,21 +26,22 @@
 #include "gc/z/zGlobals.hpp"
 #include "gc/z/zHeuristics.hpp"
 #include "logging/log.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/os.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/powerOfTwo.hpp"
 
 void ZHeuristics::set_medium_page_size() {
   // Set ZPageSizeMedium so that a medium page occupies at most 3.125% of the
   // max heap size. ZPageSizeMedium is initially set to 0, which means medium
   // pages are effectively disabled. It is adjusted only if ZPageSizeMedium
   // becomes larger than ZPageSizeSmall.
   const size_t min = ZGranuleSize;
   const size_t max = ZGranuleSize * 16;
   const size_t unclamped = MaxHeapSize * 0.03125;
-  const size_t clamped = MIN2(MAX2(min, unclamped), max);
+  const size_t clamped = clamp(unclamped, min, max);
   const size_t size = round_down_power_of_2(clamped);
 
   if (size > ZPageSizeSmall) {
     // Enable medium pages
     ZPageSizeMedium             = size;
< prev index next >