diff src/share/vm/memory/metaspace.cpp @ 13058:3aee6bc29547

8026852: Use restricted_align_down in collector policy code Summary: Moved restricted_align_down to globalDefinitions and renamed it align_size_down_bounded Reviewed-by: stefank, mgerdin, tschatzl
author jwilhelm
date Mon, 21 Oct 2013 18:52:13 +0200
parents 91a88c8450f4
children 610be0309a79
line wrap: on
line diff
--- a/src/share/vm/memory/metaspace.cpp	Mon Oct 21 18:51:37 2013 +0200
+++ b/src/share/vm/memory/metaspace.cpp	Mon Oct 21 18:52:13 2013 +0200
@@ -2965,11 +2965,6 @@
 
 #endif
 
-// Align down. If the aligning result in 0, return 'alignment'.
-static size_t restricted_align_down(size_t size, size_t alignment) {
-  return MAX2(alignment, align_size_down_(size, alignment));
-}
-
 void Metaspace::ergo_initialize() {
   if (DumpSharedSpaces) {
     // Using large pages when dumping the shared archive is currently not implemented.
@@ -2992,13 +2987,13 @@
   // Ideally, we would be able to set the default value of MaxMetaspaceSize in
   // globals.hpp to the aligned value, but this is not possible, since the
   // alignment depends on other flags being parsed.
-  MaxMetaspaceSize = restricted_align_down(MaxMetaspaceSize, _reserve_alignment);
+  MaxMetaspaceSize = align_size_down_bounded(MaxMetaspaceSize, _reserve_alignment);
 
   if (MetaspaceSize > MaxMetaspaceSize) {
     MetaspaceSize = MaxMetaspaceSize;
   }
 
-  MetaspaceSize = restricted_align_down(MetaspaceSize, _commit_alignment);
+  MetaspaceSize = align_size_down_bounded(MetaspaceSize, _commit_alignment);
 
   assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize");
 
@@ -3006,10 +3001,10 @@
     vm_exit_during_initialization("Too small initial Metaspace size");
   }
 
-  MinMetaspaceExpansion = restricted_align_down(MinMetaspaceExpansion, _commit_alignment);
-  MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, _commit_alignment);
-
-  CompressedClassSpaceSize = restricted_align_down(CompressedClassSpaceSize, _reserve_alignment);
+  MinMetaspaceExpansion = align_size_down_bounded(MinMetaspaceExpansion, _commit_alignment);
+  MaxMetaspaceExpansion = align_size_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
+
+  CompressedClassSpaceSize = align_size_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
   set_class_metaspace_size(CompressedClassSpaceSize);
 }