< prev index next >

src/hotspot/share/cds/filemap.cpp

Print this page

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

































































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

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

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

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

 303   st->print_cr("- serialized_data_offset:         0x%zx", _serialized_data_offset);
 304   st->print_cr("- jvm_ident:                      %s", _jvm_ident);
 305   st->print_cr("- class_location_config_offset:   0x%zx", _class_location_config_offset);
 306   st->print_cr("- verify_local:                   %d", _verify_local);
 307   st->print_cr("- verify_remote:                  %d", _verify_remote);
 308   st->print_cr("- has_platform_or_app_classes:    %d", _has_platform_or_app_classes);
 309   st->print_cr("- requested_base_address:         " INTPTR_FORMAT, p2i(_requested_base_address));
 310   st->print_cr("- mapped_base_address:            " INTPTR_FORMAT, p2i(_mapped_base_address));
 311   st->print_cr("- heap_root_segments.roots_count: %d" , _heap_root_segments.roots_count());
 312   st->print_cr("- heap_root_segments.base_offset: 0x%zx", _heap_root_segments.base_offset());
 313   st->print_cr("- heap_root_segments.count:       %zu", _heap_root_segments.count());
 314   st->print_cr("- heap_root_segments.max_size_elems: %d", _heap_root_segments.max_size_in_elems());
 315   st->print_cr("- heap_root_segments.max_size_bytes: %d", _heap_root_segments.max_size_in_bytes());
 316   st->print_cr("- _heap_oopmap_start_pos:         %zu", _heap_oopmap_start_pos);
 317   st->print_cr("- _heap_ptrmap_start_pos:         %zu", _heap_ptrmap_start_pos);
 318   st->print_cr("- _rw_ptrmap_start_pos:           %zu", _rw_ptrmap_start_pos);
 319   st->print_cr("- _ro_ptrmap_start_pos:           %zu", _ro_ptrmap_start_pos);
 320   st->print_cr("- allow_archiving_with_java_agent:%d", _allow_archiving_with_java_agent);
 321   st->print_cr("- use_optimized_module_handling:  %d", _use_optimized_module_handling);
 322   st->print_cr("- has_full_module_graph           %d", _has_full_module_graph);


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

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




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

2057   // while AllowArchivingWithJavaAgent is set during the current run.
2058   if (_allow_archiving_with_java_agent && !AllowArchivingWithJavaAgent) {
2059     aot_log_warning(aot)("The setting of the AllowArchivingWithJavaAgent is different "
2060                                "from the setting in the %s.", file_type);
2061     return false;
2062   }
2063 
2064   if (_allow_archiving_with_java_agent) {
2065     aot_log_warning(aot)("This %s was created with AllowArchivingWithJavaAgent. It should be used "
2066             "for testing purposes only and should not be used in a production environment", file_type);
2067   }
2068 
2069   aot_log_info(aot)("The %s was created with UseCompressedOops = %d, UseCompressedClassPointers = %d, UseCompactObjectHeaders = %d",
2070                           file_type, compressed_oops(), compressed_class_pointers(), compact_headers());
2071   if (compressed_oops() != UseCompressedOops || compressed_class_pointers() != UseCompressedClassPointers) {
2072     aot_log_warning(aot)("Unable to use %s.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
2073                                "different from runtime, CDS will be disabled.", file_type);
2074     return false;
2075   }
2076 


















