< 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 

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

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

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

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


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

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




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

1911   // if the archive only contains system classes.
1912   if (_has_platform_or_app_classes
1913       && !_verify_remote // we didn't verify the archived platform/app classes
1914       && BytecodeVerificationRemote) { // but we want to verify all loaded platform/app classes
1915     aot_log_info(aot)("The %s was created with less restrictive "
1916                                "verification setting than the current setting.", file_type);
1917     // Pretend that we didn't have any archived platform/app classes, so they won't be loaded
1918     // by SystemDictionaryShared.
1919     _has_platform_or_app_classes = false;
1920   }
1921 
1922   aot_log_info(aot)("The %s was created with UseCompressedOops = %d, UseCompactObjectHeaders = %d",
1923                           file_type, compressed_oops(), compact_headers());
1924   if (compressed_oops() != UseCompressedOops) {
1925     aot_log_warning(aot)("Unable to use %s.\nThe saved state of UseCompressedOops (%d) is "
1926                                "different from runtime (%d), CDS will be disabled.", file_type,
1927                                compressed_oops(), UseCompressedOops);
1928     return false;
1929   }
1930 


















1931   if (compact_headers() != UseCompactObjectHeaders) {
1932     aot_log_warning(aot)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
1933                      " does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
1934                      _compact_headers          ? "enabled" : "disabled",
1935                      UseCompactObjectHeaders   ? "enabled" : "disabled");
1936     return false;
1937   }
1938 
1939   if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
1940     CDSConfig::stop_using_optimized_module_handling();
1941     aot_log_info(aot)("optimized module handling: disabled because archive was created without optimized module handling");
1942   }
1943 
1944   if (is_static()) {
1945     // Only the static archive can contain the full module graph.
1946     if (!_has_full_module_graph) {
1947       CDSConfig::stop_using_full_module_graph("archive was created without full module graph");
1948     }
1949   }
1950 

  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 

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

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

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

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