349 * |
349 * |
350 * Tests: Aliases should be tested in VMAliasOptions.java. |
350 * Tests: Aliases should be tested in VMAliasOptions.java. |
351 * Deprecated options should be tested in VMDeprecatedOptions.java. |
351 * Deprecated options should be tested in VMDeprecatedOptions.java. |
352 */ |
352 */ |
353 |
353 |
354 // Obsolete or deprecated -XX flag. |
|
355 typedef struct { |
|
356 const char* name; |
|
357 JDK_Version deprecated_in; // When the deprecation warning started (or "undefined"). |
|
358 JDK_Version obsolete_in; // When the obsolete warning started (or "undefined"). |
|
359 JDK_Version expired_in; // When the option expires (or "undefined"). |
|
360 } SpecialFlag; |
|
361 |
|
362 // The special_jvm_flags table declares options that are being deprecated and/or obsoleted. The |
354 // The special_jvm_flags table declares options that are being deprecated and/or obsoleted. The |
363 // "deprecated_in" or "obsolete_in" fields may be set to "undefined", but not both. |
355 // "deprecated_in" or "obsolete_in" fields may be set to "undefined", but not both. |
364 // When the JDK version reaches 'deprecated_in' limit, the JVM will process this flag on |
356 // When the JDK version reaches 'deprecated_in' limit, the JVM will process this flag on |
365 // the command-line as usual, but will issue a warning. |
357 // the command-line as usual, but will issue a warning. |
366 // When the JDK version reaches 'obsolete_in' limit, the JVM will continue accepting this flag on |
358 // When the JDK version reaches 'obsolete_in' limit, the JVM will continue accepting this flag on |
378 // - All expired options should be removed from the table. |
370 // - All expired options should be removed from the table. |
379 static SpecialFlag const special_jvm_flags[] = { |
371 static SpecialFlag const special_jvm_flags[] = { |
380 // -------------- Deprecated Flags -------------- |
372 // -------------- Deprecated Flags -------------- |
381 // --- Non-alias flags - sorted by obsolete_in then expired_in: |
373 // --- Non-alias flags - sorted by obsolete_in then expired_in: |
382 { "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, |
374 { "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, |
|
375 { "AutoGCSelectPauseMillis", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) }, |
|
376 { "UseAutoGCSelectPolicy", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) }, |
383 { "UseParNewGC", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) }, |
377 { "UseParNewGC", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) }, |
384 { "ConvertSleepToYield", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) }, |
378 { "ConvertSleepToYield", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) }, |
385 { "ConvertYieldToSleep", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) }, |
379 { "ConvertYieldToSleep", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) }, |
386 |
380 |
387 // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: |
381 // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: |
498 } else { |
492 } else { |
499 return true; |
493 return true; |
500 } |
494 } |
501 } |
495 } |
502 |
496 |
|
497 extern bool lookup_special_flag_ext(const char *flag_name, SpecialFlag& flag); |
|
498 |
503 static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) { |
499 static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) { |
|
500 // Allow extensions to have priority |
|
501 if (lookup_special_flag_ext(flag_name, flag)) { |
|
502 return true; |
|
503 } |
|
504 |
504 for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) { |
505 for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) { |
505 if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) { |
506 if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) { |
506 flag = special_jvm_flags[i]; |
507 flag = special_jvm_flags[i]; |
507 return true; |
508 return true; |
508 } |
509 } |
1803 } |
1804 } |
1804 |
1805 |
1805 void Arguments::select_gc_ergonomically() { |
1806 void Arguments::select_gc_ergonomically() { |
1806 #if INCLUDE_ALL_GCS |
1807 #if INCLUDE_ALL_GCS |
1807 if (os::is_server_class_machine()) { |
1808 if (os::is_server_class_machine()) { |
1808 if (should_auto_select_low_pause_collector()) { |
1809 if (!UseAutoGCSelectPolicy) { |
1809 FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true); |
1810 FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true); |
1810 } else { |
1811 } else { |
1811 FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true); |
1812 if (should_auto_select_low_pause_collector()) { |
|
1813 FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true); |
|
1814 FLAG_SET_ERGO_IF_DEFAULT(bool, UseParNewGC, true); |
|
1815 } else { |
|
1816 FLAG_SET_ERGO_IF_DEFAULT(bool, UseParallelGC, true); |
|
1817 } |
1812 } |
1818 } |
1813 } else { |
1819 } else { |
1814 FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true); |
1820 FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true); |
1815 } |
1821 } |
1816 #else |
1822 #else |
2873 // -Xconcgc |
2879 // -Xconcgc |
2874 } else if (match_option(option, "-Xconcgc")) { |
2880 } else if (match_option(option, "-Xconcgc")) { |
2875 if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true) != Flag::SUCCESS) { |
2881 if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true) != Flag::SUCCESS) { |
2876 return JNI_EINVAL; |
2882 return JNI_EINVAL; |
2877 } |
2883 } |
|
2884 handle_extra_cms_flags("-Xconcgc uses UseConcMarkSweepGC"); |
2878 // -Xnoconcgc |
2885 // -Xnoconcgc |
2879 } else if (match_option(option, "-Xnoconcgc")) { |
2886 } else if (match_option(option, "-Xnoconcgc")) { |
2880 if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false) != Flag::SUCCESS) { |
2887 if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false) != Flag::SUCCESS) { |
2881 return JNI_EINVAL; |
2888 return JNI_EINVAL; |
2882 } |
2889 } |
|
2890 handle_extra_cms_flags("-Xnoconcgc uses UseConcMarkSweepGC"); |
2883 // -Xbatch |
2891 // -Xbatch |
2884 } else if (match_option(option, "-Xbatch")) { |
2892 } else if (match_option(option, "-Xbatch")) { |
2885 if (FLAG_SET_CMDLINE(bool, BackgroundCompilation, false) != Flag::SUCCESS) { |
2893 if (FLAG_SET_CMDLINE(bool, BackgroundCompilation, false) != Flag::SUCCESS) { |
2886 return JNI_EINVAL; |
2894 return JNI_EINVAL; |
2887 } |
2895 } |
4167 LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc)); |
4175 LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc)); |
4168 } |
4176 } |
4169 return true; |
4177 return true; |
4170 } |
4178 } |
4171 |
4179 |
|
4180 void Arguments::handle_extra_cms_flags(const char* msg) { |
|
4181 SpecialFlag flag; |
|
4182 const char *flag_name = "UseConcMarkSweepGC"; |
|
4183 if (lookup_special_flag(flag_name, flag)) { |
|
4184 handle_aliases_and_deprecation(flag_name, /* print warning */ true); |
|
4185 warning("%s", msg); |
|
4186 } |
|
4187 } |
|
4188 |
4172 // Parse entry point called from JNI_CreateJavaVM |
4189 // Parse entry point called from JNI_CreateJavaVM |
4173 |
4190 |
4174 jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) { |
4191 jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) { |
4175 assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent"); |
4192 assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent"); |
4176 |
4193 |