src/share/vm/runtime/arguments.cpp

Print this page

        

*** 1685,1694 **** --- 1685,1731 ---- // FLAG_SET_DEFAULT(EliminateZeroing, true); // } } } + void Arguments::process_stackguardpages_option(const char* tail) { + int page_size = os::vm_page_size(); + #define convert_page_size_units(_value, _unit1, _unit2) (round_to(align_size_up((_value) * (_unit1), (page_size)), (_unit2)) / (_unit2)) + + if (tail == NULL) { + FLAG_SET_DEFAULT(StackYellowPages, convert_page_size_units(StackYellowSize, 1, page_size)); + FLAG_SET_DEFAULT(StackRedPages, convert_page_size_units(StackRedSize, 1, page_size)); + FLAG_SET_DEFAULT(StackShadowPages, convert_page_size_units(StackShadowSize, 1, page_size)); + } else { + if (!strncmp(tail, "StackYellowSize=", strlen("StackYellowSize="))) { + FLAG_SET_DEFAULT(StackYellowPages, convert_page_size_units(StackYellowSize, 1, page_size)); + } else if (!strncmp(tail, "StackRedSize=", strlen("StackRedSize="))) { + FLAG_SET_DEFAULT(StackRedPages, convert_page_size_units(StackRedSize, 1, page_size)); + } else if (!strncmp(tail, "StackShadowSize=", strlen("StackShadowSize="))) { + FLAG_SET_DEFAULT(StackShadowPages, convert_page_size_units(StackShadowSize, 1, page_size)); + } else + if (!strncmp(tail, "StackYellowPages=", strlen("StackYellowPages="))) { + FLAG_SET_DEFAULT(StackYellowSize, convert_page_size_units(StackYellowPages, page_size, 1)); + } else if (!strncmp(tail, "StackRedPages=", strlen("StackRedPages="))) { + FLAG_SET_DEFAULT(StackRedSize, convert_page_size_units(StackRedPages, page_size, 1)); + } else if (!strncmp(tail, "StackShadowPages=", strlen("StackShadowPages="))) { + FLAG_SET_DEFAULT(StackShadowSize, convert_page_size_units(StackShadowPages, page_size, 1)); + } + } + + if (StackRedSize <= 0) FLAG_SET_DEFAULT(StackRedSize, page_size); + if (StackYellowSize <= 0) FLAG_SET_DEFAULT(StackYellowSize, page_size); + if (StackShadowSize <= 0) FLAG_SET_DEFAULT(StackShadowSize, page_size); + + // Make sure parameter pairs reflect identical size. + if (StackRedPages <= 0) FLAG_SET_DEFAULT(StackRedPages, convert_page_size_units(StackRedSize, 1, page_size)); + if (StackYellowPages <= 0) FLAG_SET_DEFAULT(StackYellowPages, convert_page_size_units(StackYellowSize, 1, page_size)); + if (StackShadowPages <= 0) FLAG_SET_DEFAULT(StackShadowPages, convert_page_size_units(StackShadowSize, 1, page_size)); + + #undef convert_page_size_units + } + //=========================================================================================================== // Parsing of java.compiler property void Arguments::process_java_compiler_argument(char* arg) { // For backwards compatibility, Djava.compiler=NONE or ""
*** 2850,2859 **** --- 2887,2908 ---- } else if (match_option(option, "-XX:+UseVMInterruptibleIO", &tail)) { // NOTE! In JDK 9, the UseVMInterruptibleIO flag will completely go // away and will cause VM initialization failures! warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release."); FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true); + } else if (match_option(option, "-XX:StackRedPages", &tail) || + match_option(option, "-XX:StackShadowPages", &tail) || + match_option(option, "-XX:StackYellowPages", &tail) || + match_option(option, "-XX:StackRedSize", &tail) || + match_option(option, "-XX:StackShadowSize", &tail) || + match_option(option, "-XX:StackYellowSize", &tail)) { + if (match_option(option, "-XX:", &tail) && + process_argument(tail, args->ignoreUnrecognized, origin)) { + process_stackguardpages_option(tail); + } else { + return JNI_EINVAL; + } #if !INCLUDE_MANAGEMENT } else if (match_option(option, "-XX:+ManagementServer", &tail)) { jio_fprintf(defaultStream::error_stream(), "ManagementServer is not supported in this VM.\n"); return JNI_ERR;
*** 3111,3120 **** --- 3160,3172 ---- // Parse entry point called from JNI_CreateJavaVM jint Arguments::parse(const JavaVMInitArgs* args) { + // Derive and set default values for Stack{Red,Yellow,Shadow}Pages options. + process_stackguardpages_option(); + // Sharing support // Construct the path to the archive char jvm_path[JVM_MAXPATHLEN]; os::jvm_path(jvm_path, sizeof(jvm_path)); char *end = strrchr(jvm_path, *os::file_separator());