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

2841   }
2842 
2843 #if !COMPILER2_OR_JVMCI
2844   // Don't degrade server performance for footprint
2845   if (FLAG_IS_DEFAULT(UseLargePages) &&
2846       MaxHeapSize < LargePageHeapSizeThreshold) {
2847     // No need for large granularity pages w/small heaps.
2848     // Note that large pages are enabled/disabled for both the
2849     // Java heap and the code cache.
2850     FLAG_SET_DEFAULT(UseLargePages, false);
2851   }
2852 
2853   UNSUPPORTED_OPTION(ProfileInterpreter);
2854 #endif
2855 
2856   // Parse the CompilationMode flag
2857   if (!CompilationModeFlag::initialize()) {
2858     return JNI_ERR;
2859   }
2860 


2861   if (!check_vm_args_consistency()) {
2862     return JNI_ERR;
2863   }
2864 
2865 
2866 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2867   UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2868 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2869 
2870   return JNI_OK;
2871 }
2872 
2873 // Helper class for controlling the lifetime of JavaVMInitArgs
2874 // objects.  The contents of the JavaVMInitArgs are guaranteed to be
2875 // deleted on the destruction of the ScopedVMInitArgs object.
2876 class ScopedVMInitArgs : public StackObj {
2877  private:
2878   JavaVMInitArgs _args;
2879   char*          _container_name;
2880   bool           _is_set;

3717     FLAG_SET_DEFAULT(StressSecondarySupers, false);
3718     FLAG_SET_DEFAULT(VerifySecondarySupers, false);
3719   }
3720 
3721 #ifdef ZERO
3722   // Clear flags not supported on zero.
3723   FLAG_SET_DEFAULT(ProfileInterpreter, false);
3724 #endif // ZERO
3725 
3726   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3727     warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3728     DebugNonSafepoints = true;
3729   }
3730 
3731   // Treat the odd case where local verification is enabled but remote
3732   // verification is not as if both were enabled.
3733   if (BytecodeVerificationLocal && !BytecodeVerificationRemote) {
3734     log_info(verification)("Turning on remote verification because local verification is on");
3735     FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
3736   }


































































3737 
3738 #ifndef PRODUCT
3739   if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
3740     if (use_vm_log()) {
3741       LogVMOutput = true;
3742     }
3743   }
3744 #endif // PRODUCT
3745 
3746   if (PrintCommandLineFlags) {
3747     JVMFlag::printSetFlags(tty);
3748   }
3749 
3750 #if COMPILER2_OR_JVMCI
3751   if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
3752     if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
3753       warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3754     }
3755     FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3756 

  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;

