src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6788376 Sdiff src/share/vm/runtime

src/share/vm/runtime/arguments.cpp

Print this page




2461             *wrt++ = *rd++;                   // copy to option string
2462           }
2463           rd++;                               // don't copy close quote
2464         } else {
2465           *wrt++ = *rd++;                     // copy to option string
2466         }
2467       }
2468       // Need to check if we're done before writing a NULL,
2469       // because the write could be to the byte that rd is pointing to.
2470       if (*rd++ == 0) {
2471         *wrt = 0;
2472         break;
2473       }
2474       *wrt = 0;                               // Zero terminate option
2475     }
2476     // Construct JavaVMInitArgs structure and parse as if it was part of the command line
2477     JavaVMInitArgs vm_args;
2478     vm_args.version = JNI_VERSION_1_2;
2479     vm_args.options = options;
2480     vm_args.nOptions = i;
2481     vm_args.ignoreUnrecognized = false;
2482 
2483     if (PrintVMOptions) {
2484       const char* tail;
2485       for (int i = 0; i < vm_args.nOptions; i++) {
2486         const JavaVMOption *option = vm_args.options + i;
2487         if (match_option(option, "-XX:", &tail)) {
2488           logOption(tail);
2489         }
2490       }
2491     }
2492 
2493     return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR));
2494   }
2495   return JNI_OK;
2496 }
2497 
2498 // Parse entry point called from JNI_CreateJavaVM
2499 
2500 jint Arguments::parse(const JavaVMInitArgs* args) {
2501 


2508     force_client_mode = true;
2509   }
2510 #endif // TIERED
2511   char *end = strrchr(jvm_path, *os::file_separator());
2512   if (end != NULL) *end = '\0';
2513   char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) +
2514                                         strlen(os::file_separator()) + 20);
2515   if (shared_archive_path == NULL) return JNI_ENOMEM;
2516   strcpy(shared_archive_path, jvm_path);
2517   strcat(shared_archive_path, os::file_separator());
2518   strcat(shared_archive_path, "classes");
2519   DEBUG_ONLY(strcat(shared_archive_path, "_g");)
2520   strcat(shared_archive_path, ".jsa");
2521   SharedArchivePath = shared_archive_path;
2522 
2523   // Remaining part of option string
2524   const char* tail;
2525 
2526   // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
2527   bool settings_file_specified = false;

2528   int index;
2529   for (index = 0; index < args->nOptions; index++) {
2530     const JavaVMOption *option = args->options + index;
2531     if (match_option(option, "-XX:Flags=", &tail)) {
2532       if (!process_settings_file(tail, true, args->ignoreUnrecognized)) {
2533         return JNI_EINVAL;
2534       }
2535       settings_file_specified = true;
2536     }
2537     if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
2538       PrintVMOptions = true;
2539     }
2540     if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
2541       PrintVMOptions = false;
2542     }


2543   }
















2544 
2545   // Parse default .hotspotrc settings file
2546   if (!settings_file_specified) {
2547     if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) {
2548       return JNI_EINVAL;
2549     }
2550   }
2551 
2552   if (PrintVMOptions) {
2553     for (index = 0; index < args->nOptions; index++) {
2554       const JavaVMOption *option = args->options + index;
2555       if (match_option(option, "-XX:", &tail)) {
2556         logOption(tail);
2557       }
2558     }
2559   }
2560 
2561 
2562   // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS
2563   jint result = parse_vm_init_args(args);




2461             *wrt++ = *rd++;                   // copy to option string
2462           }
2463           rd++;                               // don't copy close quote
2464         } else {
2465           *wrt++ = *rd++;                     // copy to option string
2466         }
2467       }
2468       // Need to check if we're done before writing a NULL,
2469       // because the write could be to the byte that rd is pointing to.
2470       if (*rd++ == 0) {
2471         *wrt = 0;
2472         break;
2473       }
2474       *wrt = 0;                               // Zero terminate option
2475     }
2476     // Construct JavaVMInitArgs structure and parse as if it was part of the command line
2477     JavaVMInitArgs vm_args;
2478     vm_args.version = JNI_VERSION_1_2;
2479     vm_args.options = options;
2480     vm_args.nOptions = i;
2481     vm_args.ignoreUnrecognized = IgnoreUnrecognizedVMOptions;
2482 
2483     if (PrintVMOptions) {
2484       const char* tail;
2485       for (int i = 0; i < vm_args.nOptions; i++) {
2486         const JavaVMOption *option = vm_args.options + i;
2487         if (match_option(option, "-XX:", &tail)) {
2488           logOption(tail);
2489         }
2490       }
2491     }
2492 
2493     return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR));
2494   }
2495   return JNI_OK;
2496 }
2497 
2498 // Parse entry point called from JNI_CreateJavaVM
2499 
2500 jint Arguments::parse(const JavaVMInitArgs* args) {
2501 


2508     force_client_mode = true;
2509   }
2510 #endif // TIERED
2511   char *end = strrchr(jvm_path, *os::file_separator());
2512   if (end != NULL) *end = '\0';
2513   char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) +
2514                                         strlen(os::file_separator()) + 20);
2515   if (shared_archive_path == NULL) return JNI_ENOMEM;
2516   strcpy(shared_archive_path, jvm_path);
2517   strcat(shared_archive_path, os::file_separator());
2518   strcat(shared_archive_path, "classes");
2519   DEBUG_ONLY(strcat(shared_archive_path, "_g");)
2520   strcat(shared_archive_path, ".jsa");
2521   SharedArchivePath = shared_archive_path;
2522 
2523   // Remaining part of option string
2524   const char* tail;
2525 
2526   // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
2527   bool settings_file_specified = false;
2528   const char* flags_file;
2529   int index;
2530   for (index = 0; index < args->nOptions; index++) {
2531     const JavaVMOption *option = args->options + index;
2532     if (match_option(option, "-XX:Flags=", &tail)) {
2533       flags_file = tail;


2534       settings_file_specified = true;
2535     }
2536     if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
2537       PrintVMOptions = true;
2538     }
2539     if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
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;
2559     }
2560   }
2561 
2562   // Parse default .hotspotrc settings file
2563   if (!settings_file_specified) {
2564     if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) {
2565       return JNI_EINVAL;
2566     }
2567   }
2568 
2569   if (PrintVMOptions) {
2570     for (index = 0; index < args->nOptions; index++) {
2571       const JavaVMOption *option = args->options + index;
2572       if (match_option(option, "-XX:", &tail)) {
2573         logOption(tail);
2574       }
2575     }
2576   }
2577 
2578 
2579   // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS
2580   jint result = parse_vm_init_args(args);


src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File