< prev index next >

src/hotspot/share/cds/cdsConfig.cpp

Print this page

 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "cds/archiveHeapLoader.hpp"
 26 #include "cds/cdsConfig.hpp"
 27 #include "cds/classListWriter.hpp"
 28 #include "cds/filemap.hpp"
 29 #include "cds/heapShared.hpp"
 30 #include "classfile/classLoaderDataShared.hpp"
 31 #include "classfile/moduleEntry.hpp"
 32 #include "include/jvm_io.h"
 33 #include "logging/log.hpp"
 34 #include "memory/universe.hpp"
 35 #include "runtime/arguments.hpp"

 36 #include "runtime/globals_extension.hpp"
 37 #include "runtime/java.hpp"
 38 #include "runtime/vmThread.hpp"
 39 #include "utilities/defaultStream.hpp"
 40 #include "utilities/formatBuffer.hpp"
 41 
 42 bool CDSConfig::_is_dumping_static_archive = false;
 43 bool CDSConfig::_is_dumping_preimage_static_archive = false;
 44 bool CDSConfig::_is_dumping_final_static_archive = false;
 45 bool CDSConfig::_is_dumping_dynamic_archive = false;
 46 bool CDSConfig::_is_using_optimized_module_handling = true;
 47 bool CDSConfig::_is_dumping_full_module_graph = true;
 48 bool CDSConfig::_is_using_full_module_graph = true;
 49 bool CDSConfig::_has_aot_linked_classes = false;
 50 bool CDSConfig::_old_cds_flags_used = false;
 51 bool CDSConfig::_new_aot_flags_used = false;
 52 bool CDSConfig::_disable_heap_dumping = false;
 53 



 54 const char* CDSConfig::_default_archive_path = nullptr;
 55 const char* CDSConfig::_input_static_archive_path = nullptr;
 56 const char* CDSConfig::_input_dynamic_archive_path = nullptr;
 57 const char* CDSConfig::_output_archive_path = nullptr;
 58 
 59 JavaThread* CDSConfig::_dumper_thread = nullptr;
 60 
 61 int CDSConfig::get_status() {
 62   assert(Universe::is_fully_initialized(), "status is finalized only after Universe is initialized");
 63   return (is_dumping_archive()              ? IS_DUMPING_ARCHIVE : 0) |
 64          (is_dumping_method_handles()       ? IS_DUMPING_METHOD_HANDLES : 0) |
 65          (is_dumping_static_archive()       ? IS_DUMPING_STATIC_ARCHIVE : 0) |
 66          (is_logging_lambda_form_invokers() ? IS_LOGGING_LAMBDA_FORM_INVOKERS : 0) |
 67          (is_using_archive()                ? IS_USING_ARCHIVE : 0);
 68 }
 69 
 70 DEBUG_ONLY(static bool _cds_ergo_initialize_started = false);
 71 
 72 void CDSConfig::ergo_initialize() {
 73   DEBUG_ONLY(_cds_ergo_initialize_started = true);

103 
104 const char* CDSConfig::default_archive_path() {
105   // The path depends on UseCompressedOops, etc, which are set by GC ergonomics just
106   // before CDSConfig::ergo_initialize() is called.
107   assert(_cds_ergo_initialize_started, "sanity");
108   if (_default_archive_path == nullptr) {
109     stringStream tmp;
110     const char* subdir = WINDOWS_ONLY("bin") NOT_WINDOWS("lib");
111     tmp.print("%s%s%s%s%s%sclasses", Arguments::get_java_home(), os::file_separator(), subdir,
112               os::file_separator(), Abstract_VM_Version::vm_variant(), os::file_separator());
113 #ifdef _LP64
114     if (!UseCompressedOops) {
115       tmp.print_raw("_nocoops");
116     }
117     if (UseCompactObjectHeaders) {
118       // Note that generation of xxx_coh.jsa variants require
119       // --enable-cds-archive-coh at build time
120       tmp.print_raw("_coh");
121     }
122 #endif



123     tmp.print_raw(".jsa");
124     _default_archive_path = os::strdup(tmp.base());
125   }
126   return _default_archive_path;
127 }
128 
129 int CDSConfig::num_archive_paths(const char* path_spec) {
130   if (path_spec == nullptr) {
131     return 0;
132   }
133   int npaths = 1;
134   char* p = (char*)path_spec;
135   while (*p != '\0') {
136     if (*p == os::path_separator()[0]) {
137       npaths++;
138     }
139     p++;
140   }
141   return npaths;
142 }

291   for (const char* property : incompatible_properties) {
292     if (strcmp(key, property) == 0) {
293       stop_dumping_full_module_graph();
294       stop_using_full_module_graph();
295       log_info(cds)("full module graph: disabled due to incompatible property: %s=%s", key, value);
296       break;
297     }
298   }
299 
300 }
301 
302 // Returns any JVM command-line option, such as "--patch-module", that's not supported by CDS.
303 static const char* find_any_unsupported_module_option() {
304   // Note that arguments.cpp has translated the command-line options into properties. If we find an
305   // unsupported property, translate it back to its command-line option for better error reporting.
306 
307   // The following properties are checked by Arguments::is_internal_module_property() and cannot be
308   // directly specified in the command-line.
309   static const char* unsupported_module_properties[] = {
310     "jdk.module.limitmods",
311     "jdk.module.upgrade.path",
312     "jdk.module.patch.0"
313   };
314   static const char* unsupported_module_options[] = {
315     "--limit-modules",
316     "--upgrade-module-path",
317     "--patch-module"
318   };
319 
320   assert(ARRAY_SIZE(unsupported_module_properties) == ARRAY_SIZE(unsupported_module_options), "must be");
321   SystemProperty* sp = Arguments::system_properties();
322   while (sp != nullptr) {
323     for (uint i = 0; i < ARRAY_SIZE(unsupported_module_properties); i++) {
324       if (strcmp(sp->key(), unsupported_module_properties[i]) == 0) {
325         return unsupported_module_options[i];
326       }
327     }
328     sp = sp->next();
329   }
330 
331   return nullptr; // not found
332 }
333 
334 void CDSConfig::check_unsupported_dumping_module_options() {
335   assert(is_dumping_archive(), "this function is only used with CDS dump time");
336   const char* option = find_any_unsupported_module_option();
337   if (option != nullptr) {
338     vm_exit_during_initialization("Cannot use the following option when dumping the shared archive", option);
339   }






340   // Check for an exploded module build in use with -Xshare:dump.
341   if (!Arguments::has_jimage()) {
342     vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build");
343   }
344 }
345 
346 bool CDSConfig::has_unsupported_runtime_module_options() {
347   assert(is_using_archive(), "this function is only used with -Xshare:{on,auto}");
348   if (ArchiveClassesAtExit != nullptr) {
349     // dynamic dumping, just return false for now.
350     // check_unsupported_dumping_properties() will be called later to check the same set of
351     // properties, and will exit the VM with the correct error message if the unsupported properties
352     // are used.
353     return false;
354   }
355   const char* option = find_any_unsupported_module_option();
356   if (option != nullptr) {
357     if (RequireSharedSpaces) {
358       warning("CDS is disabled when the %s option is specified.", option);
359     } else {
360       if (new_aot_flags_used()) {
361         log_warning(cds)("AOT cache is disabled when the %s option is specified.", option);
362       } else {
363         log_info(cds)("CDS is disabled when the %s option is specified.", option);
364       }
365     }
366     return true;
367   }










368   return false;
369 }
370 
371 #define CHECK_NEW_FLAG(f) check_new_flag(FLAG_IS_DEFAULT(f), #f)
372 
373 void CDSConfig::check_new_flag(bool new_flag_is_default, const char* new_flag_name) {
374   if (old_cds_flags_used() && !new_flag_is_default) {
375     vm_exit_during_initialization(err_msg("Option %s cannot be used at the same time with "
376                                           "-Xshare:on, -Xshare:auto, -Xshare:off, -Xshare:dump, "
377                                           "DumpLoadedClassList, SharedClassListFile, or SharedArchiveFile",
378                                           new_flag_name));
379   }
380 }
381 
382 #define CHECK_SINGLE_PATH(f) check_flag_single_path(#f, f)
383 
384 void CDSConfig::check_flag_single_path(const char* flag_name, const char* value) {
385   if (value != nullptr && num_archive_paths(value) != 1) {
386     vm_exit_during_initialization(err_msg("Option %s must specify a single file name", flag_name));
387   }

481 void CDSConfig::ergo_init_aot_paths() {
482   assert(_cds_ergo_initialize_started, "sanity");
483   if (is_dumping_static_archive()) {
484     if (is_dumping_preimage_static_archive()) {
485       _output_archive_path = AOTConfiguration;
486     } else {
487       assert(is_dumping_final_static_archive(), "must be");
488       _input_static_archive_path = AOTConfiguration;
489       _output_archive_path = AOTCache;
490     }
491   } else if (is_using_archive()) {
492     if (FLAG_IS_DEFAULT(AOTCache)) {
493       // Only -XX:AOTMode={auto,on} is specified
494       _input_static_archive_path = default_archive_path();
495     } else {
496       _input_static_archive_path = AOTCache;
497     }
498   }
499 }
500 
501 bool CDSConfig::check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line) {
502   assert(!_cds_ergo_initialize_started, "This is called earlier than CDSConfig::ergo_initialize()");
503 
504   check_aot_flags();
505 
506   if (!FLAG_IS_DEFAULT(AOTMode)) {
507     // Using any form of the new AOTMode switch enables enhanced optimizations.
508     FLAG_SET_ERGO_IF_DEFAULT(AOTClassLinking, true);
509   }
510 
511   if (AOTClassLinking) {
512     // If AOTClassLinking is specified, enable all AOT optimizations by default.
513     FLAG_SET_ERGO_IF_DEFAULT(AOTInvokeDynamicLinking, true);
514   } else {
515     // AOTInvokeDynamicLinking depends on AOTClassLinking.
516     FLAG_SET_ERGO(AOTInvokeDynamicLinking, false);
517   }
518 
519   if (is_dumping_static_archive()) {
520     if (is_dumping_preimage_static_archive()) {
521       // Don't tweak execution mode

548     return false;
549   }
550 
551   if (ArchiveClassesAtExit == nullptr && !RecordDynamicDumpInfo) {
552     disable_dumping_dynamic_archive();
553   } else {
554     enable_dumping_dynamic_archive(ArchiveClassesAtExit);
555   }
556 
557   if (AutoCreateSharedArchive) {
558     if (SharedArchiveFile == nullptr) {
559       log_warning(cds)("-XX:+AutoCreateSharedArchive requires -XX:SharedArchiveFile");
560       return false;
561     }
562     if (ArchiveClassesAtExit != nullptr) {
563       log_warning(cds)("-XX:+AutoCreateSharedArchive does not work with ArchiveClassesAtExit");
564       return false;
565     }
566   }
567 
568   if (is_using_archive() && patch_mod_javabase) {
569     Arguments::no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
570   }
571   if (is_using_archive() && has_unsupported_runtime_module_options()) {
572     UseSharedSpaces = false;
573   }
574 
575   if (is_dumping_archive()) {
576     // Always verify non-system classes during CDS dump
577     if (!BytecodeVerificationRemote) {
578       BytecodeVerificationRemote = true;
579       log_info(cds)("All non-system classes will be verified (-Xverify:remote) during CDS dump time.");
580     }
581   }
582 
583   return true;
584 }
585 
586 void CDSConfig::prepare_for_dumping() {
587   assert(CDSConfig::is_dumping_archive(), "sanity");
588 

737     reason = "Programmatically disabled";
738   } else {
739     reason = check_options_incompatible_with_dumping_heap();
740   }
741 
742   assert(reason != nullptr, "sanity");
743   log_info(cds)("Archived java heap is not supported: %s", reason);
744 }
745 
746 // This is *Legacy* optimization for lambdas before JEP 483. May be removed in the future.
747 bool CDSConfig::is_dumping_lambdas_in_legacy_mode() {
748   return !is_dumping_method_handles();
749 }
750 
751 #if INCLUDE_CDS_JAVA_HEAP
752 bool CDSConfig::are_vm_options_incompatible_with_dumping_heap() {
753   return check_options_incompatible_with_dumping_heap() != nullptr;
754 }
755 
756 bool CDSConfig::is_dumping_heap() {




757   if (!(is_dumping_classic_static_archive() || is_dumping_final_static_archive())
758       || are_vm_options_incompatible_with_dumping_heap()
759       || _disable_heap_dumping) {
760     return false;
761   }
762   return true;
763 }
764 
765 bool CDSConfig::is_loading_heap() {
766   return ArchiveHeapLoader::is_in_use();
767 }
768 
769 bool CDSConfig::is_using_full_module_graph() {
770   if (ClassLoaderDataShared::is_full_module_graph_loaded()) {
771     return true;
772   }
773 
774   if (!_is_using_full_module_graph) {
775     return false;
776   }

 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "cds/archiveHeapLoader.hpp"
 26 #include "cds/cdsConfig.hpp"
 27 #include "cds/classListWriter.hpp"
 28 #include "cds/filemap.hpp"
 29 #include "cds/heapShared.hpp"
 30 #include "classfile/classLoaderDataShared.hpp"
 31 #include "classfile/moduleEntry.hpp"
 32 #include "include/jvm_io.h"
 33 #include "logging/log.hpp"
 34 #include "memory/universe.hpp"
 35 #include "runtime/arguments.hpp"
 36 #include "runtime/globals.hpp"
 37 #include "runtime/globals_extension.hpp"
 38 #include "runtime/java.hpp"
 39 #include "runtime/vmThread.hpp"
 40 #include "utilities/defaultStream.hpp"
 41 #include "utilities/formatBuffer.hpp"
 42 
 43 bool CDSConfig::_is_dumping_static_archive = false;
 44 bool CDSConfig::_is_dumping_preimage_static_archive = false;
 45 bool CDSConfig::_is_dumping_final_static_archive = false;
 46 bool CDSConfig::_is_dumping_dynamic_archive = false;
 47 bool CDSConfig::_is_using_optimized_module_handling = true;
 48 bool CDSConfig::_is_dumping_full_module_graph = true;
 49 bool CDSConfig::_is_using_full_module_graph = true;
 50 bool CDSConfig::_has_aot_linked_classes = false;
 51 bool CDSConfig::_old_cds_flags_used = false;
 52 bool CDSConfig::_new_aot_flags_used = false;
 53 bool CDSConfig::_disable_heap_dumping = false;
 54 
 55 bool CDSConfig::_module_patching_disables_cds = false;
 56 bool CDSConfig::_java_base_module_patching_disables_cds = false;
 57 
 58 const char* CDSConfig::_default_archive_path = nullptr;
 59 const char* CDSConfig::_input_static_archive_path = nullptr;
 60 const char* CDSConfig::_input_dynamic_archive_path = nullptr;
 61 const char* CDSConfig::_output_archive_path = nullptr;
 62 
 63 JavaThread* CDSConfig::_dumper_thread = nullptr;
 64 
 65 int CDSConfig::get_status() {
 66   assert(Universe::is_fully_initialized(), "status is finalized only after Universe is initialized");
 67   return (is_dumping_archive()              ? IS_DUMPING_ARCHIVE : 0) |
 68          (is_dumping_method_handles()       ? IS_DUMPING_METHOD_HANDLES : 0) |
 69          (is_dumping_static_archive()       ? IS_DUMPING_STATIC_ARCHIVE : 0) |
 70          (is_logging_lambda_form_invokers() ? IS_LOGGING_LAMBDA_FORM_INVOKERS : 0) |
 71          (is_using_archive()                ? IS_USING_ARCHIVE : 0);
 72 }
 73 
 74 DEBUG_ONLY(static bool _cds_ergo_initialize_started = false);
 75 
 76 void CDSConfig::ergo_initialize() {
 77   DEBUG_ONLY(_cds_ergo_initialize_started = true);

107 
108 const char* CDSConfig::default_archive_path() {
109   // The path depends on UseCompressedOops, etc, which are set by GC ergonomics just
110   // before CDSConfig::ergo_initialize() is called.
111   assert(_cds_ergo_initialize_started, "sanity");
112   if (_default_archive_path == nullptr) {
113     stringStream tmp;
114     const char* subdir = WINDOWS_ONLY("bin") NOT_WINDOWS("lib");
115     tmp.print("%s%s%s%s%s%sclasses", Arguments::get_java_home(), os::file_separator(), subdir,
116               os::file_separator(), Abstract_VM_Version::vm_variant(), os::file_separator());
117 #ifdef _LP64
118     if (!UseCompressedOops) {
119       tmp.print_raw("_nocoops");
120     }
121     if (UseCompactObjectHeaders) {
122       // Note that generation of xxx_coh.jsa variants require
123       // --enable-cds-archive-coh at build time
124       tmp.print_raw("_coh");
125     }
126 #endif
127     if (is_valhalla_preview()) {
128       tmp.print_raw("_valhalla");
129     }
130     tmp.print_raw(".jsa");
131     _default_archive_path = os::strdup(tmp.base());
132   }
133   return _default_archive_path;
134 }
135 
136 int CDSConfig::num_archive_paths(const char* path_spec) {
137   if (path_spec == nullptr) {
138     return 0;
139   }
140   int npaths = 1;
141   char* p = (char*)path_spec;
142   while (*p != '\0') {
143     if (*p == os::path_separator()[0]) {
144       npaths++;
145     }
146     p++;
147   }
148   return npaths;
149 }

298   for (const char* property : incompatible_properties) {
299     if (strcmp(key, property) == 0) {
300       stop_dumping_full_module_graph();
301       stop_using_full_module_graph();
302       log_info(cds)("full module graph: disabled due to incompatible property: %s=%s", key, value);
303       break;
304     }
305   }
306 
307 }
308 
309 // Returns any JVM command-line option, such as "--patch-module", that's not supported by CDS.
310 static const char* find_any_unsupported_module_option() {
311   // Note that arguments.cpp has translated the command-line options into properties. If we find an
312   // unsupported property, translate it back to its command-line option for better error reporting.
313 
314   // The following properties are checked by Arguments::is_internal_module_property() and cannot be
315   // directly specified in the command-line.
316   static const char* unsupported_module_properties[] = {
317     "jdk.module.limitmods",
318     "jdk.module.upgrade.path"

319   };
320   static const char* unsupported_module_options[] = {
321     "--limit-modules",
322     "--upgrade-module-path"

323   };
324 
325   assert(ARRAY_SIZE(unsupported_module_properties) == ARRAY_SIZE(unsupported_module_options), "must be");
326   SystemProperty* sp = Arguments::system_properties();
327   while (sp != nullptr) {
328     for (uint i = 0; i < ARRAY_SIZE(unsupported_module_properties); i++) {
329       if (strcmp(sp->key(), unsupported_module_properties[i]) == 0) {
330         return unsupported_module_options[i];
331       }
332     }
333     sp = sp->next();
334   }
335 
336   return nullptr; // not found
337 }
338 
339 void CDSConfig::check_unsupported_dumping_module_options() {
340   assert(is_dumping_archive(), "this function is only used with CDS dump time");
341   const char* option = find_any_unsupported_module_option();
342   if (option != nullptr) {
343     vm_exit_during_initialization("Cannot use the following option when dumping the shared archive", option);
344   }
345 
346   if (module_patching_disables_cds()) {
347     vm_exit_during_initialization(
348             "Cannot use the following option when dumping the shared archive", "--patch-module");
349   }
350 
351   // Check for an exploded module build in use with -Xshare:dump.
352   if (!Arguments::has_jimage()) {
353     vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build");
354   }
355 }
356 
357 bool CDSConfig::has_unsupported_runtime_module_options() {
358   assert(is_using_archive(), "this function is only used with -Xshare:{on,auto}");
359   if (ArchiveClassesAtExit != nullptr) {
360     // dynamic dumping, just return false for now.
361     // check_unsupported_dumping_properties() will be called later to check the same set of
362     // properties, and will exit the VM with the correct error message if the unsupported properties
363     // are used.
364     return false;
365   }
366   const char* option = find_any_unsupported_module_option();
367   if (option != nullptr) {
368     if (RequireSharedSpaces) {
369       warning("CDS is disabled when the %s option is specified.", option);
370     } else {
371       if (new_aot_flags_used()) {
372         log_warning(cds)("AOT cache is disabled when the %s option is specified.", option);
373       } else {
374         log_info(cds)("CDS is disabled when the %s option is specified.", option);
375       }
376     }
377     return true;
378   }
379 
380   if (module_patching_disables_cds()) {
381     if (RequireSharedSpaces) {
382       warning("CDS is disabled when the %s option is specified.", "--patch-module");
383     } else {
384       log_info(cds)("CDS is disabled when the %s option is specified.", "--patch-module");
385     }
386     return true;
387   }
388 
389   return false;
390 }
391 
392 #define CHECK_NEW_FLAG(f) check_new_flag(FLAG_IS_DEFAULT(f), #f)
393 
394 void CDSConfig::check_new_flag(bool new_flag_is_default, const char* new_flag_name) {
395   if (old_cds_flags_used() && !new_flag_is_default) {
396     vm_exit_during_initialization(err_msg("Option %s cannot be used at the same time with "
397                                           "-Xshare:on, -Xshare:auto, -Xshare:off, -Xshare:dump, "
398                                           "DumpLoadedClassList, SharedClassListFile, or SharedArchiveFile",
399                                           new_flag_name));
400   }
401 }
402 
403 #define CHECK_SINGLE_PATH(f) check_flag_single_path(#f, f)
404 
405 void CDSConfig::check_flag_single_path(const char* flag_name, const char* value) {
406   if (value != nullptr && num_archive_paths(value) != 1) {
407     vm_exit_during_initialization(err_msg("Option %s must specify a single file name", flag_name));
408   }

502 void CDSConfig::ergo_init_aot_paths() {
503   assert(_cds_ergo_initialize_started, "sanity");
504   if (is_dumping_static_archive()) {
505     if (is_dumping_preimage_static_archive()) {
506       _output_archive_path = AOTConfiguration;
507     } else {
508       assert(is_dumping_final_static_archive(), "must be");
509       _input_static_archive_path = AOTConfiguration;
510       _output_archive_path = AOTCache;
511     }
512   } else if (is_using_archive()) {
513     if (FLAG_IS_DEFAULT(AOTCache)) {
514       // Only -XX:AOTMode={auto,on} is specified
515       _input_static_archive_path = default_archive_path();
516     } else {
517       _input_static_archive_path = AOTCache;
518     }
519   }
520 }
521 
522 bool CDSConfig::check_vm_args_consistency(bool mode_flag_cmd_line) {
523   assert(!_cds_ergo_initialize_started, "This is called earlier than CDSConfig::ergo_initialize()");
524 
525   check_aot_flags();
526 
527   if (!FLAG_IS_DEFAULT(AOTMode)) {
528     // Using any form of the new AOTMode switch enables enhanced optimizations.
529     FLAG_SET_ERGO_IF_DEFAULT(AOTClassLinking, true);
530   }
531 
532   if (AOTClassLinking) {
533     // If AOTClassLinking is specified, enable all AOT optimizations by default.
534     FLAG_SET_ERGO_IF_DEFAULT(AOTInvokeDynamicLinking, true);
535   } else {
536     // AOTInvokeDynamicLinking depends on AOTClassLinking.
537     FLAG_SET_ERGO(AOTInvokeDynamicLinking, false);
538   }
539 
540   if (is_dumping_static_archive()) {
541     if (is_dumping_preimage_static_archive()) {
542       // Don't tweak execution mode

569     return false;
570   }
571 
572   if (ArchiveClassesAtExit == nullptr && !RecordDynamicDumpInfo) {
573     disable_dumping_dynamic_archive();
574   } else {
575     enable_dumping_dynamic_archive(ArchiveClassesAtExit);
576   }
577 
578   if (AutoCreateSharedArchive) {
579     if (SharedArchiveFile == nullptr) {
580       log_warning(cds)("-XX:+AutoCreateSharedArchive requires -XX:SharedArchiveFile");
581       return false;
582     }
583     if (ArchiveClassesAtExit != nullptr) {
584       log_warning(cds)("-XX:+AutoCreateSharedArchive does not work with ArchiveClassesAtExit");
585       return false;
586     }
587   }
588 
589   if (is_using_archive() && java_base_module_patching_disables_cds() && module_patching_disables_cds()) {
590     Arguments::no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
591   }
592   if (is_using_archive() && has_unsupported_runtime_module_options()) {
593     UseSharedSpaces = false;
594   }
595 
596   if (is_dumping_archive()) {
597     // Always verify non-system classes during CDS dump
598     if (!BytecodeVerificationRemote) {
599       BytecodeVerificationRemote = true;
600       log_info(cds)("All non-system classes will be verified (-Xverify:remote) during CDS dump time.");
601     }
602   }
603 
604   return true;
605 }
606 
607 void CDSConfig::prepare_for_dumping() {
608   assert(CDSConfig::is_dumping_archive(), "sanity");
609 

758     reason = "Programmatically disabled";
759   } else {
760     reason = check_options_incompatible_with_dumping_heap();
761   }
762 
763   assert(reason != nullptr, "sanity");
764   log_info(cds)("Archived java heap is not supported: %s", reason);
765 }
766 
767 // This is *Legacy* optimization for lambdas before JEP 483. May be removed in the future.
768 bool CDSConfig::is_dumping_lambdas_in_legacy_mode() {
769   return !is_dumping_method_handles();
770 }
771 
772 #if INCLUDE_CDS_JAVA_HEAP
773 bool CDSConfig::are_vm_options_incompatible_with_dumping_heap() {
774   return check_options_incompatible_with_dumping_heap() != nullptr;
775 }
776 
777 bool CDSConfig::is_dumping_heap() {
778   if (is_valhalla_preview()) {
779     // Not working yet -- e.g., HeapShared::oop_hash() needs to be implemented for value oops
780     return false;
781   }
782   if (!(is_dumping_classic_static_archive() || is_dumping_final_static_archive())
783       || are_vm_options_incompatible_with_dumping_heap()
784       || _disable_heap_dumping) {
785     return false;
786   }
787   return true;
788 }
789 
790 bool CDSConfig::is_loading_heap() {
791   return ArchiveHeapLoader::is_in_use();
792 }
793 
794 bool CDSConfig::is_using_full_module_graph() {
795   if (ClassLoaderDataShared::is_full_module_graph_loaded()) {
796     return true;
797   }
798 
799   if (!_is_using_full_module_graph) {
800     return false;
801   }
< prev index next >