< prev index next >

src/hotspot/share/memory/filemap.cpp

Print this page

*** 912,921 **** --- 912,935 ---- log_info(cds)("CDS heap data is being ignored. UseG1GC, " "UseCompressedOops and UseCompressedClassPointers are required."); return; } + if (JvmtiExport::should_post_class_file_load_hook() && JvmtiExport::early_class_hook_env()) { + ShouldNotReachHere(); // CDS should have been disabled. + // The archived objects are mapped at JVM start-up, but we don't know if + // j.l.String or j.l.Class might be replaced by the ClassFileLoadHook, + // which would make the archived String or mirror objects invalid. Let's be safe and not + // use the archived objects. These 2 classes are loaded during the JVMTI "early" stage + // (aka JVMTI_PHASE_PRIMORDIAL). + // + // If JvmtiExport::early_class_hook_env() is false, the classes of some objects + // in the archived subgraphs may be replaced by the ClassFileLoadHook. But that's OK + // because we won't install an archived object subgraph if the klass of any of the + // referenced objects are replaced. See HeapShared::initialize_from_archived_subgraph(). + } + MemRegion heap_reserved = Universe::heap()->reserved_region(); log_info(cds)("CDS archive was created with max heap size = " SIZE_FORMAT "M, and the following configuration:", max_heap_size()/M); log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d",
*** 1222,1231 **** --- 1236,1254 ---- // [2] validate_shared_path_table - this is done later, because the table is in the RW // region of the archive, which is not mapped yet. bool FileMapInfo::initialize() { assert(UseSharedSpaces, "UseSharedSpaces expected."); + if (JvmtiExport::should_post_class_file_load_hook() && JvmtiExport::early_class_hook_env()) { + // CDS assumes that no classes resolved in SystemDictionary::resolve_well_known_classes + // are replaced at runtime by JVMTI ClassFileLoadHook. All of those classes are resolved + // during the JVMTI "early" stage (JVMTI_PHASE_PRIMORDIAL), so we're OK if + // JvmtiExport::early_class_hook_env() is not requested by native agent(s). + FileMapInfo::fail_continue("CDS is disabled because early JVMTI ClassFileLoadHook is in use."); + return false; + } + if (!open_for_read()) { return false; } init_from_file(_fd);
< prev index next >