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




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)) {




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     FLAG_SET_DEFAULT(ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5);
1131     FLAG_SET_DEFAULT(NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5);
1132   }
1133   if (!UseInterpreter) { // -Xcomp
1134     Tier3InvokeNotifyFreqLog = 0;
1135     Tier4InvocationThreshold = 0;
1136   }
1137   if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
1138     FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
1139   }
1140 }
1141 
1142 #if INCLUDE_ALL_GCS
1143 static void disable_adaptive_size_policy(const char* collector_name) {
1144   if (UseAdaptiveSizePolicy) {
1145     if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
1146       warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
1147               collector_name);
1148     }
1149     FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
1150   }
1151 }


2324     jio_fprintf(defaultStream::error_stream(),
2325                 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2326                 os::vm_page_size()/K);
2327     status = false;
2328   } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2329     jio_fprintf(defaultStream::error_stream(),
2330                 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2331                 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2332     status = false;
2333   } else if (ReservedCodeCacheSize < min_code_cache_size) {
2334     jio_fprintf(defaultStream::error_stream(),
2335                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2336                 min_code_cache_size/K);
2337     status = false;
2338   } else if (ReservedCodeCacheSize > 2*G) {
2339     // Code cache size larger than MAXINT is not supported.
2340     jio_fprintf(defaultStream::error_stream(),
2341                 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2342                 (2*G)/M);
2343     status = false;
2344   } else if ((!FLAG_IS_DEFAULT(NonProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize))
2345       && (NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
2346     jio_fprintf(defaultStream::error_stream(),
2347                 "Invalid NonProfiledCodeHeapSize + ProfiledCodeHeapSize = %dM. Must be equal to ReservedCodeCacheSize = %dM.\n",
2348                 (NonProfiledCodeHeapSize + ProfiledCodeHeapSize)/M, ReservedCodeCacheSize/M);
2349     status = false;
2350   }
2351 
2352   status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2353   status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2354 
2355   return status;
2356 }
2357 
2358 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2359   const char* option_type) {
2360   if (ignore) return false;
2361 
2362   const char* spacer = " ";
2363   if (option_type == NULL) {
2364     option_type = ++spacer; // Set both to the empty string.
2365   }
2366 
2367   if (os::obsolete_option(option)) {
2368     jio_fprintf(defaultStream::error_stream(),
2369                 "Obsolete %s%soption: %s\n", option_type, spacer,


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