2844   }
2845 
2846 #if !COMPILER2_OR_JVMCI
2847   // Don't degrade server performance for footprint
2848   if (FLAG_IS_DEFAULT(UseLargePages) &&
2849       MaxHeapSize < LargePageHeapSizeThreshold) {
2850     // No need for large granularity pages w/small heaps.
2851     // Note that large pages are enabled/disabled for both the
2852     // Java heap and the code cache.
2853     FLAG_SET_DEFAULT(UseLargePages, false);
2854   }
2855 
2856   UNSUPPORTED_OPTION(ProfileInterpreter);
2857 #endif
2858 
2859   // Parse the CompilationMode flag
2860   if (!CompilationModeFlag::initialize()) {
2861     return JNI_ERR;
2862   }
2863 
2864   ClassLoader::set_preview_mode(is_valhalla_enabled());
2865 
2866   if (!check_vm_args_consistency()) {
2867     return JNI_ERR;
2868   }
2869 
2870 
2871 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2872   UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2873 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2874 
2875   return JNI_OK;
2876 }
2877 
2878 // Helper class for controlling the lifetime of JavaVMInitArgs
2879 // objects.  The contents of the JavaVMInitArgs are guaranteed to be
2880 // deleted on the destruction of the ScopedVMInitArgs object.
2881 class ScopedVMInitArgs : public StackObj {
2882  private:
2883   JavaVMInitArgs _args;
2884   char*          _container_name;
2885   bool           _is_set;

3722     FLAG_SET_DEFAULT(StressSecondarySupers, false);
3723     FLAG_SET_DEFAULT(VerifySecondarySupers, false);
3724   }
3725 
3726 #ifdef ZERO
3727   // Clear flags not supported on zero.
3728   FLAG_SET_DEFAULT(ProfileInterpreter, false);
3729 #endif // ZERO
3730 
3731   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3732     warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3733     DebugNonSafepoints = true;
3734   }
3735 
3736   // Treat the odd case where local verification is enabled but remote
3737   // verification is not as if both were enabled.
3738   if (BytecodeVerificationLocal && !BytecodeVerificationRemote) {
3739     log_info(verification)("Turning on remote verification because local verification is on");
3740     FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
3741   }
3742   if (!is_valhalla_enabled()) {
3743 #define WARN_IF_NOT_DEFAULT_FLAG(flag)                                                                       \
3744     if (!FLAG_IS_DEFAULT(flag)) {                                                                            \
3745       warning("Preview-specific flag \"%s\" has no effect when --enable-preview is not specified.", #flag);  \
3746     }
3747 
3748 #define DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(flag)  \
3749     WARN_IF_NOT_DEFAULT_FLAG(flag)                  \
3750     FLAG_SET_DEFAULT(flag, false);
3751 
3752     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(InlineTypePassFieldsAsArgs);
3753     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(InlineTypeReturnedAsFields);
3754     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseArrayFlattening);
3755     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseFieldFlattening);
3756     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullFreeNonAtomicValueFlattening);
3757     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullableAtomicValueFlattening);
3758     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullFreeAtomicValueFlattening);
3759     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullableNonAtomicValueFlattening);
3760     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintInlineLayout);
3761     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintFlatArrayLayout);
3762     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(IgnoreAssertUnsetFields);
3763     WARN_IF_NOT_DEFAULT_FLAG(FlatArrayElementMaxOops);
3764     WARN_IF_NOT_DEFAULT_FLAG(ForceNonTearable);
3765 #ifdef ASSERT
3766     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(StressCallingConvention);
3767     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PreloadClasses);
3768     WARN_IF_NOT_DEFAULT_FLAG(PrintInlineKlassFields);
3769 #endif
3770 #ifdef COMPILER1
3771     DEBUG_ONLY(DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(C1UseDelayedFlattenedFieldReads);)
3772 #endif
3773 #ifdef COMPILER2
3774     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseArrayLoadStoreProfile);
3775     DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseACmpProfile);
3776 #endif
3777 #undef DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT
3778 #undef WARN_IF_NOT_DEFAULT_FLAG
3779   } else {
3780 #define DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(flag, fallback)                                        \
3781     if (!FLAG_IS_DEFAULT(flag) && !UseArrayFlattening && !UseFieldFlattening) {                       \
3782       warning("Flattening flag \"%s\" has no effect when all flattening modes are disabled.", #flag); \
3783       FLAG_SET_DEFAULT(flag, fallback);                                                               \
3784     }
3785 
3786     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(UseNullFreeNonAtomicValueFlattening, false);
3787     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(UseNullableAtomicValueFlattening, false);
3788     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(UseNullFreeAtomicValueFlattening, false);
3789     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(UseNullableNonAtomicValueFlattening, false);
3790     DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING(FlatArrayElementMaxOops, 0);
3791 #undef DISABLE_FLAG_AND_WARN_IF_NO_FLATTENING
3792     if (is_interpreter_only() && !CDSConfig::is_dumping_archive() && !UseSharedSpaces) {
3793       // Disable calling convention optimizations if inline types are not supported.
3794       // Also these aren't useful in -Xint. However, don't disable them when dumping or using
3795       // the CDS archive, as the values must match between dumptime and runtime.
3796       FLAG_SET_DEFAULT(InlineTypePassFieldsAsArgs, false);
3797       FLAG_SET_DEFAULT(InlineTypeReturnedAsFields, false);
3798     }
3799     if (!UseNullFreeNonAtomicValueFlattening &&
3800         !UseNullableAtomicValueFlattening &&
3801         !UseNullFreeAtomicValueFlattening &&
3802         !UseNullableNonAtomicValueFlattening) {
3803       // Flattening is disabled
3804       FLAG_SET_DEFAULT(UseArrayFlattening, false);
3805       FLAG_SET_DEFAULT(UseFieldFlattening, false);
3806     }
3807   }
3808 
3809 #ifndef PRODUCT
3810   if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
3811     if (use_vm_log()) {
3812       LogVMOutput = true;
3813     }
3814   }
3815 #endif // PRODUCT
3816 
3817   if (PrintCommandLineFlags) {
3818     JVMFlag::printSetFlags(tty);
3819   }
3820 
3821 #if COMPILER2_OR_JVMCI
3822   if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
3823     if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
3824       warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3825     }
3826     FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3827 
< prev index next >