8145153: Convert TraceMonitorInflation to Unified Logging

Updated -XX:+TraceMonitorInflation flag to -Xlog:monitorinflation=debug, with an alias (and related alias table) to support the old option.

Reviewed-by: dholmes, mockner, coleenp
This commit is contained in:
Rachel Protacio 2015-12-11 14:58:20 -05:00
parent ddab9e4387
commit a74243c302
6 changed files with 115 additions and 15 deletions

View file

@ -399,6 +399,12 @@ static AliasedFlag const aliased_jvm_flags[] = {
{ NULL, NULL}
};
static AliasedFlag const aliased_jvm_logging_flags[] = {
{ "-XX:+TraceMonitorInflation", "-Xlog:monitorinflation=debug" },
{ "-XX:-TraceMonitorInflation", "-Xlog:monitorinflation=off" },
{ NULL, NULL }
};
// 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");
@ -929,6 +935,20 @@ const char* Arguments::handle_aliases_and_deprecation(const char* arg, bool warn
return NULL;
}
// lookup_logging_aliases
// Called from parse_each_vm_init_arg(). Should be called on -XX options before specific cases are checked.
// If arg matches any aliased_jvm_logging_flags entry, look up the real name and copy it into buffer.
bool Arguments::lookup_logging_aliases(const char* arg, char* buffer) {
for (size_t i = 0; aliased_jvm_logging_flags[i].alias_name != NULL; i++) {
const AliasedFlag& flag_status = aliased_jvm_logging_flags[i];
if (strcmp(flag_status.alias_name, arg) == 0) {
strcpy(buffer, flag_status.real_name);
return true;
}
}
return false;
}
bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
// range of acceptable characters spelled out for portability reasons
@ -2605,7 +2625,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
for (int index = 0; index < args->nOptions; index++) {
bool is_absolute_path = false; // for -agentpath vs -agentlib
const JavaVMOption* option = args->options + index;
JavaVMOption* option = args->options + index;
if (!match_option(option, "-Djava.class.path", &tail) &&
!match_option(option, "-Dsun.java.command", &tail) &&
@ -2619,6 +2639,16 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
build_jvm_args(option->optionString);
}
// char buffer to store looked up logging option.
char aliased_logging_option[256];
// Catch -XX options which are aliased to Unified logging commands.
if (match_option(option, "-XX:", &tail)) {
if (lookup_logging_aliases(option->optionString, aliased_logging_option)) {
option->optionString = aliased_logging_option;
}
}
// -verbose:[class/gc/jni]
if (match_option(option, "-verbose", &tail)) {
if (!strcmp(tail, ":class") || !strcmp(tail, "")) {