--- old/src/hotspot/share/gc/shared/genArguments.cpp 2019-11-14 15:57:40.084838154 +0100 +++ new/src/hotspot/share/gc/shared/genArguments.cpp 2019-11-14 15:57:39.734826978 +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