diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 78e526b31c1..da3775d28e2 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -2570,6 +2570,7 @@ GrowableArray* FileMapInfo::_non_existent_class_paths = nullptr; // region of the archive, which is not mapped yet. bool FileMapInfo::initialize() { assert(UseSharedSpaces, "UseSharedSpaces expected."); + assert(Arguments::has_jimage(), "The shared archive file cannot be used with an exploded module build."); if (JvmtiExport::should_post_class_file_load_hook() && JvmtiExport::has_early_class_hook_env()) { // CDS assumes that no classes resolved in vmClasses::resolve_all() @@ -2580,11 +2581,6 @@ bool FileMapInfo::initialize() { return false; } - if (!Arguments::has_jimage()) { - log_info(cds)("The shared archive file cannot be used with an exploded module build."); - return false; - } - if (!open_for_read() || !init_from_file(_fd) || !validate_header()) { if (_is_static) { log_info(cds)("Initialize static archive failed."); diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 73e73ef6f46..cceee1472c6 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -2139,6 +2139,11 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs *vm_options_args, return result; } + // Disable CDS for exploded image + if (!has_jimage()) { + no_shared_spaces("CDS disabled on exploded JDK"); + } + // We need to ensure processor and memory resources have been properly // configured - which may rely on arguments we just processed - before // doing the final argument processing. Any argument processing that