< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page

  38 #include "gc/shared/genArguments.hpp"
  39 #include "gc/shared/stringdedup/stringDedup.hpp"
  40 #include "gc/shared/tlab_globals.hpp"
  41 #include "jvm.h"
  42 #include "logging/log.hpp"
  43 #include "logging/logConfiguration.hpp"
  44 #include "logging/logStream.hpp"
  45 #include "logging/logTag.hpp"
  46 #include "memory/allocation.inline.hpp"
  47 #include "nmt/nmtCommon.hpp"
  48 #include "oops/compressedKlass.hpp"
  49 #include "oops/instanceKlass.hpp"
  50 #include "oops/objLayout.hpp"
  51 #include "oops/oop.inline.hpp"
  52 #include "prims/jvmtiAgentList.hpp"
  53 #include "prims/jvmtiExport.hpp"
  54 #include "runtime/arguments.hpp"
  55 #include "runtime/flags/jvmFlag.hpp"
  56 #include "runtime/flags/jvmFlagAccess.hpp"
  57 #include "runtime/flags/jvmFlagLimit.hpp"

  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;

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


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

3842     FLAG_SET_DEFAULT(StressSecondarySupers, false);
3843     FLAG_SET_DEFAULT(VerifySecondarySupers, false);
3844   }
3845 
3846 #ifdef ZERO
3847   // Clear flags not supported on zero.
3848   FLAG_SET_DEFAULT(ProfileInterpreter, false);
3849 #endif // ZERO
3850 
3851   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3852     warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3853     DebugNonSafepoints = true;
3854   }
3855 
3856   // Treat the odd case where local verification is enabled but remote
3857   // verification is not as if both were enabled.
3858   if (BytecodeVerificationLocal && !BytecodeVerificationRemote) {
3859     log_info(verification)("Turning on remote verification because local verification is on");
3860     FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
3861   }


































































3862 
3863 #ifndef PRODUCT
3864   if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
3865     if (use_vm_log()) {
3866       LogVMOutput = true;
3867     }
3868   }
3869 #endif // PRODUCT
3870 
3871   if (PrintCommandLineFlags) {
3872     JVMFlag::printSetFlags(tty);
3873   }
3874 
3875 #if COMPILER2_OR_JVMCI
3876   if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
3877     if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
3878       warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3879     }
3880     FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3881 

  38 #include "gc/shared/genArguments.hpp"
  39 #include "gc/shared/stringdedup/stringDedup.hpp"
  40 #include "gc/shared/tlab_globals.hpp"
  41 #include "jvm.h"
  42 #include "logging/log.hpp"
  43 #include "logging/logConfiguration.hpp"
  44 #include "logging/logStream.hpp"
  45 #include "logging/logTag.hpp"
  46 #include "memory/allocation.inline.hpp"
  47 #include "nmt/nmtCommon.hpp"
  48 #include "oops/compressedKlass.hpp"
  49 #include "oops/instanceKlass.hpp"
  50 #include "oops/objLayout.hpp"
  51 #include "oops/oop.inline.hpp"
  52 #include "prims/jvmtiAgentList.hpp"
  53 #include "prims/jvmtiExport.hpp"
  54 #include "runtime/arguments.hpp"
  55 #include "runtime/flags/jvmFlag.hpp"
  56 #include "runtime/flags/jvmFlagAccess.hpp"
  57 #include "runtime/flags/jvmFlagLimit.hpp"
  58 #include "runtime/globals.hpp"
  59 #include "runtime/globals_extension.hpp"
  60 #include "runtime/java.hpp"
  61 #include "runtime/os.hpp"
  62 #include "runtime/safepoint.hpp"
  63 #include "runtime/safepointMechanism.hpp"
  64 #include "runtime/synchronizer.hpp"
  65 #include "runtime/vm_version.hpp"
  66 #include "services/management.hpp"
  67 #include "utilities/align.hpp"
  68 #include "utilities/debug.hpp"
  69 #include "utilities/defaultStream.hpp"
  70 #include "utilities/macros.hpp"
  71 #include "utilities/parseInteger.hpp"
  72 #include "utilities/powerOfTwo.hpp"
  73 #include "utilities/stringUtils.hpp"
  74 #include "utilities/systemMemoryBarrier.hpp"
  75 #if INCLUDE_JFR
  76 #include "jfr/jfr.hpp"
  77 #endif
  78 
  79 #include <string.h>
  80 
  81 static const char _default_java_launcher[] = "generic";
  82 
  83 #define DEFAULT_JAVA_LAUNCHER _default_java_launcher
  84 
  85 char*  Arguments::_jvm_flags_file               = nullptr;
  86 char** Arguments::_jvm_flags_array              = nullptr;
  87 int    Arguments::_num_jvm_flags                = 0;
  88 char** Arguments::_jvm_args_array               = nullptr;
  89 int    Arguments::_num_jvm_args                 = 0;
  90 unsigned int Arguments::_addmods_count          = 0;
  91 #if INCLUDE_JVMCI
  92 bool   Arguments::_jvmci_module_added           = false;
  93 #endif
  94 char*  Arguments::_java_command                 = nullptr;
  95 SystemProperty* Arguments::_system_properties   = nullptr;
  96 size_t Arguments::_conservative_max_heap_alignment = 0;
  97 Arguments::Mode Arguments::_mode                = _mixed;
  98 const char*  Arguments::_java_vendor_url_bug    = nullptr;
  99 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
 100 bool   Arguments::_executing_unit_tests         = false;

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

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