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;
|
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 warning("ZGC does not work with compact object headers, disabling UseCompactObjectHeaders");
3175 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3176 }
3177
3178 if (UseCompactObjectHeaders && FLAG_IS_CMDLINE(UseCompressedClassPointers) && !UseCompressedClassPointers) {
3179 // If user specifies -UseCompressedClassPointers, disable compact headers with a warning.
3180 warning("Compact object headers require compressed class pointers. Disabling compact object headers.");
3181 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3182 }
3183 if (UseCompactObjectHeaders && LockingMode == LM_LEGACY) {
3184 FLAG_SET_DEFAULT(LockingMode, LM_LIGHTWEIGHT);
3185 }
3186 if (UseCompactObjectHeaders && UseBiasedLocking) {
3187 FLAG_SET_DEFAULT(UseBiasedLocking, false);
3188 }
3189 if (UseCompactObjectHeaders && !UseAltGCForwarding) {
3190 FLAG_SET_DEFAULT(UseAltGCForwarding, true);
3191 }
3192 #endif
3193
3194 return JNI_OK;
3195 }
3196
3197 // Helper class for controlling the lifetime of JavaVMInitArgs
3198 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3199 // deleted on the destruction of the ScopedVMInitArgs object.
3200 class ScopedVMInitArgs : public StackObj {
3201 private:
3202 JavaVMInitArgs _args;
3203 char* _container_name;
3204 bool _is_set;
3205 char* _vm_options_file_arg;
3206
3207 public:
3208 ScopedVMInitArgs(const char *container_name) {
3209 _args.version = JNI_VERSION_1_2;
3210 _args.nOptions = 0;
3211 _args.options = NULL;
3212 _args.ignoreUnrecognized = false;
3213 _container_name = (char *)container_name;
|