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 } 1150 1151 void Arguments::set_parnew_gc_flags() { 1152 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, 1153 "control point invariant"); 1154 assert(UseParNewGC, "Error"); 1155 1156 // Turn off AdaptiveSizePolicy for parnew until it is complete. 1157 disable_adaptive_size_policy("UseParNewGC"); 3626 3627 // Set flags based on ergonomics. 3628 set_ergonomics_flags(); 3629 3630 set_shared_spaces_flags(); 3631 3632 // Check the GC selections again. 3633 if (!check_gc_consistency()) { 3634 return JNI_EINVAL; 3635 } 3636 3637 if (TieredCompilation) { 3638 set_tiered_flags(); 3639 } else { 3640 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup. 3641 if (CompilationPolicyChoice >= 2) { 3642 vm_exit_during_initialization( 3643 "Incompatible compilation policy selected", NULL); 3644 } 3645 } 3646 3647 // Set heap size based on available physical memory 3648 set_heap_size(); 3649 3650 #if INCLUDE_ALL_GCS 3651 // Set per-collector flags 3652 if (UseParallelGC || UseParallelOldGC) { 3653 set_parallel_gc_flags(); 3654 } else if (UseConcMarkSweepGC) { // should be done before ParNew check below 3655 set_cms_and_parnew_gc_flags(); 3656 } else if (UseParNewGC) { // skipped if CMS is set above 3657 set_parnew_gc_flags(); 3658 } else if (UseG1GC) { 3659 set_g1_gc_flags(); 3660 } 3661 check_deprecated_gcs(); 3662 check_deprecated_gc_flags(); 3663 if (AssumeMP && !UseSerialGC) { 3664 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) { 3665 warning("If the number of processors is expected to increase from one, then" | 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 } 1136 1137 #if INCLUDE_ALL_GCS 1138 static void disable_adaptive_size_policy(const char* collector_name) { 1139 if (UseAdaptiveSizePolicy) { 1140 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { 1141 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", 1142 collector_name); 1143 } 1144 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); 1145 } 1146 } 1147 1148 void Arguments::set_parnew_gc_flags() { 1149 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, 1150 "control point invariant"); 1151 assert(UseParNewGC, "Error"); 1152 1153 // Turn off AdaptiveSizePolicy for parnew until it is complete. 1154 disable_adaptive_size_policy("UseParNewGC"); 3623 3624 // Set flags based on ergonomics. 3625 set_ergonomics_flags(); 3626 3627 set_shared_spaces_flags(); 3628 3629 // Check the GC selections again. 3630 if (!check_gc_consistency()) { 3631 return JNI_EINVAL; 3632 } 3633 3634 if (TieredCompilation) { 3635 set_tiered_flags(); 3636 } else { 3637 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup. 3638 if (CompilationPolicyChoice >= 2) { 3639 vm_exit_during_initialization( 3640 "Incompatible compilation policy selected", NULL); 3641 } 3642 } 3643 // Set NmethodSweepFraction after the size of the code cache is adapted (in case of tiered) 3644 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) { 3645 FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M)); 3646 } 3647 3648 3649 // Set heap size based on available physical memory 3650 set_heap_size(); 3651 3652 #if INCLUDE_ALL_GCS 3653 // Set per-collector flags 3654 if (UseParallelGC || UseParallelOldGC) { 3655 set_parallel_gc_flags(); 3656 } else if (UseConcMarkSweepGC) { // should be done before ParNew check below 3657 set_cms_and_parnew_gc_flags(); 3658 } else if (UseParNewGC) { // skipped if CMS is set above 3659 set_parnew_gc_flags(); 3660 } else if (UseG1GC) { 3661 set_g1_gc_flags(); 3662 } 3663 check_deprecated_gcs(); 3664 check_deprecated_gc_flags(); 3665 if (AssumeMP && !UseSerialGC) { 3666 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) { 3667 warning("If the number of processors is expected to increase from one, then" |