@@ -326,7 +326,7 @@ bool FileMapInfo::validate_class_location() {
326
326
327
327
if (header ()->has_full_module_graph () && has_extra_module_paths) {
328
328
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" );
330
330
}
331
331
332
332
if (CDSConfig::is_dumping_dynamic_archive ()) {
@@ -1256,7 +1256,7 @@ char* FileMapInfo::map_bitmap_region() {
1256
1256
char * bitmap_base = map_memory (_fd, _full_path, r->file_offset (),
1257
1257
requested_addr, r->used_aligned (), read_only, allow_exec, mtClassShared);
1258
1258
if (bitmap_base == nullptr ) {
1259
- log_info (cds) (" failed to map relocation bitmap" );
1259
+ MetaspaceShared::report_loading_error (" failed to map relocation bitmap" );
1260
1260
return nullptr ;
1261
1261
}
1262
1262
@@ -1454,9 +1454,9 @@ void FileMapInfo::map_or_load_heap_region() {
1454
1454
success = ArchiveHeapLoader::load_heap_region (this );
1455
1455
} else {
1456
1456
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" );
1458
1458
} 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." );
1460
1460
}
1461
1461
}
1462
1462
}
@@ -1468,8 +1468,10 @@ void FileMapInfo::map_or_load_heap_region() {
1468
1468
// all AOT-linked classes are visible.
1469
1469
//
1470
1470
// 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 ();
1473
1475
}
1474
1476
CDSConfig::stop_using_full_module_graph (" archive heap loading failed" );
1475
1477
}
@@ -1635,7 +1637,7 @@ bool FileMapInfo::map_heap_region_impl() {
1635
1637
// allocate from java heap
1636
1638
HeapWord* start = G1CollectedHeap::heap ()->alloc_archive_region (word_size, (HeapWord*)requested_start);
1637
1639
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." );
1639
1641
return false ;
1640
1642
}
1641
1643
@@ -1670,7 +1672,7 @@ bool FileMapInfo::map_heap_region_impl() {
1670
1672
1671
1673
if (VerifySharedSpaces && !r->check_region_crc (base)) {
1672
1674
dealloc_heap_region ();
1673
- log_info (cds) (" UseSharedSpaces: mapped heap region is corrupt" );
1675
+ MetaspaceShared::report_loading_error (" UseSharedSpaces: mapped heap region is corrupt" );
1674
1676
return false ;
1675
1677
}
1676
1678
}
@@ -1694,7 +1696,7 @@ bool FileMapInfo::map_heap_region_impl() {
1694
1696
if (_heap_pointers_need_patching) {
1695
1697
char * bitmap_base = map_bitmap_region ();
1696
1698
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" );
1698
1700
dealloc_heap_region ();
1699
1701
_heap_pointers_need_patching = false ;
1700
1702
return false ;
@@ -1807,16 +1809,16 @@ bool FileMapInfo::open_as_input() {
1807
1809
// are replaced at runtime by JVMTI ClassFileLoadHook. All of those classes are resolved
1808
1810
// during the JVMTI "early" stage, so we can still use CDS if
1809
1811
// 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." );
1811
1813
return false ;
1812
1814
}
1813
1815
1814
1816
if (!open_for_read () || !init_from_file (_fd) || !validate_header ()) {
1815
1817
if (_is_static) {
1816
- log_info (cds) (" Loading static archive failed." );
1818
+ MetaspaceShared::report_loading_error (" Loading static archive failed." );
1817
1819
return false ;
1818
1820
} else {
1819
- log_info (cds) (" Loading dynamic archive failed." );
1821
+ MetaspaceShared::report_loading_error (" Loading dynamic archive failed." );
1820
1822
if (AutoCreateSharedArchive) {
1821
1823
CDSConfig::enable_dumping_dynamic_archive (_full_path);
1822
1824
}
@@ -1831,29 +1833,34 @@ bool FileMapInfo::validate_aot_class_linking() {
1831
1833
// These checks need to be done after FileMapInfo::initialize(), which gets called before Universe::heap()
1832
1834
// is available.
1833
1835
if (header ()->has_aot_linked_classes ()) {
1836
+ const char * archive_type = CDSConfig::type_of_archive_being_loaded ();
1834
1837
CDSConfig::set_has_aot_linked_classes (true );
1835
1838
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);
1837
1841
return false ;
1838
1842
}
1839
1843
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);
1841
1846
return false ;
1842
1847
}
1843
1848
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);
1845
1851
return false ;
1846
1852
}
1847
1853
1848
1854
const char * prop = Arguments::get_property (" java.security.manager" );
1849
1855
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);
1851
1858
return false ;
1852
1859
}
1853
1860
1854
1861
#if INCLUDE_JVMTI
1855
1862
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 );
1857
1864
return false ;
1858
1865
}
1859
1866
#endif
@@ -1913,8 +1920,8 @@ bool FileMapHeader::validate() {
1913
1920
const char * prop = Arguments::get_property (" java.system.class.loader" );
1914
1921
if (prop != nullptr ) {
1915
1922
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 () );
1918
1925
return false ;
1919
1926
}
1920
1927
log_warning (cds)(" Archived non-system classes are disabled because the "
0 commit comments