1108 if (RequireSharedSpaces) {
1109 jio_fprintf(defaultStream::error_stream(),
1110 "Class data sharing is inconsistent with other specified options.\n");
1111 vm_exit_during_initialization("Unable to use shared archive.", NULL);
1112 } else {
1113 FLAG_SET_DEFAULT(UseSharedSpaces, false);
1114 }
1115 }
1116 #endif
1117
1118 void Arguments::set_tiered_flags() {
1119 // With tiered, set default policy to AdvancedThresholdPolicy, which is 3.
1120 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
1121 FLAG_SET_DEFAULT(CompilationPolicyChoice, 3);
1122 }
1123 if (CompilationPolicyChoice < 2) {
1124 vm_exit_during_initialization(
1125 "Incompatible compilation policy selected", NULL);
1126 }
1127 // Increase the code cache size - tiered compiles a lot more.
1128 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
1129 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5);
1130 }
1131 if (!UseInterpreter) { // -Xcomp
1132 Tier3InvokeNotifyFreqLog = 0;
1133 Tier4InvocationThreshold = 0;
1134 }
1135 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
1136 FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
1137 }
1138 }
1139
1140 #if INCLUDE_ALL_GCS
1141 static void disable_adaptive_size_policy(const char* collector_name) {
1142 if (UseAdaptiveSizePolicy) {
1143 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
1144 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
1145 collector_name);
1146 }
1147 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
1148 }
1149 }
2322 jio_fprintf(defaultStream::error_stream(),
2323 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2324 os::vm_page_size()/K);
2325 status = false;
2326 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2327 jio_fprintf(defaultStream::error_stream(),
2328 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2329 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2330 status = false;
2331 } else if (ReservedCodeCacheSize < min_code_cache_size) {
2332 jio_fprintf(defaultStream::error_stream(),
2333 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2334 min_code_cache_size/K);
2335 status = false;
2336 } else if (ReservedCodeCacheSize > 2*G) {
2337 // Code cache size larger than MAXINT is not supported.
2338 jio_fprintf(defaultStream::error_stream(),
2339 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2340 (2*G)/M);
2341 status = false;
2342 }
2343
2344 status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2345 status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2346
2347 return status;
2348 }
2349
2350 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2351 const char* option_type) {
2352 if (ignore) return false;
2353
2354 const char* spacer = " ";
2355 if (option_type == NULL) {
2356 option_type = ++spacer; // Set both to the empty string.
2357 }
2358
2359 if (os::obsolete_option(option)) {
2360 jio_fprintf(defaultStream::error_stream(),
2361 "Obsolete %s%soption: %s\n", option_type, spacer,
2731 julong long_CodeCacheExpansionSize = 0;
2732 ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2733 if (errcode != arg_in_range) {
2734 jio_fprintf(defaultStream::error_stream(),
2735 "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2736 os::vm_page_size()/K);
2737 return JNI_EINVAL;
2738 }
2739 FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
2740 } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2741 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2742 julong long_ReservedCodeCacheSize = 0;
2743
2744 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2745 if (errcode != arg_in_range) {
2746 jio_fprintf(defaultStream::error_stream(),
2747 "Invalid maximum code cache size: %s.\n", option->optionString);
2748 return JNI_EINVAL;
2749 }
2750 FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
2751 //-XX:IncreaseFirstTierCompileThresholdAt=
2752 } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2753 uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2754 if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2755 jio_fprintf(defaultStream::error_stream(),
2756 "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2757 option->optionString);
2758 return JNI_EINVAL;
2759 }
2760 FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2761 // -green
2762 } else if (match_option(option, "-green", &tail)) {
2763 jio_fprintf(defaultStream::error_stream(),
2764 "Green threads support not available\n");
2765 return JNI_EINVAL;
2766 // -native
2767 } else if (match_option(option, "-native", &tail)) {
2768 // HotSpot always uses native threads, ignore silently for compatibility
2769 // -Xsqnopause
2770 } else if (match_option(option, "-Xsqnopause", &tail)) {
|
1108 if (RequireSharedSpaces) {
1109 jio_fprintf(defaultStream::error_stream(),
1110 "Class data sharing is inconsistent with other specified options.\n");
1111 vm_exit_during_initialization("Unable to use shared archive.", NULL);
1112 } else {
1113 FLAG_SET_DEFAULT(UseSharedSpaces, false);
1114 }
1115 }
1116 #endif
1117
1118 void Arguments::set_tiered_flags() {
1119 // With tiered, set default policy to AdvancedThresholdPolicy, which is 3.
1120 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
1121 FLAG_SET_DEFAULT(CompilationPolicyChoice, 3);
1122 }
1123 if (CompilationPolicyChoice < 2) {
1124 vm_exit_during_initialization(
1125 "Incompatible compilation policy selected", NULL);
1126 }
1127 // Increase the code cache size - tiered compiles a lot more.
1128 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize) &&
1129 FLAG_IS_DEFAULT(ProfiledCodeHeapSize) &&
1130 FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
1131 intx non_method_size = ReservedCodeCacheSize - (ProfiledCodeHeapSize + NonProfiledCodeHeapSize);
1132
1133 // Multiply sizes by 5 but fix non_method_size (distribute among non-profiled and profiled code heap)
1134 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5);
1135 FLAG_SET_DEFAULT(ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + non_method_size * 2);
1136 FLAG_SET_DEFAULT(NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + non_method_size * 2);
1137 }
1138 if (!UseInterpreter) { // -Xcomp
1139 Tier3InvokeNotifyFreqLog = 0;
1140 Tier4InvocationThreshold = 0;
1141 }
1142 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
1143 FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
1144 }
1145 }
1146
1147 #if INCLUDE_ALL_GCS
1148 static void disable_adaptive_size_policy(const char* collector_name) {
1149 if (UseAdaptiveSizePolicy) {
1150 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
1151 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
1152 collector_name);
1153 }
1154 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
1155 }
1156 }
2329 jio_fprintf(defaultStream::error_stream(),
2330 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2331 os::vm_page_size()/K);
2332 status = false;
2333 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2334 jio_fprintf(defaultStream::error_stream(),
2335 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2336 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2337 status = false;
2338 } else if (ReservedCodeCacheSize < min_code_cache_size) {
2339 jio_fprintf(defaultStream::error_stream(),
2340 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2341 min_code_cache_size/K);
2342 status = false;
2343 } else if (ReservedCodeCacheSize > 2*G) {
2344 // Code cache size larger than MAXINT is not supported.
2345 jio_fprintf(defaultStream::error_stream(),
2346 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2347 (2*G)/M);
2348 status = false;
2349 } else if (NonMethodCodeHeapSize < min_code_cache_size){
2350 jio_fprintf(defaultStream::error_stream(),
2351 "Invalid NonMethodCodeHeapSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2352 min_code_cache_size/K);
2353 status = false;
2354 } else if ((!FLAG_IS_DEFAULT(NonMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
2355 && (NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
2356 jio_fprintf(defaultStream::error_stream(),
2357 "Invalid NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
2358 (NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
2359 status = false;
2360 }
2361
2362 status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2363 status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2364
2365 return status;
2366 }
2367
2368 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2369 const char* option_type) {
2370 if (ignore) return false;
2371
2372 const char* spacer = " ";
2373 if (option_type == NULL) {
2374 option_type = ++spacer; // Set both to the empty string.
2375 }
2376
2377 if (os::obsolete_option(option)) {
2378 jio_fprintf(defaultStream::error_stream(),
2379 "Obsolete %s%soption: %s\n", option_type, spacer,
2749 julong long_CodeCacheExpansionSize = 0;
2750 ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2751 if (errcode != arg_in_range) {
2752 jio_fprintf(defaultStream::error_stream(),
2753 "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2754 os::vm_page_size()/K);
2755 return JNI_EINVAL;
2756 }
2757 FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
2758 } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2759 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2760 julong long_ReservedCodeCacheSize = 0;
2761
2762 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2763 if (errcode != arg_in_range) {
2764 jio_fprintf(defaultStream::error_stream(),
2765 "Invalid maximum code cache size: %s.\n", option->optionString);
2766 return JNI_EINVAL;
2767 }
2768 FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
2769 // -XX:ProfiledCodeHeapSize=
2770 } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
2771 julong long_ProfiledCodeHeapSize = 0;
2772
2773 ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1);
2774 if (errcode != arg_in_range) {
2775 jio_fprintf(defaultStream::error_stream(),
2776 "Invalid maximum profiled code heap size: %s.\n", option->optionString);
2777 return JNI_EINVAL;
2778 }
2779 FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize);
2780 // -XX:NonProfiledCodeHeapSizee=
2781 } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) {
2782 julong long_NonProfiledCodeHeapSize = 0;
2783
2784 ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
2785 if (errcode != arg_in_range) {
2786 jio_fprintf(defaultStream::error_stream(),
2787 "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
2788 return JNI_EINVAL;
2789 }
2790 FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize);
2791 //-XX:IncreaseFirstTierCompileThresholdAt=
2792 } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2793 uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2794 if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2795 jio_fprintf(defaultStream::error_stream(),
2796 "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2797 option->optionString);
2798 return JNI_EINVAL;
2799 }
2800 FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2801 // -green
2802 } else if (match_option(option, "-green", &tail)) {
2803 jio_fprintf(defaultStream::error_stream(),
2804 "Green threads support not available\n");
2805 return JNI_EINVAL;
2806 // -native
2807 } else if (match_option(option, "-native", &tail)) {
2808 // HotSpot always uses native threads, ignore silently for compatibility
2809 // -Xsqnopause
2810 } else if (match_option(option, "-Xsqnopause", &tail)) {
|