< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page

  58 #include "runtime/globals_extension.hpp"
  59 #include "runtime/java.hpp"
  60 #include "runtime/os.hpp"
  61 #include "runtime/safepoint.hpp"
  62 #include "runtime/safepointMechanism.hpp"
  63 #include "runtime/synchronizer.hpp"
  64 #include "runtime/vm_version.hpp"
  65 #include "services/management.hpp"
  66 #include "utilities/align.hpp"
  67 #include "utilities/debug.hpp"
  68 #include "utilities/defaultStream.hpp"
  69 #include "utilities/macros.hpp"
  70 #include "utilities/parseInteger.hpp"
  71 #include "utilities/powerOfTwo.hpp"
  72 #include "utilities/stringUtils.hpp"
  73 #include "utilities/systemMemoryBarrier.hpp"
  74 #if INCLUDE_JFR
  75 #include "jfr/jfr.hpp"
  76 #endif
  77 


  78 static const char _default_java_launcher[] = "generic";
  79 
  80 #define DEFAULT_JAVA_LAUNCHER _default_java_launcher
  81 
  82 char*  Arguments::_jvm_flags_file               = nullptr;
  83 char** Arguments::_jvm_flags_array              = nullptr;
  84 int    Arguments::_num_jvm_flags                = 0;
  85 char** Arguments::_jvm_args_array               = nullptr;
  86 int    Arguments::_num_jvm_args                 = 0;
  87 unsigned int Arguments::_addmods_count          = 0;
  88 #if INCLUDE_JVMCI
  89 bool   Arguments::_jvmci_module_added           = false;
  90 #endif
  91 char*  Arguments::_java_command                 = nullptr;
  92 SystemProperty* Arguments::_system_properties   = nullptr;
  93 size_t Arguments::_conservative_max_heap_alignment = 0;
  94 Arguments::Mode Arguments::_mode                = _mixed;
  95 const char*  Arguments::_java_vendor_url_bug    = nullptr;
  96 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
  97 bool   Arguments::_executing_unit_tests         = false;

2968   }
2969 
2970 #if !COMPILER2_OR_JVMCI
2971   // Don't degrade server performance for footprint
2972   if (FLAG_IS_DEFAULT(UseLargePages) &&
2973       MaxHeapSize < LargePageHeapSizeThreshold) {
2974     // No need for large granularity pages w/small heaps.
2975     // Note that large pages are enabled/disabled for both the
2976     // Java heap and the code cache.
2977     FLAG_SET_DEFAULT(UseLargePages, false);
2978   }
2979 
2980   UNSUPPORTED_OPTION(ProfileInterpreter);
2981 #endif
2982 
2983   // Parse the CompilationMode flag
2984   if (!CompilationModeFlag::initialize()) {
2985     return JNI_ERR;
2986   }
2987 


2988   if (!check_vm_args_consistency()) {
2989     return JNI_ERR;
2990   }
2991 
2992 
2993 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2994   UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2995 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2996 
2997   return JNI_OK;
2998 }
2999 
3000 // Helper class for controlling the lifetime of JavaVMInitArgs
3001 // objects.  The contents of the JavaVMInitArgs are guaranteed to be
3002 // deleted on the destruction of the ScopedVMInitArgs object.
3003 class ScopedVMInitArgs : public StackObj {
3004  private:
3005   JavaVMInitArgs _args;
3006   char*          _container_name;
3007   bool           _is_set;
3008   char*          _vm_options_file_arg;
3009 
3010  public:
3011   ScopedVMInitArgs(const char *container_name) {
3012     _args.version = JNI_VERSION_1_2;

3857 #ifdef ZERO
3858   // Clear flags not supported on zero.
3859   FLAG_SET_DEFAULT(ProfileInterpreter, false);
3860 #endif // ZERO
3861 
3862   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3863     warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3864     DebugNonSafepoints = true;
3865   }
3866 
3867   if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) {
3868     warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used");
3869   }
3870 
3871   // Treat the odd case where local verification is enabled but remote
3872   // verification is not as if both were enabled.
3873   if (BytecodeVerificationLocal && !BytecodeVerificationRemote) {
3874     log_info(verification)("Turning on remote verification because local verification is on");
3875     FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
3876   }
















































