comparison src/share/vm/runtime/arguments.cpp @ 564:323728917cf4

6788376: allow to ignore unrecognized VM options Summary: Add new product flag -XX:+IgnoreUnrecognizedVMOptions Reviewed-by: ysr, xlu
author kvn
date Thu, 05 Feb 2009 13:38:52 -0800
parents 2494ab195856
children dca06e7f503d
comparison
equal deleted inserted replaced
563:1b9fc6e3171b 564:323728917cf4
2476 // Construct JavaVMInitArgs structure and parse as if it was part of the command line 2476 // Construct JavaVMInitArgs structure and parse as if it was part of the command line
2477 JavaVMInitArgs vm_args; 2477 JavaVMInitArgs vm_args;
2478 vm_args.version = JNI_VERSION_1_2; 2478 vm_args.version = JNI_VERSION_1_2;
2479 vm_args.options = options; 2479 vm_args.options = options;
2480 vm_args.nOptions = i; 2480 vm_args.nOptions = i;
2481 vm_args.ignoreUnrecognized = false; 2481 vm_args.ignoreUnrecognized = IgnoreUnrecognizedVMOptions;
2482 2482
2483 if (PrintVMOptions) { 2483 if (PrintVMOptions) {
2484 const char* tail; 2484 const char* tail;
2485 for (int i = 0; i < vm_args.nOptions; i++) { 2485 for (int i = 0; i < vm_args.nOptions; i++) {
2486 const JavaVMOption *option = vm_args.options + i; 2486 const JavaVMOption *option = vm_args.options + i;
2523 // Remaining part of option string 2523 // Remaining part of option string
2524 const char* tail; 2524 const char* tail;
2525 2525
2526 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. 2526 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
2527 bool settings_file_specified = false; 2527 bool settings_file_specified = false;
2528 const char* flags_file;
2528 int index; 2529 int index;
2529 for (index = 0; index < args->nOptions; index++) { 2530 for (index = 0; index < args->nOptions; index++) {
2530 const JavaVMOption *option = args->options + index; 2531 const JavaVMOption *option = args->options + index;
2531 if (match_option(option, "-XX:Flags=", &tail)) { 2532 if (match_option(option, "-XX:Flags=", &tail)) {
2532 if (!process_settings_file(tail, true, args->ignoreUnrecognized)) { 2533 flags_file = tail;
2533 return JNI_EINVAL;
2534 }
2535 settings_file_specified = true; 2534 settings_file_specified = true;
2536 } 2535 }
2537 if (match_option(option, "-XX:+PrintVMOptions", &tail)) { 2536 if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
2538 PrintVMOptions = true; 2537 PrintVMOptions = true;
2539 } 2538 }
2540 if (match_option(option, "-XX:-PrintVMOptions", &tail)) { 2539 if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
2541 PrintVMOptions = false; 2540 PrintVMOptions = false;
2541 }
2542 if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) {
2543 IgnoreUnrecognizedVMOptions = true;
2544 }
2545 if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) {
2546 IgnoreUnrecognizedVMOptions = false;
2547 }
2548 }
2549
2550 if (IgnoreUnrecognizedVMOptions) {
2551 // uncast const to modify the flag args->ignoreUnrecognized
2552 *(jboolean*)(&args->ignoreUnrecognized) = true;
2553 }
2554
2555 // Parse specified settings file
2556 if (settings_file_specified) {
2557 if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) {
2558 return JNI_EINVAL;
2542 } 2559 }
2543 } 2560 }
2544 2561
2545 // Parse default .hotspotrc settings file 2562 // Parse default .hotspotrc settings file
2546 if (!settings_file_specified) { 2563 if (!settings_file_specified) {