提交 c7ebedd7 编写于 作者: A anoll

8014972: Crash with specific values for -XX:InitialCodeCacheSize=500K...

8014972: Crash with specific values for -XX:InitialCodeCacheSize=500K -XX:ReservedCodeCacheSize=500k
Summary: Introduce a minimum code cache size that guarantees that the VM can startup.
Reviewed-by: kvn, twisti
上级 9ce8a586
...@@ -49,8 +49,9 @@ define_pd_global(intx, FreqInlineSize, 325 ); ...@@ -49,8 +49,9 @@ define_pd_global(intx, FreqInlineSize, 325 );
define_pd_global(bool, ResizeTLAB, true ); define_pd_global(bool, ResizeTLAB, true );
define_pd_global(intx, ReservedCodeCacheSize, 32*M ); define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(intx, CodeCacheExpansionSize, 32*K ); define_pd_global(intx, CodeCacheExpansionSize, 32*K );
define_pd_global(uintx,CodeCacheMinBlockLength, 1); define_pd_global(uintx, CodeCacheMinBlockLength, 1);
define_pd_global(uintx,MetaspaceSize, 12*M ); define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(uintx, MetaspaceSize, 12*M );
define_pd_global(bool, NeverActAsServerClassMachine, true ); define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(intx, NewSizeThreadIncrease, 16*K ); define_pd_global(intx, NewSizeThreadIncrease, 16*K );
define_pd_global(uint64_t,MaxRAM, 1ULL*G); define_pd_global(uint64_t,MaxRAM, 1ULL*G);
......
...@@ -86,7 +86,8 @@ define_pd_global(intx, CodeCacheExpansionSize, 32*K); ...@@ -86,7 +86,8 @@ define_pd_global(intx, CodeCacheExpansionSize, 32*K);
// Ergonomics related flags // Ergonomics related flags
define_pd_global(uint64_t,MaxRAM, 4ULL*G); define_pd_global(uint64_t,MaxRAM, 4ULL*G);
#endif #endif
define_pd_global(uintx,CodeCacheMinBlockLength, 4); define_pd_global(uintx, CodeCacheMinBlockLength, 4);
define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
// Heap related flags // Heap related flags
define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M)); define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M));
......
...@@ -50,8 +50,9 @@ define_pd_global(intx, InitialCodeCacheSize, 160*K); ...@@ -50,8 +50,9 @@ define_pd_global(intx, InitialCodeCacheSize, 160*K);
define_pd_global(intx, ReservedCodeCacheSize, 32*M ); define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(bool, ProfileInterpreter, false); define_pd_global(bool, ProfileInterpreter, false);
define_pd_global(intx, CodeCacheExpansionSize, 32*K ); define_pd_global(intx, CodeCacheExpansionSize, 32*K );
define_pd_global(uintx,CodeCacheMinBlockLength, 1); define_pd_global(uintx, CodeCacheMinBlockLength, 1);
define_pd_global(uintx,MetaspaceSize, 12*M ); define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(uintx, MetaspaceSize, 12*M );
define_pd_global(bool, NeverActAsServerClassMachine, true ); define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t,MaxRAM, 1ULL*G); define_pd_global(uint64_t,MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true ); define_pd_global(bool, CICompileOSR, true );
......
...@@ -85,7 +85,8 @@ define_pd_global(bool, OptoScheduling, false); ...@@ -85,7 +85,8 @@ define_pd_global(bool, OptoScheduling, false);
define_pd_global(bool, OptoBundling, false); define_pd_global(bool, OptoBundling, false);
define_pd_global(intx, ReservedCodeCacheSize, 48*M); define_pd_global(intx, ReservedCodeCacheSize, 48*M);
define_pd_global(uintx,CodeCacheMinBlockLength, 4); define_pd_global(uintx, CodeCacheMinBlockLength, 4);
define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
// Heap related flags // Heap related flags
define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M)); define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M));
......
...@@ -58,7 +58,9 @@ define_pd_global(intx, ReservedCodeCacheSize, 32*M ); ...@@ -58,7 +58,9 @@ define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(bool, ProfileInterpreter, false); define_pd_global(bool, ProfileInterpreter, false);
define_pd_global(intx, CodeCacheExpansionSize, 32*K ); define_pd_global(intx, CodeCacheExpansionSize, 32*K );
define_pd_global(uintx, CodeCacheMinBlockLength, 1 ); define_pd_global(uintx, CodeCacheMinBlockLength, 1 );
define_pd_global(uintx, MetaspaceSize, 12*M ); define_pd_global(uintx, CodeCacheMinimumUseSpace, 200*K);
define_pd_global(uintx, MetaspaceSize, 12*M );
define_pd_global(bool, NeverActAsServerClassMachine, true ); define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t, MaxRAM, 1ULL*G); define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true ); define_pd_global(bool, CICompileOSR, true );
......
...@@ -2211,11 +2211,24 @@ bool Arguments::check_vm_args_consistency() { ...@@ -2211,11 +2211,24 @@ bool Arguments::check_vm_args_consistency() {
status = false; status = false;
} }
if (ReservedCodeCacheSize < InitialCodeCacheSize) { // Check lower bounds of the code cache
// Template Interpreter code is approximately 3X larger in debug builds.
uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace;
if (InitialCodeCacheSize < (uintx)os::vm_page_size()) {
jio_fprintf(defaultStream::error_stream(), jio_fprintf(defaultStream::error_stream(),
"Invalid ReservedCodeCacheSize: %dK. Should be greater than InitialCodeCacheSize=%dK\n", "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
os::vm_page_size()/K);
status = false;
} else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
ReservedCodeCacheSize/K, InitialCodeCacheSize/K); ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
status = false; status = false;
} else if (ReservedCodeCacheSize < min_code_cache_size) {
jio_fprintf(defaultStream::error_stream(),
"Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
min_code_cache_size/K);
status = false;
} }
return status; return status;
...@@ -2616,10 +2629,20 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, ...@@ -2616,10 +2629,20 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
// -Xoss // -Xoss
} else if (match_option(option, "-Xoss", &tail)) { } else if (match_option(option, "-Xoss", &tail)) {
// HotSpot does not have separate native and Java stacks, ignore silently for compatibility // HotSpot does not have separate native and Java stacks, ignore silently for compatibility
// -Xmaxjitcodesize } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
julong long_CodeCacheExpansionSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid argument: %s. Must be at least %luK.\n", option->optionString,
os::vm_page_size()/K);
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
} else if (match_option(option, "-Xmaxjitcodesize", &tail) || } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
julong long_ReservedCodeCacheSize = 0; julong long_ReservedCodeCacheSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1); ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
if (errcode != arg_in_range) { if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(), jio_fprintf(defaultStream::error_stream(),
......
...@@ -3160,6 +3160,9 @@ class CommandLineFlags { ...@@ -3160,6 +3160,9 @@ class CommandLineFlags {
product_pd(uintx, InitialCodeCacheSize, \ product_pd(uintx, InitialCodeCacheSize, \
"Initial code cache size (in bytes)") \ "Initial code cache size (in bytes)") \
\ \
develop_pd(uintx, CodeCacheMinimumUseSpace, \
"Minimum code cache size (in bytes) required to start VM.") \
\
product_pd(uintx, ReservedCodeCacheSize, \ product_pd(uintx, ReservedCodeCacheSize, \
"Reserved code cache size (in bytes) - maximum code cache size") \ "Reserved code cache size (in bytes) - maximum code cache size") \
\ \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册