< prev index next >

src/hotspot/share/cds/cdsConfig.cpp

Print this page
*** 34,10 ***
--- 34,11 ---
  #include "include/jvm_io.h"
  #include "logging/log.hpp"
  #include "memory/universe.hpp"
  #include "prims/jvmtiAgentList.hpp"
  #include "runtime/arguments.hpp"
+ #include "runtime/globals.hpp"
  #include "runtime/globals_extension.hpp"
  #include "runtime/java.hpp"
  #include "runtime/vmThread.hpp"
  #include "utilities/defaultStream.hpp"
  #include "utilities/formatBuffer.hpp"

*** 54,10 ***
--- 55,13 ---
  bool CDSConfig::_has_temp_aot_config_file = false;
  bool CDSConfig::_old_cds_flags_used = false;
  bool CDSConfig::_new_aot_flags_used = false;
  bool CDSConfig::_disable_heap_dumping = false;
  
+ bool CDSConfig::_module_patching_disables_cds = false;
+ bool CDSConfig::_java_base_module_patching_disables_cds = false;
+ 
  const char* CDSConfig::_default_archive_path = nullptr;
  const char* CDSConfig::_input_static_archive_path = nullptr;
  const char* CDSConfig::_input_dynamic_archive_path = nullptr;
  const char* CDSConfig::_output_archive_path = nullptr;
  

*** 137,10 ***
--- 141,13 ---
        // Note that generation of xxx_coh.jsa variants require
        // --enable-cds-archive-coh at build time
        tmp.print_raw("_coh");
      }
  #endif
+     if (is_valhalla_preview()) {
+       tmp.print_raw("_valhalla");
+     }
      tmp.print_raw(".jsa");
      _default_archive_path = os::strdup(tmp.base());
    }
    return _default_archive_path;
  }

*** 292,11 ***
      }
    }
  }
  
  void CDSConfig::check_internal_module_property(const char* key, const char* value) {
!   if (Arguments::is_incompatible_cds_internal_module_property(key)) {
      stop_using_optimized_module_handling();
      aot_log_info(aot)("optimized module handling: disabled due to incompatible property: %s=%s", key, value);
    }
  }
  
--- 299,11 ---
      }
    }
  }
  
  void CDSConfig::check_internal_module_property(const char* key, const char* value) {
!   if (Arguments::is_incompatible_cds_internal_module_property(key) && !Arguments::patching_migrated_classes(key, value)) {
      stop_using_optimized_module_handling();
      aot_log_info(aot)("optimized module handling: disabled due to incompatible property: %s=%s", key, value);
    }
  }
  

*** 325,17 ***
  
    // The following properties are checked by Arguments::is_internal_module_property() and cannot be
    // directly specified in the command-line.
    static const char* unsupported_module_properties[] = {
      "jdk.module.limitmods",
!     "jdk.module.upgrade.path",
-     "jdk.module.patch.0"
    };
    static const char* unsupported_module_options[] = {
      "--limit-modules",
!     "--upgrade-module-path",
-     "--patch-module"
    };
  
    assert(ARRAY_SIZE(unsupported_module_properties) == ARRAY_SIZE(unsupported_module_options), "must be");
    SystemProperty* sp = Arguments::system_properties();
    while (sp != nullptr) {
--- 332,15 ---
  
    // The following properties are checked by Arguments::is_internal_module_property() and cannot be
    // directly specified in the command-line.
    static const char* unsupported_module_properties[] = {
      "jdk.module.limitmods",
!     "jdk.module.upgrade.path"
    };
    static const char* unsupported_module_options[] = {
      "--limit-modules",
!     "--upgrade-module-path"
    };
  
    assert(ARRAY_SIZE(unsupported_module_properties) == ARRAY_SIZE(unsupported_module_options), "must be");
    SystemProperty* sp = Arguments::system_properties();
    while (sp != nullptr) {

*** 354,10 ***
--- 359,16 ---
    assert(is_dumping_archive(), "this function is only used with CDS dump time");
    const char* option = find_any_unsupported_module_option();
    if (option != nullptr) {
      vm_exit_during_initialization("Cannot use the following option when dumping the shared archive", option);
    }
+ 
+   if (module_patching_disables_cds()) {
+     vm_exit_during_initialization(
+             "Cannot use the following option when dumping the shared archive", "--patch-module");
+   }
+ 
    // Check for an exploded module build in use with -Xshare:dump.
    if (!Arguments::has_jimage()) {
      vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build");
    }
  }

*** 382,10 ***
--- 393,20 ---
          aot_log_info(aot)("CDS is disabled when the %s option is specified.", option);
        }
      }
      return true;
    }
+ 
+   if (module_patching_disables_cds()) {
+     if (RequireSharedSpaces) {
+       warning("CDS is disabled when the %s option is specified.", "--patch-module");
+     } else {
+       log_info(cds)("CDS is disabled when the %s option is specified.", "--patch-module");
+     }
+     return true;
+   }
+ 
    return false;
  }
  
  #define CHECK_NEW_FLAG(f) check_new_flag(FLAG_IS_DEFAULT(f), #f)
  

*** 619,11 ***
        _input_static_archive_path = AOTCache;
      }
    }
  }
  
! bool CDSConfig::check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line) {
    assert(!_cds_ergo_initialize_started, "This is called earlier than CDSConfig::ergo_initialize()");
  
    check_aot_flags();
  
    if (!FLAG_IS_DEFAULT(AOTMode)) {
--- 640,11 ---
        _input_static_archive_path = AOTCache;
      }
    }
  }
  
! bool CDSConfig::check_vm_args_consistency(bool mode_flag_cmd_line) {
    assert(!_cds_ergo_initialize_started, "This is called earlier than CDSConfig::ergo_initialize()");
  
    check_aot_flags();
  
    if (!FLAG_IS_DEFAULT(AOTMode)) {

*** 685,11 ***
        aot_log_warning(aot)("-XX:+AutoCreateSharedArchive does not work with ArchiveClassesAtExit");
        return false;
      }
    }
  
!   if (is_using_archive() && patch_mod_javabase) {
      Arguments::no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
    }
    if (is_using_archive() && has_unsupported_runtime_module_options()) {
      UseSharedSpaces = false;
    }
--- 706,11 ---
        aot_log_warning(aot)("-XX:+AutoCreateSharedArchive does not work with ArchiveClassesAtExit");
        return false;
      }
    }
  
!   if (is_using_archive() && java_base_module_patching_disables_cds() && module_patching_disables_cds()) {
      Arguments::no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
    }
    if (is_using_archive() && has_unsupported_runtime_module_options()) {
      UseSharedSpaces = false;
    }

*** 906,10 ***
--- 927,14 ---
  bool CDSConfig::are_vm_options_incompatible_with_dumping_heap() {
    return check_options_incompatible_with_dumping_heap() != nullptr;
  }
  
  bool CDSConfig::is_dumping_heap() {
+   if (is_valhalla_preview()) {
+     // Not working yet -- e.g., HeapShared::oop_hash() needs to be implemented for value oops
+     return false;
+   }
    if (!(is_dumping_classic_static_archive() || is_dumping_final_static_archive())
        || are_vm_options_incompatible_with_dumping_heap()
        || _disable_heap_dumping) {
      return false;
    }
< prev index next >