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

src/share/vm/runtime/arguments.cpp

Print this page




1125   if (RequireSharedSpaces) {
1126     jio_fprintf(defaultStream::error_stream(),
1127       "Class data sharing is inconsistent with other specified options.\n");
1128     vm_exit_during_initialization("Unable to use shared archive.", NULL);
1129   } else {
1130     FLAG_SET_DEFAULT(UseSharedSpaces, false);
1131   }
1132 }
1133 #endif
1134 
1135 void Arguments::set_tiered_flags() {
1136   // With tiered, set default policy to AdvancedThresholdPolicy, which is 3.
1137   if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
1138     FLAG_SET_DEFAULT(CompilationPolicyChoice, 3);
1139   }
1140   if (CompilationPolicyChoice < 2) {
1141     vm_exit_during_initialization(
1142       "Incompatible compilation policy selected", NULL);
1143   }
1144   // Increase the code cache size - tiered compiles a lot more.
1145   if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {





1146     FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5);


1147   }
1148   if (!UseInterpreter) { // -Xcomp
1149     Tier3InvokeNotifyFreqLog = 0;
1150     Tier4InvocationThreshold = 0;
1151   }
1152 }
1153 
1154 #if INCLUDE_ALL_GCS
1155 static void disable_adaptive_size_policy(const char* collector_name) {
1156   if (UseAdaptiveSizePolicy) {
1157     if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
1158       warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
1159               collector_name);
1160     }
1161     FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
1162   }
1163 }
1164 
1165 void Arguments::set_parnew_gc_flags() {
1166   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,


2374     jio_fprintf(defaultStream::error_stream(),
2375                 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2376                 os::vm_page_size()/K);
2377     status = false;
2378   } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2379     jio_fprintf(defaultStream::error_stream(),
2380                 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2381                 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2382     status = false;
2383   } else if (ReservedCodeCacheSize < min_code_cache_size) {
2384     jio_fprintf(defaultStream::error_stream(),
2385                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2386                 min_code_cache_size/K);
2387     status = false;
2388   } else if (ReservedCodeCacheSize > 2*G) {
2389     // Code cache size larger than MAXINT is not supported.
2390     jio_fprintf(defaultStream::error_stream(),
2391                 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2392                 (2*G)/M);
2393     status = false;











2394   }
2395 
2396   status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2397   status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2398   status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
2399   status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
2400 
2401   // TieredCompilation needs at least 2 compiler threads.
2402   const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : 1;
2403   status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount");
2404 
2405   return status;
2406 }
2407 
2408 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2409   const char* option_type) {
2410   if (ignore) return false;
2411 
2412   const char* spacer = " ";
2413   if (option_type == NULL) {


2792       julong long_CodeCacheExpansionSize = 0;
2793       ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2794       if (errcode != arg_in_range) {
2795         jio_fprintf(defaultStream::error_stream(),
2796                    "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2797                    os::vm_page_size()/K);
2798         return JNI_EINVAL;
2799       }
2800       FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
2801     } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2802                match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2803       julong long_ReservedCodeCacheSize = 0;
2804 
2805       ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2806       if (errcode != arg_in_range) {
2807         jio_fprintf(defaultStream::error_stream(),
2808                     "Invalid maximum code cache size: %s.\n", option->optionString);
2809         return JNI_EINVAL;
2810       }
2811       FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);






















2812       //-XX:IncreaseFirstTierCompileThresholdAt=
2813       } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2814         uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2815         if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2816           jio_fprintf(defaultStream::error_stream(),
2817                       "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2818                       option->optionString);
2819           return JNI_EINVAL;
2820         }
2821         FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2822     // -green
2823     } else if (match_option(option, "-green", &tail)) {
2824       jio_fprintf(defaultStream::error_stream(),
2825                   "Green threads support not available\n");
2826           return JNI_EINVAL;
2827     // -native
2828     } else if (match_option(option, "-native", &tail)) {
2829           // HotSpot always uses native threads, ignore silently for compatibility
2830     // -Xsqnopause
2831     } else if (match_option(option, "-Xsqnopause", &tail)) {




1125   if (RequireSharedSpaces) {
1126     jio_fprintf(defaultStream::error_stream(),
1127       "Class data sharing is inconsistent with other specified options.\n");
1128     vm_exit_during_initialization("Unable to use shared archive.", NULL);
1129   } else {
1130     FLAG_SET_DEFAULT(UseSharedSpaces, false);
1131   }
1132 }
1133 #endif
1134 
1135 void Arguments::set_tiered_flags() {
1136   // With tiered, set default policy to AdvancedThresholdPolicy, which is 3.
1137   if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
1138     FLAG_SET_DEFAULT(CompilationPolicyChoice, 3);
1139   }
1140   if (CompilationPolicyChoice < 2) {
1141     vm_exit_during_initialization(
1142       "Incompatible compilation policy selected", NULL);
1143   }
1144   // Increase the code cache size - tiered compiles a lot more.
1145   if (FLAG_IS_DEFAULT(ReservedCodeCacheSize) &&
1146       FLAG_IS_DEFAULT(ProfiledCodeHeapSize) &&
1147       FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
1148     intx non_method_size = ReservedCodeCacheSize - (ProfiledCodeHeapSize + NonProfiledCodeHeapSize);
1149 
1150     // Multiply sizes by 5 but fix non_method_size (distribute among non-profiled and profiled code heap)
1151     FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5);
1152     FLAG_SET_DEFAULT(ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + non_method_size * 2);
1153     FLAG_SET_DEFAULT(NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + non_method_size * 2);
1154   }
1155   if (!UseInterpreter) { // -Xcomp
1156     Tier3InvokeNotifyFreqLog = 0;
1157     Tier4InvocationThreshold = 0;
1158   }
1159 }
1160 
1161 #if INCLUDE_ALL_GCS
1162 static void disable_adaptive_size_policy(const char* collector_name) {
1163   if (UseAdaptiveSizePolicy) {
1164     if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
1165       warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
1166               collector_name);
1167     }
1168     FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
1169   }
1170 }
1171 
1172 void Arguments::set_parnew_gc_flags() {
1173   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,


2381     jio_fprintf(defaultStream::error_stream(),
2382                 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2383                 os::vm_page_size()/K);
2384     status = false;
2385   } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2386     jio_fprintf(defaultStream::error_stream(),
2387                 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2388                 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2389     status = false;
2390   } else if (ReservedCodeCacheSize < min_code_cache_size) {
2391     jio_fprintf(defaultStream::error_stream(),
2392                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2393                 min_code_cache_size/K);
2394     status = false;
2395   } else if (ReservedCodeCacheSize > 2*G) {
2396     // Code cache size larger than MAXINT is not supported.
2397     jio_fprintf(defaultStream::error_stream(),
2398                 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2399                 (2*G)/M);
2400     status = false;
2401   } else if (NonMethodCodeHeapSize < min_code_cache_size){
2402     jio_fprintf(defaultStream::error_stream(),
2403                 "Invalid NonMethodCodeHeapSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2404                 min_code_cache_size/K);
2405     status = false;
2406   } else if ((!FLAG_IS_DEFAULT(NonMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
2407       && (NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
2408     jio_fprintf(defaultStream::error_stream(),
2409                 "Invalid NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
2410                 (NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
2411     status = false;
2412   }
2413 
2414   status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2415   status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2416   status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
2417   status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
2418 
2419   // TieredCompilation needs at least 2 compiler threads.
2420   const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : 1;
2421   status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount");
2422 
2423   return status;
2424 }
2425 
2426 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2427   const char* option_type) {
2428   if (ignore) return false;
2429 
2430   const char* spacer = " ";
2431   if (option_type == NULL) {


2810       julong long_CodeCacheExpansionSize = 0;
2811       ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2812       if (errcode != arg_in_range) {
2813         jio_fprintf(defaultStream::error_stream(),
2814                    "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2815                    os::vm_page_size()/K);
2816         return JNI_EINVAL;
2817       }
2818       FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
2819     } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2820                match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2821       julong long_ReservedCodeCacheSize = 0;
2822 
2823       ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2824       if (errcode != arg_in_range) {
2825         jio_fprintf(defaultStream::error_stream(),
2826                     "Invalid maximum code cache size: %s.\n", option->optionString);
2827         return JNI_EINVAL;
2828       }
2829       FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
2830     // -XX:ProfiledCodeHeapSize=
2831     } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
2832       julong long_ProfiledCodeHeapSize = 0;
2833 
2834       ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1);
2835       if (errcode != arg_in_range) {
2836         jio_fprintf(defaultStream::error_stream(),
2837                     "Invalid maximum profiled code heap size: %s.\n", option->optionString);
2838         return JNI_EINVAL;
2839       }
2840       FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize);
2841       // -XX:NonProfiledCodeHeapSizee=
2842     } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) {
2843       julong long_NonProfiledCodeHeapSize = 0;
2844 
2845       ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
2846       if (errcode != arg_in_range) {
2847         jio_fprintf(defaultStream::error_stream(),
2848                     "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
2849         return JNI_EINVAL;
2850       }
2851       FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize);
2852       //-XX:IncreaseFirstTierCompileThresholdAt=
2853     } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2854         uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2855         if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2856           jio_fprintf(defaultStream::error_stream(),
2857                       "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2858                       option->optionString);
2859           return JNI_EINVAL;
2860         }
2861         FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2862     // -green
2863     } else if (match_option(option, "-green", &tail)) {
2864       jio_fprintf(defaultStream::error_stream(),
2865                   "Green threads support not available\n");
2866           return JNI_EINVAL;
2867     // -native
2868     } else if (match_option(option, "-native", &tail)) {
2869           // HotSpot always uses native threads, ignore silently for compatibility
2870     // -Xsqnopause
2871     } 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