< prev index next >

src/hotspot/share/cds/filemap.cpp

Print this page

  70 #include "runtime/mutexLocker.hpp"
  71 #include "runtime/os.hpp"
  72 #include "runtime/vm_version.hpp"
  73 #include "utilities/align.hpp"
  74 #include "utilities/bitMap.inline.hpp"
  75 #include "utilities/classpathStream.hpp"
  76 #include "utilities/defaultStream.hpp"
  77 #include "utilities/ostream.hpp"
  78 #if INCLUDE_G1GC
  79 #include "gc/g1/g1CollectedHeap.hpp"
  80 #include "gc/g1/g1HeapRegion.hpp"
  81 #endif
  82 
  83 #include <errno.h>
  84 #include <sys/stat.h>
  85 
  86 #ifndef O_BINARY       // if defined (Win32) use binary files.
  87 #define O_BINARY 0     // otherwise do nothing.
  88 #endif
  89 

































































  90 // Fill in the fileMapInfo structure with data about this VM instance.
  91 
  92 // This method copies the vm version info into header_version.  If the version is too
  93 // long then a truncated version, which has a hash code appended to it, is copied.
  94 //
  95 // Using a template enables this method to verify that header_version is an array of
  96 // length JVM_IDENT_MAX.  This ensures that the code that writes to the CDS file and
  97 // the code that reads the CDS file will both use the same size buffer.  Hence, will
  98 // use identical truncation.  This is necessary for matching of truncated versions.
  99 template <int N> static void get_header_version(char (&header_version) [N]) {
 100   assert(N == JVM_IDENT_MAX, "Bad header_version size");
 101 
 102   const char *vm_version = VM_Version::internal_vm_info_string();
 103   const int version_len = (int)strlen(vm_version);
 104 
 105   memset(header_version, 0, JVM_IDENT_MAX);
 106 
 107   if (version_len < (JVM_IDENT_MAX-1)) {
 108     strcpy(header_version, vm_version);
 109 

 231     _narrow_klass_pointer_bits = CompressedKlassPointers::narrow_klass_pointer_bits();
 232     _narrow_klass_shift = ArchiveBuilder::precomputed_narrow_klass_shift();
 233 #endif
 234   } else {
 235     _narrow_klass_pointer_bits = _narrow_klass_shift = -1;
 236   }
 237   // Which JIT compier is used
 238   _compiler_type = (u1)CompilerConfig::compiler_type();
 239   _type_profile_level = TypeProfileLevel;
 240   _type_profile_args_limit = TypeProfileArgsLimit;
 241   _type_profile_parms_limit = TypeProfileParmsLimit;
 242   _type_profile_width = TypeProfileWidth;
 243   _bci_profile_width = BciProfileWidth;
 244   _profile_traps = ProfileTraps;
 245   _type_profile_casts = TypeProfileCasts;
 246   _spec_trap_limit_extra_entries = SpecTrapLimitExtraEntries;
 247   _max_heap_size = MaxHeapSize;
 248   _use_optimized_module_handling = CDSConfig::is_using_optimized_module_handling();
 249   _has_aot_linked_classes = CDSConfig::is_dumping_aot_linked_classes();
 250   _has_full_module_graph = CDSConfig::is_dumping_full_module_graph();

 251 
 252   // The following fields are for sanity checks for whether this archive
 253   // will function correctly with this JVM and the bootclasspath it's
 254   // invoked with.
 255 
 256   // JVM version string ... changes on each build.
 257   get_header_version(_jvm_ident);
 258 
 259   _verify_local = BytecodeVerificationLocal;
 260   _verify_remote = BytecodeVerificationRemote;
 261   _has_platform_or_app_classes = AOTClassLocationConfig::dumptime()->has_platform_or_app_classes();
 262   _requested_base_address = (char*)SharedBaseAddress;
 263   _mapped_base_address = (char*)SharedBaseAddress;

 264 }
 265 
 266 void FileMapHeader::copy_base_archive_name(const char* archive) {
 267   assert(base_archive_name_size() != 0, "_base_archive_name_size not set");
 268   assert(base_archive_name_offset() != 0, "_base_archive_name_offset not set");
 269   assert(header_size() > sizeof(*this), "_base_archive_name_size not included in header size?");
 270   memcpy((char*)this + base_archive_name_offset(), archive, base_archive_name_size());
 271 }
 272 
 273 void FileMapHeader::print(outputStream* st) {
 274   ResourceMark rm;
 275 
 276   st->print_cr("- magic:                          0x%08x", magic());
 277   st->print_cr("- crc:                            0x%08x", crc());
 278   st->print_cr("- version:                        0x%x", version());
 279   st->print_cr("- header_size:                    " UINT32_FORMAT, header_size());
 280   st->print_cr("- base_archive_name_offset:       " UINT32_FORMAT, base_archive_name_offset());
 281   st->print_cr("- base_archive_name_size:         " UINT32_FORMAT, base_archive_name_size());
 282 
 283   for (int i = 0; i < NUM_CDS_REGIONS; i++) {

 313   st->print_cr("- mapped_heap_header");
 314   st->print_cr("  - root_segments");
 315   st->print_cr("    - roots_count:                          %d", _mapped_heap_header.root_segments().roots_count());
 316   st->print_cr("    - base_offset:                          0x%zx", _mapped_heap_header.root_segments().base_offset());
 317   st->print_cr("    - count:                                %zu", _mapped_heap_header.root_segments().count());
 318   st->print_cr("    - max_size_elems:                       %d", _mapped_heap_header.root_segments().max_size_in_elems());
 319   st->print_cr("    - max_size_bytes:                       %zu", _mapped_heap_header.root_segments().max_size_in_bytes());
 320   st->print_cr("  - oopmap_start_pos:                       %zu", _mapped_heap_header.oopmap_start_pos());
 321   st->print_cr("  - oopmap_ptrmap_pos:                      %zu", _mapped_heap_header.ptrmap_start_pos());
 322   st->print_cr("- streamed_heap_header");
 323   st->print_cr("  - forwarding_offset:                      %zu", _streamed_heap_header.forwarding_offset());
 324   st->print_cr("  - roots_offset:                           %zu", _streamed_heap_header.roots_offset());
 325   st->print_cr("  - num_roots:                              %zu", _streamed_heap_header.num_roots());
 326   st->print_cr("  - root_highest_object_index_table_offset: %zu", _streamed_heap_header.root_highest_object_index_table_offset());
 327   st->print_cr("  - num_archived_objects:                   %zu", _streamed_heap_header.num_archived_objects());
 328 
 329   st->print_cr("- _rw_ptrmap_start_pos:                     %zu", _rw_ptrmap_start_pos);
 330   st->print_cr("- _ro_ptrmap_start_pos:                     %zu", _ro_ptrmap_start_pos);
 331   st->print_cr("- use_optimized_module_handling:            %d", _use_optimized_module_handling);
 332   st->print_cr("- has_full_module_graph                     %d", _has_full_module_graph);


 333   st->print_cr("- has_aot_linked_classes                    %d", _has_aot_linked_classes);
 334 }
 335 
 336 bool FileMapInfo::validate_class_location() {
 337   assert(CDSConfig::is_using_archive(), "runtime only");
 338 
 339   AOTClassLocationConfig* config = header()->class_location_config();
 340   bool has_extra_module_paths = false;
 341   if (!config->validate(full_path(), header()->has_aot_linked_classes(), &has_extra_module_paths)) {
 342     if (PrintSharedArchiveAndExit) {
 343       AOTMetaspace::set_archive_loading_failed();
 344       return true;
 345     } else {
 346       return false;
 347     }
 348   }
 349 
 350   if (header()->has_full_module_graph() && has_extra_module_paths) {
 351     CDSConfig::stop_using_optimized_module_handling();
 352     AOTMetaspace::report_loading_error("optimized module handling: disabled because extra module path(s) are specified");

 696   if (strncmp(actual_ident, expected_ident, JVM_IDENT_MAX-1) != 0) {
 697     aot_log_info(aot)("_jvm_ident expected: %s", expected_ident);
 698     aot_log_info(aot)("             actual: %s", actual_ident);
 699     aot_log_warning(aot)("The %s was created by a different"
 700                   " version or build of HotSpot", file_type);
 701     return false;
 702   }
 703 
 704   _file_offset = header()->header_size(); // accounts for the size of _base_archive_name
 705 
 706   size_t len = os::lseek(fd, 0, SEEK_END);
 707 
 708   for (int i = 0; i < AOTMetaspace::n_regions; i++) {
 709     FileMapRegion* r = region_at(i);
 710     if (r->file_offset() > len || len - r->file_offset() < r->used()) {
 711       aot_log_warning(aot)("The %s has been truncated.", file_type);
 712       return false;
 713     }
 714   }
 715 




 716   return true;
 717 }
 718 
 719 void FileMapInfo::seek_to_position(size_t pos) {
 720   if (os::lseek(_fd, (long)pos, SEEK_SET) < 0) {
 721     aot_log_error(aot)("Unable to seek to position %zu", pos);
 722     AOTMetaspace::unrecoverable_loading_error();
 723   }
 724 }
 725 
 726 // Read the FileMapInfo information from the file.
 727 bool FileMapInfo::open_for_read() {
 728   if (_file_open) {
 729     return true;
 730   }
 731   const char* file_type = CDSConfig::type_of_archive_being_loaded();
 732   const char* info = CDSConfig::is_dumping_final_static_archive() ?
 733     "AOTConfiguration file " : "";
 734   aot_log_info(aot)("trying to map %s%s", info, _full_path);
 735   int fd = os::open(_full_path, O_RDONLY | O_BINARY, 0);

1901   // For backwards compatibility, we don't check the BytecodeVerificationRemote setting
1902   // if the archive only contains system classes.
1903   if (_has_platform_or_app_classes
1904       && !_verify_remote // we didn't verify the archived platform/app classes
1905       && BytecodeVerificationRemote) { // but we want to verify all loaded platform/app classes
1906     aot_log_info(aot)("The %s was created with less restrictive "
1907                                "verification setting than the current setting.", file_type);
1908     // Pretend that we didn't have any archived platform/app classes, so they won't be loaded
1909     // by SystemDictionaryShared.
1910     _has_platform_or_app_classes = false;
1911   }
1912 
1913   aot_log_info(aot)("The %s was created with UseCompressedOops = %d, UseCompressedClassPointers = %d, UseCompactObjectHeaders = %d",
1914                           file_type, compressed_oops(), compressed_class_pointers(), compact_headers());
1915   if (compressed_oops() != UseCompressedOops || compressed_class_pointers() != UseCompressedClassPointers) {
1916     aot_log_warning(aot)("Unable to use %s.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
1917                                "different from runtime, CDS will be disabled.", file_type);
1918     return false;
1919   }
1920 


















1921   if (compact_headers() != UseCompactObjectHeaders) {
1922     aot_log_warning(aot)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
1923                      " does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
1924                      _compact_headers          ? "enabled" : "disabled",
1925                      UseCompactObjectHeaders   ? "enabled" : "disabled");
1926     return false;
1927   }
1928 
1929   if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
1930     CDSConfig::stop_using_optimized_module_handling();
1931     aot_log_info(aot)("optimized module handling: disabled because archive was created without optimized module handling");
1932   }
1933 
1934   if (is_static()) {
1935     // Only the static archive can contain the full module graph.
1936     if (!_has_full_module_graph) {
1937       CDSConfig::stop_using_full_module_graph("archive was created without full module graph");
1938     }
1939   }
1940 

  70 #include "runtime/mutexLocker.hpp"
  71 #include "runtime/os.hpp"
  72 #include "runtime/vm_version.hpp"
  73 #include "utilities/align.hpp"
  74 #include "utilities/bitMap.inline.hpp"
  75 #include "utilities/classpathStream.hpp"
  76 #include "utilities/defaultStream.hpp"
  77 #include "utilities/ostream.hpp"
  78 #if INCLUDE_G1GC
  79 #include "gc/g1/g1CollectedHeap.hpp"
  80 #include "gc/g1/g1HeapRegion.hpp"
  81 #endif
  82 
  83 #include <errno.h>
  84 #include <sys/stat.h>
  85 
  86 #ifndef O_BINARY       // if defined (Win32) use binary files.
  87 #define O_BINARY 0     // otherwise do nothing.
  88 #endif
  89 
  90 inline void CDSMustMatchFlags::do_print(outputStream* st, bool v) {
  91   st->print("%s", v ? "true" : "false");
  92 }
  93 
  94 inline void CDSMustMatchFlags::do_print(outputStream* st, intx v) {
  95   st->print("%zd", v);
  96 }
  97 
  98 inline void CDSMustMatchFlags::do_print(outputStream* st, uintx v) {
  99   st->print("%zu", v);
 100 }
 101 
 102 inline void CDSMustMatchFlags::do_print(outputStream* st, double v) {
 103   st->print("%f", v);
 104 }
 105 
 106 void CDSMustMatchFlags::init() {
 107   assert(CDSConfig::is_dumping_archive(), "sanity");
 108   _max_name_width = 0;
 109 
 110 #define INIT_CDS_MUST_MATCH_FLAG(n) \
 111   _v_##n = n; \
 112   _max_name_width = MAX2(_max_name_width,strlen(#n));
 113   CDS_MUST_MATCH_FLAGS_DO(INIT_CDS_MUST_MATCH_FLAG);
 114 #undef INIT_CDS_MUST_MATCH_FLAG
 115 }
 116 
 117 bool CDSMustMatchFlags::runtime_check() const {
 118 #define CHECK_CDS_MUST_MATCH_FLAG(n) \
 119   if (_v_##n != n) { \
 120     ResourceMark rm; \
 121     stringStream ss; \
 122     ss.print("VM option %s is different between dumptime (", #n);  \
 123     do_print(&ss, _v_ ## n); \
 124     ss.print(") and runtime ("); \
 125     do_print(&ss, n); \
 126     ss.print(")"); \
 127     log_info(cds)("%s", ss.as_string()); \
 128     return false; \
 129   }
 130   CDS_MUST_MATCH_FLAGS_DO(CHECK_CDS_MUST_MATCH_FLAG);
 131 #undef CHECK_CDS_MUST_MATCH_FLAG
 132 
 133   return true;
 134 }
 135 
 136 void CDSMustMatchFlags::print_info() const {
 137   LogTarget(Info, cds) lt;
 138   if (lt.is_enabled()) {
 139     LogStream ls(lt);
 140     ls.print_cr("Recorded VM flags during dumptime:");
 141     print(&ls);
 142   }
 143 }
 144 
 145 void CDSMustMatchFlags::print(outputStream* st) const {
 146 #define PRINT_CDS_MUST_MATCH_FLAG(n) \
 147   st->print("- %-s ", #n);                   \
 148   st->sp(int(_max_name_width - strlen(#n))); \
 149   do_print(st, _v_##n);                      \
 150   st->cr();
 151   CDS_MUST_MATCH_FLAGS_DO(PRINT_CDS_MUST_MATCH_FLAG);
 152 #undef PRINT_CDS_MUST_MATCH_FLAG
 153 }
 154 
 155 // Fill in the fileMapInfo structure with data about this VM instance.
 156 
 157 // This method copies the vm version info into header_version.  If the version is too
 158 // long then a truncated version, which has a hash code appended to it, is copied.
 159 //
 160 // Using a template enables this method to verify that header_version is an array of
 161 // length JVM_IDENT_MAX.  This ensures that the code that writes to the CDS file and
 162 // the code that reads the CDS file will both use the same size buffer.  Hence, will
 163 // use identical truncation.  This is necessary for matching of truncated versions.
 164 template <int N> static void get_header_version(char (&header_version) [N]) {
 165   assert(N == JVM_IDENT_MAX, "Bad header_version size");
 166 
 167   const char *vm_version = VM_Version::internal_vm_info_string();
 168   const int version_len = (int)strlen(vm_version);
 169 
 170   memset(header_version, 0, JVM_IDENT_MAX);
 171 
 172   if (version_len < (JVM_IDENT_MAX-1)) {
 173     strcpy(header_version, vm_version);
 174 

 296     _narrow_klass_pointer_bits = CompressedKlassPointers::narrow_klass_pointer_bits();
 297     _narrow_klass_shift = ArchiveBuilder::precomputed_narrow_klass_shift();
 298 #endif
 299   } else {
 300     _narrow_klass_pointer_bits = _narrow_klass_shift = -1;
 301   }
 302   // Which JIT compier is used
 303   _compiler_type = (u1)CompilerConfig::compiler_type();
 304   _type_profile_level = TypeProfileLevel;
 305   _type_profile_args_limit = TypeProfileArgsLimit;
 306   _type_profile_parms_limit = TypeProfileParmsLimit;
 307   _type_profile_width = TypeProfileWidth;
 308   _bci_profile_width = BciProfileWidth;
 309   _profile_traps = ProfileTraps;
 310   _type_profile_casts = TypeProfileCasts;
 311   _spec_trap_limit_extra_entries = SpecTrapLimitExtraEntries;
 312   _max_heap_size = MaxHeapSize;
 313   _use_optimized_module_handling = CDSConfig::is_using_optimized_module_handling();
 314   _has_aot_linked_classes = CDSConfig::is_dumping_aot_linked_classes();
 315   _has_full_module_graph = CDSConfig::is_dumping_full_module_graph();
 316   _has_valhalla_patched_classes = Arguments::is_valhalla_enabled();
 317 
 318   // The following fields are for sanity checks for whether this archive
 319   // will function correctly with this JVM and the bootclasspath it's
 320   // invoked with.
 321 
 322   // JVM version string ... changes on each build.
 323   get_header_version(_jvm_ident);
 324 
 325   _verify_local = BytecodeVerificationLocal;
 326   _verify_remote = BytecodeVerificationRemote;
 327   _has_platform_or_app_classes = AOTClassLocationConfig::dumptime()->has_platform_or_app_classes();
 328   _requested_base_address = (char*)SharedBaseAddress;
 329   _mapped_base_address = (char*)SharedBaseAddress;
 330   _must_match.init();
 331 }
 332 
 333 void FileMapHeader::copy_base_archive_name(const char* archive) {
 334   assert(base_archive_name_size() != 0, "_base_archive_name_size not set");
 335   assert(base_archive_name_offset() != 0, "_base_archive_name_offset not set");
 336   assert(header_size() > sizeof(*this), "_base_archive_name_size not included in header size?");
 337   memcpy((char*)this + base_archive_name_offset(), archive, base_archive_name_size());
 338 }
 339 
 340 void FileMapHeader::print(outputStream* st) {
 341   ResourceMark rm;
 342 
 343   st->print_cr("- magic:                          0x%08x", magic());
 344   st->print_cr("- crc:                            0x%08x", crc());
 345   st->print_cr("- version:                        0x%x", version());
 346   st->print_cr("- header_size:                    " UINT32_FORMAT, header_size());
 347   st->print_cr("- base_archive_name_offset:       " UINT32_FORMAT, base_archive_name_offset());
 348   st->print_cr("- base_archive_name_size:         " UINT32_FORMAT, base_archive_name_size());
 349 
 350   for (int i = 0; i < NUM_CDS_REGIONS; i++) {

 380   st->print_cr("- mapped_heap_header");
 381   st->print_cr("  - root_segments");
 382   st->print_cr("    - roots_count:                          %d", _mapped_heap_header.root_segments().roots_count());
 383   st->print_cr("    - base_offset:                          0x%zx", _mapped_heap_header.root_segments().base_offset());
 384   st->print_cr("    - count:                                %zu", _mapped_heap_header.root_segments().count());
 385   st->print_cr("    - max_size_elems:                       %d", _mapped_heap_header.root_segments().max_size_in_elems());
 386   st->print_cr("    - max_size_bytes:                       %zu", _mapped_heap_header.root_segments().max_size_in_bytes());
 387   st->print_cr("  - oopmap_start_pos:                       %zu", _mapped_heap_header.oopmap_start_pos());
 388   st->print_cr("  - oopmap_ptrmap_pos:                      %zu", _mapped_heap_header.ptrmap_start_pos());
 389   st->print_cr("- streamed_heap_header");
 390   st->print_cr("  - forwarding_offset:                      %zu", _streamed_heap_header.forwarding_offset());
 391   st->print_cr("  - roots_offset:                           %zu", _streamed_heap_header.roots_offset());
 392   st->print_cr("  - num_roots:                              %zu", _streamed_heap_header.num_roots());
 393   st->print_cr("  - root_highest_object_index_table_offset: %zu", _streamed_heap_header.root_highest_object_index_table_offset());
 394   st->print_cr("  - num_archived_objects:                   %zu", _streamed_heap_header.num_archived_objects());
 395 
 396   st->print_cr("- _rw_ptrmap_start_pos:                     %zu", _rw_ptrmap_start_pos);
 397   st->print_cr("- _ro_ptrmap_start_pos:                     %zu", _ro_ptrmap_start_pos);
 398   st->print_cr("- use_optimized_module_handling:            %d", _use_optimized_module_handling);
 399   st->print_cr("- has_full_module_graph                     %d", _has_full_module_graph);
 400   st->print_cr("- has_valhalla_patched_classes              %d", _has_valhalla_patched_classes);
 401   _must_match.print(st);
 402   st->print_cr("- has_aot_linked_classes                    %d", _has_aot_linked_classes);
 403 }
 404 
 405 bool FileMapInfo::validate_class_location() {
 406   assert(CDSConfig::is_using_archive(), "runtime only");
 407 
 408   AOTClassLocationConfig* config = header()->class_location_config();
 409   bool has_extra_module_paths = false;
 410   if (!config->validate(full_path(), header()->has_aot_linked_classes(), &has_extra_module_paths)) {
 411     if (PrintSharedArchiveAndExit) {
 412       AOTMetaspace::set_archive_loading_failed();
 413       return true;
 414     } else {
 415       return false;
 416     }
 417   }
 418 
 419   if (header()->has_full_module_graph() && has_extra_module_paths) {
 420     CDSConfig::stop_using_optimized_module_handling();
 421     AOTMetaspace::report_loading_error("optimized module handling: disabled because extra module path(s) are specified");

 765   if (strncmp(actual_ident, expected_ident, JVM_IDENT_MAX-1) != 0) {
 766     aot_log_info(aot)("_jvm_ident expected: %s", expected_ident);
 767     aot_log_info(aot)("             actual: %s", actual_ident);
 768     aot_log_warning(aot)("The %s was created by a different"
 769                   " version or build of HotSpot", file_type);
 770     return false;
 771   }
 772 
 773   _file_offset = header()->header_size(); // accounts for the size of _base_archive_name
 774 
 775   size_t len = os::lseek(fd, 0, SEEK_END);
 776 
 777   for (int i = 0; i < AOTMetaspace::n_regions; i++) {
 778     FileMapRegion* r = region_at(i);
 779     if (r->file_offset() > len || len - r->file_offset() < r->used()) {
 780       aot_log_warning(aot)("The %s has been truncated.", file_type);
 781       return false;
 782     }
 783   }
 784 
 785   if (!header()->check_must_match_flags()) {
 786     return false;
 787   }
 788 
 789   return true;
 790 }
 791 
 792 void FileMapInfo::seek_to_position(size_t pos) {
 793   if (os::lseek(_fd, (long)pos, SEEK_SET) < 0) {
 794     aot_log_error(aot)("Unable to seek to position %zu", pos);
 795     AOTMetaspace::unrecoverable_loading_error();
 796   }
 797 }
 798 
 799 // Read the FileMapInfo information from the file.
 800 bool FileMapInfo::open_for_read() {
 801   if (_file_open) {
 802     return true;
 803   }
 804   const char* file_type = CDSConfig::type_of_archive_being_loaded();
 805   const char* info = CDSConfig::is_dumping_final_static_archive() ?
 806     "AOTConfiguration file " : "";
 807   aot_log_info(aot)("trying to map %s%s", info, _full_path);
 808   int fd = os::open(_full_path, O_RDONLY | O_BINARY, 0);

1974   // For backwards compatibility, we don't check the BytecodeVerificationRemote setting
1975   // if the archive only contains system classes.
1976   if (_has_platform_or_app_classes
1977       && !_verify_remote // we didn't verify the archived platform/app classes
1978       && BytecodeVerificationRemote) { // but we want to verify all loaded platform/app classes
1979     aot_log_info(aot)("The %s was created with less restrictive "
1980                                "verification setting than the current setting.", file_type);
1981     // Pretend that we didn't have any archived platform/app classes, so they won't be loaded
1982     // by SystemDictionaryShared.
1983     _has_platform_or_app_classes = false;
1984   }
1985 
1986   aot_log_info(aot)("The %s was created with UseCompressedOops = %d, UseCompressedClassPointers = %d, UseCompactObjectHeaders = %d",
1987                           file_type, compressed_oops(), compressed_class_pointers(), compact_headers());
1988   if (compressed_oops() != UseCompressedOops || compressed_class_pointers() != UseCompressedClassPointers) {
1989     aot_log_warning(aot)("Unable to use %s.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
1990                                "different from runtime, CDS will be disabled.", file_type);
1991     return false;
1992   }
1993 
1994   if (is_static()) {
1995     const char* err = nullptr;
1996     if (Arguments::is_valhalla_enabled()) {
1997       if (!_has_valhalla_patched_classes) {
1998         err = "not created";
1999       }
2000     } else {
2001       if (_has_valhalla_patched_classes) {
2002         err = "created";
2003       }
2004     }
2005     if (err != nullptr) {
2006       log_warning(cds)("This archive was %s with --enable-preview. It is "
2007                          "incompatible with the current JVM setting", err);
2008       return false;
2009     }
2010   }
2011 
2012   if (compact_headers() != UseCompactObjectHeaders) {
2013     aot_log_warning(aot)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
2014                      " does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
2015                      _compact_headers          ? "enabled" : "disabled",
2016                      UseCompactObjectHeaders   ? "enabled" : "disabled");
2017     return false;
2018   }
2019 
2020   if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
2021     CDSConfig::stop_using_optimized_module_handling();
2022     aot_log_info(aot)("optimized module handling: disabled because archive was created without optimized module handling");
2023   }
2024 
2025   if (is_static()) {
2026     // Only the static archive can contain the full module graph.
2027     if (!_has_full_module_graph) {
2028       CDSConfig::stop_using_full_module_graph("archive was created without full module graph");
2029     }
2030   }
2031 
< prev index next >