1986 }
1987
1988 status = CompilerConfig::check_args_consistency(status);
1989 #if INCLUDE_JVMCI
1990 if (status && EnableJVMCI) {
1991 PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true",
1992 AddProperty, UnwriteableProperty, InternalProperty);
1993 if (!create_numbered_module_property("jdk.module.addmods", "jdk.internal.vm.ci", addmods_count++)) {
1994 return false;
1995 }
1996 }
1997 #endif
1998
1999 #ifndef SUPPORT_RESERVED_STACK_AREA
2000 if (StackReservedPages != 0) {
2001 FLAG_SET_CMDLINE(StackReservedPages, 0);
2002 warning("Reserved Stack Area not supported on this platform");
2003 }
2004 #endif
2005
2006 return status;
2007 }
2008
2009 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2010 const char* option_type) {
2011 if (ignore) return false;
2012
2013 const char* spacer = " ";
2014 if (option_type == NULL) {
2015 option_type = ++spacer; // Set both to the empty string.
2016 }
2017
2018 jio_fprintf(defaultStream::error_stream(),
2019 "Unrecognized %s%soption: %s\n", option_type, spacer,
2020 option->optionString);
2021 return true;
2022 }
2023
2024 static const char* user_assertion_options[] = {
2025 "-da", "-ea", "-disableassertions", "-enableassertions", 0
3136 }
3137
3138 if (ArchiveClassesAtExit == NULL && !RecordDynamicDumpInfo) {
3139 FLAG_SET_DEFAULT(DynamicDumpSharedSpaces, false);
3140 } else {
3141 FLAG_SET_DEFAULT(DynamicDumpSharedSpaces, true);
3142 }
3143
3144 if (UseSharedSpaces && patch_mod_javabase) {
3145 no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
3146 }
3147 if (UseSharedSpaces && !DumpSharedSpaces && check_unsupported_cds_runtime_properties()) {
3148 FLAG_SET_DEFAULT(UseSharedSpaces, false);
3149 }
3150 #endif
3151
3152 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
3153 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
3154 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3155
3156 return JNI_OK;
3157 }
3158
3159 // Helper class for controlling the lifetime of JavaVMInitArgs
3160 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3161 // deleted on the destruction of the ScopedVMInitArgs object.
3162 class ScopedVMInitArgs : public StackObj {
3163 private:
3164 JavaVMInitArgs _args;
3165 char* _container_name;
3166 bool _is_set;
3167 char* _vm_options_file_arg;
3168
3169 public:
3170 ScopedVMInitArgs(const char *container_name) {
3171 _args.version = JNI_VERSION_1_2;
3172 _args.nOptions = 0;
3173 _args.options = NULL;
3174 _args.ignoreUnrecognized = false;
3175 _container_name = (char *)container_name;
4012 // Set compiler flags after GC is selected and GC specific
4013 // flags (LoopStripMiningIter) are set.
4014 CompilerConfig::ergo_initialize();
4015
4016 // Set bytecode rewriting flags
4017 set_bytecode_flags();
4018
4019 // Set flags if aggressive optimization flags are enabled
4020 jint code = set_aggressive_opts_flags();
4021 if (code != JNI_OK) {
4022 return code;
4023 }
4024
4025 // Turn off biased locking for locking debug mode flags,
4026 // which are subtly different from each other but neither works with
4027 // biased locking
4028 if (UseHeavyMonitors
4029 #ifdef COMPILER1
4030 || !UseFastLocking
4031 #endif // COMPILER1
4032 #if INCLUDE_JVMCI
4033 || !JVMCIUseFastLocking
4034 #endif
4035 ) {
4036 if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
4037 // flag set to true on command line; warn the user that they
4038 // can't enable biased locking here
4039 warning("Biased Locking is not supported with locking debug flags"
4040 "; ignoring UseBiasedLocking flag." );
4041 }
4042 UseBiasedLocking = false;
4043 }
4044
4045 #ifdef ZERO
4046 // Clear flags not supported on zero.
4047 FLAG_SET_DEFAULT(ProfileInterpreter, false);
4048 FLAG_SET_DEFAULT(UseBiasedLocking, false);
4049
4050 if (LogTouchedMethods) {
4051 warning("LogTouchedMethods is not supported for Zero");
4052 FLAG_SET_DEFAULT(LogTouchedMethods, false);
4053 }
4054 #endif // ZERO
|
1986 }
1987
1988 status = CompilerConfig::check_args_consistency(status);
1989 #if INCLUDE_JVMCI
1990 if (status && EnableJVMCI) {
1991 PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true",
1992 AddProperty, UnwriteableProperty, InternalProperty);
1993 if (!create_numbered_module_property("jdk.module.addmods", "jdk.internal.vm.ci", addmods_count++)) {
1994 return false;
1995 }
1996 }
1997 #endif
1998
1999 #ifndef SUPPORT_RESERVED_STACK_AREA
2000 if (StackReservedPages != 0) {
2001 FLAG_SET_CMDLINE(StackReservedPages, 0);
2002 warning("Reserved Stack Area not supported on this platform");
2003 }
2004 #endif
2005
2006 #if !defined(X86) && !defined(AARCH64)
2007 if (LockingMode == LM_LIGHTWEIGHT) {
2008 FLAG_SET_CMDLINE(LockingMode, LM_LEGACY);
2009 warning("New lightweight locking not supported on this platform");
2010 }
2011 #endif
2012
2013 if (UseHeavyMonitors) {
2014 if (FLAG_IS_CMDLINE(LockingMode) && LockingMode != LM_MONITOR) {
2015 jio_fprintf(defaultStream::error_stream(),
2016 "Conflicting -XX:+UseHeavyMonitors and -XX:LockingMode=%d flags", LockingMode);
2017 return false;
2018 }
2019 FLAG_SET_CMDLINE(LockingMode, LM_MONITOR);
2020 }
2021
2022 return status;
2023 }
2024
2025 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2026 const char* option_type) {
2027 if (ignore) return false;
2028
2029 const char* spacer = " ";
2030 if (option_type == NULL) {
2031 option_type = ++spacer; // Set both to the empty string.
2032 }
2033
2034 jio_fprintf(defaultStream::error_stream(),
2035 "Unrecognized %s%soption: %s\n", option_type, spacer,
2036 option->optionString);
2037 return true;
2038 }
2039
2040 static const char* user_assertion_options[] = {
2041 "-da", "-ea", "-disableassertions", "-enableassertions", 0
3152 }
3153
3154 if (ArchiveClassesAtExit == NULL && !RecordDynamicDumpInfo) {
3155 FLAG_SET_DEFAULT(DynamicDumpSharedSpaces, false);
3156 } else {
3157 FLAG_SET_DEFAULT(DynamicDumpSharedSpaces, true);
3158 }
3159
3160 if (UseSharedSpaces && patch_mod_javabase) {
3161 no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
3162 }
3163 if (UseSharedSpaces && !DumpSharedSpaces && check_unsupported_cds_runtime_properties()) {
3164 FLAG_SET_DEFAULT(UseSharedSpaces, false);
3165 }
3166 #endif
3167
3168 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
3169 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
3170 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3171
3172 #ifdef _LP64
3173 if (UseCompactObjectHeaders && UseZGC) {
3174 if (FLAG_IS_CMDLINE(UseCompactObjectHeaders)) {
3175 warning("ZGC does not work with compact object headers, disabling UseCompactObjectHeaders");
3176 }
3177 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3178 }
3179
3180 if (UseCompactObjectHeaders && FLAG_IS_CMDLINE(UseCompressedClassPointers) && !UseCompressedClassPointers) {
3181 // If user specifies -UseCompressedClassPointers, disable compact headers with a warning.
3182 warning("Compact object headers require compressed class pointers. Disabling compact object headers.");
3183 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3184 }
3185 if (UseCompactObjectHeaders && LockingMode == LM_LEGACY) {
3186 FLAG_SET_DEFAULT(LockingMode, LM_LIGHTWEIGHT);
3187 }
3188 if (UseCompactObjectHeaders && UseBiasedLocking) {
3189 FLAG_SET_DEFAULT(UseBiasedLocking, false);
3190 }
3191 if (UseCompactObjectHeaders && !UseAltGCForwarding) {
3192 FLAG_SET_DEFAULT(UseAltGCForwarding, true);
3193 }
3194 #endif
3195
3196 return JNI_OK;
3197 }
3198
3199 // Helper class for controlling the lifetime of JavaVMInitArgs
3200 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3201 // deleted on the destruction of the ScopedVMInitArgs object.
3202 class ScopedVMInitArgs : public StackObj {
3203 private:
3204 JavaVMInitArgs _args;
3205 char* _container_name;
3206 bool _is_set;
3207 char* _vm_options_file_arg;
3208
3209 public:
3210 ScopedVMInitArgs(const char *container_name) {
3211 _args.version = JNI_VERSION_1_2;
3212 _args.nOptions = 0;
3213 _args.options = NULL;
3214 _args.ignoreUnrecognized = false;
3215 _container_name = (char *)container_name;
4052 // Set compiler flags after GC is selected and GC specific
4053 // flags (LoopStripMiningIter) are set.
4054 CompilerConfig::ergo_initialize();
4055
4056 // Set bytecode rewriting flags
4057 set_bytecode_flags();
4058
4059 // Set flags if aggressive optimization flags are enabled
4060 jint code = set_aggressive_opts_flags();
4061 if (code != JNI_OK) {
4062 return code;
4063 }
4064
4065 // Turn off biased locking for locking debug mode flags,
4066 // which are subtly different from each other but neither works with
4067 // biased locking
4068 if (UseHeavyMonitors
4069 #ifdef COMPILER1
4070 || !UseFastLocking
4071 #endif // COMPILER1
4072 ) {
4073 if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
4074 // flag set to true on command line; warn the user that they
4075 // can't enable biased locking here
4076 warning("Biased Locking is not supported with locking debug flags"
4077 "; ignoring UseBiasedLocking flag." );
4078 }
4079 UseBiasedLocking = false;
4080 }
4081
4082 #ifdef ZERO
4083 // Clear flags not supported on zero.
4084 FLAG_SET_DEFAULT(ProfileInterpreter, false);
4085 FLAG_SET_DEFAULT(UseBiasedLocking, false);
4086
4087 if (LogTouchedMethods) {
4088 warning("LogTouchedMethods is not supported for Zero");
4089 FLAG_SET_DEFAULT(LogTouchedMethods, false);
4090 }
4091 #endif // ZERO
|