< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page
*** 53,10 ***
--- 53,11 ---
  #include "prims/jvmtiExport.hpp"
  #include "runtime/arguments.hpp"
  #include "runtime/flags/jvmFlag.hpp"
  #include "runtime/flags/jvmFlagAccess.hpp"
  #include "runtime/flags/jvmFlagLimit.hpp"
+ #include "runtime/globals.hpp"
  #include "runtime/globals_extension.hpp"
  #include "runtime/java.hpp"
  #include "runtime/os.hpp"
  #include "runtime/safepoint.hpp"
  #include "runtime/safepointMechanism.hpp"

*** 73,10 ***
--- 74,12 ---
  #include "utilities/systemMemoryBarrier.hpp"
  #if INCLUDE_JFR
  #include "jfr/jfr.hpp"
  #endif
  
+ #include <string.h>
+ 
  static const char _default_java_launcher[] = "generic";
  
  #define DEFAULT_JAVA_LAUNCHER _default_java_launcher
  
  char*  Arguments::_jvm_flags_file               = nullptr;

*** 2981,10 ***
--- 2984,12 ---
    // Parse the CompilationMode flag
    if (!CompilationModeFlag::initialize()) {
      return JNI_ERR;
    }
  
+   ClassLoader::set_preview_mode(is_valhalla_enabled());
+ 
    if (!check_vm_args_consistency()) {
      return JNI_ERR;
    }
  
  

*** 3857,10 ***
--- 3862,76 ---
    // verification is not as if both were enabled.
    if (BytecodeVerificationLocal && !BytecodeVerificationRemote) {
      log_info(verification)("Turning on remote verification because local verification is on");
      FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
    }
+   if (!is_valhalla_enabled()) {
+ #define WARN_IF_NOT_DEFAULT_FLAG(flag)                                                                       \
+     if (!FLAG_IS_DEFAULT(flag)) {                                                                            \
+       warning("Preview-specific flag \"%s\" has no effect when --enable-preview is not specified.", #flag);  \
+     }
+ 
+ #define DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(flag)  \
+     WARN_IF_NOT_DEFAULT_FLAG(flag)                  \
+     FLAG_SET_DEFAULT(flag, false);
+ 
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(InlineTypePassFieldsAsArgs);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(InlineTypeReturnedAsFields);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseArrayFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseFieldFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullFreeNonAtomicValueFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullableAtomicValueFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullFreeAtomicValueFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullableNonAtomicValueFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintInlineLayout);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintFlatArrayLayout);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(IgnoreAssertUnsetFields);
+     WARN_IF_NOT_DEFAULT_FLAG(FlatArrayElementMaxOops);
+     WARN_IF_NOT_DEFAULT_FLAG(ForceNonTearable);
+ #ifdef ASSERT
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(StressCallingConvention);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PreloadClasses);
+     WARN_IF_NOT_DEFAULT_FLAG(PrintInlineKlassFields);
+ #endif
+ #ifdef COMPILER1
+     DEBUG_ONLY(DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(C1UseDelayedFlattenedFieldReads);)
+ #endif
+ #ifdef COMPILER2
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseArrayLoadStoreProfile);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseACmpProfile);
+ #endif
+ #undef DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT
+ #undef WARN_IF_NOT_DEFAULT_FLAG
+   } else {
+ #define DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(flag, fallback)                                        \
+     if (!FLAG_IS_DEFAULT(flag) && !UseArrayFlattening && !UseFieldFlattening) {                       \
+       warning("Flattening flag \"%s\" has no effect when all flattening modes are disabled.", #flag); \
+       FLAG_SET_DEFAULT(flag, fallback);                                                               \
+     }
+ 
+     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(UseNullFreeNonAtomicValueFlattening, false);
+     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(UseNullableAtomicValueFlattening, false);
+     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(UseNullFreeAtomicValueFlattening, false);
+     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(UseNullableNonAtomicValueFlattening, false);
+     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(FlatArrayElementMaxOops, 0);
+ #undef DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING
+     if (is_interpreter_only() && !CDSConfig::is_dumping_archive() && !UseSharedSpaces) {
+       // Disable calling convention optimizations if inline types are not supported.
+       // Also these aren't useful in -Xint. However, don't disable them when dumping or using
+       // the CDS archive, as the values must match between dumptime and runtime.
+       FLAG_SET_DEFAULT(InlineTypePassFieldsAsArgs, false);
+       FLAG_SET_DEFAULT(InlineTypeReturnedAsFields, false);
+     }
+     if (!UseNullFreeNonAtomicValueFlattening &&
+         !UseNullableAtomicValueFlattening &&
+         !UseNullFreeAtomicValueFlattening &&
+         !UseNullableNonAtomicValueFlattening) {
+       // Flattening is disabled
+       FLAG_SET_DEFAULT(UseArrayFlattening, false);
+       FLAG_SET_DEFAULT(UseFieldFlattening, false);
+     }
+   }
  
  #ifndef PRODUCT
    if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
      if (use_vm_log()) {
        LogVMOutput = true;
< prev index next >