8301715: CDS should be disabled in exploded JDK

Reviewed-by: ccheung, coleenp
This commit is contained in:
Matias Saavedra Silva 2023-03-20 15:21:10 +00:00 committed by Coleen Phillimore
parent 80e979720a
commit eb73fa833c
2 changed files with 6 additions and 5 deletions

View File

@ -2570,6 +2570,7 @@ GrowableArray<const char*>* 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.");

View File

@ -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