8171011: convert some CDS dump time warning and error messages to informational messages which will be printed with -XX:+PrintSharedSpaces

Print informational message if a module related options is used during dumping except for the -m option

Reviewed-by: iklam, jiangli, mseledtsov
This commit is contained in:
Calvin Cheung 2016-12-20 11:50:40 -08:00
parent 973b6f24d0
commit 026a05429c

@ -1327,26 +1327,29 @@ void Arguments::check_unsupported_dumping_properties() {
"jdk.module.addmods.0",
"jdk.module.patch.0" };
const char* unsupported_options[] = { "-m", // cannot use at dump time
"--limit-modules", // cannot use at dump time
"--limit-modules", // ignored at dump time
"--module-path", // ignored at dump time
"--upgrade-module-path", // ignored at dump time
"--add-modules", // ignored at dump time
"--patch-module" // ignored at dump time
};
assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
// If a vm option is found in the unsupported_options array with index less than the warning_idx,
// vm will exit with an error message. Otherwise, it will result in a warning message.
uint warning_idx = 2;
// If a vm option is found in the unsupported_options array with index less than the info_idx,
// vm will exit with an error message. Otherwise, it will print an informational message if
// PrintSharedSpaces is enabled.
uint info_idx = 1;
SystemProperty* sp = system_properties();
while (sp != NULL) {
for (uint i = 0; i < ARRAY_SIZE(unsupported_properties); i++) {
if (strcmp(sp->key(), unsupported_properties[i]) == 0) {
if (i < warning_idx) {
if (i < info_idx) {
vm_exit_during_initialization(
"Cannot use the following option when dumping the shared archive", unsupported_options[i]);
} else {
warning(
"the %s option is ignored when dumping the shared archive", unsupported_options[i]);
if (PrintSharedSpaces) {
tty->print_cr(
"Info: the %s option is ignored when dumping the shared archive", unsupported_options[i]);
}
}
}
}