diff --git a/src/hotspot/share/cds/cdsConfig.cpp b/src/hotspot/share/cds/cdsConfig.cpp index dc38ab8cb32..3c7a521a18c 100644 --- a/src/hotspot/share/cds/cdsConfig.cpp +++ b/src/hotspot/share/cds/cdsConfig.cpp @@ -235,18 +235,29 @@ void CDSConfig::init_shared_archive_paths() { } } -void CDSConfig::check_system_property(const char* key, const char* value) { +void CDSConfig::check_internal_module_property(const char* key, const char* value) { if (Arguments::is_internal_module_property(key)) { stop_using_optimized_module_handling(); log_info(cds)("optimized module handling: disabled due to incompatible property: %s=%s", key, value); } - if (strcmp(key, "jdk.module.showModuleResolution") == 0 || - strcmp(key, "jdk.module.validation") == 0 || - strcmp(key, "java.system.class.loader") == 0) { - stop_dumping_full_module_graph(); - stop_using_full_module_graph(); - log_info(cds)("full module graph: disabled due to incompatible property: %s=%s", key, value); +} + +void CDSConfig::check_incompatible_property(const char* key, const char* value) { + static const char* incompatible_properties[] = { + "java.system.class.loader", + "jdk.module.showModuleResolution", + "jdk.module.validation" + }; + + for (const char* property : incompatible_properties) { + if (strcmp(key, property) == 0) { + stop_dumping_full_module_graph(); + stop_using_full_module_graph(); + log_info(cds)("full module graph: disabled due to incompatible property: %s=%s", key, value); + break; + } } + } static const char* unsupported_properties[] = { diff --git a/src/hotspot/share/cds/cdsConfig.hpp b/src/hotspot/share/cds/cdsConfig.hpp index ac785000061..98f2157797c 100644 --- a/src/hotspot/share/cds/cdsConfig.hpp +++ b/src/hotspot/share/cds/cdsConfig.hpp @@ -58,7 +58,8 @@ public: // Initialization and command-line checking static void initialize() NOT_CDS_RETURN; - static void check_system_property(const char* key, const char* value) NOT_CDS_RETURN; + static void check_internal_module_property(const char* key, const char* value) NOT_CDS_RETURN; + static void check_incompatible_property(const char* key, const char* value) NOT_CDS_RETURN; static void check_unsupported_dumping_properties() NOT_CDS_RETURN; static bool check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line) NOT_CDS_RETURN_(true); diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 81b73a015fb..c0a42595272 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1261,7 +1261,9 @@ bool Arguments::add_property(const char* prop, PropertyWriteable writeable, Prop value = &prop[key_len + 1]; } - CDSConfig::check_system_property(key, value); + if (internal == ExternalProperty) { + CDSConfig::check_incompatible_property(key, value); + } if (strcmp(key, "java.compiler") == 0) { // we no longer support java.compiler system property, log a warning and let it get @@ -1900,6 +1902,7 @@ bool Arguments::parse_uint(const char* value, bool Arguments::create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal) { assert(is_internal_module_property(prop_name), "unknown module property: '%s'", prop_name); + CDSConfig::check_internal_module_property(prop_name, prop_value); size_t prop_len = strlen(prop_name) + strlen(prop_value) + 2; char* property = AllocateHeap(prop_len, mtArguments); int ret = jio_snprintf(property, prop_len, "%s=%s", prop_name, prop_value); @@ -1919,6 +1922,7 @@ bool Arguments::create_module_property(const char* prop_name, const char* prop_v bool Arguments::create_numbered_module_property(const char* prop_base_name, const char* prop_value, unsigned int count) { assert(is_internal_module_property(prop_base_name), "unknown module property: '%s'", prop_base_name); + CDSConfig::check_internal_module_property(prop_base_name, prop_value); const unsigned int props_count_limit = 1000; const int max_digits = 3; const int extra_symbols_count = 3; // includes '.', '=', '\0'