< prev index next >
src/share/vm/runtime/arguments.cpp
Print this page
rev 8803 : [mq]: 8066821.rev6
rev 8804 : [mq]: 8066821.rev7
*** 243,296 ****
* -XX arguments are parsed in parse_argument().
* -XX argument bounds checking is done in check_vm_args_consistency().
*
* Over time -XX arguments may change. There are mechanisms to handle common cases:
*
! * ALIAS: An option may be renamed or replaced by another option. The old name can be supported by
! * adding the old and new option names to the "aliased_jvm_flags" table. Delete the old
! * variable from globals.hpp. This is often part of the process of deprecating a flag, but
! * not all aliases need to be deprecated.
*
- * DEPRECATED: An option may be supported, but a warning is printed to let the user know that support may
- * be removed in the future. Both regular and aliased options may be deprecated.
* Add a deprecation warning for an option (or alias) by adding an entry in the
! * "deprecated_jvm_flags" table. Specify the option name, the jdk version that deprecated the
! * option, and the jdk version that will expire the option (use "undefined()" if removal has
! * been not scheduled).
*
! * OBSOLETE: An option may be removed (and deleted from globals.hpp), but still be accepted on the command
! * line. A warning is printed to let the user know that support may be removed in the future.
! * Add an obsolete warning for an option (or alias) by adding an entry in the
! * "obsolete_jvm_flags" table. Specify the option name, the jdk version that obsoleted the option,
! * and the jdk version that will expire the option (use "undefined()" if removal has been not
! * scheduled).
*
- * EXPIRED: When the current JDK version is equal or greater to the "accept_until" version of a deprecated
- * or obsolete option, the system will flatly refuse to admit the existence of the flag. This
- * allows a flag to die correctly over JDK releases.
* Note that manual cleanup of expired options should be done at major JDK version upgrades:
! * - Expired options can be removed from the obsolete_jvm_flags, deprecated_jvm_flags tables,
* and aliased_jvm_flags tables.
! * - Removed options may have global variable definitions that should also be
! * removed (in globals.hpp, etc).
*
! * Tests: Aliases are tested in VMAliasOptions.java.
! * Deprecated options are tested in VMDeprecatedOptions.java.
! * Obsolete options are tested in various files.
*/
// Obsolete or deprecated -XX flag.
typedef struct {
const char* name;
! JDK_Version obsoleted_in; // When the warning started (obsolete or deprecated).
JDK_Version accept_until; // Which version to start denying the existence of the flag (if scheduled).
} SpecialFlag;
! // When a flag is eliminated, it can be added to this list in order to
// continue accepting this flag on the command-line, while issuing a warning
// and ignoring the value. Once the JDK version reaches the 'accept_until'
! // limit, we flatly refuse to admit the existence of the flag.
static SpecialFlag const obsolete_jvm_flags[] = {
{ "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "SafepointPollOffset", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "UseBoundThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "DefaultThreadPriority", JDK_Version::jdk(9), JDK_Version::jdk(10) },
--- 243,302 ----
* -XX arguments are parsed in parse_argument().
* -XX argument bounds checking is done in check_vm_args_consistency().
*
* Over time -XX arguments may change. There are mechanisms to handle common cases:
*
! * ALIASED: An option that is simply another name for another option. This is often
! * part of the process of deprecating a flag, but not all aliases need
! * to be deprecated.
! *
! * Create an alias for an option by adding the old and new option names to the
! * "aliased_jvm_flags" table. Delete the old variable from globals.hpp (etc),.
! *
! * DEPRECATED: An option that is supported, but a warning is printed to let the user know that
! * support may be removed in the future. Both regular and aliased options may be
! * deprecated.
*
* Add a deprecation warning for an option (or alias) by adding an entry in the
! * "deprecated_jvm_flags" table. Often an option "deprecated" in one major release will
! * be made "obsolete" in the next. In this case the entry should be removed from the
! * "deprecated_jvm_flags" table and added to the "obsolete_jvm_flags" table (see below).
! *
! * OBSOLETE: An option that has been removed (and deleted from globals.hpp), but is still accepted
! * on the command line. A warning is printed to let the user know that option might not
! * be accepted in the future.
*
! * Add an obsolete warning for an option by adding an entry in the "obsolete_jvm_flags"
! * table.
! *
! * EXPIRED: A deprecated or obsolete option that has an "accept_until" version less than or equal
! * to the current JDK version. The system will flatly refuse to admit the existence of
! * the flag. This allows a flag to die automatically over JDK releases.
*
* Note that manual cleanup of expired options should be done at major JDK version upgrades:
! * - Expired options should be removed from the obsolete_jvm_flags, deprecated_jvm_flags,
* and aliased_jvm_flags tables.
! * - Expired deprecated options should have their global variable definitions removed
! * (in globals.hpp, etc).
*
! * Tests: Aliases should be tested in VMAliasOptions.java.
! * Deprecated options should be tested in VMDeprecatedOptions.java.
*/
// Obsolete or deprecated -XX flag.
typedef struct {
const char* name;
! JDK_Version warning_started_in; // When the warning started (obsolete or deprecated).
JDK_Version accept_until; // Which version to start denying the existence of the flag (if scheduled).
} SpecialFlag;
! // When a flag is made obsolete, it can be added to this list in order to
// continue accepting this flag on the command-line, while issuing a warning
// and ignoring the value. Once the JDK version reaches the 'accept_until'
! // limit, we flatly refuse to admit the existence of the flag. The 'accept_until'
! // field can be set to undefined() if the expiration date has not yet been set.
! // This table should be scrubbed of expired options on major JDK releases.
static SpecialFlag const obsolete_jvm_flags[] = {
{ "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "SafepointPollOffset", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "UseBoundThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "DefaultThreadPriority", JDK_Version::jdk(9), JDK_Version::jdk(10) },
*** 315,326 ****
{ "StarvationMonitorInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "PreInflateSpin", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ NULL, JDK_Version(0), JDK_Version(0) }
};
! // When a flag is deprecated, it can be added to this list in order to issuing a warning when the flag is used.
// Once the JDK version reaches the 'accept_until' limit, we flatly refuse to admit the existence of the flag.
static SpecialFlag const deprecated_jvm_flags[] = {
// deprecated non-alias flags:
{ "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined() },
{ "UseParNewGC", JDK_Version::jdk(9), JDK_Version::jdk(10) },
--- 321,336 ----
{ "StarvationMonitorInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "PreInflateSpin", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ NULL, JDK_Version(0), JDK_Version(0) }
};
! // When a flag is deprecated, it can be added to this list in order to issue a warning when the flag is used.
// Once the JDK version reaches the 'accept_until' limit, we flatly refuse to admit the existence of the flag.
+ // The 'accept_until' field can be set to undefined() if the expiration date has not yet been set.
+ // If a deprecated option should be treated as obsolete before it is expired, it needs to be removed
+ // from this table and added to the obsolete_jvm_flags table.
+ // This table should be scrubbed of expired options on major JDK releases.
static SpecialFlag const deprecated_jvm_flags[] = {
// deprecated non-alias flags:
{ "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined() },
{ "UseParNewGC", JDK_Version::jdk(9), JDK_Version::jdk(10) },
*** 363,383 ****
for (size_t i = 0; special_table[i].name != NULL; i++) {
const SpecialFlag& flag_status = special_table[i];
if ((strcmp(flag_status.name, flag_name) == 0)) {
if (flag_status.accept_until.is_undefined() ||
JDK_Version::current().compare(flag_status.accept_until) == -1) {
! *version = flag_status.obsoleted_in;
return 1;
} else {
return -1;
}
}
}
return 0;
}
! bool Arguments::is_newly_obsolete(const char *flag_name, JDK_Version* version) {
return (is_special_flag(obsolete_jvm_flags, flag_name, version) == 1);
}
int Arguments::is_deprecated_flag(const char *flag_name, JDK_Version* version) {
return is_special_flag(deprecated_jvm_flags, flag_name, version);
--- 373,393 ----
for (size_t i = 0; special_table[i].name != NULL; i++) {
const SpecialFlag& flag_status = special_table[i];
if ((strcmp(flag_status.name, flag_name) == 0)) {
if (flag_status.accept_until.is_undefined() ||
JDK_Version::current().compare(flag_status.accept_until) == -1) {
! *version = flag_status.warning_started_in;
return 1;
} else {
return -1;
}
}
}
return 0;
}
! bool Arguments::is_obsolete_flag(const char *flag_name, JDK_Version* version) {
return (is_special_flag(obsolete_jvm_flags, flag_name, version) == 1);
}
int Arguments::is_deprecated_flag(const char *flag_name, JDK_Version* version) {
return is_special_flag(deprecated_jvm_flags, flag_name, version);
*** 803,813 ****
bool warn_if_deprecated = true;
if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
if (real_name == NULL) {
! return false; // "name" is a deprecated option that has expired.
}
return set_bool_flag(real_name, false, origin);
}
if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
--- 813,823 ----
bool warn_if_deprecated = true;
if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
if (real_name == NULL) {
! return false;
}
return set_bool_flag(real_name, false, origin);
}
if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
*** 1010,1020 ****
// Construct a string which consists only of the argument name without '+', '-', or '='.
char stripped_argname[BUFLEN+1];
strncpy(stripped_argname, argname, arg_len);
stripped_argname[arg_len] = '\0'; // strncpy may not null terminate.
! if (is_newly_obsolete(stripped_argname, &since)) {
char version[256];
since.to_string(version, sizeof(version));
warning("Ignoring option %s; support was removed in %s", stripped_argname, version);
return true;
}
--- 1020,1030 ----
// Construct a string which consists only of the argument name without '+', '-', or '='.
char stripped_argname[BUFLEN+1];
strncpy(stripped_argname, argname, arg_len);
stripped_argname[arg_len] = '\0'; // strncpy may not null terminate.
! if (is_obsolete_flag(stripped_argname, &since)) {
char version[256];
since.to_string(version, sizeof(version));
warning("Ignoring option %s; support was removed in %s", stripped_argname, version);
return true;
}
< prev index next >