src/hotspot/share/memory/filemap.cpp
changeset 52319 625f6c742392
parent 52314 e53af5fa0dae
child 52402 72d4e10305b9
equal deleted inserted replaced
52318:124af9276e44 52319:625f6c742392
   912     log_info(cds)("CDS heap data is being ignored. UseG1GC, "
   912     log_info(cds)("CDS heap data is being ignored. UseG1GC, "
   913                   "UseCompressedOops and UseCompressedClassPointers are required.");
   913                   "UseCompressedOops and UseCompressedClassPointers are required.");
   914     return;
   914     return;
   915   }
   915   }
   916 
   916 
       
   917   if (JvmtiExport::should_post_class_file_load_hook() && JvmtiExport::has_early_class_hook_env()) {
       
   918     ShouldNotReachHere(); // CDS should have been disabled.
       
   919     // The archived objects are mapped at JVM start-up, but we don't know if
       
   920     // j.l.String or j.l.Class might be replaced by the ClassFileLoadHook,
       
   921     // which would make the archived String or mirror objects invalid. Let's be safe and not
       
   922     // use the archived objects. These 2 classes are loaded during the JVMTI "early" stage.
       
   923     //
       
   924     // If JvmtiExport::has_early_class_hook_env() is false, the classes of some objects
       
   925     // in the archived subgraphs may be replaced by the ClassFileLoadHook. But that's OK
       
   926     // because we won't install an archived object subgraph if the klass of any of the
       
   927     // referenced objects are replaced. See HeapShared::initialize_from_archived_subgraph().
       
   928   }
       
   929 
   917   MemRegion heap_reserved = Universe::heap()->reserved_region();
   930   MemRegion heap_reserved = Universe::heap()->reserved_region();
   918 
   931 
   919   log_info(cds)("CDS archive was created with max heap size = " SIZE_FORMAT "M, and the following configuration:",
   932   log_info(cds)("CDS archive was created with max heap size = " SIZE_FORMAT "M, and the following configuration:",
   920                 max_heap_size()/M);
   933                 max_heap_size()/M);
   921   log_info(cds)("    narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d",
   934   log_info(cds)("    narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d",
  1222 // [2] validate_shared_path_table - this is done later, because the table is in the RW
  1235 // [2] validate_shared_path_table - this is done later, because the table is in the RW
  1223 //     region of the archive, which is not mapped yet.
  1236 //     region of the archive, which is not mapped yet.
  1224 bool FileMapInfo::initialize() {
  1237 bool FileMapInfo::initialize() {
  1225   assert(UseSharedSpaces, "UseSharedSpaces expected.");
  1238   assert(UseSharedSpaces, "UseSharedSpaces expected.");
  1226 
  1239 
       
  1240   if (JvmtiExport::should_post_class_file_load_hook() && JvmtiExport::has_early_class_hook_env()) {
       
  1241     // CDS assumes that no classes resolved in SystemDictionary::resolve_well_known_classes
       
  1242     // are replaced at runtime by JVMTI ClassFileLoadHook. All of those classes are resolved
       
  1243     // during the JVMTI "early" stage, so we can still use CDS if
       
  1244     // JvmtiExport::has_early_class_hook_env() is false.
       
  1245     FileMapInfo::fail_continue("CDS is disabled because early JVMTI ClassFileLoadHook is in use.");
       
  1246     return false;
       
  1247   }
       
  1248 
  1227   if (!open_for_read()) {
  1249   if (!open_for_read()) {
  1228     return false;
  1250     return false;
  1229   }
  1251   }
  1230 
  1252 
  1231   init_from_file(_fd);
  1253   init_from_file(_fd);