< 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   _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   _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);

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


















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

  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 

 296   }
 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   _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++) {

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

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

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