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




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.", message);
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 /**
1155  * Returns the minimum number of compiler threads needed to run the JVM. The following
1156  * configurations are possible.
1157  *
1158  * 1) The JVM is build using an interpreter only. As a result, the minimum number of
1159  *    compiler threads is 0.
1160  * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
1161  *    a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
1162  * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
1163  *    the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
1164  *    C1 can be used, so the minimum number of compiler threads is 1.
1165  * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
1166  *    'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,


2425     jio_fprintf(defaultStream::error_stream(),
2426                 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2427                 os::vm_page_size()/K);
2428     status = false;
2429   } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2430     jio_fprintf(defaultStream::error_stream(),
2431                 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2432                 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2433     status = false;
2434   } else if (ReservedCodeCacheSize < min_code_cache_size) {
2435     jio_fprintf(defaultStream::error_stream(),
2436                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2437                 min_code_cache_size/K);
2438     status = false;
2439   } else if (ReservedCodeCacheSize > 2*G) {
2440     // Code cache size larger than MAXINT is not supported.
2441     jio_fprintf(defaultStream::error_stream(),
2442                 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2443                 (2*G)/M);
2444     status = false;












2445   }
2446 
2447   status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2448   status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2449   status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
2450   status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
2451 
2452   int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
2453   // The default CICompilerCount's value is CI_COMPILER_COUNT.
2454   assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
2455   // Check the minimum number of compiler threads
2456   status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
2457 
2458   if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
2459     warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
2460   }
2461 
2462   status &= check_vm_args_consistency_ext();
2463 
2464   return status;


2851       julong long_CodeCacheExpansionSize = 0;
2852       ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2853       if (errcode != arg_in_range) {
2854         jio_fprintf(defaultStream::error_stream(),
2855                    "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2856                    os::vm_page_size()/K);
2857         return JNI_EINVAL;
2858       }
2859       FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
2860     } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2861                match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2862       julong long_ReservedCodeCacheSize = 0;
2863 
2864       ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2865       if (errcode != arg_in_range) {
2866         jio_fprintf(defaultStream::error_stream(),
2867                     "Invalid maximum code cache size: %s.\n", option->optionString);
2868         return JNI_EINVAL;
2869       }
2870       FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);

































2871       //-XX:IncreaseFirstTierCompileThresholdAt=
2872       } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2873         uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2874         if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2875           jio_fprintf(defaultStream::error_stream(),
2876                       "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2877                       option->optionString);
2878           return JNI_EINVAL;
2879         }
2880         FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2881     // -green
2882     } else if (match_option(option, "-green", &tail)) {
2883       jio_fprintf(defaultStream::error_stream(),
2884                   "Green threads support not available\n");
2885           return JNI_EINVAL;
2886     // -native
2887     } else if (match_option(option, "-native", &tail)) {
2888           // HotSpot always uses native threads, ignore silently for compatibility
2889     // -Xsqnopause
2890     } else if (match_option(option, "-Xsqnopause", &tail)) {




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.", message);
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_ERGO(uintx, ReservedCodeCacheSize, ReservedCodeCacheSize * 5);
1147   }
1148   // Enable SegmentedCodeCache if TieredCompilation is enabled and ReservedCodeCacheSize >= 240M
1149   if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) {
1150     FLAG_SET_ERGO(bool, SegmentedCodeCache, true);
1151 
1152     // Multiply sizes by 5 but fix NonMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
1153     if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
1154       FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
1155     }
1156     if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
1157       FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
1158     }
1159     // Check consistency of code heap sizes
1160     if ((NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
1161       jio_fprintf(defaultStream::error_stream(),
1162                   "Invalid code heap sizes: NonMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
1163                   NonMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
1164                   (NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
1165       vm_exit(1);
1166     }
1167   }
1168   if (!UseInterpreter) { // -Xcomp
1169     Tier3InvokeNotifyFreqLog = 0;
1170     Tier4InvocationThreshold = 0;
1171   }
1172 }
1173 
1174 /**
1175  * Returns the minimum number of compiler threads needed to run the JVM. The following
1176  * configurations are possible.
1177  *
1178  * 1) The JVM is build using an interpreter only. As a result, the minimum number of
1179  *    compiler threads is 0.
1180  * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
1181  *    a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
1182  * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
1183  *    the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
1184  *    C1 can be used, so the minimum number of compiler threads is 1.
1185  * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
1186  *    'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,


2445     jio_fprintf(defaultStream::error_stream(),
2446                 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2447                 os::vm_page_size()/K);
2448     status = false;
2449   } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2450     jio_fprintf(defaultStream::error_stream(),
2451                 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2452                 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2453     status = false;
2454   } else if (ReservedCodeCacheSize < min_code_cache_size) {
2455     jio_fprintf(defaultStream::error_stream(),
2456                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2457                 min_code_cache_size/K);
2458     status = false;
2459   } else if (ReservedCodeCacheSize > 2*G) {
2460     // Code cache size larger than MAXINT is not supported.
2461     jio_fprintf(defaultStream::error_stream(),
2462                 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2463                 (2*G)/M);
2464     status = false;
2465   } else if (NonMethodCodeHeapSize < min_code_cache_size){
2466     jio_fprintf(defaultStream::error_stream(),
2467                 "Invalid NonMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonMethodCodeHeapSize/K,
2468                 min_code_cache_size/K);
2469     status = false;
2470   } else if ((!FLAG_IS_DEFAULT(NonMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
2471              && (NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
2472     jio_fprintf(defaultStream::error_stream(),
2473                 "Invalid code heap sizes: NonMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
2474                 NonMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
2475                 (NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
2476     status = false;
2477   }
2478 
2479   status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2480   status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2481   status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
2482   status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
2483 
2484   int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
2485   // The default CICompilerCount's value is CI_COMPILER_COUNT.
2486   assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
2487   // Check the minimum number of compiler threads
2488   status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
2489 
2490   if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
2491     warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
2492   }
2493 
2494   status &= check_vm_args_consistency_ext();
2495 
2496   return status;


2883       julong long_CodeCacheExpansionSize = 0;
2884       ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2885       if (errcode != arg_in_range) {
2886         jio_fprintf(defaultStream::error_stream(),
2887                    "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2888                    os::vm_page_size()/K);
2889         return JNI_EINVAL;
2890       }
2891       FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
2892     } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2893                match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2894       julong long_ReservedCodeCacheSize = 0;
2895 
2896       ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2897       if (errcode != arg_in_range) {
2898         jio_fprintf(defaultStream::error_stream(),
2899                     "Invalid maximum code cache size: %s.\n", option->optionString);
2900         return JNI_EINVAL;
2901       }
2902       FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
2903       // -XX:NonMethodCodeHeapSize=
2904     } else if (match_option(option, "-XX:NonMethodCodeHeapSize=", &tail)) {
2905       julong long_NonMethodCodeHeapSize = 0;
2906 
2907       ArgsRange errcode = parse_memory_size(tail, &long_NonMethodCodeHeapSize, 1);
2908       if (errcode != arg_in_range) {
2909         jio_fprintf(defaultStream::error_stream(),
2910                     "Invalid maximum non-method code heap size: %s.\n", option->optionString);
2911         return JNI_EINVAL;
2912       }
2913       FLAG_SET_CMDLINE(uintx, NonMethodCodeHeapSize, (uintx)long_NonMethodCodeHeapSize);
2914       // -XX:ProfiledCodeHeapSize=
2915     } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
2916       julong long_ProfiledCodeHeapSize = 0;
2917 
2918       ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1);
2919       if (errcode != arg_in_range) {
2920         jio_fprintf(defaultStream::error_stream(),
2921                     "Invalid maximum profiled code heap size: %s.\n", option->optionString);
2922         return JNI_EINVAL;
2923       }
2924       FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize);
2925       // -XX:NonProfiledCodeHeapSizee=
2926     } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) {
2927       julong long_NonProfiledCodeHeapSize = 0;
2928 
2929       ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
2930       if (errcode != arg_in_range) {
2931         jio_fprintf(defaultStream::error_stream(),
2932                     "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
2933         return JNI_EINVAL;
2934       }
2935       FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize);
2936       //-XX:IncreaseFirstTierCompileThresholdAt=
2937     } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2938         uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2939         if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2940           jio_fprintf(defaultStream::error_stream(),
2941                       "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2942                       option->optionString);
2943           return JNI_EINVAL;
2944         }
2945         FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2946     // -green
2947     } else if (match_option(option, "-green", &tail)) {
2948       jio_fprintf(defaultStream::error_stream(),
2949                   "Green threads support not available\n");
2950           return JNI_EINVAL;
2951     // -native
2952     } else if (match_option(option, "-native", &tail)) {
2953           // HotSpot always uses native threads, ignore silently for compatibility
2954     // -Xsqnopause
2955     } 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