3877 
3878 #ifndef PRODUCT
3879   if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
3880     if (use_vm_log()) {
3881       LogVMOutput = true;
3882     }
3883   }
3884 #endif // PRODUCT
3885 
3886   if (PrintCommandLineFlags) {
3887     JVMFlag::printSetFlags(tty);
3888   }
3889 
3890 #if COMPILER2_OR_JVMCI
3891   if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
3892     if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
3893       warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3894     }
3895     FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3896 

  58 #include "runtime/globals_extension.hpp"
  59 #include "runtime/java.hpp"
  60 #include "runtime/os.hpp"
  61 #include "runtime/safepoint.hpp"
  62 #include "runtime/safepointMechanism.hpp"
  63 #include "runtime/synchronizer.hpp"
  64 #include "runtime/vm_version.hpp"
  65 #include "services/management.hpp"
  66 #include "utilities/align.hpp"
  67 #include "utilities/debug.hpp"
  68 #include "utilities/defaultStream.hpp"
  69 #include "utilities/macros.hpp"
  70 #include "utilities/parseInteger.hpp"
  71 #include "utilities/powerOfTwo.hpp"
  72 #include "utilities/stringUtils.hpp"
  73 #include "utilities/systemMemoryBarrier.hpp"
  74 #if INCLUDE_JFR
  75 #include "jfr/jfr.hpp"
  76 #endif
  77 
  78 #include <string.h>
  79 
  80 static const char _default_java_launcher[] = "generic";
  81 
  82 #define DEFAULT_JAVA_LAUNCHER _default_java_launcher
  83 
  84 char*  Arguments::_jvm_flags_file               = nullptr;
  85 char** Arguments::_jvm_flags_array              = nullptr;
  86 int    Arguments::_num_jvm_flags                = 0;
  87 char** Arguments::_jvm_args_array               = nullptr;
  88 int    Arguments::_num_jvm_args                 = 0;
  89 unsigned int Arguments::_addmods_count          = 0;
  90 #if INCLUDE_JVMCI
  91 bool   Arguments::_jvmci_module_added           = false;
  92 #endif
  93 char*  Arguments::_java_command                 = nullptr;
  94 SystemProperty* Arguments::_system_properties   = nullptr;
  95 size_t Arguments::_conservative_max_heap_alignment = 0;
  96 Arguments::Mode Arguments::_mode                = _mixed;
  97 const char*  Arguments::_java_vendor_url_bug    = nullptr;
  98 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
  99 bool   Arguments::_executing_unit_tests         = false;

2970   }
2971 
2972 #if !COMPILER2_OR_JVMCI
2973   // Don't degrade server performance for footprint
2974   if (FLAG_IS_DEFAULT(UseLargePages) &&
2975       MaxHeapSize < LargePageHeapSizeThreshold) {
2976     // No need for large granularity pages w/small heaps.
2977     // Note that large pages are enabled/disabled for both the
2978     // Java heap and the code cache.
2979     FLAG_SET_DEFAULT(UseLargePages, false);
2980   }
2981 
2982   UNSUPPORTED_OPTION(ProfileInterpreter);
2983 #endif
2984 
2985   // Parse the CompilationMode flag
2986   if (!CompilationModeFlag::initialize()) {
2987     return JNI_ERR;
2988   }
2989 
2990   ClassLoader::set_preview_mode(is_valhalla_enabled());
2991 
2992   if (!check_vm_args_consistency()) {
2993     return JNI_ERR;
2994   }
2995 