2077   if (compact_headers() != UseCompactObjectHeaders) {
2078     aot_log_warning(aot)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
2079                      " does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
2080                      _compact_headers          ? "enabled" : "disabled",
2081                      UseCompactObjectHeaders   ? "enabled" : "disabled");
2082     return false;
2083   }
2084 
2085   if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
2086     CDSConfig::stop_using_optimized_module_handling();
2087     aot_log_info(aot)("optimized module handling: disabled because archive was created without optimized module handling");
2088   }
2089 
2090   if (is_static()) {
2091     // Only the static archive can contain the full module graph.
2092     if (!_has_full_module_graph) {
2093       CDSConfig::stop_using_full_module_graph("archive was created without full module graph");
2094     }
2095   }
2096 

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

 295     _narrow_klass_pointer_bits = CompressedKlassPointers::narrow_klass_pointer_bits();
 296     _narrow_klass_shift = ArchiveBuilder::precomputed_narrow_klass_shift();
 297 #endif
 298   } else {
 299     _narrow_klass_pointer_bits = _narrow_klass_shift = -1;
 300   }
 301   // Which JIT compier is used
 302   _compiler_type = (u1)CompilerConfig::compiler_type();
 303   _type_profile_level = TypeProfileLevel;
 304   _type_profile_args_limit = TypeProfileArgsLimit;
 305   _type_profile_parms_limit = TypeProfileParmsLimit;
 306   _type_profile_width = TypeProfileWidth;
 307   _bci_profile_width = BciProfileWidth;
 308   _profile_traps = ProfileTraps;
 309   _type_profile_casts = TypeProfileCasts;
 310   _spec_trap_limit_extra_entries = SpecTrapLimitExtraEntries;
 311   _max_heap_size = MaxHeapSize;
 312   _use_optimized_module_handling = CDSConfig::is_using_optimized_module_handling();
 313   _has_aot_linked_classes = CDSConfig::is_dumping_aot_linked_classes();
 314   _has_full_module_graph = CDSConfig::is_dumping_full_module_graph();
 315   _has_valhalla_patched_classes = CDSConfig::is_valhalla_preview();
 316 
 317   // The following fields are for sanity checks for whether this archive
 318   // will function correctly with this JVM and the bootclasspath it's
 319   // invoked with.
 320 
 321   // JVM version string ... changes on each build.
 322   get_header_version(_jvm_ident);
 323 
 324   _verify_local = BytecodeVerificationLocal;
 325   _verify_remote = BytecodeVerificationRemote;
 326   _has_platform_or_app_classes = AOTClassLocationConfig::dumptime()->has_platform_or_app_classes();
 327   _requested_base_address = (char*)SharedBaseAddress;
 328   _mapped_base_address = (char*)SharedBaseAddress;
 329   _allow_archiving_with_java_agent = AllowArchivingWithJavaAgent;
 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++) {

 370   st->print_cr("- serialized_data_offset:         0x%zx", _serialized_data_offset);
 371   st->print_cr("- jvm_ident:                      %s", _jvm_ident);
 372   st->print_cr("- class_location_config_offset:   0x%zx", _class_location_config_offset);
 373   st->print_cr("- verify_local:                   %d", _verify_local);
 374   st->print_cr("- verify_remote:                  %d", _verify_remote);
 375   st->print_cr("- has_platform_or_app_classes:    %d", _has_platform_or_app_classes);
 376   st->print_cr("- requested_base_address:         " INTPTR_FORMAT, p2i(_requested_base_address));
 377   st->print_cr("- mapped_base_address:            " INTPTR_FORMAT, p2i(_mapped_base_address));
 378   st->print_cr("- heap_root_segments.roots_count: %d" , _heap_root_segments.roots_count());
 379   st->print_cr("- heap_root_segments.base_offset: 0x%zx", _heap_root_segments.base_offset());
 380   st->print_cr("- heap_root_segments.count:       %zu", _heap_root_segments.count());
 381   st->print_cr("- heap_root_segments.max_size_elems: %d", _heap_root_segments.max_size_in_elems());
 382   st->print_cr("- heap_root_segments.max_size_bytes: %d", _heap_root_segments.max_size_in_bytes());
 383   st->print_cr("- _heap_oopmap_start_pos:         %zu", _heap_oopmap_start_pos);
 384   st->print_cr("- _heap_ptrmap_start_pos:         %zu", _heap_ptrmap_start_pos);
 385   st->print_cr("- _rw_ptrmap_start_pos:           %zu", _rw_ptrmap_start_pos);
 386   st->print_cr("- _ro_ptrmap_start_pos:           %zu", _ro_ptrmap_start_pos);
 387   st->print_cr("- allow_archiving_with_java_agent:%d", _allow_archiving_with_java_agent);
 388   st->print_cr("- use_optimized_module_handling:  %d", _use_optimized_module_handling);
 389   st->print_cr("- has_full_module_graph           %d", _has_full_module_graph);
 390   st->print_cr("- has_valhalla_patched_classes    %d", _has_valhalla_patched_classes);
 391   _must_match.print(st);
 392   st->print_cr("- has_aot_linked_classes          %d", _has_aot_linked_classes);
 393 }
 394 
 395 bool FileMapInfo::validate_class_location() {
 396   assert(CDSConfig::is_using_archive(), "runtime only");
 397 
 398   AOTClassLocationConfig* config = header()->class_location_config();
 399   bool has_extra_module_paths = false;
 400   if (!config->validate(full_path(), header()->has_aot_linked_classes(), &has_extra_module_paths)) {
 401     if (PrintSharedArchiveAndExit) {
 402       MetaspaceShared::set_archive_loading_failed();
 403       return true;
 404     } else {
 405       return false;
 406     }
 407   }
 408 
 409   if (header()->has_full_module_graph() && has_extra_module_paths) {
 410     CDSConfig::stop_using_optimized_module_handling();
 411     MetaspaceShared::report_loading_error("optimized module handling: disabled because extra module path(s) are specified");

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

2130   // while AllowArchivingWithJavaAgent is set during the current run.
2131   if (_allow_archiving_with_java_agent && !AllowArchivingWithJavaAgent) {
2132     aot_log_warning(aot)("The setting of the AllowArchivingWithJavaAgent is different "
2133                                "from the setting in the %s.", file_type);
2134     return false;
2135   }
2136 
2137   if (_allow_archiving_with_java_agent) {
2138     aot_log_warning(aot)("This %s was created with AllowArchivingWithJavaAgent. It should be used "
2139             "for testing purposes only and should not be used in a production environment", file_type);
2140   }
2141 
2142   aot_log_info(aot)("The %s was created with UseCompressedOops = %d, UseCompressedClassPointers = %d, UseCompactObjectHeaders = %d",
2143                           file_type, compressed_oops(), compressed_class_pointers(), compact_headers());
2144   if (compressed_oops() != UseCompressedOops || compressed_class_pointers() != UseCompressedClassPointers) {
2145     aot_log_warning(aot)("Unable to use %s.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
2146                                "different from runtime, CDS will be disabled.", file_type);
2147     return false;
2148   }
2149 
2150   if (is_static()) {
2151     const char* err = nullptr;
2152     if (CDSConfig::is_valhalla_preview()) {
2153       if (!_has_valhalla_patched_classes) {
2154         err = "not created";
2155       }
2156     } else {
2157       if (_has_valhalla_patched_classes) {
2158         err = "created";
2159       }
2160     }
2161     if (err != nullptr) {
2162       log_warning(cds)("This archive was %s with --enable-preview -XX:+EnableValhalla. It is "
2163                          "incompatible with the current JVM setting", err);
2164       return false;
2165     }
2166   }
2167 
2168   if (compact_headers() != UseCompactObjectHeaders) {
2169     aot_log_warning(aot)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
2170                      " does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
2171                      _compact_headers          ? "enabled" : "disabled",
2172                      UseCompactObjectHeaders   ? "enabled" : "disabled");
2173     return false;
2174   }
2175 
2176   if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
2177     CDSConfig::stop_using_optimized_module_handling();
2178     aot_log_info(aot)("optimized module handling: disabled because archive was created without optimized module handling");
2179   }
2180 
2181   if (is_static()) {
2182     // Only the static archive can contain the full module graph.
2183     if (!_has_full_module_graph) {
2184       CDSConfig::stop_using_full_module_graph("archive was created without full module graph");
2185     }
2186   }
2187 
< prev index next >