1066 vm_exit_during_initialization( 1067 "Incompatible compilation policy selected", NULL); 1068 } 1069 // Increase the code cache size - tiered compiles a lot more. 1070 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { 1071 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); 1072 } 1073 } 1074 1075 #if INCLUDE_ALTERNATE_GCS 1076 static void disable_adaptive_size_policy(const char* collector_name) { 1077 if (UseAdaptiveSizePolicy) { 1078 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { 1079 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", 1080 collector_name); 1081 } 1082 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); 1083 } 1084 } 1085 1086 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC 1087 // if it's not explictly set or unset. If the user has chosen 1088 // UseParNewGC and not explicitly set ParallelGCThreads we 1089 // set it, unless this is a single cpu machine. 1090 void Arguments::set_parnew_gc_flags() { 1091 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, 1092 "control point invariant"); 1093 assert(UseParNewGC, "Error"); 1094 1095 // Turn off AdaptiveSizePolicy for parnew until it is complete. 1096 disable_adaptive_size_policy("UseParNewGC"); 1097 1098 if (ParallelGCThreads == 0) { 1099 FLAG_SET_DEFAULT(ParallelGCThreads, 1100 Abstract_VM_Version::parallel_worker_threads()); 1101 if (ParallelGCThreads == 1) { 1102 FLAG_SET_DEFAULT(UseParNewGC, false); 1103 FLAG_SET_DEFAULT(ParallelGCThreads, 0); 1104 } 1105 } 1106 if (UseParNewGC) { 1107 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively, 1108 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration 1109 // we set them to 1024 and 1024. 1110 // See CR 6362902. 1111 if (FLAG_IS_DEFAULT(YoungPLABSize)) { 1112 FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024); 1113 } 1114 if (FLAG_IS_DEFAULT(OldPLABSize)) { 1115 FLAG_SET_DEFAULT(OldPLABSize, (intx)1024); 1116 } 1117 1118 // AlwaysTenure flag should make ParNew promote all at first collection. 1119 // See CR 6362902. 1120 if (AlwaysTenure) { 1121 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0); 1122 } 1123 // When using compressed oops, we use local overflow stacks, 1124 // rather than using a global overflow list chained through 1125 // the klass word of the object's pre-image. 1126 if (UseCompressedOops && !ParGCUseLocalOverflow) { 1127 if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) { 1128 warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references"); 1129 } 1130 FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true); 1131 } 1132 assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error"); 1133 } 1134 } 1135 1136 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on 1137 // sparc/solaris for certain applications, but would gain from 1138 // further optimization and tuning efforts, and would almost 1139 // certainly gain from analysis of platform and environment. 1140 void Arguments::set_cms_and_parnew_gc_flags() { 1141 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error"); 1142 assert(UseConcMarkSweepGC, "CMS is expected to be on here"); 1143 1144 // If we are using CMS, we prefer to UseParNewGC, 1145 // unless explicitly forbidden. 1146 if (FLAG_IS_DEFAULT(UseParNewGC)) { 1147 FLAG_SET_ERGO(bool, UseParNewGC, true); 1148 } 1149 1150 // Turn off AdaptiveSizePolicy by default for cms until it is complete. 1151 disable_adaptive_size_policy("UseConcMarkSweepGC"); 1152 1153 // In either case, adjust ParallelGCThreads and/or UseParNewGC | 1066 vm_exit_during_initialization( 1067 "Incompatible compilation policy selected", NULL); 1068 } 1069 // Increase the code cache size - tiered compiles a lot more. 1070 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { 1071 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); 1072 } 1073 } 1074 1075 #if INCLUDE_ALTERNATE_GCS 1076 static void disable_adaptive_size_policy(const char* collector_name) { 1077 if (UseAdaptiveSizePolicy) { 1078 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { 1079 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", 1080 collector_name); 1081 } 1082 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); 1083 } 1084 } 1085 1086 void Arguments::set_parnew_gc_flags() { 1087 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, 1088 "control point invariant"); 1089 assert(UseParNewGC, "Error"); 1090 1091 // Turn off AdaptiveSizePolicy for parnew until it is complete. 1092 disable_adaptive_size_policy("UseParNewGC"); 1093 1094 if (FLAG_IS_DEFAULT(ParallelGCThreads)) { 1095 FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads()); 1096 assert(ParallelGCThreads > 0, "We should always have at least one thread by default"); 1097 } else if (ParallelGCThreads == 0) { 1098 jio_fprintf(defaultStream::error_stream(), 1099 "The ParNew GC can not be combined with -XX:ParallelGCThreads=0\n"); 1100 vm_exit(1); 1101 } 1102 1103 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively, 1104 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration 1105 // we set them to 1024 and 1024. 1106 // See CR 6362902. 1107 if (FLAG_IS_DEFAULT(YoungPLABSize)) { 1108 FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024); 1109 } 1110 if (FLAG_IS_DEFAULT(OldPLABSize)) { 1111 FLAG_SET_DEFAULT(OldPLABSize, (intx)1024); 1112 } 1113 1114 // AlwaysTenure flag should make ParNew promote all at first collection. 1115 // See CR 6362902. 1116 if (AlwaysTenure) { 1117 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0); 1118 } 1119 // When using compressed oops, we use local overflow stacks, 1120 // rather than using a global overflow list chained through 1121 // the klass word of the object's pre-image. 1122 if (UseCompressedOops && !ParGCUseLocalOverflow) { 1123 if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) { 1124 warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references"); 1125 } 1126 FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true); 1127 } 1128 assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error"); 1129 } 1130 1131 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on 1132 // sparc/solaris for certain applications, but would gain from 1133 // further optimization and tuning efforts, and would almost 1134 // certainly gain from analysis of platform and environment. 1135 void Arguments::set_cms_and_parnew_gc_flags() { 1136 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error"); 1137 assert(UseConcMarkSweepGC, "CMS is expected to be on here"); 1138 1139 // If we are using CMS, we prefer to UseParNewGC, 1140 // unless explicitly forbidden. 1141 if (FLAG_IS_DEFAULT(UseParNewGC)) { 1142 FLAG_SET_ERGO(bool, UseParNewGC, true); 1143 } 1144 1145 // Turn off AdaptiveSizePolicy by default for cms until it is complete. 1146 disable_adaptive_size_policy("UseConcMarkSweepGC"); 1147 1148 // In either case, adjust ParallelGCThreads and/or UseParNewGC |