8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
Add support for alias options and automatically expiring deprecated options Reviewed-by: dholmes, kbarrett, acorn
This commit is contained in:
parent
26254f4645
commit
23813ce92e
@ -118,7 +118,7 @@ char* Arguments::_ext_dirs = NULL;
|
|||||||
// part of the option string.
|
// part of the option string.
|
||||||
static bool match_option(const JavaVMOption *option, const char* name,
|
static bool match_option(const JavaVMOption *option, const char* name,
|
||||||
const char** tail) {
|
const char** tail) {
|
||||||
int len = (int)strlen(name);
|
size_t len = strlen(name);
|
||||||
if (strncmp(option->optionString, name, len) == 0) {
|
if (strncmp(option->optionString, name, len) == 0) {
|
||||||
*tail = option->optionString + len;
|
*tail = option->optionString + len;
|
||||||
return true;
|
return true;
|
||||||
@ -219,11 +219,9 @@ void Arguments::init_system_properties() {
|
|||||||
void Arguments::init_version_specific_system_properties() {
|
void Arguments::init_version_specific_system_properties() {
|
||||||
enum { bufsz = 16 };
|
enum { bufsz = 16 };
|
||||||
char buffer[bufsz];
|
char buffer[bufsz];
|
||||||
const char* spec_vendor = "Sun Microsystems Inc.";
|
const char* spec_vendor = "Oracle Corporation";
|
||||||
uint32_t spec_version = 0;
|
uint32_t spec_version = JDK_Version::current().major_version();
|
||||||
|
|
||||||
spec_vendor = "Oracle Corporation";
|
|
||||||
spec_version = JDK_Version::current().major_version();
|
|
||||||
jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version);
|
jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version);
|
||||||
|
|
||||||
PropertyList_add(&_system_properties,
|
PropertyList_add(&_system_properties,
|
||||||
@ -234,75 +232,290 @@ void Arguments::init_version_specific_system_properties() {
|
|||||||
new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false));
|
new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Provide a slightly more user-friendly way of eliminating -XX flags.
|
* -XX argument processing:
|
||||||
* 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
|
* -XX arguments are defined in several places, such as:
|
||||||
* and ignoring the value. Once the JDK version reaches the 'accept_until'
|
* globals.hpp, globals_<cpu>.hpp, globals_<os>.hpp, <compiler>_globals.hpp, or <gc>_globals.hpp.
|
||||||
* limit, we flatly refuse to admit the existence of the flag. This allows
|
* -XX arguments are parsed in parse_argument().
|
||||||
* a flag to die correctly over JDK releases using HSX.
|
* -XX argument bounds checking is done in check_vm_args_consistency().
|
||||||
* But now that HSX is no longer supported only options with a future
|
*
|
||||||
* accept_until value need to be listed, and the list can be pruned
|
* Over time -XX arguments may change. There are mechanisms to handle common cases:
|
||||||
* on each major release.
|
*
|
||||||
|
* 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
|
||||||
|
* "special_jvm_flags" table and setting the "deprecated_in" field.
|
||||||
|
* Often an option "deprecated" in one major release will
|
||||||
|
* be made "obsolete" in the next. In this case the entry should also have it's
|
||||||
|
* "obsolete_in" field set.
|
||||||
|
*
|
||||||
|
* 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 "special_jvm_flags"
|
||||||
|
* table and setting the "obsolete_in" field.
|
||||||
|
*
|
||||||
|
* 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:
|
||||||
|
* - Newly expired options should be removed from the special_jvm_flags and aliased_jvm_flags tables.
|
||||||
|
* - Newly obsolete or expired deprecated options should have their global variable
|
||||||
|
* definitions removed (from globals.hpp, etc) and related implementations removed.
|
||||||
|
*
|
||||||
|
* Recommended approach for removing options:
|
||||||
|
*
|
||||||
|
* To remove options commonly used by customers (e.g. product, commercial -XX options), use
|
||||||
|
* the 3-step model adding major release numbers to the deprecate, obsolete and expire columns.
|
||||||
|
*
|
||||||
|
* To remove internal options (e.g. diagnostic, experimental, develop options), use
|
||||||
|
* a 2-step model adding major release numbers to the obsolete and expire columns.
|
||||||
|
*
|
||||||
|
* To change the name of an option, use the alias table as well as a 2-step
|
||||||
|
* model adding major release numbers to the deprecate and expire columns.
|
||||||
|
* Think twice about aliasing commonly used customer options.
|
||||||
|
*
|
||||||
|
* There are times when it is appropriate to leave a future release number as undefined.
|
||||||
|
*
|
||||||
|
* Tests: Aliases should be tested in VMAliasOptions.java.
|
||||||
|
* Deprecated options should be tested in VMDeprecatedOptions.java.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Obsolete or deprecated -XX flag.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char* name;
|
const char* name;
|
||||||
JDK_Version obsoleted_in; // when the flag went away
|
JDK_Version deprecated_in; // When the deprecation warning started (or "undefined").
|
||||||
JDK_Version accept_until; // which version to start denying the existence
|
JDK_Version obsolete_in; // When the obsolete warning started (or "undefined").
|
||||||
} ObsoleteFlag;
|
JDK_Version expired_in; // When the option expires (or "undefined").
|
||||||
|
} SpecialFlag;
|
||||||
|
|
||||||
static ObsoleteFlag obsolete_jvm_flags[] = {
|
// The special_jvm_flags table declares options that are being deprecated and/or obsoleted. The
|
||||||
{ "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// "deprecated_in" or "obsolete_in" fields may be set to "undefined", but not both.
|
||||||
{ "SafepointPollOffset", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// When the JDK version reaches 'deprecated_in' limit, the JVM will process this flag on
|
||||||
{ "UseBoundThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// the command-line as usual, but will issue a warning.
|
||||||
{ "DefaultThreadPriority", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// When the JDK version reaches 'obsolete_in' limit, the JVM will continue accepting this flag on
|
||||||
{ "NoYieldsInMicrolock", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// the command-line, while issuing a warning and ignoring the flag value.
|
||||||
{ "BackEdgeThreshold", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// Once the JDK version reaches 'expired_in' limit, the JVM will flatly refuse to admit the
|
||||||
{ "UseNewReflection", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// existence of the flag.
|
||||||
{ "ReflectionWrapResolutionErrors",JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
//
|
||||||
{ "VerifyReflectionBytecodes", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// MANUAL CLEANUP ON JDK VERSION UPDATES:
|
||||||
{ "AutoShutdownNMT", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// This table ensures that the handling of options will update automatically when the JDK
|
||||||
{ "NmethodSweepFraction", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// version is incremented, but the source code needs to be cleanup up manually:
|
||||||
{ "NmethodSweepCheckInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// - As "deprecated" options age into "obsolete" or "expired" options, the associated "globals"
|
||||||
{ "CodeCacheMinimumFreeSpace", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
// variable should be removed, as well as users of the variable.
|
||||||
|
// - As "deprecated" options age into "obsolete" options, move the entry into the
|
||||||
|
// "Obsolete Flags" section of the table.
|
||||||
|
// - All expired options should be removed from the table.
|
||||||
|
static SpecialFlag const special_jvm_flags[] = {
|
||||||
|
// -------------- Deprecated Flags --------------
|
||||||
|
// --- Non-alias flags - sorted by obsolete_in then expired_in:
|
||||||
|
{ "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
|
||||||
|
{ "UseParNewGC", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
|
||||||
|
|
||||||
|
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
|
||||||
|
{ "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
|
||||||
|
{ "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
|
||||||
|
{ "CMSMarkStackSizeMax", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
|
||||||
|
{ "CMSMarkStackSize", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
|
||||||
|
{ "G1MarkStackSize", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
|
||||||
|
{ "ParallelMarkingThreads", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
|
||||||
|
{ "ParallelCMSThreads", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
|
||||||
|
|
||||||
|
// -------------- Obsolete Flags - sorted by expired_in --------------
|
||||||
|
{ "UseOldInlining", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "SafepointPollOffset", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "UseBoundThreads", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "DefaultThreadPriority", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "NoYieldsInMicrolock", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "BackEdgeThreshold", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "UseNewReflection", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "ReflectionWrapResolutionErrors",JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "VerifyReflectionBytecodes", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "AutoShutdownNMT", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "NmethodSweepFraction", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "NmethodSweepCheckInterval", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
{ "CodeCacheMinimumFreeSpace", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
#ifndef ZERO
|
#ifndef ZERO
|
||||||
{ "UseFastAccessorMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "UseFastAccessorMethods", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
{ "UseFastEmptyMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "UseFastEmptyMethods", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
#endif // ZERO
|
#endif // ZERO
|
||||||
{ "UseCompilerSafepoints", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "UseCompilerSafepoints", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
{ "AdaptiveSizePausePolicy", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "AdaptiveSizePausePolicy", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
{ "ParallelGCRetainPLAB", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "ParallelGCRetainPLAB", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
{ "ThreadSafetyMargin", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "ThreadSafetyMargin", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
{ "LazyBootClassLoader", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "LazyBootClassLoader", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
{ "StarvationMonitorInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "StarvationMonitorInterval", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
{ "PreInflateSpin", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
{ "PreInflateSpin", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||||
|
|
||||||
|
#ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
|
||||||
|
{ "dep > obs", JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
|
||||||
|
{ "dep > exp ", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(8) },
|
||||||
|
{ "obs > exp ", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(8) },
|
||||||
|
{ "not deprecated or obsolete", JDK_Version::undefined(), JDK_Version::undefined(), JDK_Version::jdk(9) },
|
||||||
|
{ "dup option", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
|
||||||
|
{ "dup option", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
|
||||||
|
{ "BytecodeVerificationRemote", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::undefined() },
|
||||||
|
#endif
|
||||||
|
|
||||||
{ NULL, JDK_Version(0), JDK_Version(0) }
|
{ NULL, JDK_Version(0), JDK_Version(0) }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns true if the flag is obsolete and fits into the range specified
|
// Flags that are aliases for other flags.
|
||||||
// for being ignored. In the case that the flag is ignored, the 'version'
|
typedef struct {
|
||||||
// value is filled in with the version number when the flag became
|
const char* alias_name;
|
||||||
// obsolete so that that value can be displayed to the user.
|
const char* real_name;
|
||||||
bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
|
} AliasedFlag;
|
||||||
int i = 0;
|
|
||||||
assert(version != NULL, "Must provide a version buffer");
|
static AliasedFlag const aliased_jvm_flags[] = {
|
||||||
while (obsolete_jvm_flags[i].name != NULL) {
|
{ "DefaultMaxRAMFraction", "MaxRAMFraction" },
|
||||||
const ObsoleteFlag& flag_status = obsolete_jvm_flags[i];
|
{ "CMSMarkStackSizeMax", "MarkStackSizeMax" },
|
||||||
// <flag>=xxx form
|
{ "CMSMarkStackSize", "MarkStackSize" },
|
||||||
// [-|+]<flag> form
|
{ "G1MarkStackSize", "MarkStackSize" },
|
||||||
size_t len = strlen(flag_status.name);
|
{ "ParallelMarkingThreads", "ConcGCThreads" },
|
||||||
if ((strncmp(flag_status.name, s, len) == 0) &&
|
{ "ParallelCMSThreads", "ConcGCThreads" },
|
||||||
(strlen(s) == len)){
|
{ "CreateMinidumpOnCrash", "CreateCoredumpOnCrash" },
|
||||||
if (JDK_Version::current().compare(flag_status.accept_until) == -1) {
|
{ NULL, NULL}
|
||||||
*version = flag_status.obsoleted_in;
|
};
|
||||||
return true;
|
|
||||||
}
|
// Return true if "v" is less than "other", where "other" may be "undefined".
|
||||||
|
static bool version_less_than(JDK_Version v, JDK_Version other) {
|
||||||
|
assert(!v.is_undefined(), "must be defined");
|
||||||
|
if (!other.is_undefined() && v.compare(other) >= 0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) {
|
||||||
|
for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
|
||||||
|
if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) {
|
||||||
|
flag = special_jvm_flags[i];
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Arguments::is_obsolete_flag(const char *flag_name, JDK_Version* version) {
|
||||||
|
assert(version != NULL, "Must provide a version buffer");
|
||||||
|
SpecialFlag flag;
|
||||||
|
if (lookup_special_flag(flag_name, flag)) {
|
||||||
|
if (!flag.obsolete_in.is_undefined()) {
|
||||||
|
if (version_less_than(JDK_Version::current(), flag.expired_in)) {
|
||||||
|
*version = flag.obsolete_in;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Arguments::is_deprecated_flag(const char *flag_name, JDK_Version* version) {
|
||||||
|
assert(version != NULL, "Must provide a version buffer");
|
||||||
|
SpecialFlag flag;
|
||||||
|
if (lookup_special_flag(flag_name, flag)) {
|
||||||
|
if (!flag.deprecated_in.is_undefined()) {
|
||||||
|
if (version_less_than(JDK_Version::current(), flag.obsolete_in) &&
|
||||||
|
version_less_than(JDK_Version::current(), flag.expired_in)) {
|
||||||
|
*version = flag.deprecated_in;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* Arguments::real_flag_name(const char *flag_name) {
|
||||||
|
for (size_t i = 0; aliased_jvm_flags[i].alias_name != NULL; i++) {
|
||||||
|
const AliasedFlag& flag_status = aliased_jvm_flags[i];
|
||||||
|
if (strcmp(flag_status.alias_name, flag_name) == 0) {
|
||||||
|
return flag_status.real_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef PRODUCT
|
||||||
|
static bool lookup_special_flag(const char *flag_name, size_t skip_index) {
|
||||||
|
for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
|
||||||
|
if ((i != skip_index) && (strcmp(special_jvm_flags[i].name, flag_name) == 0)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool verify_special_jvm_flags() {
|
||||||
|
bool success = true;
|
||||||
|
for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
|
||||||
|
const SpecialFlag& flag = special_jvm_flags[i];
|
||||||
|
if (lookup_special_flag(flag.name, i)) {
|
||||||
|
warning("Duplicate special flag declaration \"%s\"", flag.name);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
if (flag.deprecated_in.is_undefined() &&
|
||||||
|
flag.obsolete_in.is_undefined()) {
|
||||||
|
warning("Special flag entry \"%s\" must declare version deprecated and/or obsoleted in.", flag.name);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag.deprecated_in.is_undefined()) {
|
||||||
|
if (!version_less_than(flag.deprecated_in, flag.obsolete_in)) {
|
||||||
|
warning("Special flag entry \"%s\" must be deprecated before obsoleted.", flag.name);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!version_less_than(flag.deprecated_in, flag.expired_in)) {
|
||||||
|
warning("Special flag entry \"%s\" must be deprecated before expired.", flag.name);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag.obsolete_in.is_undefined()) {
|
||||||
|
if (!version_less_than(flag.obsolete_in, flag.expired_in)) {
|
||||||
|
warning("Special flag entry \"%s\" must be obsoleted before expired.", flag.name);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if flag has become obsolete it should not have a "globals" flag defined anymore.
|
||||||
|
if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) {
|
||||||
|
if (Flag::find_flag(flag.name) != NULL) {
|
||||||
|
warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag.expired_in.is_undefined()) {
|
||||||
|
// if flag has become expired it should not have a "globals" flag defined anymore.
|
||||||
|
if (!version_less_than(JDK_Version::current(), flag.expired_in)) {
|
||||||
|
if (Flag::find_flag(flag.name) != NULL) {
|
||||||
|
warning("Global variable for expired flag entry \"%s\" should be removed", flag.name);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Constructs the system class path (aka boot class path) from the following
|
// Constructs the system class path (aka boot class path) from the following
|
||||||
// components, in order:
|
// components, in order:
|
||||||
//
|
//
|
||||||
@ -571,7 +784,7 @@ void Arguments::describe_range_error(ArgsRange errcode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_bool_flag(char* name, bool value, Flag::Flags origin) {
|
static bool set_bool_flag(const char* name, bool value, Flag::Flags origin) {
|
||||||
if (CommandLineFlags::boolAtPut(name, &value, origin) == Flag::SUCCESS) {
|
if (CommandLineFlags::boolAtPut(name, &value, origin) == Flag::SUCCESS) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -579,7 +792,7 @@ static bool set_bool_flag(char* name, bool value, Flag::Flags origin) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) {
|
static bool set_fp_numeric_flag(const char* name, char* value, Flag::Flags origin) {
|
||||||
double v;
|
double v;
|
||||||
if (sscanf(value, "%lf", &v) != 1) {
|
if (sscanf(value, "%lf", &v) != 1) {
|
||||||
return false;
|
return false;
|
||||||
@ -591,7 +804,7 @@ static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
|
static bool set_numeric_flag(const char* name, char* value, Flag::Flags origin) {
|
||||||
julong v;
|
julong v;
|
||||||
int int_v;
|
int int_v;
|
||||||
intx intx_v;
|
intx intx_v;
|
||||||
@ -640,14 +853,14 @@ static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_string_flag(char* name, const char* value, Flag::Flags origin) {
|
static bool set_string_flag(const char* name, const char* value, Flag::Flags origin) {
|
||||||
if (CommandLineFlags::ccstrAtPut(name, &value, origin) != Flag::SUCCESS) return false;
|
if (CommandLineFlags::ccstrAtPut(name, &value, origin) != Flag::SUCCESS) return false;
|
||||||
// Contract: CommandLineFlags always returns a pointer that needs freeing.
|
// Contract: CommandLineFlags always returns a pointer that needs freeing.
|
||||||
FREE_C_HEAP_ARRAY(char, value);
|
FREE_C_HEAP_ARRAY(char, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags origin) {
|
static bool append_to_string_flag(const char* name, const char* new_value, Flag::Flags origin) {
|
||||||
const char* old_value = "";
|
const char* old_value = "";
|
||||||
if (CommandLineFlags::ccstrAt(name, &old_value) != Flag::SUCCESS) return false;
|
if (CommandLineFlags::ccstrAt(name, &old_value) != Flag::SUCCESS) return false;
|
||||||
size_t old_len = old_value != NULL ? strlen(old_value) : 0;
|
size_t old_len = old_value != NULL ? strlen(old_value) : 0;
|
||||||
@ -675,6 +888,33 @@ static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* Arguments::handle_aliases_and_deprecation(const char* arg, bool warn) {
|
||||||
|
const char* real_name = real_flag_name(arg);
|
||||||
|
JDK_Version since = JDK_Version();
|
||||||
|
switch (is_deprecated_flag(arg, &since)) {
|
||||||
|
case -1:
|
||||||
|
return NULL; // obsolete or expired, don't process normally
|
||||||
|
case 0:
|
||||||
|
return real_name;
|
||||||
|
case 1: {
|
||||||
|
if (warn) {
|
||||||
|
char version[256];
|
||||||
|
since.to_string(version, sizeof(version));
|
||||||
|
if (real_name != arg) {
|
||||||
|
warning("Option %s was deprecated in version %s and will likely be removed in a future release. Use option %s instead.",
|
||||||
|
arg, version, real_name);
|
||||||
|
} else {
|
||||||
|
warning("Option %s was deprecated in version %s and will likely be removed in a future release.",
|
||||||
|
arg, version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return real_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ShouldNotReachHere();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
|
bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
|
||||||
|
|
||||||
// range of acceptable characters spelled out for portability reasons
|
// range of acceptable characters spelled out for portability reasons
|
||||||
@ -682,27 +922,46 @@ bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
|
|||||||
#define BUFLEN 255
|
#define BUFLEN 255
|
||||||
char name[BUFLEN+1];
|
char name[BUFLEN+1];
|
||||||
char dummy;
|
char dummy;
|
||||||
|
const char* real_name;
|
||||||
|
bool warn_if_deprecated = true;
|
||||||
|
|
||||||
if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
|
if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
|
||||||
return set_bool_flag(name, false, origin);
|
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) {
|
if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
|
||||||
return set_bool_flag(name, true, origin);
|
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
|
||||||
|
if (real_name == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return set_bool_flag(real_name, true, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
char punct;
|
char punct;
|
||||||
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "%c", name, &punct) == 2 && punct == '=') {
|
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "%c", name, &punct) == 2 && punct == '=') {
|
||||||
const char* value = strchr(arg, '=') + 1;
|
const char* value = strchr(arg, '=') + 1;
|
||||||
Flag* flag = Flag::find_flag(name, strlen(name));
|
Flag* flag;
|
||||||
|
|
||||||
|
// this scanf pattern matches both strings (handled here) and numbers (handled later))
|
||||||
|
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
|
||||||
|
if (real_name == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
flag = Flag::find_flag(real_name);
|
||||||
if (flag != NULL && flag->is_ccstr()) {
|
if (flag != NULL && flag->is_ccstr()) {
|
||||||
if (flag->ccstr_accumulates()) {
|
if (flag->ccstr_accumulates()) {
|
||||||
return append_to_string_flag(name, value, origin);
|
return append_to_string_flag(real_name, value, origin);
|
||||||
} else {
|
} else {
|
||||||
if (value[0] == '\0') {
|
if (value[0] == '\0') {
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
return set_string_flag(name, value, origin);
|
return set_string_flag(real_name, value, origin);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
warn_if_deprecated = false; // if arg is deprecated, we've already done warning...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +971,11 @@ bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
|
|||||||
if (value[0] == '\0') {
|
if (value[0] == '\0') {
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
return set_string_flag(name, value, origin);
|
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
|
||||||
|
if (real_name == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return set_string_flag(real_name, value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SIGNED_FP_NUMBER_RANGE "[-0123456789.]"
|
#define SIGNED_FP_NUMBER_RANGE "[-0123456789.]"
|
||||||
@ -723,13 +986,21 @@ bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
|
|||||||
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_NUMBER_RANGE "." "%" XSTR(BUFLEN) NUMBER_RANGE "%c", name, value, value2, &dummy) == 3) {
|
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_NUMBER_RANGE "." "%" XSTR(BUFLEN) NUMBER_RANGE "%c", name, value, value2, &dummy) == 3) {
|
||||||
// Looks like a floating-point number -- try again with more lenient format string
|
// Looks like a floating-point number -- try again with more lenient format string
|
||||||
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_FP_NUMBER_RANGE "%c", name, value, &dummy) == 2) {
|
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_FP_NUMBER_RANGE "%c", name, value, &dummy) == 2) {
|
||||||
return set_fp_numeric_flag(name, value, origin);
|
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
|
||||||
|
if (real_name == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return set_fp_numeric_flag(real_name, value, origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VALUE_RANGE "[-kmgtxKMGTX0123456789abcdefABCDEF]"
|
#define VALUE_RANGE "[-kmgtxKMGTX0123456789abcdefABCDEF]"
|
||||||
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) VALUE_RANGE "%c", name, value, &dummy) == 2) {
|
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) VALUE_RANGE "%c", name, value, &dummy) == 2) {
|
||||||
return set_numeric_flag(name, value, origin);
|
real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
|
||||||
|
if (real_name == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return set_numeric_flag(real_name, value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -837,8 +1108,8 @@ void Arguments::print_jvm_args_on(outputStream* st) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Arguments::process_argument(const char* arg,
|
bool Arguments::process_argument(const char* arg,
|
||||||
jboolean ignore_unrecognized, Flag::Flags origin) {
|
jboolean ignore_unrecognized,
|
||||||
|
Flag::Flags origin) {
|
||||||
JDK_Version since = JDK_Version();
|
JDK_Version since = JDK_Version();
|
||||||
|
|
||||||
if (parse_argument(arg, origin) || ignore_unrecognized) {
|
if (parse_argument(arg, origin) || ignore_unrecognized) {
|
||||||
@ -864,10 +1135,10 @@ bool Arguments::process_argument(const char* arg,
|
|||||||
strncpy(stripped_argname, argname, arg_len);
|
strncpy(stripped_argname, argname, arg_len);
|
||||||
stripped_argname[arg_len] = '\0'; // strncpy may not null terminate.
|
stripped_argname[arg_len] = '\0'; // strncpy may not null terminate.
|
||||||
|
|
||||||
if (is_newly_obsolete(stripped_argname, &since)) {
|
if (is_obsolete_flag(stripped_argname, &since)) {
|
||||||
char version[256];
|
char version[256];
|
||||||
since.to_string(version, sizeof(version));
|
since.to_string(version, sizeof(version));
|
||||||
warning("ignoring option %s; support was removed in %s", stripped_argname, version);
|
warning("Ignoring option %s; support was removed in %s", stripped_argname, version);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1235,7 +1506,7 @@ void Arguments::set_tiered_flags() {
|
|||||||
static void disable_adaptive_size_policy(const char* collector_name) {
|
static void disable_adaptive_size_policy(const char* collector_name) {
|
||||||
if (UseAdaptiveSizePolicy) {
|
if (UseAdaptiveSizePolicy) {
|
||||||
if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
|
if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
|
||||||
warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
|
warning("Disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
|
||||||
collector_name);
|
collector_name);
|
||||||
}
|
}
|
||||||
FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
|
FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
|
||||||
@ -1707,7 +1978,6 @@ void Arguments::set_gc_specific_flags() {
|
|||||||
} else if (UseG1GC) {
|
} else if (UseG1GC) {
|
||||||
set_g1_gc_flags();
|
set_g1_gc_flags();
|
||||||
}
|
}
|
||||||
check_deprecated_gc_flags();
|
|
||||||
if (AssumeMP && !UseSerialGC) {
|
if (AssumeMP && !UseSerialGC) {
|
||||||
if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
|
if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
|
||||||
warning("If the number of processors is expected to increase from one, then"
|
warning("If the number of processors is expected to increase from one, then"
|
||||||
@ -1737,11 +2007,6 @@ julong Arguments::limit_by_allocatable_memory(julong limit) {
|
|||||||
static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress;
|
static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress;
|
||||||
|
|
||||||
void Arguments::set_heap_size() {
|
void Arguments::set_heap_size() {
|
||||||
if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) {
|
|
||||||
// Deprecated flag
|
|
||||||
FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction);
|
|
||||||
}
|
|
||||||
|
|
||||||
const julong phys_mem =
|
const julong phys_mem =
|
||||||
FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM)
|
FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM)
|
||||||
: (julong)MaxRAM;
|
: (julong)MaxRAM;
|
||||||
@ -1844,6 +2109,122 @@ void Arguments::set_heap_size() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This option inspects the machine and attempts to set various
|
||||||
|
// parameters to be optimal for long-running, memory allocation
|
||||||
|
// intensive jobs. It is intended for machines with large
|
||||||
|
// amounts of cpu and memory.
|
||||||
|
jint Arguments::set_aggressive_heap_flags() {
|
||||||
|
// initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit
|
||||||
|
// VM, but we may not be able to represent the total physical memory
|
||||||
|
// available (like having 8gb of memory on a box but using a 32bit VM).
|
||||||
|
// Thus, we need to make sure we're using a julong for intermediate
|
||||||
|
// calculations.
|
||||||
|
julong initHeapSize;
|
||||||
|
julong total_memory = os::physical_memory();
|
||||||
|
|
||||||
|
if (total_memory < (julong) 256 * M) {
|
||||||
|
jio_fprintf(defaultStream::error_stream(),
|
||||||
|
"You need at least 256mb of memory to use -XX:+AggressiveHeap\n");
|
||||||
|
vm_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The heap size is half of available memory, or (at most)
|
||||||
|
// all of possible memory less 160mb (leaving room for the OS
|
||||||
|
// when using ISM). This is the maximum; because adaptive sizing
|
||||||
|
// is turned on below, the actual space used may be smaller.
|
||||||
|
|
||||||
|
initHeapSize = MIN2(total_memory / (julong) 2,
|
||||||
|
total_memory - (julong) 160 * M);
|
||||||
|
|
||||||
|
initHeapSize = limit_by_allocatable_memory(initHeapSize);
|
||||||
|
|
||||||
|
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
|
||||||
|
if (FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
if (FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
// Currently the minimum size and the initial heap sizes are the same.
|
||||||
|
set_min_heap_size(initHeapSize);
|
||||||
|
}
|
||||||
|
if (FLAG_IS_DEFAULT(NewSize)) {
|
||||||
|
// Make the young generation 3/8ths of the total heap.
|
||||||
|
if (FLAG_SET_CMDLINE(size_t, NewSize,
|
||||||
|
((julong) MaxHeapSize / (julong) 8) * (julong) 3) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
if (FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(_ALLBSD_SOURCE) && !defined(AIX) // UseLargePages is not yet supported on BSD and AIX.
|
||||||
|
FLAG_SET_DEFAULT(UseLargePages, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Increase some data structure sizes for efficiency
|
||||||
|
if (FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
if (FLAG_SET_CMDLINE(bool, ResizeTLAB, false) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
if (FLAG_SET_CMDLINE(size_t, TLABSize, 256 * K) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// See the OldPLABSize comment below, but replace 'after promotion'
|
||||||
|
// with 'after copying'. YoungPLABSize is the size of the survivor
|
||||||
|
// space per-gc-thread buffers. The default is 4kw.
|
||||||
|
if (FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256 * K) != Flag::SUCCESS) { // Note: this is in words
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OldPLABSize is the size of the buffers in the old gen that
|
||||||
|
// UseParallelGC uses to promote live data that doesn't fit in the
|
||||||
|
// survivor spaces. At any given time, there's one for each gc thread.
|
||||||
|
// The default size is 1kw. These buffers are rarely used, since the
|
||||||
|
// survivor spaces are usually big enough. For specjbb, however, there
|
||||||
|
// are occasions when there's lots of live data in the young gen
|
||||||
|
// and we end up promoting some of it. We don't have a definite
|
||||||
|
// explanation for why bumping OldPLABSize helps, but the theory
|
||||||
|
// is that a bigger PLAB results in retaining something like the
|
||||||
|
// original allocation order after promotion, which improves mutator
|
||||||
|
// locality. A minor effect may be that larger PLABs reduce the
|
||||||
|
// number of PLAB allocation events during gc. The value of 8kw
|
||||||
|
// was arrived at by experimenting with specjbb.
|
||||||
|
if (FLAG_SET_CMDLINE(size_t, OldPLABSize, 8 * K) != Flag::SUCCESS) { // Note: this is in words
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable parallel GC and adaptive generation sizing
|
||||||
|
if (FLAG_SET_CMDLINE(bool, UseParallelGC, true) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
FLAG_SET_DEFAULT(ParallelGCThreads,
|
||||||
|
Abstract_VM_Version::parallel_worker_threads());
|
||||||
|
|
||||||
|
// Encourage steady state memory management
|
||||||
|
if (FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This appears to improve mutator locality
|
||||||
|
if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get around early Solaris scheduling bug
|
||||||
|
// (affinity vs other jobs on system)
|
||||||
|
// but disallow DR and offlining (5008695).
|
||||||
|
if (FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true) != Flag::SUCCESS) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JNI_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// This must be called after ergonomics.
|
// This must be called after ergonomics.
|
||||||
void Arguments::set_bytecode_flags() {
|
void Arguments::set_bytecode_flags() {
|
||||||
if (!RewriteBytecodes) {
|
if (!RewriteBytecodes) {
|
||||||
@ -2027,20 +2408,6 @@ bool Arguments::check_gc_consistency() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arguments::check_deprecated_gc_flags() {
|
|
||||||
if (FLAG_IS_CMDLINE(UseParNewGC)) {
|
|
||||||
warning("The UseParNewGC flag is deprecated and will likely be removed in a future release");
|
|
||||||
}
|
|
||||||
if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
|
|
||||||
warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
|
|
||||||
"and will likely be removed in future release");
|
|
||||||
}
|
|
||||||
if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) {
|
|
||||||
warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
|
|
||||||
"Use MaxRAMFraction instead.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check the consistency of vm_init_args
|
// Check the consistency of vm_init_args
|
||||||
bool Arguments::check_vm_args_consistency() {
|
bool Arguments::check_vm_args_consistency() {
|
||||||
// Method for adding checks for flag consistency.
|
// Method for adding checks for flag consistency.
|
||||||
@ -2576,7 +2943,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||||||
// All these options are deprecated in JDK 9 and will be removed in a future release
|
// All these options are deprecated in JDK 9 and will be removed in a future release
|
||||||
char version[256];
|
char version[256];
|
||||||
JDK_Version::jdk(9).to_string(version, sizeof(version));
|
JDK_Version::jdk(9).to_string(version, sizeof(version));
|
||||||
warning("ignoring option %s; support was removed in %s", option->optionString, version);
|
warning("Ignoring option %s; support was removed in %s", option->optionString, version);
|
||||||
} else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
|
} else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
|
||||||
julong long_CodeCacheExpansionSize = 0;
|
julong long_CodeCacheExpansionSize = 0;
|
||||||
ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
|
ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
|
||||||
@ -2843,120 +3210,10 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||||||
_abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo);
|
_abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo);
|
||||||
// -XX:+AggressiveHeap
|
// -XX:+AggressiveHeap
|
||||||
} else if (match_option(option, "-XX:+AggressiveHeap")) {
|
} else if (match_option(option, "-XX:+AggressiveHeap")) {
|
||||||
|
jint result = set_aggressive_heap_flags();
|
||||||
// This option inspects the machine and attempts to set various
|
if (result != JNI_OK) {
|
||||||
// parameters to be optimal for long-running, memory allocation
|
return result;
|
||||||
// intensive jobs. It is intended for machines with large
|
|
||||||
// amounts of cpu and memory.
|
|
||||||
|
|
||||||
// initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit
|
|
||||||
// VM, but we may not be able to represent the total physical memory
|
|
||||||
// available (like having 8gb of memory on a box but using a 32bit VM).
|
|
||||||
// Thus, we need to make sure we're using a julong for intermediate
|
|
||||||
// calculations.
|
|
||||||
julong initHeapSize;
|
|
||||||
julong total_memory = os::physical_memory();
|
|
||||||
|
|
||||||
if (total_memory < (julong)256*M) {
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"You need at least 256mb of memory to use -XX:+AggressiveHeap\n");
|
|
||||||
vm_exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The heap size is half of available memory, or (at most)
|
|
||||||
// all of possible memory less 160mb (leaving room for the OS
|
|
||||||
// when using ISM). This is the maximum; because adaptive sizing
|
|
||||||
// is turned on below, the actual space used may be smaller.
|
|
||||||
|
|
||||||
initHeapSize = MIN2(total_memory / (julong)2,
|
|
||||||
total_memory - (julong)160*M);
|
|
||||||
|
|
||||||
initHeapSize = limit_by_allocatable_memory(initHeapSize);
|
|
||||||
|
|
||||||
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
// Currently the minimum size and the initial heap sizes are the same.
|
|
||||||
set_min_heap_size(initHeapSize);
|
|
||||||
}
|
|
||||||
if (FLAG_IS_DEFAULT(NewSize)) {
|
|
||||||
// Make the young generation 3/8ths of the total heap.
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, NewSize,
|
|
||||||
((julong)MaxHeapSize / (julong)8) * (julong)3) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(_ALLBSD_SOURCE) && !defined(AIX) // UseLargePages is not yet supported on BSD and AIX.
|
|
||||||
FLAG_SET_DEFAULT(UseLargePages, true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Increase some data structure sizes for efficiency
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
if (FLAG_SET_CMDLINE(bool, ResizeTLAB, false) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, TLABSize, 256*K) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// See the OldPLABSize comment below, but replace 'after promotion'
|
|
||||||
// with 'after copying'. YoungPLABSize is the size of the survivor
|
|
||||||
// space per-gc-thread buffers. The default is 4kw.
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256*K) != Flag::SUCCESS) { // Note: this is in words
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// OldPLABSize is the size of the buffers in the old gen that
|
|
||||||
// UseParallelGC uses to promote live data that doesn't fit in the
|
|
||||||
// survivor spaces. At any given time, there's one for each gc thread.
|
|
||||||
// The default size is 1kw. These buffers are rarely used, since the
|
|
||||||
// survivor spaces are usually big enough. For specjbb, however, there
|
|
||||||
// are occasions when there's lots of live data in the young gen
|
|
||||||
// and we end up promoting some of it. We don't have a definite
|
|
||||||
// explanation for why bumping OldPLABSize helps, but the theory
|
|
||||||
// is that a bigger PLAB results in retaining something like the
|
|
||||||
// original allocation order after promotion, which improves mutator
|
|
||||||
// locality. A minor effect may be that larger PLABs reduce the
|
|
||||||
// number of PLAB allocation events during gc. The value of 8kw
|
|
||||||
// was arrived at by experimenting with specjbb.
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, OldPLABSize, 8*K) != Flag::SUCCESS) { // Note: this is in words
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable parallel GC and adaptive generation sizing
|
|
||||||
if (FLAG_SET_CMDLINE(bool, UseParallelGC, true) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
FLAG_SET_DEFAULT(ParallelGCThreads,
|
|
||||||
Abstract_VM_Version::parallel_worker_threads());
|
|
||||||
|
|
||||||
// Encourage steady state memory management
|
|
||||||
if (FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This appears to improve mutator locality
|
|
||||||
if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get around early Solaris scheduling bug
|
|
||||||
// (affinity vs other jobs on system)
|
|
||||||
// but disallow DR and offlining (5008695).
|
|
||||||
if (FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure;
|
// Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure;
|
||||||
// and the last option wins.
|
// and the last option wins.
|
||||||
} else if (match_option(option, "-XX:+NeverTenure")) {
|
} else if (match_option(option, "-XX:+NeverTenure")) {
|
||||||
@ -3049,52 +3306,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||||||
return JNI_EINVAL;
|
return JNI_EINVAL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (match_option(option, "-XX:CMSMarkStackSize=", &tail) ||
|
|
||||||
match_option(option, "-XX:G1MarkStackSize=", &tail)) {
|
|
||||||
julong stack_size = 0;
|
|
||||||
ArgsRange errcode = parse_memory_size(tail, &stack_size, 1);
|
|
||||||
if (errcode != arg_in_range) {
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Invalid mark stack size: %s\n", option->optionString);
|
|
||||||
describe_range_error(errcode);
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Please use -XX:MarkStackSize in place of "
|
|
||||||
"-XX:CMSMarkStackSize or -XX:G1MarkStackSize in the future\n");
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, MarkStackSize, stack_size) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
} else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) {
|
|
||||||
julong max_stack_size = 0;
|
|
||||||
ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1);
|
|
||||||
if (errcode != arg_in_range) {
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Invalid maximum mark stack size: %s\n",
|
|
||||||
option->optionString);
|
|
||||||
describe_range_error(errcode);
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Please use -XX:MarkStackSizeMax in place of "
|
|
||||||
"-XX:CMSMarkStackSizeMax in the future\n");
|
|
||||||
if (FLAG_SET_CMDLINE(size_t, MarkStackSizeMax, max_stack_size) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
} else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) ||
|
|
||||||
match_option(option, "-XX:ParallelCMSThreads=", &tail)) {
|
|
||||||
uintx conc_threads = 0;
|
|
||||||
if (!parse_uintx(tail, &conc_threads, 1)) {
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Invalid concurrent threads: %s\n", option->optionString);
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Please use -XX:ConcGCThreads in place of "
|
|
||||||
"-XX:ParallelMarkingThreads or -XX:ParallelCMSThreads in the future\n");
|
|
||||||
if (FLAG_SET_CMDLINE(uint, ConcGCThreads, conc_threads) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
} else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
|
} else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
|
||||||
julong max_direct_memory_size = 0;
|
julong max_direct_memory_size = 0;
|
||||||
ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
|
ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
|
||||||
@ -3114,19 +3325,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||||||
"ManagementServer is not supported in this VM.\n");
|
"ManagementServer is not supported in this VM.\n");
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
#endif // INCLUDE_MANAGEMENT
|
#endif // INCLUDE_MANAGEMENT
|
||||||
// CreateMinidumpOnCrash is removed, and replaced by CreateCoredumpOnCrash
|
|
||||||
} else if (match_option(option, "-XX:+CreateMinidumpOnCrash")) {
|
|
||||||
if (FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, true) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
jio_fprintf(defaultStream::output_stream(),
|
|
||||||
"CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is on\n");
|
|
||||||
} else if (match_option(option, "-XX:-CreateMinidumpOnCrash")) {
|
|
||||||
if (FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, false) != Flag::SUCCESS) {
|
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
jio_fprintf(defaultStream::output_stream(),
|
|
||||||
"CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is off\n");
|
|
||||||
} else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
|
} else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
|
||||||
// Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have
|
// Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have
|
||||||
// already been handled
|
// already been handled
|
||||||
@ -3623,7 +3821,7 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_
|
|||||||
void Arguments::set_shared_spaces_flags() {
|
void Arguments::set_shared_spaces_flags() {
|
||||||
if (DumpSharedSpaces) {
|
if (DumpSharedSpaces) {
|
||||||
if (RequireSharedSpaces) {
|
if (RequireSharedSpaces) {
|
||||||
warning("cannot dump shared archive while using shared archive");
|
warning("Cannot dump shared archive while using shared archive");
|
||||||
}
|
}
|
||||||
UseSharedSpaces = false;
|
UseSharedSpaces = false;
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
@ -3848,6 +4046,7 @@ static void print_options(const JavaVMInitArgs *args) {
|
|||||||
// Parse entry point called from JNI_CreateJavaVM
|
// Parse entry point called from JNI_CreateJavaVM
|
||||||
|
|
||||||
jint Arguments::parse(const JavaVMInitArgs* args) {
|
jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||||
|
assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent");
|
||||||
|
|
||||||
// Initialize ranges and constraints
|
// Initialize ranges and constraints
|
||||||
CommandLineFlagRangeList::init();
|
CommandLineFlagRangeList::init();
|
||||||
@ -3984,7 +4183,7 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
|||||||
|
|
||||||
if (ScavengeRootsInCode == 0) {
|
if (ScavengeRootsInCode == 0) {
|
||||||
if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
|
if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
|
||||||
warning("forcing ScavengeRootsInCode non-zero");
|
warning("Forcing ScavengeRootsInCode non-zero");
|
||||||
}
|
}
|
||||||
ScavengeRootsInCode = 1;
|
ScavengeRootsInCode = 1;
|
||||||
}
|
}
|
||||||
|
@ -364,6 +364,8 @@ class Arguments : AllStatic {
|
|||||||
// Aggressive optimization flags.
|
// Aggressive optimization flags.
|
||||||
static jint set_aggressive_opts_flags();
|
static jint set_aggressive_opts_flags();
|
||||||
|
|
||||||
|
static jint set_aggressive_heap_flags();
|
||||||
|
|
||||||
// Argument parsing
|
// Argument parsing
|
||||||
static void do_pd_flag_adjustments();
|
static void do_pd_flag_adjustments();
|
||||||
static bool parse_argument(const char* arg, Flag::Flags origin);
|
static bool parse_argument(const char* arg, Flag::Flags origin);
|
||||||
@ -427,11 +429,24 @@ class Arguments : AllStatic {
|
|||||||
short* methodsNum, short* methodsMax, char*** methods, bool** allClasses
|
short* methodsNum, short* methodsMax, char*** methods, bool** allClasses
|
||||||
);
|
);
|
||||||
|
|
||||||
// Returns true if the string s is in the list of flags that have recently
|
// Returns true if the flag is obsolete (and not yet expired).
|
||||||
// been made obsolete. If we detect one of these flags on the command
|
// In this case the 'version' buffer is filled in with
|
||||||
// line, instead of failing we print a warning message and ignore the
|
// the version number when the flag became obsolete.
|
||||||
// flag. This gives the user a release or so to stop using the flag.
|
static bool is_obsolete_flag(const char* flag_name, JDK_Version* version);
|
||||||
static bool is_newly_obsolete(const char* s, JDK_Version* buffer);
|
|
||||||
|
// Returns 1 if the flag is deprecated (and not yet obsolete or expired).
|
||||||
|
// In this case the 'version' buffer is filled in with the version number when
|
||||||
|
// the flag became deprecated.
|
||||||
|
// Returns -1 if the flag is expired or obsolete.
|
||||||
|
// Returns 0 otherwise.
|
||||||
|
static int is_deprecated_flag(const char* flag_name, JDK_Version* version);
|
||||||
|
|
||||||
|
// Return the real name for the flag passed on the command line (either an alias name or "flag_name").
|
||||||
|
static const char* real_flag_name(const char *flag_name);
|
||||||
|
|
||||||
|
// Return the "real" name for option arg if arg is an alias, and print a warning if arg is deprecated.
|
||||||
|
// Return NULL if the arg has expired.
|
||||||
|
static const char* handle_aliases_and_deprecation(const char* arg, bool warn);
|
||||||
|
|
||||||
static short CompileOnlyClassesNum;
|
static short CompileOnlyClassesNum;
|
||||||
static short CompileOnlyClassesMax;
|
static short CompileOnlyClassesMax;
|
||||||
@ -478,7 +493,6 @@ class Arguments : AllStatic {
|
|||||||
|
|
||||||
// Check for consistency in the selection of the garbage collector.
|
// Check for consistency in the selection of the garbage collector.
|
||||||
static bool check_gc_consistency(); // Check user-selected gc
|
static bool check_gc_consistency(); // Check user-selected gc
|
||||||
static void check_deprecated_gc_flags();
|
|
||||||
// Check consistency or otherwise of VM argument settings
|
// Check consistency or otherwise of VM argument settings
|
||||||
static bool check_vm_args_consistency();
|
static bool check_vm_args_consistency();
|
||||||
// Used by os_solaris
|
// Used by os_solaris
|
||||||
|
@ -1599,7 +1599,7 @@ public:
|
|||||||
"(ParallelGC only)") \
|
"(ParallelGC only)") \
|
||||||
\
|
\
|
||||||
product(bool, ScavengeBeforeFullGC, true, \
|
product(bool, ScavengeBeforeFullGC, true, \
|
||||||
"Scavenge young generation before each full GC.") \
|
"Scavenge youngest generation before each full GC.") \
|
||||||
\
|
\
|
||||||
develop(bool, ScavengeWithObjectsInToSpace, false, \
|
develop(bool, ScavengeWithObjectsInToSpace, false, \
|
||||||
"Allow scavenges to occur when to-space contains objects") \
|
"Allow scavenges to occur when to-space contains objects") \
|
||||||
@ -2097,7 +2097,7 @@ public:
|
|||||||
"promotion failure") \
|
"promotion failure") \
|
||||||
\
|
\
|
||||||
notproduct(bool, PromotionFailureALot, false, \
|
notproduct(bool, PromotionFailureALot, false, \
|
||||||
"Use promotion failure handling on every young generation " \
|
"Use promotion failure handling on every youngest generation " \
|
||||||
"collection") \
|
"collection") \
|
||||||
\
|
\
|
||||||
develop(uintx, PromotionFailureALotCount, 1000, \
|
develop(uintx, PromotionFailureALotCount, 1000, \
|
||||||
@ -2183,11 +2183,6 @@ public:
|
|||||||
"size") \
|
"size") \
|
||||||
range(1, max_uintx) \
|
range(1, max_uintx) \
|
||||||
\
|
\
|
||||||
product(uintx, DefaultMaxRAMFraction, 4, \
|
|
||||||
"Maximum fraction (1/n) of real memory used for maximum heap " \
|
|
||||||
"size; deprecated: to be renamed to MaxRAMFraction") \
|
|
||||||
range(1, max_uintx) \
|
|
||||||
\
|
|
||||||
product(uintx, MinRAMFraction, 2, \
|
product(uintx, MinRAMFraction, 2, \
|
||||||
"Minimum fraction (1/n) of real memory used for maximum heap " \
|
"Minimum fraction (1/n) of real memory used for maximum heap " \
|
||||||
"size on systems with small physical memory size") \
|
"size on systems with small physical memory size") \
|
||||||
|
@ -137,6 +137,14 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC {
|
|||||||
return JDK_Version(major, 0, 0, update_number);
|
return JDK_Version(major, 0, 0, update_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JDK_Version undefined() {
|
||||||
|
return JDK_Version(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_undefined() const {
|
||||||
|
return (_major == 0);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t major_version() const { return _major; }
|
uint8_t major_version() const { return _major; }
|
||||||
uint8_t minor_version() const { return _minor; }
|
uint8_t minor_version() const { return _minor; }
|
||||||
uint8_t micro_version() const { return _micro; }
|
uint8_t micro_version() const { return _micro; }
|
||||||
|
@ -190,7 +190,6 @@ needs_full_vm_compact1 = \
|
|||||||
gc/g1/TestShrinkToOneRegion.java \
|
gc/g1/TestShrinkToOneRegion.java \
|
||||||
gc/metaspace/G1AddMetaspaceDependency.java \
|
gc/metaspace/G1AddMetaspaceDependency.java \
|
||||||
gc/startup_warnings/TestCMS.java \
|
gc/startup_warnings/TestCMS.java \
|
||||||
gc/startup_warnings/TestDefaultMaxRAMFraction.java \
|
|
||||||
gc/startup_warnings/TestDefNewCMS.java \
|
gc/startup_warnings/TestDefNewCMS.java \
|
||||||
gc/startup_warnings/TestParallelGC.java \
|
gc/startup_warnings/TestParallelGC.java \
|
||||||
gc/startup_warnings/TestParallelScavengeSerialOld.java \
|
gc/startup_warnings/TestParallelScavengeSerialOld.java \
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @test TestDefaultMaxRAMFraction
|
|
||||||
* @key gc
|
|
||||||
* @bug 8021967
|
|
||||||
* @summary Test that the deprecated TestDefaultMaxRAMFraction flag print a warning message
|
|
||||||
* @library /testlibrary
|
|
||||||
* @modules java.base/sun.misc
|
|
||||||
* java.management
|
|
||||||
*/
|
|
||||||
|
|
||||||
import jdk.test.lib.OutputAnalyzer;
|
|
||||||
import jdk.test.lib.ProcessTools;
|
|
||||||
|
|
||||||
public class TestDefaultMaxRAMFraction {
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:DefaultMaxRAMFraction=4", "-version");
|
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
|
||||||
output.shouldContain("warning: DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. Use MaxRAMFraction instead.");
|
|
||||||
output.shouldNotContain("error");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @test TestNoParNew
|
|
||||||
* @key gc
|
|
||||||
* @bug 8065972
|
|
||||||
* @summary Test that specifying -XX:-UseParNewGC on the command line logs a warning message
|
|
||||||
* @library /testlibrary
|
|
||||||
* @modules java.base/sun.misc
|
|
||||||
* java.management
|
|
||||||
*/
|
|
||||||
|
|
||||||
import jdk.test.lib.OutputAnalyzer;
|
|
||||||
import jdk.test.lib.ProcessTools;
|
|
||||||
|
|
||||||
|
|
||||||
public class TestNoParNew {
|
|
||||||
|
|
||||||
public static void main(String args[]) throws Exception {
|
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-version");
|
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
|
||||||
output.shouldContain("warning: The UseParNewGC flag is deprecated and will likely be removed in a future release");
|
|
||||||
output.shouldNotContain("error");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -40,7 +40,7 @@ public class TestParNewCMS {
|
|||||||
public static void main(String args[]) throws Exception {
|
public static void main(String args[]) throws Exception {
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldContain("warning: The UseParNewGC flag is deprecated and will likely be removed in a future release");
|
output.shouldContain("warning: Option UseParNewGC was deprecated in version");
|
||||||
output.shouldNotContain("error");
|
output.shouldNotContain("error");
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class ObsoleteFlagErrorMessage {
|
|||||||
"-XX:NmethodSweepFraction=10", "-version");
|
"-XX:NmethodSweepFraction=10", "-version");
|
||||||
|
|
||||||
OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
|
OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
|
||||||
output2.shouldContain("ignoring option").shouldContain("support was removed");
|
output2.shouldContain("Ignoring option").shouldContain("support was removed");
|
||||||
output2.shouldContain("NmethodSweepFraction");
|
output2.shouldContain("NmethodSweepFraction");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
66
hotspot/test/runtime/CommandLine/VMAliasOptions.java
Normal file
66
hotspot/test/runtime/CommandLine/VMAliasOptions.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.*;
|
||||||
|
import jdk.test.lib.cli.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8061611
|
||||||
|
* @summary Test that various alias options correctly set the target options. See aliased_jvm_flags in arguments.cpp.
|
||||||
|
* @library /testlibrary
|
||||||
|
*/
|
||||||
|
public class VMAliasOptions {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* each entry is {[0]: alias name, [1]: alias target, [2]: value to set
|
||||||
|
* (true/false/n/string)}.
|
||||||
|
*/
|
||||||
|
public static final String[][] ALIAS_OPTIONS = {
|
||||||
|
{"DefaultMaxRAMFraction", "MaxRAMFraction", "1032"},
|
||||||
|
{"CMSMarkStackSizeMax", "MarkStackSizeMax", "1032"},
|
||||||
|
{"CMSMarkStackSize", "MarkStackSize", "1032"},
|
||||||
|
{"G1MarkStackSize", "MarkStackSize", "1032"},
|
||||||
|
{"ParallelMarkingThreads", "ConcGCThreads", "2"},
|
||||||
|
{"ParallelCMSThreads", "ConcGCThreads", "2"},
|
||||||
|
{"CreateMinidumpOnCrash", "CreateCoredumpOnCrash", "false" },
|
||||||
|
};
|
||||||
|
|
||||||
|
static void testAliases(String[][] optionInfo) throws Throwable {
|
||||||
|
String aliasNames[] = new String[optionInfo.length];
|
||||||
|
String optionNames[] = new String[optionInfo.length];
|
||||||
|
String expectedValues[] = new String[optionInfo.length];
|
||||||
|
for (int i = 0; i < optionInfo.length; i++) {
|
||||||
|
aliasNames[i] = optionInfo[i][0];
|
||||||
|
optionNames[i] = optionInfo[i][1];
|
||||||
|
expectedValues[i] = optionInfo[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputAnalyzer output = CommandLineOptionTest.startVMWithOptions(aliasNames, expectedValues, "-XX:+PrintFlagsFinal");
|
||||||
|
CommandLineOptionTest.verifyOptionValuesFromOutput(output, optionNames, expectedValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
testAliases(ALIAS_OPTIONS);
|
||||||
|
}
|
||||||
|
}
|
80
hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java
Normal file
80
hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.*;
|
||||||
|
import jdk.test.lib.cli.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8066821
|
||||||
|
* @summary Test that various options are deprecated. See deprecated_jvm_flags in arguments.cpp.
|
||||||
|
* @library /testlibrary
|
||||||
|
*/
|
||||||
|
public class VMDeprecatedOptions {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* each entry is {[0]: option name, [1]: value to set
|
||||||
|
* (true/false/n/string)}.
|
||||||
|
*/
|
||||||
|
public static final String[][] DEPRECATED_OPTIONS = {
|
||||||
|
// deprecated non-alias flags:
|
||||||
|
{"MaxGCMinorPauseMillis", "1032"},
|
||||||
|
{"UseParNewGC", "false"},
|
||||||
|
|
||||||
|
// deprecated alias flags (see also aliased_jvm_flags):
|
||||||
|
{"DefaultMaxRAMFraction", "4"},
|
||||||
|
{"CMSMarkStackSizeMax", "1032"},
|
||||||
|
{"CMSMarkStackSize", "1032"},
|
||||||
|
{"G1MarkStackSize", "1032"},
|
||||||
|
{"ParallelMarkingThreads", "2"},
|
||||||
|
{"ParallelCMSThreads", "2"},
|
||||||
|
{"CreateMinidumpOnCrash", "false"}
|
||||||
|
};
|
||||||
|
|
||||||
|
static String getDeprecationString(String optionName) {
|
||||||
|
return "Option " + optionName
|
||||||
|
+ " was deprecated in version [\\S]+ and will likely be removed in a future release";
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testDeprecated(String[][] optionInfo) throws Throwable {
|
||||||
|
String optionNames[] = new String[optionInfo.length];
|
||||||
|
String expectedValues[] = new String[optionInfo.length];
|
||||||
|
for (int i = 0; i < optionInfo.length; i++) {
|
||||||
|
optionNames[i] = optionInfo[i][0];
|
||||||
|
expectedValues[i] = optionInfo[i][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputAnalyzer output = CommandLineOptionTest.startVMWithOptions(optionNames, expectedValues);
|
||||||
|
|
||||||
|
// check for option deprecation messages:
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
for (String[] deprecated : optionInfo) {
|
||||||
|
String match = getDeprecationString(deprecated[0]);
|
||||||
|
output.shouldMatch(match);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
testDeprecated(DEPRECATED_OPTIONS); // Make sure that each deprecated option is mentioned in the output.
|
||||||
|
}
|
||||||
|
}
|
@ -41,6 +41,6 @@ public class AutoshutdownNMT {
|
|||||||
"-XX:-AutoShutdownNMT",
|
"-XX:-AutoShutdownNMT",
|
||||||
"-version");
|
"-version");
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldContain("ignoring option AutoShutdownNMT");
|
output.shouldContain("Ignoring option AutoShutdownNMT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,6 +260,73 @@ public abstract class CommandLineOptionTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start VM with given options and values.
|
||||||
|
* Generates command line option flags from
|
||||||
|
* {@code optionNames} and {@code optionValues}.
|
||||||
|
*
|
||||||
|
* @param optionNames names of options to pass in
|
||||||
|
* @param optionValues values of option
|
||||||
|
* @param additionalVMOpts additional options that should be
|
||||||
|
* passed to JVM.
|
||||||
|
* @return output from vm process
|
||||||
|
*/
|
||||||
|
public static OutputAnalyzer startVMWithOptions(String[] optionNames,
|
||||||
|
String[] optionValues,
|
||||||
|
String... additionalVMOpts) throws Throwable {
|
||||||
|
List<String> vmOpts = new ArrayList<>();
|
||||||
|
if (optionNames == null || optionValues == null || optionNames.length != optionValues.length) {
|
||||||
|
throw new IllegalArgumentException("optionNames and/or optionValues");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < optionNames.length; i++) {
|
||||||
|
vmOpts.add(prepareFlag(optionNames[i], optionValues[i]));
|
||||||
|
}
|
||||||
|
Collections.addAll(vmOpts, additionalVMOpts);
|
||||||
|
Collections.addAll(vmOpts, "-version");
|
||||||
|
|
||||||
|
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(
|
||||||
|
vmOpts.toArray(new String[vmOpts.size()]));
|
||||||
|
|
||||||
|
return new OutputAnalyzer(processBuilder.start());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies from the output that values of specified JVM options were the same as
|
||||||
|
* expected values.
|
||||||
|
*
|
||||||
|
* @param outputAnalyzer search output for expect options and values.
|
||||||
|
* @param optionNames names of tested options.
|
||||||
|
* @param expectedValues expected values of tested options.
|
||||||
|
* @throws Throwable if verification fails or some other issues occur.
|
||||||
|
*/
|
||||||
|
public static void verifyOptionValuesFromOutput(OutputAnalyzer outputAnalyzer,
|
||||||
|
String[] optionNames,
|
||||||
|
String[] expectedValues) throws Throwable {
|
||||||
|
outputAnalyzer.shouldHaveExitValue(0);
|
||||||
|
for (int i = 0; i < optionNames.length; i++) {
|
||||||
|
outputAnalyzer.shouldMatch(String.format(
|
||||||
|
CommandLineOptionTest.PRINT_FLAGS_FINAL_FORMAT,
|
||||||
|
optionNames[i], expectedValues[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that value of specified JVM options are the same as
|
||||||
|
* expected values.
|
||||||
|
* Generates command line option flags from
|
||||||
|
* {@code optionNames} and {@code expectedValues}.
|
||||||
|
*
|
||||||
|
* @param optionNames names of tested options.
|
||||||
|
* @param expectedValues expected values of tested options.
|
||||||
|
* @throws Throwable if verification fails or some other issues occur.
|
||||||
|
*/
|
||||||
|
public static void verifyOptionValues(String[] optionNames,
|
||||||
|
String[] expectedValues) throws Throwable {
|
||||||
|
OutputAnalyzer outputAnalyzer = startVMWithOptions(optionNames, expectedValues, "-XX:+PrintFlagsFinal");
|
||||||
|
verifyOptionValuesFromOutput(outputAnalyzer, optionNames, expectedValues);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies that value of specified JVM when type of newly started VM
|
* Verifies that value of specified JVM when type of newly started VM
|
||||||
* is the same as the type of current.
|
* is the same as the type of current.
|
||||||
@ -311,6 +378,24 @@ public abstract class CommandLineOptionTest {
|
|||||||
return String.format("-XX:%s=%s", name, value.toString());
|
return String.format("-XX:%s=%s", name, value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares generic command line flag with name {@code name} by setting
|
||||||
|
* it's value to {@code value}.
|
||||||
|
*
|
||||||
|
* @param name the name of option to be prepared
|
||||||
|
* @param value the value of option ("+" or "-" can be used instead of "true" or "false")
|
||||||
|
* @return prepared command line flag
|
||||||
|
*/
|
||||||
|
public static String prepareFlag(String name, String value) {
|
||||||
|
if (value.equals("+") || value.equalsIgnoreCase("true")) {
|
||||||
|
return "-XX:+" + name;
|
||||||
|
} else if (value.equals("-") || value.equalsIgnoreCase("false")) {
|
||||||
|
return "-XX:-" + name;
|
||||||
|
} else {
|
||||||
|
return "-XX:" + name + "=" + value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns message that should occur in VM output if option
|
* Returns message that should occur in VM output if option
|
||||||
* {@code optionName} if unrecognized.
|
* {@code optionName} if unrecognized.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user