< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page

   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "cds/cds_globals.hpp"
  27 #include "cds/cdsConfig.hpp"
  28 #include "cds/filemap.hpp"

  29 #include "classfile/classLoader.hpp"
  30 #include "classfile/javaAssertions.hpp"
  31 #include "classfile/moduleEntry.hpp"
  32 #include "classfile/stringTable.hpp"
  33 #include "classfile/symbolTable.hpp"
  34 #include "compiler/compilerDefinitions.hpp"
  35 #include "gc/shared/gcArguments.hpp"
  36 #include "gc/shared/gcConfig.hpp"
  37 #include "gc/shared/genArguments.hpp"
  38 #include "gc/shared/stringdedup/stringDedup.hpp"
  39 #include "gc/shared/tlab_globals.hpp"
  40 #include "jvm.h"
  41 #include "logging/log.hpp"
  42 #include "logging/logConfiguration.hpp"
  43 #include "logging/logStream.hpp"
  44 #include "logging/logTag.hpp"
  45 #include "memory/allocation.inline.hpp"
  46 #include "nmt/nmtCommon.hpp"
  47 #include "oops/compressedKlass.hpp"
  48 #include "oops/instanceKlass.hpp"

1772 bool Arguments::check_vm_args_consistency() {
1773   // Method for adding checks for flag consistency.
1774   // The intent is to warn the user of all possible conflicts,
1775   // before returning an error.
1776   // Note: Needs platform-dependent factoring.
1777   bool status = true;
1778 
1779   if (TLABRefillWasteFraction == 0) {
1780     jio_fprintf(defaultStream::error_stream(),
1781                 "TLABRefillWasteFraction should be a denominator, "
1782                 "not " SIZE_FORMAT "\n",
1783                 TLABRefillWasteFraction);
1784     status = false;
1785   }
1786 
1787   status = CompilerConfig::check_args_consistency(status);
1788 #if INCLUDE_JVMCI
1789   if (status && EnableJVMCI) {
1790     PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true",
1791         AddProperty, UnwriteableProperty, InternalProperty);
1792     if (ClassLoader::is_module_observable("jdk.internal.vm.ci")) {





1793       if (!create_numbered_module_property("jdk.module.addmods", "jdk.internal.vm.ci", addmods_count++)) {
1794         return false;
1795       }
1796     }
1797   }
1798 #endif
1799 
1800 #if INCLUDE_JFR
1801   if (status && (FlightRecorderOptions || StartFlightRecording)) {
1802     if (!create_numbered_module_property("jdk.module.addmods", "jdk.jfr", addmods_count++)) {
1803       return false;
1804     }
1805   }
1806 #endif
1807 
1808 #ifndef SUPPORT_RESERVED_STACK_AREA
1809   if (StackReservedPages != 0) {
1810     FLAG_SET_CMDLINE(StackReservedPages, 0);
1811     warning("Reserved Stack Area not supported on this platform");
1812   }

2911   if (FLAG_IS_DEFAULT(UseLargePages) &&
2912       MaxHeapSize < LargePageHeapSizeThreshold) {
2913     // No need for large granularity pages w/small heaps.
2914     // Note that large pages are enabled/disabled for both the
2915     // Java heap and the code cache.
2916     FLAG_SET_DEFAULT(UseLargePages, false);
2917   }
2918 
2919   UNSUPPORTED_OPTION(ProfileInterpreter);
2920 #endif
2921 
2922   // Parse the CompilationMode flag
2923   if (!CompilationModeFlag::initialize()) {
2924     return JNI_ERR;
2925   }
2926 
2927   if (!check_vm_args_consistency()) {
2928     return JNI_ERR;
2929   }
2930 
2931   if (!CDSConfig::check_vm_args_consistency(patch_mod_javabase, mode_flag_cmd_line)) {
2932     return JNI_ERR;
2933   }
2934 




