< prev index next >
src/share/vm/runtime/arguments.cpp
Print this page
@@ -125,22 +125,24 @@
char* Arguments::_meta_index_dir = NULL;
char* Arguments::_ext_dirs = NULL;
// Check if head of 'option' matches 'name', and sets 'tail' to the remaining
// part of the option string.
+
static bool match_option(const JavaVMOption *option, const char* name,
const char** tail) {
- int len = (int)strlen(name);
+ int len = (int) strlen(name);
if (strncmp(option->optionString, name, len) == 0) {
*tail = option->optionString + len;
return true;
} else {
return false;
}
}
// Check if 'option' matches 'name'. No "tail" is allowed.
+
static bool match_option(const JavaVMOption *option, const char* name) {
const char* tail = NULL;
bool result = match_option(option, name, &tail);
if (tail != NULL && *tail == '\0') {
return result;
@@ -150,10 +152,11 @@
}
// Return true if any of the strings in null-terminated array 'names' matches.
// If tail_allowed is true, then the tail must begin with a colon; otherwise,
// the option must match exactly.
+
static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
bool tail_allowed) {
for (/* empty */; *names != NULL; ++names) {
if (match_option(option, *names, tail)) {
if (**tail == '\0' || tail_allowed && **tail == ':') {
@@ -169,10 +172,11 @@
jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
}
}
// Process java launcher properties.
+
void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
// See if sun.java.launcher, sun.java.launcher.is_altjvm or
// sun.java.launcher.pid is defined.
// Must do this before setting up other system properties,
// as some of them may depend on launcher type.
@@ -196,10 +200,11 @@
}
}
}
// Initialize system properties key and value.
+
void Arguments::init_system_properties() {
PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name",
"Java Virtual Machine Specification", false));
PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
@@ -226,13 +231,17 @@
// Set OS specific system properties values
os::init_system_properties_values();
}
- // Update/Initialize System properties after JDK version number is known
+// Update/Initialize System properties after JDK version number is known
+
void Arguments::init_version_specific_system_properties() {
- enum { bufsz = 16 };
+
+ enum {
+ bufsz = 16
+ };
char buffer[bufsz];
const char* spec_vendor = "Sun Microsystems Inc.";
uint32_t spec_version = 0;
spec_vendor = "Oracle Corporation";
@@ -245,126 +254,227 @@
new SystemProperty("java.vm.specification.version", buffer, false));
PropertyList_add(&_system_properties,
new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false));
}
-/**
- * Provide a slightly more user-friendly way of eliminating -XX flags.
- * 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. This allows
- * a flag to die correctly over JDK releases using HSX.
+/*
+ * -XX argument processing:
+ *
+ * -XX arguments are usually defined in globals.hpp, globals_<cpu>.hpp, globals_<os>.hpp, <compiler>_globals.hpp, or <gc>_globals.hpp.
+ * -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 (if removal has been 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 (if removal has been 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 using HSX.
+ * 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.
+ * - Expired deprecated options may still have global variable definitions that should be removed (in globals.hpp, etc).
+ *
+ * Tests: Aliases are tested in VMAliasOptions.java. Deprecated options in VMDeprecatedOptions.java. Obsolete options are tested in various files.
*/
-typedef struct {
+
+// Obsolete or deprecated -XX flag.
+
+typedef struct SpecialFlag {
const char* name;
- JDK_Version obsoleted_in; // when the flag went away
- JDK_Version accept_until; // which version to start denying the existence
-} ObsoleteFlag;
-
-static ObsoleteFlag obsolete_jvm_flags[] = {
- { "UseTrainGC", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "UseSpecialLargeObjectHandling", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "UseOversizedCarHandling", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "TraceCarAllocation", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "PrintTrainGCProcessingStats", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "LogOfCarSpaceSize", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "OversizedCarThreshold", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "MinTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "DefaultTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "MaxTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "DelayTickAdjustment", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "ProcessingToTenuringRatio", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "MinTrainLength", JDK_Version::jdk(5), JDK_Version::jdk(7) },
- { "AppendRatio", JDK_Version::jdk_update(6,10), JDK_Version::jdk(7) },
- { "DefaultMaxRAM", JDK_Version::jdk_update(6,18), JDK_Version::jdk(7) },
+ 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).
+
+ static const uint8_t _removal_unscheduled = 0;
+
+ bool is_removal_scheduled() const {
+ return accept_until.major_version() != _removal_unscheduled;
+ }
+
+} 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[] = {
+ { "UseTrainGC", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "UseSpecialLargeObjectHandling", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "UseOversizedCarHandling", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "TraceCarAllocation", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "PrintTrainGCProcessingStats", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "LogOfCarSpaceSize", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "OversizedCarThreshold", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "MinTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "DefaultTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "MaxTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "DelayTickAdjustment", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "ProcessingToTenuringRatio", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "MinTrainLength", JDK_Version::jdk(5), JDK_Version::jdk(7)},
+ { "AppendRatio", JDK_Version::jdk_update(6, 10), JDK_Version::jdk(7)},
+ { "DefaultMaxRAM", JDK_Version::jdk_update(6, 18), JDK_Version::jdk(7)},
{ "DefaultInitialRAMFraction",
- JDK_Version::jdk_update(6,18), JDK_Version::jdk(7) },
+ JDK_Version::jdk_update(6, 18), JDK_Version::jdk(7)},
{ "UseDepthFirstScavengeOrder",
- JDK_Version::jdk_update(6,22), JDK_Version::jdk(7) },
+ JDK_Version::jdk_update(6, 22), JDK_Version::jdk(7)},
{ "HandlePromotionFailure",
- JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
+ JDK_Version::jdk_update(6, 24), JDK_Version::jdk(8)},
{ "MaxLiveObjectEvacuationRatio",
- JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
- { "ForceSharedSpaces", JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) },
+ JDK_Version::jdk_update(6, 24), JDK_Version::jdk(8)},
+ { "ForceSharedSpaces", JDK_Version::jdk_update(6, 25), JDK_Version::jdk(8)},
{ "UseParallelOldGCCompacting",
- JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
+ JDK_Version::jdk_update(6, 27), JDK_Version::jdk(8)},
{ "UseParallelDensePrefixUpdate",
- JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
+ JDK_Version::jdk_update(6, 27), JDK_Version::jdk(8)},
{ "UseParallelOldGCDensePrefix",
- JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
- { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) },
- { "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) },
- { "CMSPermGenPrecleaningEnabled", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "CMSTriggerPermRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "CMSInitiatingPermOccupancyFraction", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "AdaptivePermSizeWeight", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "PermGenPadding", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "PermMarkSweepDeadRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "PermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "MaxPermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "MinPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "MaxPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "CMSRevisitStackSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "UseVectoredExceptions", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "UseSplitVerifier", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "SafepointPollOffset", JDK_Version::jdk(9), JDK_Version::jdk(10) },
+ JDK_Version::jdk_update(6, 27), JDK_Version::jdk(8)},
+ { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8)},
+ { "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8)},
+ { "CMSPermGenPrecleaningEnabled", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "CMSTriggerPermRatio", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "CMSInitiatingPermOccupancyFraction",
+ JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "AdaptivePermSizeWeight", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "PermGenPadding", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "PermMarkSweepDeadRatio", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "PermSize", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "MaxPermSize", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "MinPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "MaxPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "CMSRevisitStackSize", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "UseVectoredExceptions", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "UseSplitVerifier", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "SafepointPollOffset", JDK_Version::jdk(9), JDK_Version::jdk(10)},
#ifdef PRODUCT
- { "DesiredMethodLimit",
- JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
+ { "DesiredMethodLimit", JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8)},
#endif // PRODUCT
- { "UseVMInterruptibleIO", JDK_Version::jdk(8), JDK_Version::jdk(9) },
- { "UseBoundThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "DefaultThreadPriority", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "NoYieldsInMicrolock", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "BackEdgeThreshold", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "UseNewReflection", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "ReflectionWrapResolutionErrors",JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "VerifyReflectionBytecodes", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "AutoShutdownNMT", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "NmethodSweepFraction", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "NmethodSweepCheckInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "CodeCacheMinimumFreeSpace", JDK_Version::jdk(9), JDK_Version::jdk(10) },
+ { "UseVMInterruptibleIO", JDK_Version::jdk(8), JDK_Version::jdk(9)},
+ { "UseBoundThreads", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "DefaultThreadPriority", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "NoYieldsInMicrolock", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "BackEdgeThreshold", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "UseNewReflection", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "ReflectionWrapResolutionErrors", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "VerifyReflectionBytecodes", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "AutoShutdownNMT", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "NmethodSweepFraction", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "NmethodSweepCheckInterval", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "CodeCacheMinimumFreeSpace", JDK_Version::jdk(9), JDK_Version::jdk(10)},
#ifndef ZERO
- { "UseFastAccessorMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "UseFastEmptyMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
+ { "UseFastAccessorMethods", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "UseFastEmptyMethods", JDK_Version::jdk(9), JDK_Version::jdk(10)},
#endif // ZERO
- { "UseCompilerSafepoints", JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { NULL, JDK_Version(0), JDK_Version(0) }
+ { "UseCompilerSafepoints", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { NULL, JDK_Version(0), JDK_Version(0)}
};
-// Returns true if the flag is obsolete and fits into the range specified
-// for being ignored. In the case that the flag is ignored, the 'version'
-// value is filled in with the version number when the flag became
-// obsolete so that that value can be displayed to the user.
-bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
+// 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::jdk(SpecialFlag::_removal_unscheduled)},
+ { "UseParNewGC", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+
+ // deprecated alias flags (see also aliased_jvm_flags):
+ { "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::jdk(SpecialFlag::_removal_unscheduled)},
+ { "CMSMarkStackSizeMax", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "CMSMarkStackSize", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "G1MarkStackSize", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "ParallelMarkingThreads", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { "ParallelCMSThreads", JDK_Version::jdk(9), JDK_Version::jdk(10)},
+ { NULL, JDK_Version(0), JDK_Version(0)}
+};
+
+// Flags that are aliases for other flags.
+
+typedef struct {
+ const char* alias_name;
+ const char* real_name;
+} AliasedFlag;
+
+static AliasedFlag const aliased_jvm_flags[] = {
+ { "DefaultMaxRAMFraction", "MaxRAMFraction"},
+ { "CMSMarkStackSizeMax", "MarkStackSizeMax"},
+ { "CMSMarkStackSize", "MarkStackSize"},
+ { "G1MarkStackSize", "MarkStackSize"},
+ { "ParallelMarkingThreads", "ConcGCThreads"},
+ { "ParallelCMSThreads", "ConcGCThreads"},
+ { NULL, NULL}
+};
+
+// Returns 1 if the flag is special and jdk version is in the range specified.
+// In this case the 'version' buffer is filled in with the version number when
+// the flag became special.
+// Returns -1 if the flag is special and has expired (should be ignored).
+// Returns 0 if the flag is not special.
+
+static int is_special_flag(const SpecialFlag special_table[], const char *s, JDK_Version* version) {
int i = 0;
assert(version != NULL, "Must provide a version buffer");
- while (obsolete_jvm_flags[i].name != NULL) {
- const ObsoleteFlag& flag_status = obsolete_jvm_flags[i];
+ while (special_table[i].name != NULL) {
+ const SpecialFlag& flag_status = special_table[i];
// <flag>=xxx form
// [-|+]<flag> form
size_t len = strlen(flag_status.name);
if (((strncmp(flag_status.name, s, len) == 0) &&
(strlen(s) == len)) ||
((s[0] == '+' || s[0] == '-') &&
(strncmp(flag_status.name, &s[1], len) == 0) &&
(strlen(&s[1]) == len))) {
- if (JDK_Version::current().compare(flag_status.accept_until) == -1) {
+ if (!flag_status.is_removal_scheduled() ||
+ JDK_Version::current().compare(flag_status.accept_until) == -1) {
*version = flag_status.obsoleted_in;
- return true;
+ return 1;
+ } else {
+ return -1;
}
}
i++;
}
- return false;
+ return 0;
+}
+
+bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
+ return (is_special_flag(obsolete_jvm_flags, s, version) == 1);
+}
+
+int Arguments::is_deprecated_flag(const char *s, JDK_Version* version) {
+ return is_special_flag(deprecated_jvm_flags, s, version);
+}
+
+const char* Arguments::real_flag_name(const char *flag_name) {
+ int i = 0;
+ while (aliased_jvm_flags[i].alias_name != NULL) {
+ const AliasedFlag& flag_status = aliased_jvm_flags[i];
+ size_t len = strlen(flag_status.alias_name);
+ if (((strncmp(flag_status.alias_name, flag_name, len) == 0) &&
+ (strlen(flag_name) == len))) {
+ return flag_status.real_name;
+ }
+ i++;
+ }
+ return flag_name;
}
// Constructs the system class path (aka boot class path) from the following
// components, in order:
//
@@ -372,24 +482,33 @@
// base // from os::get_system_properties() or -Xbootclasspath=
// suffix // from -Xbootclasspath/a:...
//
// This could be AllStatic, but it isn't needed after argument processing is
// complete.
-class SysClassPath: public StackObj {
+
+class SysClassPath : public StackObj {
public:
SysClassPath(const char* base);
~SysClassPath();
inline void set_base(const char* base);
inline void add_prefix(const char* prefix);
inline void add_suffix_to_prefix(const char* suffix);
inline void add_suffix(const char* suffix);
inline void reset_path(const char* base);
- inline const char* get_base() const { return _items[_scp_base]; }
- inline const char* get_prefix() const { return _items[_scp_prefix]; }
- inline const char* get_suffix() const { return _items[_scp_suffix]; }
+ inline const char* get_base() const {
+ return _items[_scp_base];
+ }
+
+ inline const char* get_prefix() const {
+ return _items[_scp_prefix];
+ }
+
+ inline const char* get_suffix() const {
+ return _items[_scp_suffix];
+ }
// Combine all the components into a single c-heap-allocated string; caller
// must free the string if/when no longer needed.
char* combined_path();
@@ -400,10 +519,11 @@
inline void reset_item_at(int index);
// Array indices for the items that make up the sysclasspath. All except the
// base are allocated in the C heap and freed by this class.
+
enum {
_scp_prefix, // from -Xbootclasspath/p:...
_scp_base, // the default sysclasspath
_scp_suffix, // from -Xbootclasspath/a:...
_scp_nitems // the number of items, must be last.
@@ -411,11 +531,11 @@
const char* _items[_scp_nitems];
};
SysClassPath::SysClassPath(const char* base) {
- memset(_items, 0, sizeof(_items));
+ memset(_items, 0, sizeof (_items));
_items[_scp_base] = base;
}
SysClassPath::~SysClassPath() {
// Free everything except the base.
@@ -458,10 +578,11 @@
//------------------------------------------------------------------------------
// Combine the bootclasspath elements, some of which may be null, into a single
// c-heap-allocated string.
+
char* SysClassPath::combined_path() {
assert(_items[_scp_base] != NULL, "empty default sysclasspath");
size_t lengths[_scp_nitems];
size_t total_len = 0;
@@ -492,10 +613,11 @@
*--cp_tmp = '\0'; // Replace the extra separator.
return cp;
}
// Note: path must be c-heap-allocated (or NULL); it is freed if non-null.
+
char*
SysClassPath::add_to_path(const char* path, const char* str, bool prepend) {
char *cp;
assert(str != NULL, "just checking");
@@ -527,15 +649,16 @@
return cp;
}
// Scan the directory and append any jar or zip files found to path.
// Note: path must be c-heap-allocated (or NULL); it is freed if non-null.
+
char* SysClassPath::add_jars_to_path(char* path, const char* directory) {
DIR* dir = os::opendir(directory);
if (dir == NULL) return path;
- char dir_sep[2] = { '\0', '\0' };
+ char dir_sep[2] = {'\0', '\0'};
size_t directory_len = strlen(directory);
const char fileSep = *os::file_separator();
if (directory[directory_len - 1] != fileSep) dir_sep[0] = fileSep;
/* Scan the directory for jars/zips, appending them to path. */
@@ -558,16 +681,17 @@
os::closedir(dir);
return path;
}
// Parses a memory size specification string.
+
static bool atomull(const char *s, julong* result) {
julong n = 0;
int args_read = 0;
bool is_hex = false;
// Skip leading 0[xX] for hexadecimal
- if (*s =='0' && (*(s+1) == 'x' || *(s+1) == 'X')) {
+ if (*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) {
s += 2;
is_hex = true;
args_read = sscanf(s, JULONG_FORMAT_X, &n);
} else {
args_read = sscanf(s, JULONG_FORMAT, &n);
@@ -584,23 +708,23 @@
}
switch (*s) {
case 'T': case 't':
*result = n * G * K;
// Check for overflow.
- if (*result/((julong)G * K) != n) return false;
+ if (*result / ((julong) G * K) != n) return false;
return true;
case 'G': case 'g':
*result = n * G;
- if (*result/G != n) return false;
+ if (*result / G != n) return false;
return true;
case 'M': case 'm':
*result = n * M;
- if (*result/M != n) return false;
+ if (*result / M != n) return false;
return true;
case 'K': case 'k':
*result = n * K;
- if (*result/K != n) return false;
+ if (*result / K != n) return false;
return true;
case '\0':
*result = n;
return true;
default:
@@ -614,12 +738,13 @@
if (size > max_uintx) return arg_too_big;
return arg_in_range;
}
// Describe an argument out of range error
+
void Arguments::describe_range_error(ArgsRange errcode) {
- switch(errcode) {
+ switch (errcode) {
case arg_too_big:
jio_fprintf(defaultStream::error_stream(),
"The specified size exceeds the maximum "
"representable size.\n");
break;
@@ -631,15 +756,15 @@
default:
ShouldNotReachHere();
}
}
-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) {
return CommandLineFlags::boolAtPut(name, &value, 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;
if (sscanf(value, "%lf", &v) != 1) {
return false;
}
@@ -647,11 +772,11 @@
return true;
}
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;
intx intx_v;
bool is_neg = false;
// Check the sign first since atomull() parses only unsigned values.
if (*value == '-') {
@@ -684,18 +809,18 @@
return true;
}
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)) return false;
// Contract: CommandLineFlags always returns a pointer that needs freeing.
FREE_C_HEAP_ARRAY(char, value);
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 = "";
if (!CommandLineFlags::ccstrAt(name, &old_value)) return false;
size_t old_len = old_value != NULL ? strlen(old_value) : 0;
size_t new_len = strlen(new_value);
const char* value;
@@ -719,65 +844,118 @@
FREE_C_HEAP_ARRAY(char, free_this_too);
}
return true;
}
+const char* Arguments::handle_aliases_and_deprecation(const char* arg) {
+ const char* real_name = real_flag_name(arg);
+ JDK_Version since = JDK_Version();
+ switch (is_deprecated_flag(arg, &since)) {
+ case -1:
+ return NULL;
+ case 0:
+ return real_name;
+ case 1:
+ {
+ 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) {
// range of acceptable characters spelled out for portability reasons
#define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]"
#define BUFLEN 255
- char name[BUFLEN+1];
+ char name[BUFLEN + 1];
char dummy;
+ const char* real_name;
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);
+ 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) {
- return set_bool_flag(name, true, origin);
+ real_name = handle_aliases_and_deprecation(name);
+ if (real_name == NULL) {
+ return false;
+ }
+ return set_bool_flag(real_name, true, origin);
}
char punct;
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "%c", name, &punct) == 2 && punct == '=') {
const char* value = strchr(arg, '=') + 1;
- Flag* flag = Flag::find_flag(name, strlen(name));
+ Flag* flag;
+
+ real_name = handle_aliases_and_deprecation(name);
+ if (real_name == NULL) {
+ return false;
+ }
+ flag = Flag::find_flag(real_name, strlen(real_name));
if (flag != NULL && flag->is_ccstr()) {
if (flag->ccstr_accumulates()) {
- return append_to_string_flag(name, value, origin);
+ return append_to_string_flag(real_name, value, origin);
} else {
if (value[0] == '\0') {
value = NULL;
}
- return set_string_flag(name, value, origin);
+ return set_string_flag(real_name, value, origin);
}
}
}
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE ":%c", name, &punct) == 2 && punct == '=') {
const char* value = strchr(arg, '=') + 1;
// -XX:Foo:=xxx will reset the string flag to the given value.
if (value[0] == '\0') {
value = NULL;
}
- return set_string_flag(name, value, origin);
+ real_name = handle_aliases_and_deprecation(name);
+ if (real_name == NULL) {
+ return false;
+ }
+ return set_string_flag(real_name, value, origin);
}
#define SIGNED_FP_NUMBER_RANGE "[-0123456789.]"
#define SIGNED_NUMBER_RANGE "[-0123456789]"
#define NUMBER_RANGE "[0123456789]"
char value[BUFLEN + 1];
char value2[BUFLEN + 1];
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
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);
+ if (real_name == NULL) {
+ return false;
+ }
+ return set_fp_numeric_flag(real_name, value, origin);
}
}
#define VALUE_RANGE "[-kmgtxKMGTX0123456789abcdefABCDEF]"
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);
+ if (real_name == NULL) {
+ return false;
+ }
+ return set_numeric_flag(real_name, value, origin);
}
return false;
}
@@ -808,10 +986,11 @@
add_string(&_jvm_flags_array, &_num_jvm_flags, arg);
}
// utility function to return a string that concatenates all
// strings in a given char** array
+
const char* Arguments::build_resource_string(char** args, int count) {
if (args == NULL || count == 0) {
return NULL;
}
size_t length = strlen(args[0]) + 1; // add 1 for the null terminator
@@ -828,35 +1007,37 @@
}
void Arguments::print_on(outputStream* st) {
st->print_cr("VM Arguments:");
if (num_jvm_flags() > 0) {
- st->print("jvm_flags: "); print_jvm_flags_on(st);
+ st->print("jvm_flags: ");
+ print_jvm_flags_on(st);
}
if (num_jvm_args() > 0) {
- st->print("jvm_args: "); print_jvm_args_on(st);
+ st->print("jvm_args: ");
+ print_jvm_args_on(st);
}
st->print_cr("java_command: %s", java_command() ? java_command() : "<unknown>");
if (_java_class_path != NULL) {
char* path = _java_class_path->value();
- st->print_cr("java_class_path (initial): %s", strlen(path) == 0 ? "<not set>" : path );
+ st->print_cr("java_class_path (initial): %s", strlen(path) == 0 ? "<not set>" : path);
}
st->print_cr("Launcher Type: %s", _sun_java_launcher);
}
void Arguments::print_jvm_flags_on(outputStream* st) {
if (_num_jvm_flags > 0) {
- for (int i=0; i < _num_jvm_flags; i++) {
+ for (int i = 0; i < _num_jvm_flags; i++) {
st->print("%s ", _jvm_flags_array[i]);
}
st->cr();
}
}
void Arguments::print_jvm_args_on(outputStream* st) {
if (_num_jvm_args > 0) {
- for (int i=0; i < _num_jvm_args; i++) {
+ for (int i = 0; i < _num_jvm_args; i++) {
st->print("%s ", _jvm_args_array[i]);
}
st->cr();
}
}
@@ -872,11 +1053,11 @@
bool has_plus_minus = (*arg == '+' || *arg == '-');
const char* const argname = has_plus_minus ? arg + 1 : arg;
if (is_newly_obsolete(arg, &since)) {
char version[256];
- since.to_string(version, sizeof(version));
+ since.to_string(version, sizeof (version));
warning("ignoring option %s; support was removed in %s", argname, version);
return true;
}
// For locked flags, report a custom error message if available.
@@ -888,11 +1069,11 @@
arg_len = strlen(argname);
} else {
arg_len = equal_sign - argname;
}
- Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true, true);
+ Flag* found_flag = Flag::find_flag((const char*) argname, arg_len, true, true);
if (found_flag != NULL) {
char locked_message_buf[BUFLEN];
found_flag->get_locked_message(locked_message_buf, BUFLEN);
if (strlen(locked_message_buf) == 0) {
if (found_flag->is_bool() && !has_plus_minus) {
@@ -909,20 +1090,20 @@
jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
}
} else {
jio_fprintf(defaultStream::error_stream(),
"Unrecognized VM option '%s'\n", argname);
- Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
+ Flag* fuzzy_matched = Flag::fuzzy_match((const char*) argname, arg_len, true);
if (fuzzy_matched != NULL) {
jio_fprintf(defaultStream::error_stream(),
"Did you mean '%s%s%s'? ",
(fuzzy_matched->is_bool()) ? "(+/-)" : "",
fuzzy_matched->_name,
(fuzzy_matched->is_bool()) ? "" : "=<value>");
if (is_newly_obsolete(fuzzy_matched->_name, &since)) {
char version[256];
- since.to_string(version, sizeof(version));
+ since.to_string(version, sizeof (version));
jio_fprintf(defaultStream::error_stream(),
"Warning: support for %s was removed in %s\n",
fuzzy_matched->_name,
version);
}
@@ -953,11 +1134,11 @@
bool in_quote = false;
char quote_c = 0;
bool result = true;
int c = getc(stream);
- while(c != EOF && pos < (int)(sizeof(token)-1)) {
+ while (c != EOF && pos < (int) (sizeof (token) - 1)) {
if (in_white_space) {
if (in_comment) {
if (c == '\n') in_comment = false;
} else {
if (c == '#') in_comment = true;
@@ -1007,11 +1188,11 @@
bool Arguments::add_property(const char* prop) {
const char* eq = strchr(prop, '=');
char* key;
// ns must be static--its address may be stored in a SystemProperty object.
const static char ns[1] = {0};
- char* value = (char *)ns;
+ char* value = (char *) ns;
size_t key_len = (eq == NULL) ? strlen(prop) : (eq - prop);
key = AllocateHeap(key_len + 1, mtInternal);
strncpy(key, prop, key_len);
key[key_len] = '\0';
@@ -1067,11 +1248,11 @@
_mode = mode;
// Ensure Agent_OnLoad has the correct initial values.
// This may not be the final mode; mode may change later in onload phase.
PropertyList_unique_add(&_system_properties, "java.vm.info",
- (char*)VM_Version::vm_info_string(), false);
+ (char*) VM_Version::vm_info_string(), false);
UseInterpreter = true;
UseCompiler = true;
UseLoopCounter = true;
@@ -1125,17 +1306,19 @@
}
}
#endif
// Returns threshold scaled with CompileThresholdScaling
+
intx Arguments::get_scaled_compile_threshold(intx threshold) {
- return (intx)(threshold * CompileThresholdScaling);
+ return (intx) (threshold * CompileThresholdScaling);
}
// Returns freq_log scaled with CompileThresholdScaling
+
intx Arguments::get_scaled_freq_log(intx freq_log) {
- intx scaled_freq = get_scaled_compile_threshold((intx)1 << freq_log);
+ intx scaled_freq = get_scaled_compile_threshold((intx) 1 << freq_log);
if (scaled_freq == 0) {
return 0;
} else {
return log2_intptr(scaled_freq);
}
@@ -1153,11 +1336,11 @@
// Increase the code cache size - tiered compiles a lot more.
if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
FLAG_SET_ERGO(uintx, ReservedCodeCacheSize, ReservedCodeCacheSize * 5);
}
// Enable SegmentedCodeCache if TieredCompilation is enabled and ReservedCodeCacheSize >= 240M
- if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) {
+ if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240 * M) {
FLAG_SET_ERGO(bool, SegmentedCodeCache, true);
if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
// Multiply sizes by 5 but fix NonNMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
@@ -1168,12 +1351,12 @@
}
// Check consistency of code heap sizes
if ((NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
- NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
- (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
+ NonNMethodCodeHeapSize / K, ProfiledCodeHeapSize / K, NonProfiledCodeHeapSize / K,
+ (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize) / K, ReservedCodeCacheSize / K);
vm_exit(1);
}
}
}
if (!UseInterpreter) { // -Xcomp
@@ -1233,10 +1416,11 @@
return 2; // case 4 (tiered)
#endif
}
#if INCLUDE_ALL_GCS
+
static void disable_adaptive_size_policy(const char* collector_name) {
if (UseAdaptiveSizePolicy) {
if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
collector_name);
@@ -1263,14 +1447,14 @@
// By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
// these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
// we set them to 1024 and 1024.
// See CR 6362902.
if (FLAG_IS_DEFAULT(YoungPLABSize)) {
- FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
+ FLAG_SET_DEFAULT(YoungPLABSize, (intx) 1024);
}
if (FLAG_IS_DEFAULT(OldPLABSize)) {
- FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
+ FLAG_SET_DEFAULT(OldPLABSize, (intx) 1024);
}
// When using compressed oops, we use local overflow stacks,
// rather than using a global overflow list chained through
// the klass word of the object's pre-image.
@@ -1285,10 +1469,11 @@
// Adjust some sizes to suit CMS and/or ParNew needs; these work well on
// sparc/solaris for certain applications, but would gain from
// further optimization and tuning efforts, and would almost
// certainly gain from analysis of platform and environment.
+
void Arguments::set_cms_and_parnew_gc_flags() {
assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
assert(UseConcMarkSweepGC, "CMS is expected to be on here");
assert(UseParNewGC, "ParNew should always be used with CMS");
@@ -1299,19 +1484,19 @@
size_t max_heap = align_size_down(MaxHeapSize,
CardTableRS::ct_max_alignment_constraint());
// Now make adjustments for CMS
- intx tenuring_default = (intx)6;
+ intx tenuring_default = (intx) 6;
size_t young_gen_per_worker = CMSYoungGenPerWorker;
// Preferred young gen size for "short" pauses:
// upper bound depends on # of threads and NewRatio.
const uintx parallel_gc_threads =
(ParallelGCThreads == 0 ? 1 : ParallelGCThreads);
const size_t preferred_max_new_size_unaligned =
- MIN2(max_heap/(NewRatio+1), ScaleForWordSize(young_gen_per_worker * parallel_gc_threads));
+ MIN2(max_heap / (NewRatio + 1), ScaleForWordSize(young_gen_per_worker * parallel_gc_threads));
size_t preferred_max_new_size =
align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());
// Unless explicitly requested otherwise, size young gen
// for "short" pauses ~ CMSYoungGenPerWorker*ParallelGCThreads
@@ -1378,11 +1563,11 @@
// If we decided above (or user explicitly requested)
// `promote all' (via MaxTenuringThreshold := 0),
// prefer minuscule survivor spaces so as not to waste
// space for (non-existent) survivors
if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) {
- FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx)1024, SurvivorRatio));
+ FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx) 1024, SurvivorRatio));
}
// OldPLABSize is interpreted in CMS as not the size of the PLAB in words,
// but rather the number of free blocks of a given size that are used when
// replenishing the local per-worker free list caches.
@@ -1434,57 +1619,57 @@
bool verify_object_alignment() {
// Object alignment.
if (!is_power_of_2(ObjectAlignmentInBytes)) {
jio_fprintf(defaultStream::error_stream(),
"error: ObjectAlignmentInBytes=%d must be power of 2\n",
- (int)ObjectAlignmentInBytes);
+ (int) ObjectAlignmentInBytes);
return false;
}
- if ((int)ObjectAlignmentInBytes < BytesPerLong) {
+ if ((int) ObjectAlignmentInBytes < BytesPerLong) {
jio_fprintf(defaultStream::error_stream(),
"error: ObjectAlignmentInBytes=%d must be greater or equal %d\n",
- (int)ObjectAlignmentInBytes, BytesPerLong);
+ (int) ObjectAlignmentInBytes, BytesPerLong);
return false;
}
// It does not make sense to have big object alignment
// since a space lost due to alignment will be greater
// then a saved space from compressed oops.
- if ((int)ObjectAlignmentInBytes > 256) {
+ if ((int) ObjectAlignmentInBytes > 256) {
jio_fprintf(defaultStream::error_stream(),
"error: ObjectAlignmentInBytes=%d must not be greater than 256\n",
- (int)ObjectAlignmentInBytes);
+ (int) ObjectAlignmentInBytes);
return false;
}
// In case page size is very small.
- if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
+ if ((int) ObjectAlignmentInBytes >= os::vm_page_size()) {
jio_fprintf(defaultStream::error_stream(),
"error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
- (int)ObjectAlignmentInBytes, os::vm_page_size());
+ (int) ObjectAlignmentInBytes, os::vm_page_size());
return false;
}
- if(SurvivorAlignmentInBytes == 0) {
+ if (SurvivorAlignmentInBytes == 0) {
SurvivorAlignmentInBytes = ObjectAlignmentInBytes;
} else {
if (!is_power_of_2(SurvivorAlignmentInBytes)) {
jio_fprintf(defaultStream::error_stream(),
"error: SurvivorAlignmentInBytes=%d must be power of 2\n",
- (int)SurvivorAlignmentInBytes);
+ (int) SurvivorAlignmentInBytes);
return false;
}
if (SurvivorAlignmentInBytes < ObjectAlignmentInBytes) {
jio_fprintf(defaultStream::error_stream(),
"error: SurvivorAlignmentInBytes=%d must be greater than ObjectAlignmentInBytes=%d \n",
- (int)SurvivorAlignmentInBytes, (int)ObjectAlignmentInBytes);
+ (int) SurvivorAlignmentInBytes, (int) ObjectAlignmentInBytes);
return false;
}
}
return true;
}
size_t Arguments::max_heap_for_compressed_oops() {
// Avoid sign flip.
- assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
+ assert(OopEncodingHeapMax > (uint64_t) os::vm_page_size(), "Unusual page size");
// We need to fit both the NULL page and the heap into the memory budget, while
// keeping alignment constraints of the heap. To guarantee the latter, as the
// NULL page is located before the heap, we pad the NULL page to the conservative
// maximum alignment that the GC may ever impose upon the heap.
size_t displacement_due_to_null_page = align_size_up_(os::vm_page_size(),
@@ -1534,10 +1719,11 @@
}
// NOTE: set_use_compressed_klass_ptrs() must be called after calling
// set_use_compressed_oops().
+
void Arguments::set_use_compressed_klass_ptrs() {
#ifndef ZERO
#ifdef _LP64
// UseCompressedOops must be on for UseCompressedClassPointers to be on.
if (!UseCompressedOops) {
@@ -1574,11 +1760,11 @@
} else if (UseG1GC) {
heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
}
#endif // INCLUDE_ALL_GCS
_conservative_max_heap_alignment = MAX4(heap_alignment,
- (size_t)os::vm_allocation_granularity(),
+ (size_t) os::vm_allocation_granularity(),
os::max_page_size(),
CollectorPolicy::compute_heap_alignment());
}
void Arguments::select_gc_ergonomically() {
@@ -1724,10 +1910,11 @@
}
}
#if !INCLUDE_ALL_GCS
#ifdef ASSERT
+
static bool verify_serial_gc_flags() {
return (UseSerialGC &&
!(UseParNewGC || (UseConcMarkSweepGC) || UseG1GC ||
UseParallelGC || UseParallelOldGC));
}
@@ -1742,11 +1929,10 @@
} else if (UseConcMarkSweepGC) {
set_cms_and_parnew_gc_flags();
} else if (UseG1GC) {
set_g1_gc_flags();
}
- check_deprecated_gc_flags();
if (AssumeMP && !UseSerialGC) {
if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
warning("If the number of processors is expected to increase from one, then"
" you should configure the number of parallel GC threads appropriately"
" using -XX:ParallelGCThreads=N");
@@ -1772,18 +1958,13 @@
// Use static initialization to get the default before parsing
static const uintx DefaultHeapBaseMinAddress = HeapBaseMinAddress;
void Arguments::set_heap_size() {
- if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) {
- // Deprecated flag
- FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction);
- }
-
const julong phys_mem =
- FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM)
- : (julong)MaxRAM;
+ FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong) MaxRAM)
+ : (julong) MaxRAM;
// If the maximum heap size has not been set with -Xmx,
// then set it as fraction of the size of physical memory,
// respecting the maximum and minimum sizes of the heap.
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
@@ -1793,19 +1974,19 @@
// Small physical memory, so use a minimum fraction of it for the heap
reasonable_max = phys_mem / MinRAMFraction;
} else {
// Not-small physical memory, so require a heap at least
// as large as MaxHeapSize
- reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize);
+ reasonable_max = MAX2(reasonable_max, (julong) MaxHeapSize);
}
if (!FLAG_IS_DEFAULT(ErgoHeapSizeLimit) && ErgoHeapSizeLimit != 0) {
// Limit the heap size to ErgoHeapSizeLimit
- reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit);
+ reasonable_max = MIN2(reasonable_max, (julong) ErgoHeapSizeLimit);
}
if (UseCompressedOops) {
// Limit the heap size to the maximum possible when using compressed oops
- julong max_coop_heap = (julong)max_heap_for_compressed_oops();
+ julong max_coop_heap = (julong) max_heap_for_compressed_oops();
// HeapBaseMinAddress can be greater than default but not less than.
if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
// matches compressed oops printing flags
@@ -1813,11 +1994,11 @@
jio_fprintf(defaultStream::error_stream(),
"HeapBaseMinAddress must be at least " UINTX_FORMAT
" (" UINTX_FORMAT "G) which is greater than value given "
UINTX_FORMAT "\n",
DefaultHeapBaseMinAddress,
- DefaultHeapBaseMinAddress/G,
+ DefaultHeapBaseMinAddress / G,
HeapBaseMinAddress);
}
FLAG_SET_ERGO(uintx, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
}
}
@@ -1834,57 +2015,58 @@
if (!FLAG_IS_DEFAULT(InitialHeapSize)) {
// An initial heap size was specified on the command line,
// so be sure that the maximum size is consistent. Done
// after call to limit_by_allocatable_memory because that
// method might reduce the allocation size.
- reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize);
+ reasonable_max = MAX2(reasonable_max, (julong) InitialHeapSize);
}
if (PrintGCDetails && Verbose) {
// Cannot use gclog_or_tty yet.
tty->print_cr(" Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
}
- FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx)reasonable_max);
+ FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx) reasonable_max);
}
// If the minimum or initial heap_size have not been set or requested to be set
// ergonomically, set them accordingly.
if (InitialHeapSize == 0 || min_heap_size() == 0) {
- julong reasonable_minimum = (julong)(OldSize + NewSize);
+ julong reasonable_minimum = (julong) (OldSize + NewSize);
- reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize);
+ reasonable_minimum = MIN2(reasonable_minimum, (julong) MaxHeapSize);
reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum);
if (InitialHeapSize == 0) {
julong reasonable_initial = phys_mem / InitialRAMFraction;
- reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)min_heap_size());
- reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
+ reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong) min_heap_size());
+ reasonable_initial = MIN2(reasonable_initial, (julong) MaxHeapSize);
reasonable_initial = limit_by_allocatable_memory(reasonable_initial);
if (PrintGCDetails && Verbose) {
// Cannot use gclog_or_tty yet.
- tty->print_cr(" Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial);
+ tty->print_cr(" Initial heap size " SIZE_FORMAT, (uintx) reasonable_initial);
}
- FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial);
+ FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx) reasonable_initial);
}
// If the minimum heap size has not been set (via -Xms),
// synchronize with InitialHeapSize to avoid errors with the default value.
if (min_heap_size() == 0) {
- set_min_heap_size(MIN2((uintx)reasonable_minimum, InitialHeapSize));
+ set_min_heap_size(MIN2((uintx) reasonable_minimum, InitialHeapSize));
if (PrintGCDetails && Verbose) {
// Cannot use gclog_or_tty yet.
tty->print_cr(" Minimum heap size " SIZE_FORMAT, min_heap_size());
}
}
}
}
// This must be called after ergonomics because we want bytecode rewriting
// if the server compiler is used, or if UseSharedSpaces is disabled.
+
void Arguments::set_bytecode_flags() {
// Better not attempt to store into a read-only space.
if (UseSharedSpaces) {
FLAG_SET_DEFAULT(RewriteBytecodes, false);
FLAG_SET_DEFAULT(RewriteFrequentPairs, false);
@@ -1894,10 +2076,11 @@
FLAG_SET_DEFAULT(RewriteFrequentPairs, false);
}
}
// Aggressive optimization flags -XX:+AggressiveOpts
+
void Arguments::set_aggressive_opts_flags() {
#ifdef COMPILER2
if (AggressiveUnboxing) {
if (FLAG_IS_DEFAULT(EliminateAutoBox)) {
FLAG_SET_DEFAULT(EliminateAutoBox, true);
@@ -1929,14 +2112,14 @@
FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500);
}
#endif
if (AggressiveOpts) {
-// Sample flag setting code
-// if (FLAG_IS_DEFAULT(EliminateZeroing)) {
-// FLAG_SET_DEFAULT(EliminateZeroing, true);
-// }
+ // Sample flag setting code
+ // if (FLAG_IS_DEFAULT(EliminateZeroing)) {
+ // FLAG_SET_DEFAULT(EliminateZeroing, true);
+ // }
}
}
//===========================================================================================================
// Parsing of java.compiler property
@@ -1981,11 +2164,11 @@
}
bool Arguments::verify_min_value(intx val, intx min, const char* name) {
// Returns true if given value is at least specified min threshold
// false, otherwise.
- if (val >= min ) {
+ if (val >= min) {
return true;
}
jio_fprintf(defaultStream::error_stream(),
"%s of " INTX_FORMAT " is invalid; must be at least " INTX_FORMAT "\n",
name, val, min);
@@ -2004,10 +2187,11 @@
// check if do gclog rotation
// +UseGCLogFileRotation is a must,
// no gc log rotation when log file not supplied or
// NumberOfGCLogFiles is 0
+
void check_gclog_consistency() {
if (UseGCLogFileRotation) {
if ((Arguments::gc_log_filename() == NULL) || (NumberOfGCLogFiles == 0)) {
jio_fprintf(defaultStream::output_stream(),
"To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files>\n"
@@ -2015,22 +2199,23 @@
"GC log rotation is turned off\n");
UseGCLogFileRotation = false;
}
}
- if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8*K)) {
- FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K);
+ if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8 * K)) {
+ FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8 * K);
jio_fprintf(defaultStream::output_stream(),
"GCLogFileSize changed to minimum 8K\n");
}
}
// This function is called for -Xloggc:<filename>, it can be used
// to check if a given file name(or string) conforms to the following
// specification:
// A valid string only contains "[A-Z][a-z][0-9].-_%[p|t]"
// %p and %t only allowed once. We only limit usage of filename not path
+
bool is_filename_valid(const char *file_name) {
const char* p = file_name;
char file_sep = os::file_separator()[0];
const char* cp;
// skip prefix path
@@ -2051,18 +2236,18 @@
*p == '.') {
p++;
continue;
}
if (*p == '%') {
- if(*(p + 1) == 'p') {
+ if (*(p + 1) == 'p') {
p += 2;
- count_p ++;
+ count_p++;
continue;
}
if (*(p + 1) == 't') {
p += 2;
- count_t ++;
+ count_t++;
continue;
}
}
return false;
}
@@ -2100,10 +2285,11 @@
_max_heap_free_ratio = max_heap_free_ratio;
return true;
}
// Check consistency of GC selection
+
bool Arguments::check_gc_consistency_user() {
check_gclog_consistency();
// Ensure that the user has not selected conflicting sets
// of collectors.
uint i = 0;
@@ -2134,36 +2320,23 @@
}
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 stack pages settings
-bool Arguments::check_stack_pages()
-{
+
+bool Arguments::check_stack_pages() {
bool status = true;
status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages");
status = status && verify_min_value(StackRedPages, 1, "StackRedPages");
// greater stack shadow pages can't generate instruction to bang stack
status = status && verify_interval(StackShadowPages, 1, 50, "StackShadowPages");
return status;
}
// Check the consistency of vm_init_args
+
bool Arguments::check_vm_args_consistency() {
// Method for adding checks for flag consistency.
// The intent is to warn the user of all possible conflicts,
// before returning an error.
// Note: Needs platform-dependent factoring.
@@ -2191,11 +2364,11 @@
{
// Using "else if" below to avoid printing two error messages if min > max.
// This will also prevent us from reporting both min>100 and max>100 at the
// same time, but that is less annoying than printing two identical errors IMHO.
- FormatBuffer<80> err_msg("%s","");
+ FormatBuffer<80> err_msg("%s", "");
if (!verify_MinHeapFreeRatio(err_msg, MinHeapFreeRatio)) {
jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
status = false;
} else if (!verify_MaxHeapFreeRatio(err_msg, MaxHeapFreeRatio)) {
jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
@@ -2294,11 +2467,11 @@
status = status && verify_percentage(InitiatingHeapOccupancyPercent,
"InitiatingHeapOccupancyPercent");
status = status && verify_min_value(G1RefProcDrainInterval, 1,
"G1RefProcDrainInterval");
- status = status && verify_min_value((intx)G1ConcMarkStepDurationMillis, 1,
+ status = status && verify_min_value((intx) G1ConcMarkStepDurationMillis, 1,
"G1ConcMarkStepDurationMillis");
status = status && verify_interval(G1ConcRSHotCardLimit, 0, max_jubyte,
"G1ConcRSHotCardLimit");
status = status && verify_interval(G1ConcRSLogCacheSize, 0, 31,
"G1ConcRSLogCacheSize");
@@ -2363,11 +2536,11 @@
status = status && verify_interval(TLABWasteTargetPercent,
1, 100, "TLABWasteTargetPercent");
status = status && verify_object_alignment();
- status = status && verify_interval(CompressedClassSpaceSize, 1*M, 3*G,
+ status = status && verify_interval(CompressedClassSpaceSize, 1 * M, 3 * G,
"CompressedClassSpaceSize");
status = status && verify_interval(MarkStackSizeMax,
1, (max_jint - 1), "MarkStackSizeMax");
status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight");
@@ -2384,11 +2557,10 @@
status = status && verify_min_value(ParGCStridesPerThread, 1, "ParGCStridesPerThread");
status = status && verify_min_value(MinRAMFraction, 1, "MinRAMFraction");
status = status && verify_min_value(InitialRAMFraction, 1, "InitialRAMFraction");
status = status && verify_min_value(MaxRAMFraction, 1, "MaxRAMFraction");
- status = status && verify_min_value(DefaultMaxRAMFraction, 1, "DefaultMaxRAMFraction");
status = status && verify_interval(AdaptiveTimeWeight, 0, 100, "AdaptiveTimeWeight");
status = status && verify_min_value(AdaptiveSizeDecrementScaleFactor, 1, "AdaptiveSizeDecrementScaleFactor");
status = status && verify_interval(TLABAllocationWeight, 0, 100, "TLABAllocationWeight");
@@ -2441,42 +2613,42 @@
}
// Check lower bounds of the code cache
// Template Interpreter code is approximately 3X larger in debug builds.
uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
- if (InitialCodeCacheSize < (uintx)os::vm_page_size()) {
+ if (InitialCodeCacheSize < (uintx) os::vm_page_size()) {
jio_fprintf(defaultStream::error_stream(),
- "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
- os::vm_page_size()/K);
+ "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize / K,
+ os::vm_page_size() / K);
status = false;
} else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
- ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
+ ReservedCodeCacheSize / K, InitialCodeCacheSize / K);
status = false;
} else if (ReservedCodeCacheSize < min_code_cache_size) {
jio_fprintf(defaultStream::error_stream(),
- "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
- min_code_cache_size/K);
+ "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize / K,
+ min_code_cache_size / K);
status = false;
- } else if (ReservedCodeCacheSize > 2*G) {
+ } else if (ReservedCodeCacheSize > 2 * G) {
// Code cache size larger than MAXINT is not supported.
jio_fprintf(defaultStream::error_stream(),
- "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
- (2*G)/M);
+ "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize / M,
+ (2 * G) / M);
status = false;
- } else if (NonNMethodCodeHeapSize < min_code_cache_size){
+ } else if (NonNMethodCodeHeapSize < min_code_cache_size) {
jio_fprintf(defaultStream::error_stream(),
- "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,
- min_code_cache_size/K);
+ "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize / K,
+ min_code_cache_size / K);
status = false;
} else if ((!FLAG_IS_DEFAULT(NonNMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
&& (NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
- NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
- (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
+ NonNMethodCodeHeapSize / K, ProfiledCodeHeapSize / K, NonProfiledCodeHeapSize / K,
+ (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize) / K, ReservedCodeCacheSize / K);
status = false;
}
status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
@@ -2486,11 +2658,11 @@
int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
// The default CICompilerCount's value is CI_COMPILER_COUNT.
assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
// Check the minimum number of compiler threads
- status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
+ status &= verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
}
@@ -2602,10 +2774,11 @@
// Checks if name in command-line argument -agent{lib,path}:name[=options]
// represents a valid HPROF of JDWP agent. is_path==true denotes that we
// are dealing with -agentpath (case where name is a path), otherwise with
// -agentlib
+
bool valid_hprof_or_jdwp_agent(char *name, bool is_path) {
char *_name;
const char *_hprof = "hprof", *_jdwp = "jdwp";
size_t _len_hprof, _len_jdwp, _len_prefix;
@@ -2625,15 +2798,13 @@
_len_hprof = strlen(_hprof);
_len_jdwp = strlen(_jdwp);
if (strncmp(_name, _hprof, _len_hprof) == 0) {
_name += _len_hprof;
- }
- else if (strncmp(_name, _jdwp, _len_jdwp) == 0) {
+ } else if (strncmp(_name, _jdwp, _len_jdwp) == 0) {
_name += _len_jdwp;
- }
- else {
+ } else {
return false;
}
if (strcmp(_name, JNI_LIB_SUFFIX) != 0) {
return false;
@@ -2714,17 +2885,17 @@
// -Xrun
} else if (match_option(option, "-Xrun", &tail)) {
if (tail != NULL) {
const char* pos = strchr(tail, ':');
size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
- char* name = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len + 1, mtInternal), tail, len);
+ char* name = (char*) memcpy(NEW_C_HEAP_ARRAY(char, len + 1, mtInternal), tail, len);
name[len] = '\0';
char *options = NULL;
- if(pos != NULL) {
- size_t len2 = strlen(pos+1) + 1; // options start after ':'. Final zero must be copied.
- options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtInternal), pos+1, len2);
+ if (pos != NULL) {
+ size_t len2 = strlen(pos + 1) + 1; // options start after ':'. Final zero must be copied.
+ options = (char*) memcpy(NEW_C_HEAP_ARRAY(char, len2, mtInternal), pos + 1, len2);
}
#if !INCLUDE_JVMTI
if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
jio_fprintf(defaultStream::error_stream(),
"Profiling and debugging agents are not supported in this VM\n");
@@ -2734,18 +2905,18 @@
add_init_library(name, options);
}
// -agentlib and -agentpath
} else if (match_option(option, "-agentlib:", &tail) ||
(is_absolute_path = match_option(option, "-agentpath:", &tail))) {
- if(tail != NULL) {
+ if (tail != NULL) {
const char* pos = strchr(tail, '=');
size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
char* name = strncpy(NEW_C_HEAP_ARRAY(char, len + 1, mtInternal), tail, len);
name[len] = '\0';
char *options = NULL;
- if(pos != NULL) {
+ if (pos != NULL) {
options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1, mtInternal), pos + 1);
}
#if !INCLUDE_JVMTI
if (valid_hprof_or_jdwp_agent(name, is_absolute_path)) {
jio_fprintf(defaultStream::error_stream(),
@@ -2760,11 +2931,11 @@
#if !INCLUDE_JVMTI
jio_fprintf(defaultStream::error_stream(),
"Instrumentation agents are not supported in this VM\n");
return JNI_ERR;
#else
- if(tail != NULL) {
+ if (tail != NULL) {
char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
add_init_agent("instrument", options, false);
}
#endif // !INCLUDE_JVMTI
// -Xnoclassgc
@@ -2787,12 +2958,12 @@
jio_fprintf(defaultStream::error_stream(),
"Invalid initial young generation size: %s\n", option->optionString);
describe_range_error(errcode);
return JNI_EINVAL;
}
- FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size);
- FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size);
+ FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx) long_initial_young_size);
+ FLAG_SET_CMDLINE(uintx, NewSize, (uintx) long_initial_young_size);
// -Xms
} else if (match_option(option, "-Xms", &tail)) {
julong long_initial_heap_size = 0;
// an initial heap size of 0 means automatically determine
ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0);
@@ -2800,29 +2971,29 @@
jio_fprintf(defaultStream::error_stream(),
"Invalid initial heap size: %s\n", option->optionString);
describe_range_error(errcode);
return JNI_EINVAL;
}
- set_min_heap_size((uintx)long_initial_heap_size);
+ set_min_heap_size((uintx) long_initial_heap_size);
// Currently the minimum size and the initial heap sizes are the same.
// Can be overridden with -XX:InitialHeapSize.
- FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx)long_initial_heap_size);
+ FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx) long_initial_heap_size);
// -Xmx
} else if (match_option(option, "-Xmx", &tail) || match_option(option, "-XX:MaxHeapSize=", &tail)) {
julong long_max_heap_size = 0;
ArgsRange errcode = parse_memory_size(tail, &long_max_heap_size, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid maximum heap size: %s\n", option->optionString);
describe_range_error(errcode);
return JNI_EINVAL;
}
- FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
+ FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx) long_max_heap_size);
// Xmaxf
} else if (match_option(option, "-Xmaxf", &tail)) {
char* err;
- int maxf = (int)(strtod(tail, &err) * 100);
+ int maxf = (int) (strtod(tail, &err) * 100);
if (*err != '\0' || *tail == '\0' || maxf < 0 || maxf > 100) {
jio_fprintf(defaultStream::error_stream(),
"Bad max heap free percentage size: %s\n",
option->optionString);
return JNI_EINVAL;
@@ -2830,11 +3001,11 @@
FLAG_SET_CMDLINE(uintx, MaxHeapFreeRatio, maxf);
}
// Xminf
} else if (match_option(option, "-Xminf", &tail)) {
char* err;
- int minf = (int)(strtod(tail, &err) * 100);
+ int minf = (int) (strtod(tail, &err) * 100);
if (*err != '\0' || *tail == '\0' || minf < 0 || minf > 100) {
jio_fprintf(defaultStream::error_stream(),
"Bad min heap free percentage size: %s\n",
option->optionString);
return JNI_EINVAL;
@@ -2851,78 +3022,78 @@
describe_range_error(errcode);
return JNI_EINVAL;
}
// Internally track ThreadStackSize in units of 1024 bytes.
FLAG_SET_CMDLINE(intx, ThreadStackSize,
- round_to((int)long_ThreadStackSize, K) / K);
+ round_to((int) long_ThreadStackSize, K) / K);
// -Xoss
} else if (match_option(option, "-Xoss", &tail)) {
// HotSpot does not have separate native and Java stacks, ignore silently for compatibility
} else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
julong long_CodeCacheExpansionSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid argument: %s. Must be at least %luK.\n", option->optionString,
- os::vm_page_size()/K);
+ os::vm_page_size() / K);
return JNI_EINVAL;
}
- FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
+ FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx) long_CodeCacheExpansionSize);
} else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
julong long_ReservedCodeCacheSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid maximum code cache size: %s.\n", option->optionString);
return JNI_EINVAL;
}
- FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
+ FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx) long_ReservedCodeCacheSize);
// -XX:NonNMethodCodeHeapSize=
} else if (match_option(option, "-XX:NonNMethodCodeHeapSize=", &tail)) {
julong long_NonNMethodCodeHeapSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_NonNMethodCodeHeapSize, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid maximum non-nmethod code heap size: %s.\n", option->optionString);
return JNI_EINVAL;
}
- FLAG_SET_CMDLINE(uintx, NonNMethodCodeHeapSize, (uintx)long_NonNMethodCodeHeapSize);
+ FLAG_SET_CMDLINE(uintx, NonNMethodCodeHeapSize, (uintx) long_NonNMethodCodeHeapSize);
// -XX:ProfiledCodeHeapSize=
} else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
julong long_ProfiledCodeHeapSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid maximum profiled code heap size: %s.\n", option->optionString);
return JNI_EINVAL;
}
- FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize);
+ FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx) long_ProfiledCodeHeapSize);
// -XX:NonProfiledCodeHeapSizee=
} else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) {
julong long_NonProfiledCodeHeapSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
return JNI_EINVAL;
}
- FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize);
+ FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx) long_NonProfiledCodeHeapSize);
//-XX:IncreaseFirstTierCompileThresholdAt=
} else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
jio_fprintf(defaultStream::error_stream(),
"Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
option->optionString);
return JNI_EINVAL;
}
- FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
+ FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx) uint_IncreaseFirstTierCompileThresholdAt);
// -green
} else if (match_option(option, "-green")) {
jio_fprintf(defaultStream::error_stream(),
"Green threads support not available\n");
return JNI_EINVAL;
@@ -2972,11 +3143,11 @@
#endif
// -D
} else if (match_option(option, "-D", &tail)) {
const char* value;
if (match_option(option, "-Djava.endorsed.dirs=", &value) &&
- *value!= '\0' && strcmp(value, "\"\"") != 0) {
+ *value != '\0' && strcmp(value, "\"\"") != 0) {
// abort if -Djava.endorsed.dirs is set
jio_fprintf(defaultStream::output_stream(),
"-Djava.endorsed.dirs=%s is not supported. Endorsed standards and standalone APIs\n"
"in modular form will be supported via the concept of upgradeable modules.\n", value);
return JNI_EINVAL;
@@ -3099,23 +3270,23 @@
// 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) {
+ 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 = MIN2(total_memory / (julong) 2,
+ total_memory - (julong) 160 * M);
initHeapSize = limit_by_allocatable_memory(initHeapSize);
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize);
@@ -3124,27 +3295,27 @@
set_min_heap_size(initHeapSize);
}
if (FLAG_IS_DEFAULT(NewSize)) {
// Make the young generation 3/8ths of the total heap.
FLAG_SET_CMDLINE(uintx, NewSize,
- ((julong)MaxHeapSize / (julong)8) * (julong)3);
+ ((julong) MaxHeapSize / (julong) 8) * (julong) 3);
FLAG_SET_CMDLINE(uintx, MaxNewSize, NewSize);
}
#ifndef _ALLBSD_SOURCE // UseLargePages is not yet supported on BSD.
FLAG_SET_DEFAULT(UseLargePages, true);
#endif
// Increase some data structure sizes for efficiency
FLAG_SET_CMDLINE(uintx, BaseFootPrintEstimate, MaxHeapSize);
FLAG_SET_CMDLINE(bool, ResizeTLAB, false);
- FLAG_SET_CMDLINE(uintx, TLABSize, 256*K);
+ FLAG_SET_CMDLINE(uintx, TLABSize, 256 * K);
// 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.
- FLAG_SET_CMDLINE(uintx, YoungPLABSize, 256*K); // Note: this is in words
+ FLAG_SET_CMDLINE(uintx, YoungPLABSize, 256 * K); // Note: this is in words
// 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
@@ -3155,11 +3326,11 @@
// 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.
- FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K); // Note: this is in words
+ FLAG_SET_CMDLINE(uintx, OldPLABSize, 8 * K); // Note: this is in words
// Enable parallel GC and adaptive generation sizing
FLAG_SET_CMDLINE(bool, UseParallelGC, true);
FLAG_SET_DEFAULT(ParallelGCThreads,
Abstract_VM_Version::parallel_worker_threads());
@@ -3185,11 +3356,11 @@
FLAG_SET_CMDLINE(bool, NeverTenure, false);
FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
} else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) {
uintx max_tenuring_thresh = 0;
- if(!parse_uintx(tail, &max_tenuring_thresh, 0)) {
+ if (!parse_uintx(tail, &max_tenuring_thresh, 0)) {
jio_fprintf(defaultStream::error_stream(),
"Invalid MaxTenuringThreshold: %s\n", option->optionString);
}
FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, max_tenuring_thresh);
@@ -3221,50 +3392,10 @@
} else if (match_option(option, "-XX:+FullGCALot")) {
FLAG_SET_CMDLINE(bool, FullGCALot, true);
// disable scavenge before parallel mark-compact
FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
#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");
- FLAG_SET_CMDLINE(uintx, MarkStackSize, stack_size);
- } 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");
- FLAG_SET_CMDLINE(uintx, MarkStackSizeMax, max_stack_size);
- } 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");
- FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);
} else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
julong max_direct_memory_size = 0;
ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
@@ -3323,18 +3454,19 @@
//
// This causes problems with CDS, which requires that all directories specified in the classpath
// must be empty. In most cases, applications do NOT want to load classes from the current
// directory anyway. Adding -XX:+IgnoreEmptyClassPaths will make these applications' start-up
// scripts compatible with CDS.
+
void Arguments::fix_appclasspath() {
if (IgnoreEmptyClassPaths) {
const char separator = *os::path_separator();
const char* src = _java_class_path->value();
// skip over all the leading empty paths
while (*src == separator) {
- src ++;
+ src++;
}
char* copy = AllocateHeap(strlen(src) + 1, mtInternal);
strncpy(copy, src, strlen(src) + 1);
@@ -3371,11 +3503,11 @@
const char* ext = name + strlen(name) - 4;
hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
}
FREE_C_HEAP_ARRAY(char, dbuf);
os::closedir(dir);
- return hasJarFile ;
+ return hasJarFile;
}
static int check_non_empty_dirs(const char* path) {
const char separator = *os::path_separator();
const char* const end = path + strlen(path);
@@ -3475,11 +3607,11 @@
FLAG_SET_DEFAULT(UseLargePages, false);
}
#else
if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) {
- FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1);
+ FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment - 1);
}
#endif
#ifndef TIERED
// Tiered compilation is undefined.
@@ -3491,11 +3623,11 @@
// Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state.
if (os::is_headless_jre()) {
const char* headless = Arguments::get_property("java.awt.headless");
if (headless == NULL) {
char envbuffer[128];
- if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof(envbuffer))) {
+ if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof (envbuffer))) {
if (!add_property("java.awt.headless=true")) {
return JNI_ENOMEM;
}
} else {
char buffer[256];
@@ -3536,11 +3668,11 @@
char buffer[OPTION_BUFFER_SIZE];
// The variable will be ignored if it exceeds the length of the buffer.
// Don't check this variable if user has special privileges
// (e.g. unix su command).
- if (os::getenv(name, buffer, sizeof(buffer)) &&
+ if (os::getenv(name, buffer, sizeof (buffer)) &&
!os::have_special_privileges()) {
JavaVMOption options[N_MAX_OPTIONS]; // Construct option array
jio_fprintf(defaultStream::error_stream(),
"Picked up %s: %s\n", name, buffer);
char* rd = buffer; // pointer to the input string (rd)
@@ -3595,11 +3727,11 @@
logOption(tail);
}
}
}
- return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, Flag::ENVIRON_VAR));
+ return (parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, Flag::ENVIRON_VAR));
}
return JNI_OK;
}
void Arguments::set_shared_spaces_flags() {
@@ -3620,10 +3752,11 @@
#endif
}
}
#if !INCLUDE_ALL_GCS
+
static void force_serial_gc() {
FLAG_SET_DEFAULT(UseSerialGC, true);
UNSUPPORTED_GC_OPTION(UseG1GC);
UNSUPPORTED_GC_OPTION(UseParallelGC);
UNSUPPORTED_GC_OPTION(UseParallelOldGC);
@@ -3632,15 +3765,16 @@
}
#endif // INCLUDE_ALL_GCS
// Sharing support
// Construct the path to the archive
+
static char* get_shared_archive_path() {
char *shared_archive_path;
if (SharedArchiveFile == NULL) {
char jvm_path[JVM_MAXPATHLEN];
- os::jvm_path(jvm_path, sizeof(jvm_path));
+ os::jvm_path(jvm_path, sizeof (jvm_path));
char *end = strrchr(jvm_path, *os::file_separator());
if (end != NULL) *end = '\0';
size_t jvm_path_len = strlen(jvm_path);
size_t file_sep_len = strlen(os::file_separator());
shared_archive_path = NEW_C_HEAP_ARRAY(char, jvm_path_len +
@@ -3659,10 +3793,11 @@
return shared_archive_path;
}
#ifndef PRODUCT
// Determine whether LogVMOutput should be implicitly turned on.
+
static bool use_vm_log() {
if (LogCompilation || !FLAG_IS_DEFAULT(LogFile) ||
PrintCompilation || PrintInlining || PrintDependencies || PrintNativeNMethods ||
PrintDebugInfo || PrintRelocations || PrintNMethods || PrintExceptionHandlers ||
PrintAssembly || TraceDeoptimization || TraceDependencies ||
@@ -3759,11 +3894,11 @@
#endif
}
if (IgnoreUnrecognizedVMOptions) {
// uncast const to modify the flag args->ignoreUnrecognized
- *(jboolean*)(&args->ignoreUnrecognized) = true;
+ *(jboolean*) (&args->ignoreUnrecognized) = true;
}
// Parse specified settings file
if (settings_file_specified) {
if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) {
@@ -3820,13 +3955,13 @@
#ifdef _ALLBSD_SOURCE // UseLargePages is not yet supported on BSD.
UNSUPPORTED_OPTION(UseLargePages, "-XX:+UseLargePages");
#endif
#if INCLUDE_ALL_GCS
- #if (defined JAVASE_EMBEDDED || defined ARM)
+#if (defined JAVASE_EMBEDDED || defined ARM)
UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
- #endif
+#endif
#endif
#ifndef PRODUCT
if (TraceBytecodesAt != 0) {
TraceBytecodes = true;
@@ -3932,11 +4067,11 @@
) {
if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
// flag set to true on command line; warn the user that they
// can't enable biased locking here
warning("Biased Locking is not supported with locking debug flags"
- "; ignoring UseBiasedLocking flag." );
+ "; ignoring UseBiasedLocking flag.");
}
UseBiasedLocking = false;
}
#ifdef ZERO
@@ -4004,11 +4139,11 @@
jint Arguments::adjust_after_os() {
if (UseNUMA) {
if (UseParallelGC || UseParallelOldGC) {
if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
- FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
+ FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64 * M);
}
}
// UseNUMAInterleaving is set to ON for all collectors and
// platforms when UseNUMA is set to ON. NUMA-aware collectors
// such as the parallel collector for Linux and Solaris will
@@ -4024,11 +4159,11 @@
return JNI_OK;
}
int Arguments::PropertyList_count(SystemProperty* pl) {
int count = 0;
- while(pl != NULL) {
+ while (pl != NULL) {
count++;
pl = pl->next();
}
return count;
}
@@ -4044,12 +4179,12 @@
const char* Arguments::PropertyList_get_key_at(SystemProperty *pl, int index) {
int count = 0;
const char* ret_val = NULL;
- while(pl != NULL) {
- if(count >= index) {
+ while (pl != NULL) {
+ if (count >= index) {
ret_val = pl->key();
break;
}
count++;
pl = pl->next();
@@ -4060,12 +4195,12 @@
char* Arguments::PropertyList_get_value_at(SystemProperty* pl, int index) {
int count = 0;
char* ret_val = NULL;
- while(pl != NULL) {
- if(count >= index) {
+ while (pl != NULL) {
+ if (count >= index) {
ret_val = pl->value();
break;
}
count++;
pl = pl->next();
@@ -4097,10 +4232,11 @@
void Arguments::PropertyList_add(SystemProperty *element) {
PropertyList_add(&_system_properties, element);
}
// This add maintains unique property key in the list.
+
void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append) {
if (plist == NULL)
return;
// If property key exist then update with new value.
@@ -4126,10 +4262,11 @@
// 1. If the length (buflen) of the destination buffer excluding the
// NULL terminator character is not long enough for holding the expanded
// pid characters, it also returns false instead of returning the partially
// expanded one.
// 2. The passed in "buflen" should be large enough to hold the null terminator.
+
bool Arguments::copy_expand_pid(const char* src, size_t srclen,
char* buf, size_t buflen) {
const char* p = src;
char* b = buf;
const char* src_end = &src[srclen];
@@ -4139,19 +4276,20 @@
if (*p == '%') {
switch (*(++p)) {
case '%': // "%%" ==> "%"
*b++ = *p++;
break;
- case 'p': { // "%p" ==> current process id
+ case 'p':
+ { // "%p" ==> current process id
// buf_end points to the character before the last character so
// that we could write '\0' to the end of the buffer.
size_t buf_sz = buf_end - b + 1;
int ret = jio_snprintf(b, buf_sz, "%d", os::current_process_id());
// if jio_snprintf fails or the buffer is not long enough to hold
// the expanded pid, returns false.
- if (ret < 0 || ret >= (int)buf_sz) {
+ if (ret < 0 || ret >= (int) buf_sz) {
return false;
} else {
b += ret;
assert(*b == '\0', "fail in copy_expand_pid");
if (p == src_end && b == buf_end + 1) {
@@ -4160,11 +4298,11 @@
}
}
p++;
break;
}
- default :
+ default:
*b++ = '%';
}
} else {
*b++ = *p++;
}
< prev index next >