310 { "NmethodSweepCheckInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) },
311 { "CodeCacheMinimumFreeSpace", JDK_Version::jdk(9), JDK_Version::jdk(10) },
312 #ifndef ZERO
313 { "UseFastAccessorMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
314 { "UseFastEmptyMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
315 #endif // ZERO
316 { NULL, JDK_Version(0), JDK_Version(0) }
317 };
318
319 // Returns true if the flag is obsolete and fits into the range specified
320 // for being ignored. In the case that the flag is ignored, the 'version'
321 // value is filled in with the version number when the flag became
322 // obsolete so that that value can be displayed to the user.
323 bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
324 int i = 0;
325 assert(version != NULL, "Must provide a version buffer");
326 while (obsolete_jvm_flags[i].name != NULL) {
327 const ObsoleteFlag& flag_status = obsolete_jvm_flags[i];
328 // <flag>=xxx form
329 // [-|+]<flag> form
330 if ((strncmp(flag_status.name, s, strlen(flag_status.name)) == 0) ||
331 ((s[0] == '+' || s[0] == '-') &&
332 (strncmp(flag_status.name, &s[1], strlen(flag_status.name)) == 0))) {
333 if (JDK_Version::current().compare(flag_status.accept_until) == -1) {
334 *version = flag_status.obsoleted_in;
335 return true;
336 }
337 }
338 i++;
339 }
340 return false;
341 }
342
343 // Constructs the system class path (aka boot class path) from the following
344 // components, in order:
345 //
346 // prefix // from -Xbootclasspath/p:...
347 // endorsed // the expansion of -Djava.endorsed.dirs=...
348 // base // from os::get_system_properties() or -Xbootclasspath=
349 // suffix // from -Xbootclasspath/a:...
350 //
351 // java.endorsed.dirs is a list of directories; any jar or zip files in the
352 // directories are added to the sysclasspath just before the base.
917 if (strlen(locked_message_buf) == 0) {
918 if (found_flag->is_bool() && !has_plus_minus) {
919 jio_fprintf(defaultStream::error_stream(),
920 "Missing +/- setting for VM option '%s'\n", argname);
921 } else if (!found_flag->is_bool() && has_plus_minus) {
922 jio_fprintf(defaultStream::error_stream(),
923 "Unexpected +/- setting in VM option '%s'\n", argname);
924 } else {
925 jio_fprintf(defaultStream::error_stream(),
926 "Improperly specified VM option '%s'\n", argname);
927 }
928 } else {
929 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
930 }
931 } else {
932 jio_fprintf(defaultStream::error_stream(),
933 "Unrecognized VM option '%s'\n", argname);
934 Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
935 if (fuzzy_matched != NULL) {
936 jio_fprintf(defaultStream::error_stream(),
937 "Did you mean '%s%s%s'?\n",
938 (fuzzy_matched->is_bool()) ? "(+/-)" : "",
939 fuzzy_matched->_name,
940 (fuzzy_matched->is_bool()) ? "" : "=<value>");
941 }
942 }
943
944 // allow for commandline "commenting out" options like -XX:#+Verbose
945 return arg[0] == '#';
946 }
947
948 bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) {
949 FILE* stream = fopen(file_name, "rb");
950 if (stream == NULL) {
951 if (should_exist) {
952 jio_fprintf(defaultStream::error_stream(),
953 "Could not open settings file %s\n", file_name);
954 return false;
955 } else {
956 return true;
957 }
958 }
959
960 char token[1024];
|
310 { "NmethodSweepCheckInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) },
311 { "CodeCacheMinimumFreeSpace", JDK_Version::jdk(9), JDK_Version::jdk(10) },
312 #ifndef ZERO
313 { "UseFastAccessorMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
314 { "UseFastEmptyMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
315 #endif // ZERO
316 { NULL, JDK_Version(0), JDK_Version(0) }
317 };
318
319 // Returns true if the flag is obsolete and fits into the range specified
320 // for being ignored. In the case that the flag is ignored, the 'version'
321 // value is filled in with the version number when the flag became
322 // obsolete so that that value can be displayed to the user.
323 bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
324 int i = 0;
325 assert(version != NULL, "Must provide a version buffer");
326 while (obsolete_jvm_flags[i].name != NULL) {
327 const ObsoleteFlag& flag_status = obsolete_jvm_flags[i];
328 // <flag>=xxx form
329 // [-|+]<flag> form
330 size_t len = strlen(flag_status.name);
331 if (((strncmp(flag_status.name, s, len) == 0) &&
332 (strlen(s) == len)) ||
333 ((s[0] == '+' || s[0] == '-') &&
334 (strlen(&s[1]) == len) &&
335 (strncmp(flag_status.name, &s[1], len) == 0))
336 ) {
337 if (JDK_Version::current().compare(flag_status.accept_until) == -1) {
338 *version = flag_status.obsoleted_in;
339 return true;
340 }
341 }
342 i++;
343 }
344 return false;
345 }
346
347 // Constructs the system class path (aka boot class path) from the following
348 // components, in order:
349 //
350 // prefix // from -Xbootclasspath/p:...
351 // endorsed // the expansion of -Djava.endorsed.dirs=...
352 // base // from os::get_system_properties() or -Xbootclasspath=
353 // suffix // from -Xbootclasspath/a:...
354 //
355 // java.endorsed.dirs is a list of directories; any jar or zip files in the
356 // directories are added to the sysclasspath just before the base.
921 if (strlen(locked_message_buf) == 0) {
922 if (found_flag->is_bool() && !has_plus_minus) {
923 jio_fprintf(defaultStream::error_stream(),
924 "Missing +/- setting for VM option '%s'\n", argname);
925 } else if (!found_flag->is_bool() && has_plus_minus) {
926 jio_fprintf(defaultStream::error_stream(),
927 "Unexpected +/- setting in VM option '%s'\n", argname);
928 } else {
929 jio_fprintf(defaultStream::error_stream(),
930 "Improperly specified VM option '%s'\n", argname);
931 }
932 } else {
933 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
934 }
935 } else {
936 jio_fprintf(defaultStream::error_stream(),
937 "Unrecognized VM option '%s'\n", argname);
938 Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
939 if (fuzzy_matched != NULL) {
940 jio_fprintf(defaultStream::error_stream(),
941 "Did you mean '%s%s%s'? ",
942 (fuzzy_matched->is_bool()) ? "(+/-)" : "",
943 fuzzy_matched->_name,
944 (fuzzy_matched->is_bool()) ? "" : "=<value>");
945 if (is_newly_obsolete(fuzzy_matched->_name, &since)){
946 char version[256];
947 since.to_string(version, sizeof(version));
948 jio_fprintf(defaultStream::error_stream(),
949 "Warning: support for %s was removed in %s\n",
950 fuzzy_matched->_name,
951 version);
952 }
953 }
954 }
955
956 // allow for commandline "commenting out" options like -XX:#+Verbose
957 return arg[0] == '#';
958 }
959
960 bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) {
961 FILE* stream = fopen(file_name, "rb");
962 if (stream == NULL) {
963 if (should_exist) {
964 jio_fprintf(defaultStream::error_stream(),
965 "Could not open settings file %s\n", file_name);
966 return false;
967 } else {
968 return true;
969 }
970 }
971
972 char token[1024];
|