< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page
*** 73,10 ***
--- 73,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;

*** 2989,15 ***
    // Parse the CompilationMode flag
    if (!CompilationModeFlag::initialize()) {
      return JNI_ERR;
    }
  
    if (!check_vm_args_consistency()) {
      return JNI_ERR;
    }
  
- 
  #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
    UNSUPPORTED_OPTION(ShowRegistersOnAssert);
  #endif // CAN_SHOW_REGISTERS_ON_ASSERT
  
    return JNI_OK;
--- 2991,16 ---
    // 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;
    }
  
  #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
    UNSUPPORTED_OPTION(ShowRegistersOnAssert);
  #endif // CAN_SHOW_REGISTERS_ON_ASSERT
  
    return JNI_OK;

*** 3878,10 ***
--- 3881,58 ---
    // 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("Valhalla-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(UseNonAtomicValueFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullableValueFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseAtomicValueFlattening);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintInlineLayout);
+     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintFlatArrayLayout);
+     WARN_IF_NOT_DEFAULT_FLAG(FlatArrayElementMaxOops);
+ #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 {
+     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 (!UseNonAtomicValueFlattening && !UseNullableValueFlattening && !UseAtomicValueFlattening) {
+       // 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 >