66 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
67 #define DEFAULT_JAVA_LAUNCHER "generic"
68
69 #define UNSUPPORTED_GC_OPTION(gc) \
70 do { \
71 if (gc) { \
72 if (FLAG_IS_CMDLINE(gc)) { \
73 warning(#gc " is not supported in this VM. Using Serial GC."); \
74 } \
75 FLAG_SET_DEFAULT(gc, false); \
76 } \
77 } while(0)
78
79 char* Arguments::_jvm_flags_file = NULL;
80 char** Arguments::_jvm_flags_array = NULL;
81 int Arguments::_num_jvm_flags = 0;
82 char** Arguments::_jvm_args_array = NULL;
83 int Arguments::_num_jvm_args = 0;
84 char* Arguments::_java_command = NULL;
85 SystemProperty* Arguments::_system_properties = NULL;
86 bool Arguments::_has_profile = false;
87 size_t Arguments::_conservative_max_heap_alignment = 0;
88 size_t Arguments::_min_heap_size = 0;
89 Arguments::Mode Arguments::_mode = _mixed;
90 bool Arguments::_java_compiler = false;
91 bool Arguments::_xdebug_mode = false;
92 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG;
93 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
94 int Arguments::_sun_java_launcher_pid = -1;
95 bool Arguments::_sun_java_launcher_is_altjvm = false;
96
97 // These parameters are reset in method parse_vm_init_args()
98 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
99 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement;
100 bool Arguments::_BackgroundCompilation = BackgroundCompilation;
101 bool Arguments::_ClipInlining = ClipInlining;
102 intx Arguments::_Tier3InvokeNotifyFreqLog = Tier3InvokeNotifyFreqLog;
103 intx Arguments::_Tier4InvocationThreshold = Tier4InvocationThreshold;
104
105 char* Arguments::SharedArchivePath = NULL;
3073 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true) != Flag::SUCCESS) {
3074 return JNI_EINVAL;
3075 }
3076 } else if (strcmp(tail, ":none") == 0) {
3077 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false) != Flag::SUCCESS) {
3078 return JNI_EINVAL;
3079 }
3080 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false) != Flag::SUCCESS) {
3081 return JNI_EINVAL;
3082 }
3083 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
3084 return JNI_EINVAL;
3085 }
3086 // -Xdebug
3087 } else if (match_option(option, "-Xdebug")) {
3088 // note this flag has been used, then ignore
3089 set_xdebug_mode(true);
3090 // -Xnoagent
3091 } else if (match_option(option, "-Xnoagent")) {
3092 // For compatibility with classic. HotSpot refuses to load the old style agent.dll.
3093 } else if (match_option(option, "-Xlog", &tail)) {
3094 bool ret = false;
3095 if (strcmp(tail, ":help") == 0) {
3096 LogConfiguration::print_command_line_help(defaultStream::output_stream());
3097 vm_exit(0);
3098 } else if (strcmp(tail, ":disable") == 0) {
3099 LogConfiguration::disable_logging();
3100 ret = true;
3101 } else if (*tail == '\0') {
3102 ret = LogConfiguration::parse_command_line_arguments();
3103 assert(ret, "-Xlog without arguments should never fail to parse");
3104 } else if (*tail == ':') {
3105 ret = LogConfiguration::parse_command_line_arguments(tail + 1);
3106 }
3107 if (ret == false) {
3108 jio_fprintf(defaultStream::error_stream(),
3109 "Invalid -Xlog option '-Xlog%s'\n",
3110 tail);
3111 return JNI_EINVAL;
3112 }
3982 #ifndef PRODUCT
3983 if (match_option(option, "-XX:+PrintFlagsWithComments")) {
3984 CommandLineFlags::printFlags(tty, true);
3985 vm_exit(0);
3986 }
3987 #endif
3988 }
3989 return JNI_OK;
3990 }
3991
3992 static void print_options(const JavaVMInitArgs *args) {
3993 const char* tail;
3994 for (int index = 0; index < args->nOptions; index++) {
3995 const JavaVMOption *option = args->options + index;
3996 if (match_option(option, "-XX:", &tail)) {
3997 logOption(tail);
3998 }
3999 }
4000 }
4001
4002 // Parse entry point called from JNI_CreateJavaVM
4003
4004 jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
4005 assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent");
4006
4007 // Initialize ranges and constraints
4008 CommandLineFlagRangeList::init();
4009 CommandLineFlagConstraintList::init();
4010
4011 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
4012 const char* hotspotrc = ".hotspotrc";
4013 bool settings_file_specified = false;
4014 bool needs_hotspotrc_warning = false;
4015 ScopedVMInitArgs initial_java_tool_options_args("env_var='JAVA_TOOL_OPTIONS'");
4016 ScopedVMInitArgs initial_java_options_args("env_var='_JAVA_OPTIONS'");
4017
4018 // Pointers to current working set of containers
4019 JavaVMInitArgs* cur_cmd_args;
4020 JavaVMInitArgs* cur_java_options_args;
4021 JavaVMInitArgs* cur_java_tool_options_args;
4128
4129 ArgumentsExt::report_unsupported_options();
4130
4131 #ifndef PRODUCT
4132 if (TraceBytecodesAt != 0) {
4133 TraceBytecodes = true;
4134 }
4135 if (CountCompiledCalls) {
4136 if (UseCounterDecay) {
4137 warning("UseCounterDecay disabled because CountCalls is set");
4138 UseCounterDecay = false;
4139 }
4140 }
4141 #endif // PRODUCT
4142
4143 if (ScavengeRootsInCode == 0) {
4144 if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
4145 warning("Forcing ScavengeRootsInCode non-zero");
4146 }
4147 ScavengeRootsInCode = 1;
4148 }
4149
4150 // Set object alignment values.
4151 set_object_alignment();
4152
4153 #if !INCLUDE_ALL_GCS
4154 force_serial_gc();
4155 #endif // INCLUDE_ALL_GCS
4156 #if !INCLUDE_CDS
4157 if (DumpSharedSpaces || RequireSharedSpaces) {
4158 jio_fprintf(defaultStream::error_stream(),
4159 "Shared spaces are not supported in this VM\n");
4160 return JNI_ERR;
4161 }
4162 if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) || PrintSharedSpaces) {
4163 warning("Shared spaces are not supported in this VM");
4164 FLAG_SET_DEFAULT(UseSharedSpaces, false);
4165 FLAG_SET_DEFAULT(PrintSharedSpaces, false);
4166 }
4167 no_shared_spaces("CDS Disabled");
|
66 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
67 #define DEFAULT_JAVA_LAUNCHER "generic"
68
69 #define UNSUPPORTED_GC_OPTION(gc) \
70 do { \
71 if (gc) { \
72 if (FLAG_IS_CMDLINE(gc)) { \
73 warning(#gc " is not supported in this VM. Using Serial GC."); \
74 } \
75 FLAG_SET_DEFAULT(gc, false); \
76 } \
77 } while(0)
78
79 char* Arguments::_jvm_flags_file = NULL;
80 char** Arguments::_jvm_flags_array = NULL;
81 int Arguments::_num_jvm_flags = 0;
82 char** Arguments::_jvm_args_array = NULL;
83 int Arguments::_num_jvm_args = 0;
84 char* Arguments::_java_command = NULL;
85 SystemProperty* Arguments::_system_properties = NULL;
86 const char* Arguments::_gc_log_filename = NULL;
87 bool Arguments::_has_profile = false;
88 size_t Arguments::_conservative_max_heap_alignment = 0;
89 size_t Arguments::_min_heap_size = 0;
90 Arguments::Mode Arguments::_mode = _mixed;
91 bool Arguments::_java_compiler = false;
92 bool Arguments::_xdebug_mode = false;
93 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG;
94 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
95 int Arguments::_sun_java_launcher_pid = -1;
96 bool Arguments::_sun_java_launcher_is_altjvm = false;
97
98 // These parameters are reset in method parse_vm_init_args()
99 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
100 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement;
101 bool Arguments::_BackgroundCompilation = BackgroundCompilation;
102 bool Arguments::_ClipInlining = ClipInlining;
103 intx Arguments::_Tier3InvokeNotifyFreqLog = Tier3InvokeNotifyFreqLog;
104 intx Arguments::_Tier4InvocationThreshold = Tier4InvocationThreshold;
105
106 char* Arguments::SharedArchivePath = NULL;
3074 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true) != Flag::SUCCESS) {
3075 return JNI_EINVAL;
3076 }
3077 } else if (strcmp(tail, ":none") == 0) {
3078 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false) != Flag::SUCCESS) {
3079 return JNI_EINVAL;
3080 }
3081 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false) != Flag::SUCCESS) {
3082 return JNI_EINVAL;
3083 }
3084 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
3085 return JNI_EINVAL;
3086 }
3087 // -Xdebug
3088 } else if (match_option(option, "-Xdebug")) {
3089 // note this flag has been used, then ignore
3090 set_xdebug_mode(true);
3091 // -Xnoagent
3092 } else if (match_option(option, "-Xnoagent")) {
3093 // For compatibility with classic. HotSpot refuses to load the old style agent.dll.
3094 } else if (match_option(option, "-Xloggc:", &tail)) {
3095 // Deprecated flag to redirect GC output to a file. -Xloggc:<filename>
3096 log_warning(gc)("-Xloggc is deprecated. Will use -Xlog:gc:%s instead.", tail);
3097 _gc_log_filename = os::strdup_check_oom(tail);
3098 } else if (match_option(option, "-Xlog", &tail)) {
3099 bool ret = false;
3100 if (strcmp(tail, ":help") == 0) {
3101 LogConfiguration::print_command_line_help(defaultStream::output_stream());
3102 vm_exit(0);
3103 } else if (strcmp(tail, ":disable") == 0) {
3104 LogConfiguration::disable_logging();
3105 ret = true;
3106 } else if (*tail == '\0') {
3107 ret = LogConfiguration::parse_command_line_arguments();
3108 assert(ret, "-Xlog without arguments should never fail to parse");
3109 } else if (*tail == ':') {
3110 ret = LogConfiguration::parse_command_line_arguments(tail + 1);
3111 }
3112 if (ret == false) {
3113 jio_fprintf(defaultStream::error_stream(),
3114 "Invalid -Xlog option '-Xlog%s'\n",
3115 tail);
3116 return JNI_EINVAL;
3117 }
3987 #ifndef PRODUCT
3988 if (match_option(option, "-XX:+PrintFlagsWithComments")) {
3989 CommandLineFlags::printFlags(tty, true);
3990 vm_exit(0);
3991 }
3992 #endif
3993 }
3994 return JNI_OK;
3995 }
3996
3997 static void print_options(const JavaVMInitArgs *args) {
3998 const char* tail;
3999 for (int index = 0; index < args->nOptions; index++) {
4000 const JavaVMOption *option = args->options + index;
4001 if (match_option(option, "-XX:", &tail)) {
4002 logOption(tail);
4003 }
4004 }
4005 }
4006
4007 bool Arguments::handle_deprecated_print_gc_flags() {
4008 if (PrintGC) {
4009 log_warning(gc)("-XX:+PrintGC is deprecated. Will use -Xlog:gc instead.");
4010 }
4011 if (PrintGCDetails) {
4012 log_warning(gc)("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
4013 }
4014
4015 if (_gc_log_filename != NULL) {
4016 // -Xloggc was used to specify a filename
4017 const char* gc_conf = PrintGCDetails ? "gc*" : "gc";
4018 return LogConfiguration::parse_log_arguments(_gc_log_filename, gc_conf, NULL, NULL, NULL);
4019 } else if (PrintGC || PrintGCDetails) {
4020 LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc));
4021 }
4022 return true;
4023 }
4024
4025 // Parse entry point called from JNI_CreateJavaVM
4026
4027 jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
4028 assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent");
4029
4030 // Initialize ranges and constraints
4031 CommandLineFlagRangeList::init();
4032 CommandLineFlagConstraintList::init();
4033
4034 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
4035 const char* hotspotrc = ".hotspotrc";
4036 bool settings_file_specified = false;
4037 bool needs_hotspotrc_warning = false;
4038 ScopedVMInitArgs initial_java_tool_options_args("env_var='JAVA_TOOL_OPTIONS'");
4039 ScopedVMInitArgs initial_java_options_args("env_var='_JAVA_OPTIONS'");
4040
4041 // Pointers to current working set of containers
4042 JavaVMInitArgs* cur_cmd_args;
4043 JavaVMInitArgs* cur_java_options_args;
4044 JavaVMInitArgs* cur_java_tool_options_args;
4151
4152 ArgumentsExt::report_unsupported_options();
4153
4154 #ifndef PRODUCT
4155 if (TraceBytecodesAt != 0) {
4156 TraceBytecodes = true;
4157 }
4158 if (CountCompiledCalls) {
4159 if (UseCounterDecay) {
4160 warning("UseCounterDecay disabled because CountCalls is set");
4161 UseCounterDecay = false;
4162 }
4163 }
4164 #endif // PRODUCT
4165
4166 if (ScavengeRootsInCode == 0) {
4167 if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
4168 warning("Forcing ScavengeRootsInCode non-zero");
4169 }
4170 ScavengeRootsInCode = 1;
4171 }
4172
4173 if (!handle_deprecated_print_gc_flags()) {
4174 return JNI_EINVAL;
4175 }
4176
4177 // Set object alignment values.
4178 set_object_alignment();
4179
4180 #if !INCLUDE_ALL_GCS
4181 force_serial_gc();
4182 #endif // INCLUDE_ALL_GCS
4183 #if !INCLUDE_CDS
4184 if (DumpSharedSpaces || RequireSharedSpaces) {
4185 jio_fprintf(defaultStream::error_stream(),
4186 "Shared spaces are not supported in this VM\n");
4187 return JNI_ERR;
4188 }
4189 if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) || PrintSharedSpaces) {
4190 warning("Shared spaces are not supported in this VM");
4191 FLAG_SET_DEFAULT(UseSharedSpaces, false);
4192 FLAG_SET_DEFAULT(PrintSharedSpaces, false);
4193 }
4194 no_shared_spaces("CDS Disabled");
|