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;
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 if (!check_vm_args_consistency()) {
2990 return JNI_ERR;
2991 }
2992
2993
2994 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2995 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2996 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2997
2998 return JNI_OK;
2999 }
3000
3001 // Helper class for controlling the lifetime of JavaVMInitArgs
3002 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3003 // deleted on the destruction of the ScopedVMInitArgs object.
3004 class ScopedVMInitArgs : public StackObj {
3005 private:
3006 JavaVMInitArgs _args;
3007 char* _container_name;
3008 bool _is_set;
3009 char* _vm_options_file_arg;
3010
3011 public:
3012 ScopedVMInitArgs(const char *container_name) {
3013 _args.version = JNI_VERSION_1_2;
3858 #ifdef ZERO
3859 // Clear flags not supported on zero.
3860 FLAG_SET_DEFAULT(ProfileInterpreter, false);
3861 #endif // ZERO
3862
3863 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3864 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3865 DebugNonSafepoints = true;
3866 }
3867
3868 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) {
3869 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used");
3870 }
3871
3872 // Treat the odd case where local verification is enabled but remote
3873 // verification is not as if both were enabled.
3874 if (BytecodeVerificationLocal && !BytecodeVerificationRemote) {
3875 log_info(verification)("Turning on remote verification because local verification is on");
3876 FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
3877 }
3878
3879 #ifndef PRODUCT
3880 if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
3881 if (use_vm_log()) {
3882 LogVMOutput = true;
3883 }
3884 }
3885 #endif // PRODUCT
3886
3887 if (PrintCommandLineFlags) {
3888 JVMFlag::printSetFlags(tty);
3889 }
3890
3891 #if COMPILER2_OR_JVMCI
3892 if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
3893 if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
3894 warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3895 }
3896 FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3897
|
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;
2971 }
2972
2973 #if !COMPILER2_OR_JVMCI
2974 // Don't degrade server performance for footprint
2975 if (FLAG_IS_DEFAULT(UseLargePages) &&
2976 MaxHeapSize < LargePageHeapSizeThreshold) {
2977 // No need for large granularity pages w/small heaps.
2978 // Note that large pages are enabled/disabled for both the
2979 // Java heap and the code cache.
2980 FLAG_SET_DEFAULT(UseLargePages, false);
2981 }
2982
2983 UNSUPPORTED_OPTION(ProfileInterpreter);
2984 #endif
2985
2986 // Parse the CompilationMode flag
2987 if (!CompilationModeFlag::initialize()) {
2988 return JNI_ERR;
2989 }
2990
2991 ClassLoader::set_preview_mode(is_valhalla_enabled());
2992
2993 if (!check_vm_args_consistency()) {
2994 return JNI_ERR;
2995 }
2996
2997 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2998 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2999 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3000
3001 return JNI_OK;
3002 }
3003
3004 // Helper class for controlling the lifetime of JavaVMInitArgs
3005 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3006 // deleted on the destruction of the ScopedVMInitArgs object.
3007 class ScopedVMInitArgs : public StackObj {
3008 private:
3009 JavaVMInitArgs _args;
3010 char* _container_name;
3011 bool _is_set;
3012 char* _vm_options_file_arg;
3013
3014 public:
3015 ScopedVMInitArgs(const char *container_name) {
3016 _args.version = JNI_VERSION_1_2;
3861 #ifdef ZERO
3862 // Clear flags not supported on zero.
3863 FLAG_SET_DEFAULT(ProfileInterpreter, false);
3864 #endif // ZERO
3865
3866 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3867 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3868 DebugNonSafepoints = true;
3869 }
3870
3871 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) {
3872 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used");
3873 }
3874
3875 // Treat the odd case where local verification is enabled but remote
3876 // verification is not as if both were enabled.
3877 if (BytecodeVerificationLocal && !BytecodeVerificationRemote) {
3878 log_info(verification)("Turning on remote verification because local verification is on");
3879 FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
3880 }
3881 if (!is_valhalla_enabled()) {
3882 #define WARN_IF_NOT_DEFAULT_FLAG(flag) \
3883 if (!FLAG_IS_DEFAULT(flag)) { \
3884 warning("Valhalla-specific flag \"%s\" has no effect when --enable-preview is not specified.", #flag); \
3885 }
3886
3887 #define DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(flag) \
3888 WARN_IF_NOT_DEFAULT_FLAG(flag) \
3889 FLAG_SET_DEFAULT(flag, false);
3890
3891 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(InlineTypePassFieldsAsArgs);
3892 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(InlineTypeReturnedAsFields);
3893 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseArrayFlattening);
3894 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseFieldFlattening);
3895 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNonAtomicValueFlattening);
3896 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseNullableValueFlattening);
3897 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseAtomicValueFlattening);
3898 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintInlineLayout);
3899 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PrintFlatArrayLayout);
3900 WARN_IF_NOT_DEFAULT_FLAG(FlatArrayElementMaxOops);
3901 #ifdef ASSERT
3902 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(StressCallingConvention);
3903 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(PreloadClasses);
3904 WARN_IF_NOT_DEFAULT_FLAG(PrintInlineKlassFields);
3905 #endif
3906 #ifdef COMPILER1
3907 DEBUG_ONLY(DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(C1UseDelayedFlattenedFieldReads);)
3908 #endif
3909 #ifdef COMPILER2
3910 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseArrayLoadStoreProfile);
3911 DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(UseACmpProfile);
3912 #endif
3913 #undef DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT
3914 #undef WARN_IF_NOT_DEFAULT_FLAG
3915 } else {
3916 if (is_interpreter_only() && !CDSConfig::is_dumping_archive() && !UseSharedSpaces) {
3917 // Disable calling convention optimizations if inline types are not supported.
3918 // Also these aren't useful in -Xint. However, don't disable them when dumping or using
3919 // the CDS archive, as the values must match between dumptime and runtime.
3920 FLAG_SET_DEFAULT(InlineTypePassFieldsAsArgs, false);
3921 FLAG_SET_DEFAULT(InlineTypeReturnedAsFields, false);
3922 }
3923 if (!UseNonAtomicValueFlattening && !UseNullableValueFlattening && !UseAtomicValueFlattening) {
3924 // Flattening is disabled
3925 FLAG_SET_DEFAULT(UseArrayFlattening, false);
3926 FLAG_SET_DEFAULT(UseFieldFlattening, false);
3927 }
3928 }
3929
3930 #ifndef PRODUCT
3931 if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
3932 if (use_vm_log()) {
3933 LogVMOutput = true;
3934 }
3935 }
3936 #endif // PRODUCT
3937
3938 if (PrintCommandLineFlags) {
3939 JVMFlag::printSetFlags(tty);
3940 }
3941
3942 #if COMPILER2_OR_JVMCI
3943 if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
3944 if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
3945 warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3946 }
3947 FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3948
|