@@ -326,7 +326,7 @@ bool FileMapInfo::validate_class_location() {
326326
327327 if (header ()->has_full_module_graph () && has_extra_module_paths) {
328328 CDSConfig::stop_using_optimized_module_handling ();
329- log_info (cds) (" optimized module handling: disabled because extra module path(s) are specified" );
329+ MetaspaceShared::report_loading_error (" optimized module handling: disabled because extra module path(s) are specified" );
330330 }
331331
332332 if (CDSConfig::is_dumping_dynamic_archive ()) {
@@ -1256,7 +1256,7 @@ char* FileMapInfo::map_bitmap_region() {
12561256 char * bitmap_base = map_memory (_fd, _full_path, r->file_offset (),
12571257 requested_addr, r->used_aligned (), read_only, allow_exec, mtClassShared);
12581258 if (bitmap_base == nullptr ) {
1259- log_info (cds) (" failed to map relocation bitmap" );
1259+ MetaspaceShared::report_loading_error (" failed to map relocation bitmap" );
12601260 return nullptr ;
12611261 }
12621262
@@ -1454,9 +1454,9 @@ void FileMapInfo::map_or_load_heap_region() {
14541454 success = ArchiveHeapLoader::load_heap_region (this );
14551455 } else {
14561456 if (!UseCompressedOops && !ArchiveHeapLoader::can_map ()) {
1457- log_info (cds) (" Cannot use CDS heap data. Selected GC not compatible -XX:-UseCompressedOops" );
1457+ MetaspaceShared::report_loading_error (" Cannot use CDS heap data. Selected GC not compatible -XX:-UseCompressedOops" );
14581458 } else {
1459- log_info (cds) (" Cannot use CDS heap data. UseEpsilonGC, UseG1GC, UseSerialGC, UseParallelGC, or UseShenandoahGC are required." );
1459+ MetaspaceShared::report_loading_error (" Cannot use CDS heap data. UseEpsilonGC, UseG1GC, UseSerialGC, UseParallelGC, or UseShenandoahGC are required." );
14601460 }
14611461 }
14621462 }
@@ -1468,8 +1468,10 @@ void FileMapInfo::map_or_load_heap_region() {
14681468 // all AOT-linked classes are visible.
14691469 //
14701470 // We get here because the heap is too small. The app will fail anyway. So let's quit.
1471- MetaspaceShared::unrecoverable_loading_error (" CDS archive has aot-linked classes but the archived "
1472- " heap objects cannot be loaded. Try increasing your heap size." );
1471+ log_error (cds)(" %s has aot-linked classes but the archived "
1472+ " heap objects cannot be loaded. Try increasing your heap size." ,
1473+ CDSConfig::type_of_archive_being_loaded ());
1474+ MetaspaceShared::unrecoverable_loading_error ();
14731475 }
14741476 CDSConfig::stop_using_full_module_graph (" archive heap loading failed" );
14751477 }
@@ -1635,7 +1637,7 @@ bool FileMapInfo::map_heap_region_impl() {
16351637 // allocate from java heap
16361638 HeapWord* start = G1CollectedHeap::heap ()->alloc_archive_region (word_size, (HeapWord*)requested_start);
16371639 if (start == nullptr ) {
1638- log_info (cds) (" UseSharedSpaces: Unable to allocate java heap region for archive heap." );
1640+ MetaspaceShared::report_loading_error (" UseSharedSpaces: Unable to allocate java heap region for archive heap." );
16391641 return false ;
16401642 }
16411643
@@ -1670,7 +1672,7 @@ bool FileMapInfo::map_heap_region_impl() {
16701672
16711673 if (VerifySharedSpaces && !r->check_region_crc (base)) {
16721674 dealloc_heap_region ();
1673- log_info (cds) (" UseSharedSpaces: mapped heap region is corrupt" );
1675+ MetaspaceShared::report_loading_error (" UseSharedSpaces: mapped heap region is corrupt" );
16741676 return false ;
16751677 }
16761678 }
@@ -1694,7 +1696,7 @@ bool FileMapInfo::map_heap_region_impl() {
16941696 if (_heap_pointers_need_patching) {
16951697 char * bitmap_base = map_bitmap_region ();
16961698 if (bitmap_base == nullptr ) {
1697- log_info (cds) (" CDS heap cannot be used because bitmap region cannot be mapped" );
1699+ MetaspaceShared::report_loading_error (" CDS heap cannot be used because bitmap region cannot be mapped" );
16981700 dealloc_heap_region ();
16991701 _heap_pointers_need_patching = false ;
17001702 return false ;
@@ -1807,16 +1809,16 @@ bool FileMapInfo::open_as_input() {
18071809 // are replaced at runtime by JVMTI ClassFileLoadHook. All of those classes are resolved
18081810 // during the JVMTI "early" stage, so we can still use CDS if
18091811 // JvmtiExport::has_early_class_hook_env() is false.
1810- log_info (cds) (" CDS is disabled because early JVMTI ClassFileLoadHook is in use." );
1812+ MetaspaceShared::report_loading_error (" CDS is disabled because early JVMTI ClassFileLoadHook is in use." );
18111813 return false ;
18121814 }
18131815
18141816 if (!open_for_read () || !init_from_file (_fd) || !validate_header ()) {
18151817 if (_is_static) {
1816- log_info (cds) (" Loading static archive failed." );
1818+ MetaspaceShared::report_loading_error (" Loading static archive failed." );
18171819 return false ;
18181820 } else {
1819- log_info (cds) (" Loading dynamic archive failed." );
1821+ MetaspaceShared::report_loading_error (" Loading dynamic archive failed." );
18201822 if (AutoCreateSharedArchive) {
18211823 CDSConfig::enable_dumping_dynamic_archive (_full_path);
18221824 }
@@ -1831,29 +1833,34 @@ bool FileMapInfo::validate_aot_class_linking() {
18311833 // These checks need to be done after FileMapInfo::initialize(), which gets called before Universe::heap()
18321834 // is available.
18331835 if (header ()->has_aot_linked_classes ()) {
1836+ const char * archive_type = CDSConfig::type_of_archive_being_loaded ();
18341837 CDSConfig::set_has_aot_linked_classes (true );
18351838 if (JvmtiExport::should_post_class_file_load_hook ()) {
1836- log_error (cds)(" CDS archive has aot-linked classes. It cannot be used when JVMTI ClassFileLoadHook is in use." );
1839+ log_error (cds)(" %s has aot-linked classes. It cannot be used when JVMTI ClassFileLoadHook is in use." ,
1840+ archive_type);
18371841 return false ;
18381842 }
18391843 if (JvmtiExport::has_early_vmstart_env ()) {
1840- log_error (cds)(" CDS archive has aot-linked classes. It cannot be used when JVMTI early vm start is in use." );
1844+ log_error (cds)(" %s has aot-linked classes. It cannot be used when JVMTI early vm start is in use." ,
1845+ archive_type);
18411846 return false ;
18421847 }
18431848 if (!CDSConfig::is_using_full_module_graph ()) {
1844- log_error (cds)(" CDS archive has aot-linked classes. It cannot be used when archived full module graph is not used." );
1849+ log_error (cds)(" %s has aot-linked classes. It cannot be used when archived full module graph is not used." ,
1850+ archive_type);
18451851 return false ;
18461852 }
18471853
18481854 const char * prop = Arguments::get_property (" java.security.manager" );
18491855 if (prop != nullptr && strcmp (prop, " disallow" ) != 0 ) {
1850- log_error (cds)(" CDS archive has aot-linked classes. It cannot be used with -Djava.security.manager=%s." , prop);
1856+ log_error (cds)(" %s has aot-linked classes. It cannot be used with -Djava.security.manager=%s." ,
1857+ archive_type, prop);
18511858 return false ;
18521859 }
18531860
18541861#if INCLUDE_JVMTI
18551862 if (Arguments::has_jdwp_agent ()) {
1856- log_error (cds)(" CDS archive has aot-linked classes. It cannot be used with JDWP agent" );
1863+ log_error (cds)(" %s has aot-linked classes. It cannot be used with JDWP agent" , archive_type );
18571864 return false ;
18581865 }
18591866#endif
@@ -1913,8 +1920,8 @@ bool FileMapHeader::validate() {
19131920 const char * prop = Arguments::get_property (" java.system.class.loader" );
19141921 if (prop != nullptr ) {
19151922 if (has_aot_linked_classes ()) {
1916- log_error (cds)(" CDS archive has aot-linked classes. It cannot be used when the "
1917- " java.system.class.loader property is specified." );
1923+ log_error (cds)(" %s has aot-linked classes. It cannot be used when the "
1924+ " java.system.class.loader property is specified." , CDSConfig::type_of_archive_being_loaded () );
19181925 return false ;
19191926 }
19201927 log_warning (cds)(" Archived non-system classes are disabled because the "
0 commit comments