2935 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2936   UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2937 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2938 
2939   return JNI_OK;
2940 }
2941 
2942 // Helper class for controlling the lifetime of JavaVMInitArgs
2943 // objects.  The contents of the JavaVMInitArgs are guaranteed to be
2944 // deleted on the destruction of the ScopedVMInitArgs object.
2945 class ScopedVMInitArgs : public StackObj {
2946  private:
2947   JavaVMInitArgs _args;
2948   char*          _container_name;
2949   bool           _is_set;
2950   char*          _vm_options_file_arg;
2951 
2952  public:
2953   ScopedVMInitArgs(const char *container_name) {
2954     _args.version = JNI_VERSION_1_2;

3656 
3657   // Set compiler flags after GC is selected and GC specific
3658   // flags (LoopStripMiningIter) are set.
3659   CompilerConfig::ergo_initialize();
3660 
3661   // Set bytecode rewriting flags
3662   set_bytecode_flags();
3663 
3664   // Set flags if aggressive optimization flags are enabled
3665   jint code = set_aggressive_opts_flags();
3666   if (code != JNI_OK) {
3667     return code;
3668   }
3669 
3670   if (FLAG_IS_DEFAULT(UseSecondarySupersTable)) {
3671     FLAG_SET_DEFAULT(UseSecondarySupersTable, VM_Version::supports_secondary_supers_table());
3672   } else if (UseSecondarySupersTable && !VM_Version::supports_secondary_supers_table()) {
3673     warning("UseSecondarySupersTable is not supported");
3674     FLAG_SET_DEFAULT(UseSecondarySupersTable, false);
3675   }

3676   if (!UseSecondarySupersTable) {
3677     FLAG_SET_DEFAULT(StressSecondarySupers, false);
3678     FLAG_SET_DEFAULT(VerifySecondarySupers, false);
3679   }
3680 
3681 #ifdef ZERO
3682   // Clear flags not supported on zero.
3683   FLAG_SET_DEFAULT(ProfileInterpreter, false);
3684 #endif // ZERO
3685 
3686   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3687     warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3688     DebugNonSafepoints = true;
3689   }
3690 
3691   if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) {
3692     warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used");
3693   }
3694 
3695   // Treat the odd case where local verification is enabled but remote

3717       warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3718     }
3719     FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3720 
3721     if (!FLAG_IS_DEFAULT(EnableVectorAggressiveReboxing) && EnableVectorAggressiveReboxing) {
3722       if (!EnableVectorReboxing) {
3723         warning("Disabling EnableVectorAggressiveReboxing since EnableVectorReboxing is turned off.");
3724       } else {
3725         warning("Disabling EnableVectorAggressiveReboxing since EnableVectorSupport is turned off.");
3726       }
3727     }
3728     FLAG_SET_DEFAULT(EnableVectorAggressiveReboxing, false);
3729 
3730     if (!FLAG_IS_DEFAULT(UseVectorStubs) && UseVectorStubs) {
3731       warning("Disabling UseVectorStubs since EnableVectorSupport is turned off.");
3732     }
3733     FLAG_SET_DEFAULT(UseVectorStubs, false);
3734   }
3735 #endif // COMPILER2_OR_JVMCI
3736 
3737   if (log_is_enabled(Info, perf, class, link)) {
3738     if (!UsePerfData) {
3739       warning("Disabling -Xlog:perf+class+link since UsePerfData is turned off.");





















3740       LogConfiguration::configure_stdout(LogLevel::Off, false, LOG_TAGS(perf, class, link));
3741     }
3742   }





3743 
3744   if (FLAG_IS_CMDLINE(DiagnoseSyncOnValueBasedClasses)) {
3745     if (DiagnoseSyncOnValueBasedClasses == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, valuebasedclasses)) {
3746       LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(valuebasedclasses));
3747     }
3748   }
3749   return JNI_OK;
3750 }
3751 
3752 jint Arguments::adjust_after_os() {
3753   if (UseNUMA) {
3754     if (UseParallelGC) {
3755       if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
3756          FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
3757       }
3758     }
3759   }
3760   return JNI_OK;
3761 }
3762 

   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "cds/cds_globals.hpp"
  27 #include "cds/cdsConfig.hpp"
  28 #include "cds/filemap.hpp"
  29 #include "cds/heapShared.hpp"
  30 #include "classfile/classLoader.hpp"
  31 #include "classfile/javaAssertions.hpp"
  32 #include "classfile/moduleEntry.hpp"
  33 #include "classfile/stringTable.hpp"
  34 #include "classfile/symbolTable.hpp"
  35 #include "compiler/compilerDefinitions.hpp"
  36 #include "gc/shared/gcArguments.hpp"
  37 #include "gc/shared/gcConfig.hpp"
  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"

