2598 size_t length = strlen(tail) + 1;
2599 char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments);
2600 jio_snprintf(options, length, "%s", tail);
2601 add_instrument_agent("instrument", options, false);
2602 // java agents need module java.instrument
2603 if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) {
2604 return JNI_ENOMEM;
2605 }
2606 }
2607 #endif // !INCLUDE_JVMTI
2608 // --enable_preview
2609 } else if (match_option(option, "--enable-preview")) {
2610 set_enable_preview();
2611 // -Xnoclassgc
2612 } else if (match_option(option, "-Xnoclassgc")) {
2613 if (FLAG_SET_CMDLINE(ClassUnloading, false) != JVMFlag::SUCCESS) {
2614 return JNI_EINVAL;
2615 }
2616 // -Xconcgc
2617 } else if (match_option(option, "-Xconcgc")) {
2618 handle_extra_cms_flags("-Xconcgc uses UseConcMarkSweepGC");
2619 // -Xnoconcgc
2620 } else if (match_option(option, "-Xnoconcgc")) {
2621 handle_extra_cms_flags("-Xnoconcgc uses UseConcMarkSweepGC");
2622 // -Xbatch
2623 } else if (match_option(option, "-Xbatch")) {
2624 if (FLAG_SET_CMDLINE(BackgroundCompilation, false) != JVMFlag::SUCCESS) {
2625 return JNI_EINVAL;
2626 }
2627 // -Xmn for compatibility with other JVM vendors
2628 } else if (match_option(option, "-Xmn", &tail)) {
2629 julong long_initial_young_size = 0;
2630 ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2631 if (errcode != arg_in_range) {
2632 jio_fprintf(defaultStream::error_stream(),
2633 "Invalid initial young generation size: %s\n", option->optionString);
2634 describe_range_error(errcode);
2635 return JNI_EINVAL;
2636 }
2637 if (FLAG_SET_CMDLINE(MaxNewSize, (size_t)long_initial_young_size) != JVMFlag::SUCCESS) {
2638 return JNI_EINVAL;
2639 }
2640 if (FLAG_SET_CMDLINE(NewSize, (size_t)long_initial_young_size) != JVMFlag::SUCCESS) {
2641 return JNI_EINVAL;
3842 if (PrintGC) {
3843 log_warning(gc)("-XX:+PrintGC is deprecated. Will use -Xlog:gc instead.");
3844 }
3845 if (PrintGCDetails) {
3846 log_warning(gc)("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
3847 }
3848
3849 if (_gc_log_filename != NULL) {
3850 // -Xloggc was used to specify a filename
3851 const char* gc_conf = PrintGCDetails ? "gc*" : "gc";
3852
3853 LogTarget(Error, logging) target;
3854 LogStream errstream(target);
3855 return LogConfiguration::parse_log_arguments(_gc_log_filename, gc_conf, NULL, NULL, &errstream);
3856 } else if (PrintGC || PrintGCDetails) {
3857 LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc));
3858 }
3859 return true;
3860 }
3861
3862 void Arguments::handle_extra_cms_flags(const char* msg) {
3863 SpecialFlag flag;
3864 const char *flag_name = "UseConcMarkSweepGC";
3865 if (lookup_special_flag(flag_name, flag)) {
3866 handle_aliases_and_deprecation(flag_name, /* print warning */ true);
3867 warning("%s", msg);
3868 }
3869 }
3870
3871 // Parse entry point called from JNI_CreateJavaVM
3872
3873 jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
3874 assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent");
3875
3876 // Initialize ranges, constraints and writeables
3877 JVMFlagRangeList::init();
3878 JVMFlagConstraintList::init();
3879 JVMFlagWriteableList::init();
3880
3881 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
3882 const char* hotspotrc = ".hotspotrc";
3883 bool settings_file_specified = false;
3884 bool needs_hotspotrc_warning = false;
3885 ScopedVMInitArgs initial_java_tool_options_args("env_var='JAVA_TOOL_OPTIONS'");
3886 ScopedVMInitArgs initial_java_options_args("env_var='_JAVA_OPTIONS'");
3887
3888 // Pointers to current working set of containers
3889 JavaVMInitArgs* cur_cmd_args;
3890 JavaVMInitArgs* cur_java_options_args;
|
2598 size_t length = strlen(tail) + 1;
2599 char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments);
2600 jio_snprintf(options, length, "%s", tail);
2601 add_instrument_agent("instrument", options, false);
2602 // java agents need module java.instrument
2603 if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) {
2604 return JNI_ENOMEM;
2605 }
2606 }
2607 #endif // !INCLUDE_JVMTI
2608 // --enable_preview
2609 } else if (match_option(option, "--enable-preview")) {
2610 set_enable_preview();
2611 // -Xnoclassgc
2612 } else if (match_option(option, "-Xnoclassgc")) {
2613 if (FLAG_SET_CMDLINE(ClassUnloading, false) != JVMFlag::SUCCESS) {
2614 return JNI_EINVAL;
2615 }
2616 // -Xconcgc
2617 } else if (match_option(option, "-Xconcgc")) {
2618 warning("-Xconcgc uses UseConcMarkSweepGC; support was removed for both options in 14.0");
2619 // -Xnoconcgc
2620 } else if (match_option(option, "-Xnoconcgc")) {
2621 warning("-Xnoconcgc uses UseConcMarkSweepGC; support was removed for both options in 14.0");
2622 // -Xbatch
2623 } else if (match_option(option, "-Xbatch")) {
2624 if (FLAG_SET_CMDLINE(BackgroundCompilation, false) != JVMFlag::SUCCESS) {
2625 return JNI_EINVAL;
2626 }
2627 // -Xmn for compatibility with other JVM vendors
2628 } else if (match_option(option, "-Xmn", &tail)) {
2629 julong long_initial_young_size = 0;
2630 ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2631 if (errcode != arg_in_range) {
2632 jio_fprintf(defaultStream::error_stream(),
2633 "Invalid initial young generation size: %s\n", option->optionString);
2634 describe_range_error(errcode);
2635 return JNI_EINVAL;
2636 }
2637 if (FLAG_SET_CMDLINE(MaxNewSize, (size_t)long_initial_young_size) != JVMFlag::SUCCESS) {
2638 return JNI_EINVAL;
2639 }
2640 if (FLAG_SET_CMDLINE(NewSize, (size_t)long_initial_young_size) != JVMFlag::SUCCESS) {
2641 return JNI_EINVAL;
3842 if (PrintGC) {
3843 log_warning(gc)("-XX:+PrintGC is deprecated. Will use -Xlog:gc instead.");
3844 }
3845 if (PrintGCDetails) {
3846 log_warning(gc)("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
3847 }
3848
3849 if (_gc_log_filename != NULL) {
3850 // -Xloggc was used to specify a filename
3851 const char* gc_conf = PrintGCDetails ? "gc*" : "gc";
3852
3853 LogTarget(Error, logging) target;
3854 LogStream errstream(target);
3855 return LogConfiguration::parse_log_arguments(_gc_log_filename, gc_conf, NULL, NULL, &errstream);
3856 } else if (PrintGC || PrintGCDetails) {
3857 LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc));
3858 }
3859 return true;
3860 }
3861
3862 // Parse entry point called from JNI_CreateJavaVM
3863
3864 jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
3865 assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent");
3866
3867 // Initialize ranges, constraints and writeables
3868 JVMFlagRangeList::init();
3869 JVMFlagConstraintList::init();
3870 JVMFlagWriteableList::init();
3871
3872 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
3873 const char* hotspotrc = ".hotspotrc";
3874 bool settings_file_specified = false;
3875 bool needs_hotspotrc_warning = false;
3876 ScopedVMInitArgs initial_java_tool_options_args("env_var='JAVA_TOOL_OPTIONS'");
3877 ScopedVMInitArgs initial_java_options_args("env_var='_JAVA_OPTIONS'");
3878
3879 // Pointers to current working set of containers
3880 JavaVMInitArgs* cur_cmd_args;
3881 JavaVMInitArgs* cur_java_options_args;
|