< 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 

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

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

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

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


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

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




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

1925   // if the archive only contains system classes.
1926   if (_has_platform_or_app_classes
1927       && !_verify_remote // we didn't verify the archived platform/app classes
1928       && BytecodeVerificationRemote) { // but we want to verify all loaded platform/app classes
1929     aot_log_info(aot)("The %s was created with less restrictive "
1930                                "verification setting than the current setting.", file_type);
1931     // Pretend that we didn't have any archived platform/app classes, so they won't be loaded
1932     // by SystemDictionaryShared.
1933     _has_platform_or_app_classes = false;
1934   }
1935 
1936   aot_log_info(aot)("The %s was created with UseCompressedOops = %d, UseCompactObjectHeaders = %d",
1937                           file_type, compressed_oops(), compact_headers());
1938   if (compressed_oops() != UseCompressedOops) {
1939     aot_log_warning(aot)("Unable to use %s.\nThe saved state of UseCompressedOops (%d) is "
1940                                "different from runtime (%d), CDS will be disabled.", file_type,
1941                                compressed_oops(), UseCompressedOops);
1942     return false;
1943   }
1944 


















1945   if (compact_headers() != UseCompactObjectHeaders) {
1946     aot_log_warning(aot)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
1947                      " does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
1948                      _compact_headers          ? "enabled" : "disabled",
1949                      UseCompactObjectHeaders   ? "enabled" : "disabled");
1950     return false;
1951   }
1952 
1953   if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
1954     CDSConfig::stop_using_optimized_module_handling();
1955     aot_log_info(aot)("optimized module handling: disabled because archive was created without optimized module handling");
1956   }
1957 
1958   if (is_static()) {
1959     // Only the static archive can contain the full module graph.
1960     if (!_has_full_module_graph) {
1961       CDSConfig::stop_using_full_module_graph("archive was created without full module graph");
1962     }
1963   }
1964 

  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 #ifdef _LP64
  95 inline void CDSMustMatchFlags::do_print(outputStream* st, uint v) {
  96   st->print("%u", v);
  97 }
  98 #endif
  99 
 100 inline void CDSMustMatchFlags::do_print(outputStream* st, intx v) {
 101   st->print("%zd", v);
 102 }
 103 
 104 inline void CDSMustMatchFlags::do_print(outputStream* st, uintx v) {
 105   st->print("%zu", v);
 106 }
 107 
 108 inline void CDSMustMatchFlags::do_print(outputStream* st, double v) {
 109   st->print("%f", v);
 110 }
 111 
 112 void CDSMustMatchFlags::init() {
 113   assert(CDSConfig::is_dumping_archive(), "sanity");
 114   _max_name_width = 0;
 115 
 116 #define INIT_CDS_MUST_MATCH_FLAG(n) \
 117   _v_##n = n; \
 118   _max_name_width = MAX2(_max_name_width,strlen(#n));
 119   CDS_MUST_MATCH_FLAGS_DO(INIT_CDS_MUST_MATCH_FLAG);
 120 #undef INIT_CDS_MUST_MATCH_FLAG
 121 }
 122 
 123 bool CDSMustMatchFlags::runtime_check() const {
 124 #define CHECK_CDS_MUST_MATCH_FLAG(n) \
 125   if (_v_##n != n) { \
 126     ResourceMark rm; \
 127     stringStream ss; \
 128     ss.print("VM option %s is different between dumptime (", #n);  \
 129     do_print(&ss, _v_ ## n); \
 130     ss.print(") and runtime ("); \
 131     do_print(&ss, n); \
 132     ss.print(")"); \
 133     log_info(cds)("%s", ss.as_string()); \
 134     return false; \
 135   }
 136   CDS_MUST_MATCH_FLAGS_DO(CHECK_CDS_MUST_MATCH_FLAG);
 137 #undef CHECK_CDS_MUST_MATCH_FLAG
 138 
 139   return true;
 140 }
 141 
 142 void CDSMustMatchFlags::print_info() const {
 143   LogTarget(Info, cds) lt;
 144   if (lt.is_enabled()) {
 145     LogStream ls(lt);
 146     ls.print_cr("Recorded VM flags during dumptime:");
 147     print(&ls);
 148   }
 149 }
 150 
 151 void CDSMustMatchFlags::print(outputStream* st) const {
 152 #define PRINT_CDS_MUST_MATCH_FLAG(n) \
 153   st->print("- %-s ", #n);                   \
 154   st->sp(int(_max_name_width - strlen(#n))); \
 155   do_print(st, _v_##n);                      \
 156   st->cr();
 157   CDS_MUST_MATCH_FLAGS_DO(PRINT_CDS_MUST_MATCH_FLAG);
 158 #undef PRINT_CDS_MUST_MATCH_FLAG
 159 }
 160 
 161 // Fill in the fileMapInfo structure with data about this VM instance.
 162 
 163 // This method copies the vm version info into header_version.  If the version is too
 164 // long then a truncated version, which has a hash code appended to it, is copied.
 165 //
 166 // Using a template enables this method to verify that header_version is an array of
 167 // length JVM_IDENT_MAX.  This ensures that the code that writes to the CDS file and
 168 // the code that reads the CDS file will both use the same size buffer.  Hence, will
 169 // use identical truncation.  This is necessary for matching of truncated versions.
 170 template <int N> static void get_header_version(char (&header_version) [N]) {
 171   assert(N == JVM_IDENT_MAX, "Bad header_version size");
 172 
 173   const char *vm_version = VM_Version::internal_vm_info_string();
 174   const int version_len = (int)strlen(vm_version);
 175 
 176   memset(header_version, 0, JVM_IDENT_MAX);
 177 
 178   if (version_len < (JVM_IDENT_MAX-1)) {
 179     strcpy(header_version, vm_version);
 180 

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

2004   // if the archive only contains system classes.
2005   if (_has_platform_or_app_classes
2006       && !_verify_remote // we didn't verify the archived platform/app classes
2007       && BytecodeVerificationRemote) { // but we want to verify all loaded platform/app classes
2008     aot_log_info(aot)("The %s was created with less restrictive "
2009                                "verification setting than the current setting.", file_type);
2010     // Pretend that we didn't have any archived platform/app classes, so they won't be loaded
2011     // by SystemDictionaryShared.
2012     _has_platform_or_app_classes = false;
2013   }
2014 
2015   aot_log_info(aot)("The %s was created with UseCompressedOops = %d, UseCompactObjectHeaders = %d",
2016                           file_type, compressed_oops(), compact_headers());
2017   if (compressed_oops() != UseCompressedOops) {
2018     aot_log_warning(aot)("Unable to use %s.\nThe saved state of UseCompressedOops (%d) is "
2019                                "different from runtime (%d), CDS will be disabled.", file_type,
2020                                compressed_oops(), UseCompressedOops);
2021     return false;
2022   }
2023 
2024   if (is_static()) {
2025     const char* err = nullptr;
2026     if (Arguments::is_valhalla_enabled()) {
2027       if (!_has_valhalla_patched_classes) {
2028         err = "not created";
2029       }
2030     } else {
2031       if (_has_valhalla_patched_classes) {
2032         err = "created";
2033       }
2034     }
2035     if (err != nullptr) {
2036       log_warning(cds)("This archive was %s with --enable-preview. It is "
2037                          "incompatible with the current JVM setting", err);
2038       return false;
2039     }
2040   }
2041 
2042   if (compact_headers() != UseCompactObjectHeaders) {
2043     aot_log_warning(aot)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
2044                      " does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
2045                      _compact_headers          ? "enabled" : "disabled",
2046                      UseCompactObjectHeaders   ? "enabled" : "disabled");
2047     return false;
2048   }
2049 
2050   if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
2051     CDSConfig::stop_using_optimized_module_handling();
2052     aot_log_info(aot)("optimized module handling: disabled because archive was created without optimized module handling");
2053   }
2054 
2055   if (is_static()) {
2056     // Only the static archive can contain the full module graph.
2057     if (!_has_full_module_graph) {
2058       CDSConfig::stop_using_full_module_graph("archive was created without full module graph");
2059     }
2060   }
2061 
< prev index next >