Thu, 05 Feb 2009 13:38:52 -0800
6788376: allow to ignore unrecognized VM options
Summary: Add new product flag -XX:+IgnoreUnrecognizedVMOptions
Reviewed-by: ysr, xlu
1.1 --- a/src/share/vm/runtime/arguments.cpp Wed Feb 04 23:17:38 2009 -0800 1.2 +++ b/src/share/vm/runtime/arguments.cpp Thu Feb 05 13:38:52 2009 -0800 1.3 @@ -2478,7 +2478,7 @@ 1.4 vm_args.version = JNI_VERSION_1_2; 1.5 vm_args.options = options; 1.6 vm_args.nOptions = i; 1.7 - vm_args.ignoreUnrecognized = false; 1.8 + vm_args.ignoreUnrecognized = IgnoreUnrecognizedVMOptions; 1.9 1.10 if (PrintVMOptions) { 1.11 const char* tail; 1.12 @@ -2525,13 +2525,12 @@ 1.13 1.14 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. 1.15 bool settings_file_specified = false; 1.16 + const char* flags_file; 1.17 int index; 1.18 for (index = 0; index < args->nOptions; index++) { 1.19 const JavaVMOption *option = args->options + index; 1.20 if (match_option(option, "-XX:Flags=", &tail)) { 1.21 - if (!process_settings_file(tail, true, args->ignoreUnrecognized)) { 1.22 - return JNI_EINVAL; 1.23 - } 1.24 + flags_file = tail; 1.25 settings_file_specified = true; 1.26 } 1.27 if (match_option(option, "-XX:+PrintVMOptions", &tail)) { 1.28 @@ -2540,6 +2539,24 @@ 1.29 if (match_option(option, "-XX:-PrintVMOptions", &tail)) { 1.30 PrintVMOptions = false; 1.31 } 1.32 + if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) { 1.33 + IgnoreUnrecognizedVMOptions = true; 1.34 + } 1.35 + if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) { 1.36 + IgnoreUnrecognizedVMOptions = false; 1.37 + } 1.38 + } 1.39 + 1.40 + if (IgnoreUnrecognizedVMOptions) { 1.41 + // uncast const to modify the flag args->ignoreUnrecognized 1.42 + *(jboolean*)(&args->ignoreUnrecognized) = true; 1.43 + } 1.44 + 1.45 + // Parse specified settings file 1.46 + if (settings_file_specified) { 1.47 + if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) { 1.48 + return JNI_EINVAL; 1.49 + } 1.50 } 1.51 1.52 // Parse default .hotspotrc settings file
2.1 --- a/src/share/vm/runtime/globals.hpp Wed Feb 04 23:17:38 2009 -0800 2.2 +++ b/src/share/vm/runtime/globals.hpp Thu Feb 05 13:38:52 2009 -0800 2.3 @@ -2167,6 +2167,9 @@ 2.4 product(bool, PrintVMOptions, trueInDebug, \ 2.5 "print VM flag settings") \ 2.6 \ 2.7 + product(bool, IgnoreUnrecognizedVMOptions, false, \ 2.8 + "Ignore unrecognized VM options") \ 2.9 + \ 2.10 diagnostic(bool, SerializeVMOutput, true, \ 2.11 "Use a mutex to serialize output to tty and hotspot.log") \ 2.12 \
3.1 --- a/test/compiler/6775880/Test.java Wed Feb 04 23:17:38 2009 -0800 3.2 +++ b/test/compiler/6775880/Test.java Thu Feb 05 13:38:52 2009 -0800 3.3 @@ -27,7 +27,7 @@ 3.4 * @bug 6775880 3.5 * @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now") 3.6 * @compile -source 1.4 -target 1.4 Test.java 3.7 - * @run main/othervm -server -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test 3.8 + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test 3.9 */ 3.10 3.11 public class Test {