< prev index next >
src/hotspot/share/memory/metaspaceShared.cpp
Print this page
@@ -1074,23 +1074,27 @@
{
_mc_region.pack(&_rw_region);
builder.dump_rw_region();
#if INCLUDE_CDS_JAVA_HEAP
+ if (MetaspaceShared::use_full_module_graph()) {
// Archive the ModuleEntry's and PackageEntry's of the 3 built-in loaders
char* start = _rw_region.top();
ClassLoaderDataShared::allocate_archived_tables();
ArchiveBuilder::alloc_stats()->record_modules(_rw_region.top() - start, /*read_only*/false);
+ }
#endif
}
{
_rw_region.pack(&_ro_region);
builder.dump_ro_region();
#if INCLUDE_CDS_JAVA_HEAP
+ if (MetaspaceShared::use_full_module_graph()) {
char* start = _ro_region.top();
ClassLoaderDataShared::init_archived_tables();
ArchiveBuilder::alloc_stats()->record_modules(_ro_region.top() - start, /*read_only*/true);
+ }
#endif
}
builder.relocate_pointers();
dump_symbols();
@@ -2058,12 +2062,18 @@
return intx(MetaspaceShared::requested_base_address()) // We want the base archive to be mapped to here at runtime
- intx(SharedBaseAddress); // .. but the base archive is mapped at here at dump time
}
bool MetaspaceShared::use_full_module_graph() {
- return _use_optimized_module_handling && _use_full_module_graph &&
+ bool result = _use_optimized_module_handling && _use_full_module_graph &&
(UseSharedSpaces || DumpSharedSpaces) && HeapShared::is_heap_object_archiving_allowed();
+ if (result && UseSharedSpaces) {
+ // Classes used by the archived full module graph are loaded in JVMTI early phase.
+ assert(!(JvmtiExport::should_post_class_file_load_hook() && JvmtiExport::has_early_class_hook_env()),
+ "CDS should be disabled if early class hooks are enabled");
+ }
+ return result;
}
void MetaspaceShared::print_on(outputStream* st) {
if (UseSharedSpaces || DumpSharedSpaces) {
st->print("CDS archive(s) mapped at: ");
< prev index next >