< 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;

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


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

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
















































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

  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;

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

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

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