comparison src/share/vm/runtime/arguments.cpp @ 11079:738e04fb1232

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
author anoll
date Tue, 02 Jul 2013 07:51:31 +0200
parents b88209cf98c0
children 8b789ce47503
comparison
equal deleted inserted replaced
11078:2b3fe74309b6 11079:738e04fb1232
2209 "ContendedPaddingWidth=" INTX_FORMAT " must be the multiple of %d\n", 2209 "ContendedPaddingWidth=" INTX_FORMAT " must be the multiple of %d\n",
2210 ContendedPaddingWidth, BytesPerLong); 2210 ContendedPaddingWidth, BytesPerLong);
2211 status = false; 2211 status = false;
2212 } 2212 }
2213 2213
2214 if (ReservedCodeCacheSize < InitialCodeCacheSize) { 2214 // Check lower bounds of the code cache
2215 // Template Interpreter code is approximately 3X larger in debug builds.
2216 uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace;
2217 if (InitialCodeCacheSize < (uintx)os::vm_page_size()) {
2215 jio_fprintf(defaultStream::error_stream(), 2218 jio_fprintf(defaultStream::error_stream(),
2216 "Invalid ReservedCodeCacheSize: %dK. Should be greater than InitialCodeCacheSize=%dK\n", 2219 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2220 os::vm_page_size()/K);
2221 status = false;
2222 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2223 jio_fprintf(defaultStream::error_stream(),
2224 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2217 ReservedCodeCacheSize/K, InitialCodeCacheSize/K); 2225 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2226 status = false;
2227 } else if (ReservedCodeCacheSize < min_code_cache_size) {
2228 jio_fprintf(defaultStream::error_stream(),
2229 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2230 min_code_cache_size/K);
2218 status = false; 2231 status = false;
2219 } 2232 }
2220 2233
2221 return status; 2234 return status;
2222 } 2235 }
2614 FLAG_SET_CMDLINE(intx, ThreadStackSize, 2627 FLAG_SET_CMDLINE(intx, ThreadStackSize,
2615 round_to((int)long_ThreadStackSize, K) / K); 2628 round_to((int)long_ThreadStackSize, K) / K);
2616 // -Xoss 2629 // -Xoss
2617 } else if (match_option(option, "-Xoss", &tail)) { 2630 } else if (match_option(option, "-Xoss", &tail)) {
2618 // HotSpot does not have separate native and Java stacks, ignore silently for compatibility 2631 // HotSpot does not have separate native and Java stacks, ignore silently for compatibility
2619 // -Xmaxjitcodesize 2632 } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
2633 julong long_CodeCacheExpansionSize = 0;
2634 ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2635 if (errcode != arg_in_range) {
2636 jio_fprintf(defaultStream::error_stream(),
2637 "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2638 os::vm_page_size()/K);
2639 return JNI_EINVAL;
2640 }
2641 FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
2620 } else if (match_option(option, "-Xmaxjitcodesize", &tail) || 2642 } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2621 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { 2643 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2622 julong long_ReservedCodeCacheSize = 0; 2644 julong long_ReservedCodeCacheSize = 0;
2645
2623 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1); 2646 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2624 if (errcode != arg_in_range) { 2647 if (errcode != arg_in_range) {
2625 jio_fprintf(defaultStream::error_stream(), 2648 jio_fprintf(defaultStream::error_stream(),
2626 "Invalid maximum code cache size: %s.\n", option->optionString); 2649 "Invalid maximum code cache size: %s.\n", option->optionString);
2627 return JNI_EINVAL; 2650 return JNI_EINVAL;