Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
13057:4288e54fd145 | 13058:3aee6bc29547 |
---|---|
2963 } | 2963 } |
2964 } | 2964 } |
2965 | 2965 |
2966 #endif | 2966 #endif |
2967 | 2967 |
2968 // Align down. If the aligning result in 0, return 'alignment'. | |
2969 static size_t restricted_align_down(size_t size, size_t alignment) { | |
2970 return MAX2(alignment, align_size_down_(size, alignment)); | |
2971 } | |
2972 | |
2973 void Metaspace::ergo_initialize() { | 2968 void Metaspace::ergo_initialize() { |
2974 if (DumpSharedSpaces) { | 2969 if (DumpSharedSpaces) { |
2975 // Using large pages when dumping the shared archive is currently not implemented. | 2970 // Using large pages when dumping the shared archive is currently not implemented. |
2976 FLAG_SET_ERGO(bool, UseLargePagesInMetaspace, false); | 2971 FLAG_SET_ERGO(bool, UseLargePagesInMetaspace, false); |
2977 } | 2972 } |
2990 // java.lang.management.MemoryUsage API. | 2985 // java.lang.management.MemoryUsage API. |
2991 // | 2986 // |
2992 // Ideally, we would be able to set the default value of MaxMetaspaceSize in | 2987 // Ideally, we would be able to set the default value of MaxMetaspaceSize in |
2993 // globals.hpp to the aligned value, but this is not possible, since the | 2988 // globals.hpp to the aligned value, but this is not possible, since the |
2994 // alignment depends on other flags being parsed. | 2989 // alignment depends on other flags being parsed. |
2995 MaxMetaspaceSize = restricted_align_down(MaxMetaspaceSize, _reserve_alignment); | 2990 MaxMetaspaceSize = align_size_down_bounded(MaxMetaspaceSize, _reserve_alignment); |
2996 | 2991 |
2997 if (MetaspaceSize > MaxMetaspaceSize) { | 2992 if (MetaspaceSize > MaxMetaspaceSize) { |
2998 MetaspaceSize = MaxMetaspaceSize; | 2993 MetaspaceSize = MaxMetaspaceSize; |
2999 } | 2994 } |
3000 | 2995 |
3001 MetaspaceSize = restricted_align_down(MetaspaceSize, _commit_alignment); | 2996 MetaspaceSize = align_size_down_bounded(MetaspaceSize, _commit_alignment); |
3002 | 2997 |
3003 assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize"); | 2998 assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize"); |
3004 | 2999 |
3005 if (MetaspaceSize < 256*K) { | 3000 if (MetaspaceSize < 256*K) { |
3006 vm_exit_during_initialization("Too small initial Metaspace size"); | 3001 vm_exit_during_initialization("Too small initial Metaspace size"); |
3007 } | 3002 } |
3008 | 3003 |
3009 MinMetaspaceExpansion = restricted_align_down(MinMetaspaceExpansion, _commit_alignment); | 3004 MinMetaspaceExpansion = align_size_down_bounded(MinMetaspaceExpansion, _commit_alignment); |
3010 MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, _commit_alignment); | 3005 MaxMetaspaceExpansion = align_size_down_bounded(MaxMetaspaceExpansion, _commit_alignment); |
3011 | 3006 |
3012 CompressedClassSpaceSize = restricted_align_down(CompressedClassSpaceSize, _reserve_alignment); | 3007 CompressedClassSpaceSize = align_size_down_bounded(CompressedClassSpaceSize, _reserve_alignment); |
3013 set_class_metaspace_size(CompressedClassSpaceSize); | 3008 set_class_metaspace_size(CompressedClassSpaceSize); |
3014 } | 3009 } |
3015 | 3010 |
3016 void Metaspace::global_initialize() { | 3011 void Metaspace::global_initialize() { |
3017 // Initialize the alignment for shared spaces. | 3012 // Initialize the alignment for shared spaces. |