1773 bool Arguments::check_vm_args_consistency() {
1774   // Method for adding checks for flag consistency.
1775   // The intent is to warn the user of all possible conflicts,
1776   // before returning an error.
1777   // Note: Needs platform-dependent factoring.
1778   bool status = true;
1779 
1780   if (TLABRefillWasteFraction == 0) {
1781     jio_fprintf(defaultStream::error_stream(),
1782                 "TLABRefillWasteFraction should be a denominator, "
1783                 "not " SIZE_FORMAT "\n",
1784                 TLABRefillWasteFraction);
1785     status = false;
1786   }
1787 
1788   status = CompilerConfig::check_args_consistency(status);
1789 #if INCLUDE_JVMCI
1790   if (status && EnableJVMCI) {
1791     PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true",
1792         AddProperty, UnwriteableProperty, InternalProperty);
1793     /*
1794      * Ioi - 2023/05/19. There's no need for this with my patch-jdk.sh script, which adds
1795      * jdk.internal.vm.ci as one of the default modules. Using -Djdk.module.addmods will
1796      * cause the full module graph to be disabled and slow down performance.
1797      */
1798     if (!TempDisableAddJVMCIModule && ClassLoader::is_module_observable("jdk.internal.vm.ci")) {
1799       if (!create_numbered_module_property("jdk.module.addmods", "jdk.internal.vm.ci", addmods_count++)) {
1800         return false;
1801       }
1802     }
1803   }
1804 #endif
1805 
1806 #if INCLUDE_JFR
1807   if (status && (FlightRecorderOptions || StartFlightRecording)) {
1808     if (!create_numbered_module_property("jdk.module.addmods", "jdk.jfr", addmods_count++)) {
1809       return false;
1810     }
1811   }
1812 #endif
1813 
1814 #ifndef SUPPORT_RESERVED_STACK_AREA
1815   if (StackReservedPages != 0) {
1816     FLAG_SET_CMDLINE(StackReservedPages, 0);
1817     warning("Reserved Stack Area not supported on this platform");
1818   }

2917   if (FLAG_IS_DEFAULT(UseLargePages) &&
2918       MaxHeapSize < LargePageHeapSizeThreshold) {
2919     // No need for large granularity pages w/small heaps.
2920     // Note that large pages are enabled/disabled for both the
2921     // Java heap and the code cache.
2922     FLAG_SET_DEFAULT(UseLargePages, false);
2923   }
2924 
2925   UNSUPPORTED_OPTION(ProfileInterpreter);
2926 #endif
2927 
2928   // Parse the CompilationMode flag
2929   if (!CompilationModeFlag::initialize()) {
2930     return JNI_ERR;
2931   }
2932 
2933   if (!check_vm_args_consistency()) {
2934     return JNI_ERR;
2935   }
2936 
2937   if (!CDSConfig::check_vm_args_consistency(patch_mod_javabase, mode_flag_cmd_line, xshare_auto_cmd_line)) {
2938     return JNI_ERR;
2939   }
2940 
2941   if (StoreCachedCode) {
2942     FLAG_SET_ERGO_IF_DEFAULT(CachedCodeMaxSize, 512*M);
2943   }
2944 
2945 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2946   UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2947 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2948 
2949   return JNI_OK;
2950 }
2951 
2952 // Helper class for controlling the lifetime of JavaVMInitArgs
2953 // objects.  The contents of the JavaVMInitArgs are guaranteed to be
2954 // deleted on the destruction of the ScopedVMInitArgs object.
2955 class ScopedVMInitArgs : public StackObj {
2956  private:
2957   JavaVMInitArgs _args;
2958   char*          _container_name;
2959   bool           _is_set;
2960   char*          _vm_options_file_arg;
2961 
2962  public:
2963   ScopedVMInitArgs(const char *container_name) {
2964     _args.version = JNI_VERSION_1_2;

3666 
3667   // Set compiler flags after GC is selected and GC specific
3668   // flags (LoopStripMiningIter) are set.
3669   CompilerConfig::ergo_initialize();
3670 
3671   // Set bytecode rewriting flags
3672   set_bytecode_flags();
3673 
3674   // Set flags if aggressive optimization flags are enabled
3675   jint code = set_aggressive_opts_flags();
3676   if (code != JNI_OK) {
3677     return code;
3678   }
3679 
3680   if (FLAG_IS_DEFAULT(UseSecondarySupersTable)) {
3681     FLAG_SET_DEFAULT(UseSecondarySupersTable, VM_Version::supports_secondary_supers_table());
3682   } else if (UseSecondarySupersTable && !VM_Version::supports_secondary_supers_table()) {
3683     warning("UseSecondarySupersTable is not supported");
3684     FLAG_SET_DEFAULT(UseSecondarySupersTable, false);
3685   }
3686   UseSecondarySupersTable = false; // FIXME: Disabled for Leyden. Neet to fix SCAddressTable::id_for_address()
3687   if (!UseSecondarySupersTable) {
3688     FLAG_SET_DEFAULT(StressSecondarySupers, false);
3689     FLAG_SET_DEFAULT(VerifySecondarySupers, false);
3690   }
3691 
3692 #ifdef ZERO
3693   // Clear flags not supported on zero.
3694   FLAG_SET_DEFAULT(ProfileInterpreter, false);
3695 #endif // ZERO
3696 
3697   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3698     warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3699     DebugNonSafepoints = true;
3700   }
3701 
3702   if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) {
3703     warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used");
3704   }
3705 
3706   // Treat the odd case where local verification is enabled but remote

