src/hotspot/share/gc/shared/genArguments.cpp
changeset 59221 cc3a82fc7bcb
parent 58060 44f3609f46af
equal deleted inserted replaced
59220:72e15d757e6c 59221:cc3a82fc7bcb
   227     // Bound the maximum size by NewSize below (since it historically
   227     // Bound the maximum size by NewSize below (since it historically
   228     // would have been NewSize and because the NewRatio calculation could
   228     // would have been NewSize and because the NewRatio calculation could
   229     // yield a size that is too small) and bound it by MaxNewSize above.
   229     // yield a size that is too small) and bound it by MaxNewSize above.
   230     // Ergonomics plays here by previously calculating the desired
   230     // Ergonomics plays here by previously calculating the desired
   231     // NewSize and MaxNewSize.
   231     // NewSize and MaxNewSize.
   232     max_young_size = MIN2(MAX2(max_young_size, NewSize), MaxNewSize);
   232     max_young_size = clamp(max_young_size, NewSize, MaxNewSize);
   233   }
   233   }
   234 
   234 
   235   // Given the maximum young size, determine the initial and
   235   // Given the maximum young size, determine the initial and
   236   // minimum young sizes.
   236   // minimum young sizes.
   237   size_t initial_young_size = NewSize;
   237   size_t initial_young_size = NewSize;
   258       // For the case where NewSize is not set on the command line, use
   258       // For the case where NewSize is not set on the command line, use
   259       // NewRatio to size the initial generation size. Use the current
   259       // NewRatio to size the initial generation size. Use the current
   260       // NewSize as the floor, because if NewRatio is overly large, the resulting
   260       // NewSize as the floor, because if NewRatio is overly large, the resulting
   261       // size can be too small.
   261       // size can be too small.
   262       initial_young_size =
   262       initial_young_size =
   263         MIN2(max_young_size, MAX2(scale_by_NewRatio_aligned(InitialHeapSize, GenAlignment), NewSize));
   263         clamp(scale_by_NewRatio_aligned(InitialHeapSize, GenAlignment), NewSize, max_young_size);
   264     }
   264     }
   265   }
   265   }
   266 
   266 
   267   log_trace(gc, heap)("1: Minimum young " SIZE_FORMAT "  Initial young " SIZE_FORMAT "  Maximum young " SIZE_FORMAT,
   267   log_trace(gc, heap)("1: Minimum young " SIZE_FORMAT "  Initial young " SIZE_FORMAT "  Maximum young " SIZE_FORMAT,
   268                       MinNewSize, initial_young_size, max_young_size);
   268                       MinNewSize, initial_young_size, max_young_size);
   283     // may have chosen a value (which may or may not be consistent
   283     // may have chosen a value (which may or may not be consistent
   284     // with the overall heap size).  In either case make
   284     // with the overall heap size).  In either case make
   285     // the minimum, maximum and initial sizes consistent
   285     // the minimum, maximum and initial sizes consistent
   286     // with the young sizes and the overall heap sizes.
   286     // with the young sizes and the overall heap sizes.
   287     MinOldSize = GenAlignment;
   287     MinOldSize = GenAlignment;
   288     initial_old_size = MIN2(MaxOldSize, MAX2(InitialHeapSize - initial_young_size, MinOldSize));
   288     initial_old_size = clamp(InitialHeapSize - initial_young_size, MinOldSize, MaxOldSize);
   289     // MaxOldSize has already been made consistent above.
   289     // MaxOldSize has already been made consistent above.
   290   } else {
   290   } else {
   291     // OldSize has been explicitly set on the command line. Use it
   291     // OldSize has been explicitly set on the command line. Use it
   292     // for the initial size but make sure the minimum allow a young
   292     // for the initial size but make sure the minimum allow a young
   293     // generation to fit as well.
   293     // generation to fit as well.