--- old/src/share/vm/gc/shared/collectorPolicy.cpp 2016-06-21 21:14:03.000000000 +0200 +++ new/src/share/vm/gc/shared/collectorPolicy.cpp 2016-06-21 21:14:02.000000000 +0200 @@ -285,7 +285,7 @@ "heap_alignment: " SIZE_FORMAT " not aligned by gen_alignment: " SIZE_FORMAT, _heap_alignment, _gen_alignment); - // All generational heaps have a youngest gen; handle those flags here + // All generational heaps have a young gen; handle those flags here // Make sure the heap is large enough for two generations size_t smallest_new_size = young_gen_size_lower_bound(); @@ -307,7 +307,7 @@ // Make sure NewSize allows an old generation to fit even if set on the command line if (FLAG_IS_CMDLINE(NewSize) && NewSize >= _initial_heap_byte_size) { log_warning(gc, ergo)("NewSize was set larger than initial heap size, will use initial heap size."); - NewSize = bound_minus_alignment(NewSize, _initial_heap_byte_size); + FLAG_SET_ERGO(size_t, NewSize, bound_minus_alignment(NewSize, _initial_heap_byte_size)); } // Now take the actual NewSize into account. We will silently increase NewSize @@ -315,10 +315,7 @@ size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize); bounded_new_size = MAX2(smallest_new_size, (size_t)align_size_down(bounded_new_size, _gen_alignment)); if (bounded_new_size != NewSize) { - // Do not use FLAG_SET_ERGO to update NewSize here, since this will override - // if NewSize was set on the command line or not. This information is needed - // later when setting the initial and minimum young generation size. - NewSize = bounded_new_size; + FLAG_SET_ERGO(size_t, NewSize, bounded_new_size); } _min_young_size = smallest_new_size; _initial_young_size = NewSize; @@ -361,11 +358,11 @@ vm_exit_during_initialization("Invalid young gen ratio specified"); } - OldSize = MAX2(OldSize, old_gen_size_lower_bound()); + if (OldSize < old_gen_size_lower_bound()) { + FLAG_SET_ERGO(size_t, OldSize, old_gen_size_lower_bound()); + } if (!is_size_aligned(OldSize, _gen_alignment)) { - // Setting OldSize directly to preserve information about the possible - // setting of OldSize on the command line. - OldSize = align_size_down(OldSize, _gen_alignment); + FLAG_SET_ERGO(size_t, OldSize, align_size_down(OldSize, _gen_alignment)); } if (FLAG_IS_CMDLINE(OldSize) && FLAG_IS_DEFAULT(MaxHeapSize)) {