2996 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2997   UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2998 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2999 
3000   return JNI_OK;
3001 }
3002 
3003 // Helper class for controlling the lifetime of JavaVMInitArgs
3004 // objects.  The contents of the JavaVMInitArgs are guaranteed to be
3005 // deleted on the destruction of the ScopedVMInitArgs object.
3006 class ScopedVMInitArgs : public StackObj {
3007  private:
3008   JavaVMInitArgs _args;
3009   char*          _container_name;
3010   bool           _is_set;
3011   char*          _vm_options_file_arg;
3012 
3013  public:
3014   ScopedVMInitArgs(const char *container_name) {
3015     _args.version = JNI_VERSION_1_2;

3860 #ifdef ZERO
3861   // Clear flags not supported on zero.
3862   FLAG_SET_DEFAULT(ProfileInterpreter, false);
3863 #endif // ZERO
3864 
3865   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3866     warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3867     DebugNonSafepoints = true;
3868   }
3869 
3870   if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) {
3871     warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used");
3872   }
3873 
3874   // Treat the odd case where local verification is enabled but remote
3875   // verification is not as if both were enabled.
3876   if (BytecodeVerificationLocal && !BytecodeVerificationRemote) {
3877     log_info(verification)("Turning on remote verification because local verification is on");
3878     FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
3879   }
3880   if (!is_valhalla_enabled()) {
3881 #define WARN_IF_NOT_DEFAULT_FLAG(flag)                                                                       \
3882     if (!FLAG_IS_DEFAULT(flag)) {                                                                            \
3883       warning("Valhalla-specific flag \"%s\" has no effect when --enable-preview is not specified.", #flag); \
3884     }
3885 
3886 #define DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(flag)  \
3887     WARN_IF_NOT_DEFAULT_FLAG(flag)                  \
3888     FLAG_SET_DEFAULT(flag, false);
3889 
3890     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(InlineTypePassFieldsAsArgs);
3891     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(InlineTypeReturnedAsFields);
3892     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseArrayFlattening);
3893     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseFieldFlattening);
3894     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNonAtomicValueFlattening);
3895     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullableValueFlattening);
3896     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseAtomicValueFlattening);
3897     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintInlineLayout);
3898     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintFlatArrayLayout);
3899     WARN_IF_NOT_DEFAULT_FLAG(FlatArrayElementMaxOops);
3900 #ifdef ASSERT
3901     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(StressCallingConvention);
3902     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PreloadClasses);
3903     WARN_IF_NOT_DEFAULT_FLAG(PrintInlineKlassFields);
3904 #endif
3905 #ifdef COMPILER1
3906     DEBUG_ONLY(DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(C1UseDelayedFlattenedFieldReads);)
3907 #endif
3908 #ifdef COMPILER2
3909     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseArrayLoadStoreProfile);
3910     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseACmpProfile);
3911 #endif
3912 #undef DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT
3913 #undef WARN_IF_NOT_DEFAULT_FLAG
3914   } else {
3915     if (is_interpreter_only() && !CDSConfig::is_dumping_archive() && !UseSharedSpaces) {
3916       // Disable calling convention optimizations if inline types are not supported.
3917       // Also these aren't useful in -Xint. However, don't disable them when dumping or using
3918       // the CDS archive, as the values must match between dumptime and runtime.
3919       FLAG_SET_DEFAULT(InlineTypePassFieldsAsArgs, false);
3920       FLAG_SET_DEFAULT(InlineTypeReturnedAsFields, false);
3921     }
3922     if (!UseNonAtomicValueFlattening && !UseNullableValueFlattening && !UseAtomicValueFlattening) {
3923       // Flattening is disabled
3924       FLAG_SET_DEFAULT(UseArrayFlattening, false);
3925       FLAG_SET_DEFAULT(UseFieldFlattening, false);
3926     }
3927   }
3928 
3929 #ifndef PRODUCT
3930   if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
3931     if (use_vm_log()) {
3932       LogVMOutput = true;
3933     }
3934   }
3935 #endif // PRODUCT
3936 
3937   if (PrintCommandLineFlags) {
3938     JVMFlag::printSetFlags(tty);
3939   }
3940 
3941 #if COMPILER2_OR_JVMCI
3942   if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
3943     if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
3944       warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3945     }
3946     FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3947 
< prev index next >