8319999: Refactor MetaspaceShared::use_full_module_graph()

Reviewed-by: dholmes, ccheung
This commit is contained in:
Ioi Lam 2023-11-15 05:09:10 +00:00
parent d9a89c59da
commit a6343c0b7b
16 changed files with 111 additions and 76 deletions

View file

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classFileParser.hpp"
#include "classfile/classLoader.hpp"
@ -486,7 +487,7 @@ static bool _seen_system_unnamed_module = false;
// Returns true iff the oop has an archived ModuleEntry.
bool Modules::check_archived_module_oop(oop orig_module_obj) {
assert(DumpSharedSpaces, "must be");
assert(MetaspaceShared::use_full_module_graph(), "must be");
assert(CDSConfig::is_dumping_full_module_graph(), "must be");
assert(java_lang_Module::is_instance(orig_module_obj), "must be");
ModuleEntry* orig_module_ent = java_lang_Module::module_entry_raw(orig_module_obj);
@ -599,12 +600,12 @@ void Modules::serialize(SerializeClosure* soc) {
MetaspaceShared::disable_optimized_module_handling();
}
log_info(cds)("optimized module handling: %s", MetaspaceShared::use_optimized_module_handling() ? "enabled" : "disabled");
log_info(cds)("full module graph: %s", MetaspaceShared::use_full_module_graph() ? "enabled" : "disabled");
log_info(cds)("full module graph: %s", CDSConfig::is_loading_full_module_graph() ? "enabled" : "disabled");
}
}
void Modules::define_archived_modules(Handle h_platform_loader, Handle h_system_loader, TRAPS) {
assert(UseSharedSpaces && MetaspaceShared::use_full_module_graph(), "must be");
assert(CDSConfig::is_loading_full_module_graph(), "must be");
// We don't want the classes used by the archived full module graph to be redefined by JVMTI.
// Luckily, such classes are loaded in the JVMTI "early" phase, and CDS is disabled if a JVMTI
@ -640,7 +641,7 @@ void Modules::define_archived_modules(Handle h_platform_loader, Handle h_system_
}
void Modules::check_cds_restrictions(TRAPS) {
if (DumpSharedSpaces && Universe::is_module_initialized() && MetaspaceShared::use_full_module_graph()) {
if (DumpSharedSpaces && Universe::is_module_initialized() && CDSConfig::is_dumping_full_module_graph()) {
THROW_MSG(vmSymbols::java_lang_UnsupportedOperationException(),
"During -Xshare:dump, module system cannot be modified after it's initialized");
}