src/share/vm/runtime/arguments.cpp

Print this page




1263   // Preferred young gen size for "short" pauses:
1264   // upper bound depends on # of threads and NewRatio.
1265   const uintx parallel_gc_threads =
1266     (ParallelGCThreads == 0 ? 1 : ParallelGCThreads);
1267   const size_t preferred_max_new_size_unaligned =
1268     MIN2(max_heap/(NewRatio+1), ScaleForWordSize(young_gen_per_worker * parallel_gc_threads));
1269   size_t preferred_max_new_size =
1270     align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());
1271 
1272   // Unless explicitly requested otherwise, size young gen
1273   // for "short" pauses ~ CMSYoungGenPerWorker*ParallelGCThreads
1274 
1275   // If either MaxNewSize or NewRatio is set on the command line,
1276   // assume the user is trying to set the size of the young gen.
1277   if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) {
1278 
1279     // Set MaxNewSize to our calculated preferred_max_new_size unless
1280     // NewSize was set on the command line and it is larger than
1281     // preferred_max_new_size.
1282     if (!FLAG_IS_DEFAULT(NewSize)) {   // NewSize explicitly set at command-line
1283       FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size));
1284     } else {
1285       FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size);
1286     }
1287     if (PrintGCDetails && Verbose) {
1288       // Too early to use gclog_or_tty
1289       tty->print_cr("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
1290     }
1291 
1292     // Code along this path potentially sets NewSize and OldSize
1293     if (PrintGCDetails && Verbose) {
1294       // Too early to use gclog_or_tty
1295       tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT
1296            " initial_heap_size:  " SIZE_FORMAT
1297            " max_heap: " SIZE_FORMAT,
1298            min_heap_size(), InitialHeapSize, max_heap);
1299     }
1300     size_t min_new = preferred_max_new_size;
1301     if (FLAG_IS_CMDLINE(NewSize)) {
1302       min_new = NewSize;
1303     }
1304     if (max_heap > min_new && min_heap_size() > min_new) {
1305       // Unless explicitly requested otherwise, make young gen
1306       // at least min_new, and at most preferred_max_new_size.
1307       if (FLAG_IS_DEFAULT(NewSize)) {
1308         FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new));
1309         FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize));
1310         if (PrintGCDetails && Verbose) {
1311           // Too early to use gclog_or_tty
1312           tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
1313         }
1314       }
1315       // Unless explicitly requested otherwise, size old gen
1316       // so it's NewRatio x of NewSize.
1317       if (FLAG_IS_DEFAULT(OldSize)) {
1318         if (max_heap > NewSize) {
1319           FLAG_SET_ERGO(uintx, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
1320           if (PrintGCDetails && Verbose) {
1321             // Too early to use gclog_or_tty
1322             tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);
1323           }
1324         }
1325       }
1326     }
1327   }
1328   // Unless explicitly requested otherwise, definitely
1329   // promote all objects surviving "tenuring_default" scavenges.
1330   if (FLAG_IS_DEFAULT(MaxTenuringThreshold) &&
1331       FLAG_IS_DEFAULT(SurvivorRatio)) {
1332     FLAG_SET_ERGO(uintx, MaxTenuringThreshold, tenuring_default);
1333   }
1334   // If we decided above (or user explicitly requested)
1335   // `promote all' (via MaxTenuringThreshold := 0),
1336   // prefer minuscule survivor spaces so as not to waste
1337   // space for (non-existent) survivors
1338   if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) {
1339     FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx)1024, SurvivorRatio));




1263   // Preferred young gen size for "short" pauses:
1264   // upper bound depends on # of threads and NewRatio.
1265   const uintx parallel_gc_threads =
1266     (ParallelGCThreads == 0 ? 1 : ParallelGCThreads);
1267   const size_t preferred_max_new_size_unaligned =
1268     MIN2(max_heap/(NewRatio+1), ScaleForWordSize(young_gen_per_worker * parallel_gc_threads));
1269   size_t preferred_max_new_size =
1270     align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());
1271 
1272   // Unless explicitly requested otherwise, size young gen
1273   // for "short" pauses ~ CMSYoungGenPerWorker*ParallelGCThreads
1274 
1275   // If either MaxNewSize or NewRatio is set on the command line,
1276   // assume the user is trying to set the size of the young gen.
1277   if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) {
1278 
1279     // Set MaxNewSize to our calculated preferred_max_new_size unless
1280     // NewSize was set on the command line and it is larger than
1281     // preferred_max_new_size.
1282     if (!FLAG_IS_DEFAULT(NewSize)) {   // NewSize explicitly set at command-line
1283       FLAG_SET_ERGO(uintx, MaxNewSize, MAX2((size_t)NewSize, preferred_max_new_size));
1284     } else {
1285       FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size);
1286     }
1287     if (PrintGCDetails && Verbose) {
1288       // Too early to use gclog_or_tty
1289       tty->print_cr("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
1290     }
1291 
1292     // Code along this path potentially sets NewSize and OldSize
1293     if (PrintGCDetails && Verbose) {
1294       // Too early to use gclog_or_tty
1295       tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT
1296            " initial_heap_size:  " SIZE_FORMAT
1297            " max_heap: " SIZE_FORMAT,
1298            min_heap_size(), InitialHeapSize, max_heap);
1299     }
1300     size_t min_new = preferred_max_new_size;
1301     if (FLAG_IS_CMDLINE(NewSize)) {
1302       min_new = NewSize;
1303     }
1304     if (max_heap > min_new && min_heap_size() > min_new) {
1305       // Unless explicitly requested otherwise, make young gen
1306       // at least min_new, and at most preferred_max_new_size.
1307       if (FLAG_IS_DEFAULT(NewSize)) {
1308         FLAG_SET_ERGO(uintx, NewSize, MAX2((size_t)NewSize, min_new));
1309         FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, (size_t)NewSize));
1310         if (PrintGCDetails && Verbose) {
1311           // Too early to use gclog_or_tty
1312           tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
1313         }
1314       }
1315       // Unless explicitly requested otherwise, size old gen
1316       // so it's NewRatio x of NewSize.
1317       if (FLAG_IS_DEFAULT(OldSize)) {
1318         if (max_heap > NewSize) {
1319           FLAG_SET_ERGO(uintx, OldSize, MIN2((size_t)(NewRatio*NewSize), max_heap - NewSize));
1320           if (PrintGCDetails && Verbose) {
1321             // Too early to use gclog_or_tty
1322             tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);
1323           }
1324         }
1325       }
1326     }
1327   }
1328   // Unless explicitly requested otherwise, definitely
1329   // promote all objects surviving "tenuring_default" scavenges.
1330   if (FLAG_IS_DEFAULT(MaxTenuringThreshold) &&
1331       FLAG_IS_DEFAULT(SurvivorRatio)) {
1332     FLAG_SET_ERGO(uintx, MaxTenuringThreshold, tenuring_default);
1333   }
1334   // If we decided above (or user explicitly requested)
1335   // `promote all' (via MaxTenuringThreshold := 0),
1336   // prefer minuscule survivor spaces so as not to waste
1337   // space for (non-existent) survivors
1338   if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) {
1339     FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx)1024, SurvivorRatio));