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, 1167 * the minimum number of compiler threads is 2. 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)) { | 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 // 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 non_method_size (distribute among non-profiled and profiled code heap) 1153 intx non_method_size = ReservedCodeCacheSize - (ProfiledCodeHeapSize + NonProfiledCodeHeapSize); 1154 if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize) && FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) { 1155 FLAG_SET_DEFAULT(ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + non_method_size * 2); 1156 FLAG_SET_DEFAULT(NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + non_method_size * 2); 1157 } 1158 } 1159 if (!UseInterpreter) { // -Xcomp 1160 Tier3InvokeNotifyFreqLog = 0; 1161 Tier4InvocationThreshold = 0; 1162 } 1163 } 1164 1165 /** 1166 * Returns the minimum number of compiler threads needed to run the JVM. The following 1167 * configurations are possible. 1168 * 1169 * 1) The JVM is build using an interpreter only. As a result, the minimum number of 1170 * compiler threads is 0. 1171 * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As 1172 * a result, either C1 or C2 is used, so the minimum number of compiler threads is 1. 1173 * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However, 1174 * the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only 1175 * C1 can be used, so the minimum number of compiler threads is 1. 1176 * 4) The JVM is build using the compilers and tiered compilation is enabled. The option 1177 * 'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result, 1178 * the minimum number of compiler threads is 2. 2436 jio_fprintf(defaultStream::error_stream(), 2437 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K, 2438 os::vm_page_size()/K); 2439 status = false; 2440 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) { 2441 jio_fprintf(defaultStream::error_stream(), 2442 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", 2443 ReservedCodeCacheSize/K, InitialCodeCacheSize/K); 2444 status = false; 2445 } else if (ReservedCodeCacheSize < min_code_cache_size) { 2446 jio_fprintf(defaultStream::error_stream(), 2447 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, 2448 min_code_cache_size/K); 2449 status = false; 2450 } else if (ReservedCodeCacheSize > 2*G) { 2451 // Code cache size larger than MAXINT is not supported. 2452 jio_fprintf(defaultStream::error_stream(), 2453 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, 2454 (2*G)/M); 2455 status = false; 2456 } else if (NonMethodCodeHeapSize < min_code_cache_size){ 2457 jio_fprintf(defaultStream::error_stream(), 2458 "Invalid NonMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonMethodCodeHeapSize/K, 2459 min_code_cache_size/K); 2460 status = false; 2461 } else if ((!FLAG_IS_DEFAULT(NonMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) 2462 && (NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) { 2463 jio_fprintf(defaultStream::error_stream(), 2464 "Invalid NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n", 2465 (NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K); 2466 status = false; 2467 } 2468 2469 status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction"); 2470 status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity"); 2471 status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength"); 2472 status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize"); 2473 2474 int min_number_of_compiler_threads = get_min_number_of_compiler_threads(); 2475 // The default CICompilerCount's value is CI_COMPILER_COUNT. 2476 assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number"); 2477 // Check the minimum number of compiler threads 2478 status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount"); 2479 2480 if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) { 2481 warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); 2482 } 2483 2484 status &= check_vm_args_consistency_ext(); 2485 2486 return status; 2873 julong long_CodeCacheExpansionSize = 0; 2874 ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size()); 2875 if (errcode != arg_in_range) { 2876 jio_fprintf(defaultStream::error_stream(), 2877 "Invalid argument: %s. Must be at least %luK.\n", option->optionString, 2878 os::vm_page_size()/K); 2879 return JNI_EINVAL; 2880 } 2881 FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize); 2882 } else if (match_option(option, "-Xmaxjitcodesize", &tail) || 2883 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { 2884 julong long_ReservedCodeCacheSize = 0; 2885 2886 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1); 2887 if (errcode != arg_in_range) { 2888 jio_fprintf(defaultStream::error_stream(), 2889 "Invalid maximum code cache size: %s.\n", option->optionString); 2890 return JNI_EINVAL; 2891 } 2892 FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize); 2893 // -XX:NonMethodCodeHeapSize= 2894 } else if (match_option(option, "-XX:NonMethodCodeHeapSize=", &tail)) { 2895 julong long_NonMethodCodeHeapSize = 0; 2896 2897 ArgsRange errcode = parse_memory_size(tail, &long_NonMethodCodeHeapSize, 1); 2898 if (errcode != arg_in_range) { 2899 jio_fprintf(defaultStream::error_stream(), 2900 "Invalid maximum non-method code heap size: %s.\n", option->optionString); 2901 return JNI_EINVAL; 2902 } 2903 FLAG_SET_CMDLINE(uintx, NonMethodCodeHeapSize, (uintx)long_NonMethodCodeHeapSize); 2904 // -XX:ProfiledCodeHeapSize= 2905 } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) { 2906 julong long_ProfiledCodeHeapSize = 0; 2907 2908 ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1); 2909 if (errcode != arg_in_range) { 2910 jio_fprintf(defaultStream::error_stream(), 2911 "Invalid maximum profiled code heap size: %s.\n", option->optionString); 2912 return JNI_EINVAL; 2913 } 2914 FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize); 2915 // -XX:NonProfiledCodeHeapSizee= 2916 } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) { 2917 julong long_NonProfiledCodeHeapSize = 0; 2918 2919 ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1); 2920 if (errcode != arg_in_range) { 2921 jio_fprintf(defaultStream::error_stream(), 2922 "Invalid maximum non-profiled code heap size: %s.\n", option->optionString); 2923 return JNI_EINVAL; 2924 } 2925 FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize); 2926 //-XX:IncreaseFirstTierCompileThresholdAt= 2927 } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) { 2928 uintx uint_IncreaseFirstTierCompileThresholdAt = 0; 2929 if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) { 2930 jio_fprintf(defaultStream::error_stream(), 2931 "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n", 2932 option->optionString); 2933 return JNI_EINVAL; 2934 } 2935 FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt); 2936 // -green 2937 } else if (match_option(option, "-green", &tail)) { 2938 jio_fprintf(defaultStream::error_stream(), 2939 "Green threads support not available\n"); 2940 return JNI_EINVAL; 2941 // -native 2942 } else if (match_option(option, "-native", &tail)) { 2943 // HotSpot always uses native threads, ignore silently for compatibility 2944 // -Xsqnopause 2945 } else if (match_option(option, "-Xsqnopause", &tail)) { |