changeset 57890:fe7c8e8eca0b

8237884: ZGC: Use clamp() instead of MIN2(MAX2()) Reviewed-by: kbarrett, smonteith
author pliden
date Thu, 30 Jan 2020 12:41:59 +0100
parents 9c2c9e22c8ba
children 58acc5079000
files src/hotspot/share/gc/z/zHeuristics.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/z/zHeuristics.cpp	Thu Jan 30 12:41:56 2020 +0100
+++ b/src/hotspot/share/gc/z/zHeuristics.cpp	Thu Jan 30 12:41:59 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -28,6 +28,7 @@
 #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() {
@@ -38,7 +39,7 @@
   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) {