3728       warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3729     }
3730     FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3731 
3732     if (!FLAG_IS_DEFAULT(EnableVectorAggressiveReboxing) && EnableVectorAggressiveReboxing) {
3733       if (!EnableVectorReboxing) {
3734         warning("Disabling EnableVectorAggressiveReboxing since EnableVectorReboxing is turned off.");
3735       } else {
3736         warning("Disabling EnableVectorAggressiveReboxing since EnableVectorSupport is turned off.");
3737       }
3738     }
3739     FLAG_SET_DEFAULT(EnableVectorAggressiveReboxing, false);
3740 
3741     if (!FLAG_IS_DEFAULT(UseVectorStubs) && UseVectorStubs) {
3742       warning("Disabling UseVectorStubs since EnableVectorSupport is turned off.");
3743     }
3744     FLAG_SET_DEFAULT(UseVectorStubs, false);
3745   }
3746 #endif // COMPILER2_OR_JVMCI
3747 
3748   if (log_is_enabled(Info, init)) {
3749     if (FLAG_IS_DEFAULT(ProfileVMLocks)) {
3750       FLAG_SET_DEFAULT(ProfileVMLocks, true);
3751     }
3752     if (UsePerfData && !log_is_enabled(Info, perf, class, link)) {
3753       // automatically enable -Xlog:perf+class+link
3754       LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(perf, class, link));
3755     }
3756     // Don't turn on ProfileVMCalls and ProfileRuntimeCalls by default.
3757   } else {
3758     if (!FLAG_IS_DEFAULT(ProfileVMLocks) && ProfileVMLocks) {
3759       warning("Disabling ProfileVMLocks since logging is turned off.");
3760       FLAG_SET_DEFAULT(ProfileVMLocks, false);
3761     }
3762     if (!FLAG_IS_DEFAULT(ProfileVMCalls) && ProfileVMCalls) {
3763       warning("Disabling ProfileVMCalls since logging is turned off.");
3764       FLAG_SET_DEFAULT(ProfileVMCalls, false);
3765     }
3766     if (!FLAG_IS_DEFAULT(ProfileRuntimeCalls) && ProfileRuntimeCalls) {
3767       warning("Disabling ProfileRuntimeCalls since logging is turned off.");
3768       FLAG_SET_DEFAULT(ProfileRuntimeCalls, false);
3769     }
3770     if (log_is_enabled(Info, perf, class, link)) {
3771       warning("Disabling -Xlog:perf+class+link since logging is turned off.");
3772       LogConfiguration::configure_stdout(LogLevel::Off, false, LOG_TAGS(perf, class, link));
3773     }
3774   }
3775   if (FLAG_IS_DEFAULT(PerfDataMemorySize)) {
3776     if (ProfileVMLocks || ProfileVMCalls || ProfileRuntimeCalls) {
3777       FLAG_SET_DEFAULT(PerfDataMemorySize, 128*K); // reserve more space for extra perf counters
3778     }
3779   }
3780 
3781   if (FLAG_IS_CMDLINE(DiagnoseSyncOnValueBasedClasses)) {
3782     if (DiagnoseSyncOnValueBasedClasses == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, valuebasedclasses)) {
3783       LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(valuebasedclasses));
3784     }
3785   }
3786   return JNI_OK;
3787 }
3788 
3789 jint Arguments::adjust_after_os() {
3790   if (UseNUMA) {
3791     if (UseParallelGC) {
3792       if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
3793          FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
3794       }
3795     }
3796   }
3797   return JNI_OK;
3798 }
3799 
< prev index next >