83 AOTClassLocationConfig::dumptime_update_max_used_index(classpath_index);
84 result->set_shared_classpath_index(classpath_index);
85 result->set_shared_class_loader_type(classloader_type);
86 #if INCLUDE_CDS_JAVA_HEAP
87 if (CDSConfig::is_dumping_heap() && AllowArchivingWithJavaAgent && classloader_type == ClassLoader::BOOT_LOADER &&
88 classpath_index < 0 && redefined) {
89 // When dumping the heap (which happens only during static dump), classes for the built-in
90 // loaders are always loaded from known locations (jimage, classpath or modulepath),
91 // so classpath_index should always be >= 0.
92 // The only exception is when a java agent is used during dump time (for testing
93 // purposes only). If a class is transformed by the agent, the AOTClassLocation of
94 // this class may point to an unknown location. This may break heap object archiving,
95 // which requires all the boot classes to be from known locations. This is an
96 // uncommon scenario (even in test cases). Let's simply disable heap object archiving.
97 ResourceMark rm;
98 log_warning(cds)("CDS heap objects cannot be written because class %s maybe modified by ClassFileLoadHook.",
99 result->external_name());
100 CDSConfig::disable_heap_dumping();
101 }
102 #endif // INCLUDE_CDS_JAVA_HEAP
103 }
|
83 AOTClassLocationConfig::dumptime_update_max_used_index(classpath_index);
84 result->set_shared_classpath_index(classpath_index);
85 result->set_shared_class_loader_type(classloader_type);
86 #if INCLUDE_CDS_JAVA_HEAP
87 if (CDSConfig::is_dumping_heap() && AllowArchivingWithJavaAgent && classloader_type == ClassLoader::BOOT_LOADER &&
88 classpath_index < 0 && redefined) {
89 // When dumping the heap (which happens only during static dump), classes for the built-in
90 // loaders are always loaded from known locations (jimage, classpath or modulepath),
91 // so classpath_index should always be >= 0.
92 // The only exception is when a java agent is used during dump time (for testing
93 // purposes only). If a class is transformed by the agent, the AOTClassLocation of
94 // this class may point to an unknown location. This may break heap object archiving,
95 // which requires all the boot classes to be from known locations. This is an
96 // uncommon scenario (even in test cases). Let's simply disable heap object archiving.
97 ResourceMark rm;
98 log_warning(cds)("CDS heap objects cannot be written because class %s maybe modified by ClassFileLoadHook.",
99 result->external_name());
100 CDSConfig::disable_heap_dumping();
101 }
102 #endif // INCLUDE_CDS_JAVA_HEAP
103
104 if (CDSConfig::is_dumping_preimage_static_archive() || CDSConfig::is_dumping_dynamic_archive()) {
105 AOTClassLocationConfig::dumptime()->check_invalid_classpath_index(classpath_index, result);
106 }
107 }
|