< 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 

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

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

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

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


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

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




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

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


















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

  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 

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

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

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

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