8185496: Improve performance of system properties initialization in initPhase1

8213424: VersionProps duplicate and skipped initialization

Reviewed-by: mchung, redestad, dholmes
This commit is contained in:
Roger Riggs 2018-11-09 13:28:16 -05:00
parent 1b20a6781f
commit 29e742273e
12 changed files with 311 additions and 184 deletions

View file

@ -364,6 +364,8 @@ JVM_ENTRY(jobject, JVM_InitProperties(JNIEnv *env, jobject properties))
// System property list includes both user set via -D option and
// jvm system specific properties.
for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
if (strcmp(p->key(), "sun.nio.MaxDirectMemorySize") == 0) // Can not be defined with -D
continue;
PUTPROP(props, p->key(), p->value());
}
@ -371,14 +373,11 @@ JVM_ENTRY(jobject, JVM_InitProperties(JNIEnv *env, jobject properties))
// to the sun.nio.MaxDirectMemorySize property.
// Do this after setting user properties to prevent people
// from setting the value with a -D option, as requested.
{
if (FLAG_IS_DEFAULT(MaxDirectMemorySize)) {
PUTPROP(props, "sun.nio.MaxDirectMemorySize", "-1");
} else {
char as_chars[256];
jio_snprintf(as_chars, sizeof(as_chars), JULONG_FORMAT, MaxDirectMemorySize);
PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars);
}
// Leave empty if not supplied
if (!FLAG_IS_DEFAULT(MaxDirectMemorySize)) {
char as_chars[256];
jio_snprintf(as_chars, sizeof(as_chars), JULONG_FORMAT, MaxDirectMemorySize);
PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars);
}
// JVM monitoring and management support