8168796: relax vm options checking during CDS dump time

Warning instead of exit for the following vm options specified during CDS dump time: --module-path, --upgrade-module-path, --add-modules

Reviewed-by: hseigel, jiangli, sspitsyn
This commit is contained in:
Calvin Cheung 2016-11-14 10:42:13 -08:00
parent d89285aebb
commit 1c8fc7bca4

View file

@ -1315,22 +1315,31 @@ bool Arguments::add_property(const char* prop, PropertyWriteable writeable, Prop
#if INCLUDE_CDS
void Arguments::check_unsupported_dumping_properties() {
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
const char* unsupported_properties[5] = { "jdk.module.main",
const char* unsupported_properties[] = { "jdk.module.main",
"jdk.module.limitmods",
"jdk.module.path",
"jdk.module.upgrade.path",
"jdk.module.addmods.0",
"jdk.module.limitmods" };
const char* unsupported_options[5] = { "-m",
"jdk.module.addmods.0" };
const char* unsupported_options[] = { "-m",
"--limit-modules",
"--module-path",
"--upgrade-module-path",
"--add-modules",
"--limit-modules" };
"--add-modules" };
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;
SystemProperty* sp = system_properties();
while (sp != NULL) {
for (int i = 0; i < 5; i++) {
for (uint i = 0; i < ARRAY_SIZE(unsupported_properties); i++) {
if (strcmp(sp->key(), unsupported_properties[i]) == 0) {
if (i < warning_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]);
}
}
}
sp = sp->next();