< prev index next >

src/hotspot/share/cds/cdsConfig.cpp

Print this page
*** 31,10 ***
--- 31,11 ---
  #include "classfile/moduleEntry.hpp"
  #include "include/jvm_io.h"
  #include "logging/log.hpp"
  #include "memory/universe.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"

*** 49,10 ***
--- 50,18 ---
  bool CDSConfig::_has_aot_linked_classes = 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;
+ 
+ bool CDSConfig::is_valhalla_preview() {
+   return Arguments::enable_preview() && EnableValhalla;
+ }
+ 
+ 
  char* CDSConfig::_default_archive_path = nullptr;
  char* CDSConfig::_static_archive_path = nullptr;
  char* CDSConfig::_dynamic_archive_path = nullptr;
  
  JavaThread* CDSConfig::_dumper_thread = nullptr;

*** 107,10 ***
--- 116,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;
  }

*** 290,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) {
--- 302,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) {

*** 319,10 ***
--- 329,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");
    }
  }

*** 347,10 ***
--- 363,20 ---
          log_info(cds)("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_ALIAS(f) check_flag_alias(FLAG_IS_DEFAULT(f), #f)
  

*** 460,11 ***
    }
  
    CDSConfig::enable_dumping_static_archive();
  }
  
! bool CDSConfig::check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line) {
    check_aot_flags();
  
    if (!FLAG_IS_DEFAULT(AOTMode)) {
      // Using any form of the new AOTMode switch enables enhanced optimizations.
      FLAG_SET_ERGO_IF_DEFAULT(AOTClassLinking, true);
--- 486,11 ---
    }
  
    CDSConfig::enable_dumping_static_archive();
  }
  
! bool CDSConfig::check_vm_args_consistency(bool mode_flag_cmd_line) {
    check_aot_flags();
  
    if (!FLAG_IS_DEFAULT(AOTMode)) {
      // Using any form of the new AOTMode switch enables enhanced optimizations.
      FLAG_SET_ERGO_IF_DEFAULT(AOTClassLinking, true);

*** 525,11 ***
        log_warning(cds)("-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;
    }
--- 551,11 ---
        log_warning(cds)("-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;
    }

*** 652,10 ***
--- 678,14 ---
    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 >