src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File JDK-8015774 Sdiff src/share/vm/runtime

src/share/vm/runtime/arguments.cpp

Print this page




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 ((!FLAG_IS_DEFAULT(NonProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize))
2350       && (NonProfiledCodeHeapSize + ProfiledCodeHeapSize) > ReservedCodeCacheSize) {
2351     jio_fprintf(defaultStream::error_stream(),
2352                 "Invalid NonProfiledCodeHeapSize + ProfiledCodeHeapSize = %dM. Must be smaller than ReservedCodeCacheSize = %dM.\n",
2353                 (NonProfiledCodeHeapSize + ProfiledCodeHeapSize)/M, ReservedCodeCacheSize/M);
2354     status = false;
2355   }
2356 
2357   status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2358   status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2359 
2360   return status;
2361 }
2362 
2363 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2364   const char* option_type) {
2365   if (ignore) return false;
2366 
2367   const char* spacer = " ";
2368   if (option_type == NULL) {
2369     option_type = ++spacer; // Set both to the empty string.
2370   }
2371 
2372   if (os::obsolete_option(option)) {
2373     jio_fprintf(defaultStream::error_stream(),
2374                 "Obsolete %s%soption: %s\n", option_type, spacer,


2744       julong long_CodeCacheExpansionSize = 0;
2745       ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2746       if (errcode != arg_in_range) {
2747         jio_fprintf(defaultStream::error_stream(),
2748                    "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2749                    os::vm_page_size()/K);
2750         return JNI_EINVAL;
2751       }
2752       FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
2753     } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2754                match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2755       julong long_ReservedCodeCacheSize = 0;
2756 
2757       ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2758       if (errcode != arg_in_range) {
2759         jio_fprintf(defaultStream::error_stream(),
2760                     "Invalid maximum code cache size: %s.\n", option->optionString);
2761         return JNI_EINVAL;
2762       }
2763       FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
2764     // -XX:ProfiledCodeHeapSize=
2765     } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
2766       julong long_ProfiledCodeHeapSize = 0;
2767 
2768       ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1);
2769       if (errcode != arg_in_range) {
2770         jio_fprintf(defaultStream::error_stream(),
2771                     "Invalid maximum profiled code heap size: %s.\n", option->optionString);
2772         return JNI_EINVAL;
2773       }
2774       FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize);
2775       // -XX:NonProfiledCodeHeapSizee=
2776     } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) {
2777       julong long_NonProfiledCodeHeapSize = 0;
2778 
2779       ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
2780       if (errcode != arg_in_range) {
2781         jio_fprintf(defaultStream::error_stream(),
2782                     "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
2783         return JNI_EINVAL;
2784       }
2785       FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize);
2786       //-XX:IncreaseFirstTierCompileThresholdAt=
2787     } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2788         uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2789         if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2790           jio_fprintf(defaultStream::error_stream(),
2791                       "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2792                       option->optionString);
2793           return JNI_EINVAL;
2794         }
2795         FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2796     // -green
2797     } else if (match_option(option, "-green", &tail)) {
2798       jio_fprintf(defaultStream::error_stream(),
2799                   "Green threads support not available\n");
2800           return JNI_EINVAL;
2801     // -native
2802     } else if (match_option(option, "-native", &tail)) {
2803           // HotSpot always uses native threads, ignore silently for compatibility
2804     // -Xsqnopause
2805     } else if (match_option(option, "-Xsqnopause", &tail)) {


src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File