hotspot/src/share/vm/runtime/arguments.cpp
changeset 8689 1d9c2c94ce9b
parent 8674 303a2149d371
parent 8687 264727307495
child 8725 8c1e3dd5fe1b
equal deleted inserted replaced
8679:17a8cfc08f1d 8689:1d9c2c94ce9b
   240                            JDK_Version::jdk_update(6,22), JDK_Version::jdk(7) },
   240                            JDK_Version::jdk_update(6,22), JDK_Version::jdk(7) },
   241   { "HandlePromotionFailure",
   241   { "HandlePromotionFailure",
   242                            JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
   242                            JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
   243   { "MaxLiveObjectEvacuationRatio",
   243   { "MaxLiveObjectEvacuationRatio",
   244                            JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
   244                            JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
       
   245   { "ForceSharedSpaces",   JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) },
   245   { NULL, JDK_Version(0), JDK_Version(0) }
   246   { NULL, JDK_Version(0), JDK_Version(0) }
   246 };
   247 };
   247 
   248 
   248 // Returns true if the flag is obsolete and fits into the range specified
   249 // Returns true if the flag is obsolete and fits into the range specified
   249 // for being ignored.  In the case that the flag is ignored, the 'version'
   250 // for being ignored.  In the case that the flag is ignored, the 'version'
  1001   } else {
  1002   } else {
  1002     FLAG_SET_DEFAULT(UseSharedSpaces, false);
  1003     FLAG_SET_DEFAULT(UseSharedSpaces, false);
  1003   }
  1004   }
  1004 }
  1005 }
  1005 
  1006 
  1006 void Arguments::check_compressed_oops_compat() {
       
  1007 #ifdef _LP64
       
  1008   assert(UseCompressedOops, "Precondition");
       
  1009   // Is it on by default or set on ergonomically
       
  1010   bool is_on_by_default = FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops);
       
  1011 
       
  1012   // If dumping an archive or forcing its use, disable compressed oops if possible
       
  1013   if (DumpSharedSpaces || RequireSharedSpaces) {
       
  1014     if (is_on_by_default) {
       
  1015       FLAG_SET_DEFAULT(UseCompressedOops, false);
       
  1016       return;
       
  1017     } else {
       
  1018       vm_exit_during_initialization(
       
  1019         "Class Data Sharing is not supported with compressed oops yet", NULL);
       
  1020     }
       
  1021   } else if (UseSharedSpaces) {
       
  1022     // UseSharedSpaces is on by default. With compressed oops, we turn it off.
       
  1023     FLAG_SET_DEFAULT(UseSharedSpaces, false);
       
  1024   }
       
  1025 #endif
       
  1026 }
       
  1027 
       
  1028 void Arguments::set_tiered_flags() {
  1007 void Arguments::set_tiered_flags() {
  1029   // With tiered, set default policy to AdvancedThresholdPolicy, which is 3.
  1008   // With tiered, set default policy to AdvancedThresholdPolicy, which is 3.
  1030   if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
  1009   if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
  1031     FLAG_SET_DEFAULT(CompilationPolicyChoice, 3);
  1010     FLAG_SET_DEFAULT(CompilationPolicyChoice, 3);
  1032   }
  1011   }
  1121   // as needed.
  1100   // as needed.
  1122   if (UseParNewGC) {
  1101   if (UseParNewGC) {
  1123     set_parnew_gc_flags();
  1102     set_parnew_gc_flags();
  1124   }
  1103   }
  1125 
  1104 
       
  1105   // MaxHeapSize is aligned down in collectorPolicy
       
  1106   size_t max_heap = align_size_down(MaxHeapSize,
       
  1107                                     CardTableRS::ct_max_alignment_constraint());
       
  1108 
  1126   // Now make adjustments for CMS
  1109   // Now make adjustments for CMS
  1127   size_t young_gen_per_worker;
  1110   intx   tenuring_default = (intx)6;
  1128   intx new_ratio;
  1111   size_t young_gen_per_worker = CMSYoungGenPerWorker;
  1129   size_t min_new_default;
  1112 
  1130   intx tenuring_default;
  1113   // Preferred young gen size for "short" pauses:
  1131   if (CMSUseOldDefaults) {  // old defaults: "old" as of 6.0
  1114   // upper bound depends on # of threads and NewRatio.
  1132     if FLAG_IS_DEFAULT(CMSYoungGenPerWorker) {
       
  1133       FLAG_SET_ERGO(intx, CMSYoungGenPerWorker, 4*M);
       
  1134     }
       
  1135     young_gen_per_worker = 4*M;
       
  1136     new_ratio = (intx)15;
       
  1137     min_new_default = 4*M;
       
  1138     tenuring_default = (intx)0;
       
  1139   } else { // new defaults: "new" as of 6.0
       
  1140     young_gen_per_worker = CMSYoungGenPerWorker;
       
  1141     new_ratio = (intx)7;
       
  1142     min_new_default = 16*M;
       
  1143     tenuring_default = (intx)4;
       
  1144   }
       
  1145 
       
  1146   // Preferred young gen size for "short" pauses
       
  1147   const uintx parallel_gc_threads =
  1115   const uintx parallel_gc_threads =
  1148     (ParallelGCThreads == 0 ? 1 : ParallelGCThreads);
  1116     (ParallelGCThreads == 0 ? 1 : ParallelGCThreads);
  1149   const size_t preferred_max_new_size_unaligned =
  1117   const size_t preferred_max_new_size_unaligned =
  1150     ScaleForWordSize(young_gen_per_worker * parallel_gc_threads);
  1118     MIN2(max_heap/(NewRatio+1), ScaleForWordSize(young_gen_per_worker * parallel_gc_threads));
  1151   const size_t preferred_max_new_size =
  1119   size_t preferred_max_new_size =
  1152     align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());
  1120     align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());
  1153 
  1121 
  1154   // Unless explicitly requested otherwise, size young gen
  1122   // Unless explicitly requested otherwise, size young gen
  1155   // for "short" pauses ~ 4M*ParallelGCThreads
  1123   // for "short" pauses ~ CMSYoungGenPerWorker*ParallelGCThreads
  1156 
  1124 
  1157   // If either MaxNewSize or NewRatio is set on the command line,
  1125   // If either MaxNewSize or NewRatio is set on the command line,
  1158   // assume the user is trying to set the size of the young gen.
  1126   // assume the user is trying to set the size of the young gen.
  1159 
       
  1160   if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) {
  1127   if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) {
  1161 
  1128 
  1162     // Set MaxNewSize to our calculated preferred_max_new_size unless
  1129     // Set MaxNewSize to our calculated preferred_max_new_size unless
  1163     // NewSize was set on the command line and it is larger than
  1130     // NewSize was set on the command line and it is larger than
  1164     // preferred_max_new_size.
  1131     // preferred_max_new_size.
  1167     } else {
  1134     } else {
  1168       FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size);
  1135       FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size);
  1169     }
  1136     }
  1170     if (PrintGCDetails && Verbose) {
  1137     if (PrintGCDetails && Verbose) {
  1171       // Too early to use gclog_or_tty
  1138       // Too early to use gclog_or_tty
  1172       tty->print_cr("Ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
  1139       tty->print_cr("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
  1173     }
  1140     }
  1174 
       
  1175     // Unless explicitly requested otherwise, prefer a large
       
  1176     // Old to Young gen size so as to shift the collection load
       
  1177     // to the old generation concurrent collector
       
  1178 
       
  1179     // If this is only guarded by FLAG_IS_DEFAULT(NewRatio)
       
  1180     // then NewSize and OldSize may be calculated.  That would
       
  1181     // generally lead to some differences with ParNewGC for which
       
  1182     // there was no obvious reason.  Also limit to the case where
       
  1183     // MaxNewSize has not been set.
       
  1184 
       
  1185     FLAG_SET_ERGO(intx, NewRatio, MAX2(NewRatio, new_ratio));
       
  1186 
  1141 
  1187     // Code along this path potentially sets NewSize and OldSize
  1142     // Code along this path potentially sets NewSize and OldSize
  1188 
  1143 
  1189     // Calculate the desired minimum size of the young gen but if
  1144     assert(max_heap >= InitialHeapSize, "Error");
  1190     // NewSize has been set on the command line, use it here since
  1145     assert(max_heap >= NewSize, "Error");
  1191     // it should be the final value.
       
  1192     size_t min_new;
       
  1193     if (FLAG_IS_DEFAULT(NewSize)) {
       
  1194       min_new = align_size_up(ScaleForWordSize(min_new_default),
       
  1195                               os::vm_page_size());
       
  1196     } else {
       
  1197       min_new = NewSize;
       
  1198     }
       
  1199     size_t prev_initial_size = InitialHeapSize;
       
  1200     if (prev_initial_size != 0 && prev_initial_size < min_new + OldSize) {
       
  1201       FLAG_SET_ERGO(uintx, InitialHeapSize, min_new + OldSize);
       
  1202       // Currently minimum size and the initial heap sizes are the same.
       
  1203       set_min_heap_size(InitialHeapSize);
       
  1204       if (PrintGCDetails && Verbose) {
       
  1205         warning("Initial heap size increased to " SIZE_FORMAT " M from "
       
  1206                 SIZE_FORMAT " M; use -XX:NewSize=... for finer control.",
       
  1207                 InitialHeapSize/M, prev_initial_size/M);
       
  1208       }
       
  1209     }
       
  1210 
       
  1211     // MaxHeapSize is aligned down in collectorPolicy
       
  1212     size_t max_heap =
       
  1213       align_size_down(MaxHeapSize,
       
  1214                       CardTableRS::ct_max_alignment_constraint());
       
  1215 
  1146 
  1216     if (PrintGCDetails && Verbose) {
  1147     if (PrintGCDetails && Verbose) {
  1217       // Too early to use gclog_or_tty
  1148       // Too early to use gclog_or_tty
  1218       tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT
  1149       tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT
  1219            " initial_heap_size:  " SIZE_FORMAT
  1150            " initial_heap_size:  " SIZE_FORMAT
  1220            " max_heap: " SIZE_FORMAT,
  1151            " max_heap: " SIZE_FORMAT,
  1221            min_heap_size(), InitialHeapSize, max_heap);
  1152            min_heap_size(), InitialHeapSize, max_heap);
  1222     }
  1153     }
  1223     if (max_heap > min_new) {
  1154     size_t min_new = preferred_max_new_size;
       
  1155     if (FLAG_IS_CMDLINE(NewSize)) {
       
  1156       min_new = NewSize;
       
  1157     }
       
  1158     if (max_heap > min_new && min_heap_size() > min_new) {
  1224       // Unless explicitly requested otherwise, make young gen
  1159       // Unless explicitly requested otherwise, make young gen
  1225       // at least min_new, and at most preferred_max_new_size.
  1160       // at least min_new, and at most preferred_max_new_size.
  1226       if (FLAG_IS_DEFAULT(NewSize)) {
  1161       if (FLAG_IS_DEFAULT(NewSize)) {
  1227         FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new));
  1162         FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new));
  1228         FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize));
  1163         FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize));
  1229         if (PrintGCDetails && Verbose) {
  1164         if (PrintGCDetails && Verbose) {
  1230           // Too early to use gclog_or_tty
  1165           // Too early to use gclog_or_tty
  1231           tty->print_cr("Ergo set NewSize: " SIZE_FORMAT, NewSize);
  1166           tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
  1232         }
  1167         }
  1233       }
  1168       }
  1234       // Unless explicitly requested otherwise, size old gen
  1169       // Unless explicitly requested otherwise, size old gen
  1235       // so that it's at least 3X of NewSize to begin with;
  1170       // so it's NewRatio x of NewSize.
  1236       // later NewRatio will decide how it grows; see above.
       
  1237       if (FLAG_IS_DEFAULT(OldSize)) {
  1171       if (FLAG_IS_DEFAULT(OldSize)) {
  1238         if (max_heap > NewSize) {
  1172         if (max_heap > NewSize) {
  1239           FLAG_SET_ERGO(uintx, OldSize, MIN2(3*NewSize, max_heap - NewSize));
  1173           FLAG_SET_ERGO(uintx, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
  1240           if (PrintGCDetails && Verbose) {
  1174           if (PrintGCDetails && Verbose) {
  1241             // Too early to use gclog_or_tty
  1175             // Too early to use gclog_or_tty
  1242             tty->print_cr("Ergo set OldSize: " SIZE_FORMAT, OldSize);
  1176             tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);
  1243           }
  1177           }
  1244         }
  1178         }
  1245       }
  1179       }
  1246     }
  1180     }
  1247   }
  1181   }
  1381 }
  1315 }
  1382 
  1316 
  1383 void Arguments::set_ergonomics_flags() {
  1317 void Arguments::set_ergonomics_flags() {
  1384   // Parallel GC is not compatible with sharing. If one specifies
  1318   // Parallel GC is not compatible with sharing. If one specifies
  1385   // that they want sharing explicitly, do not set ergonomics flags.
  1319   // that they want sharing explicitly, do not set ergonomics flags.
  1386   if (DumpSharedSpaces || ForceSharedSpaces) {
  1320   if (DumpSharedSpaces || RequireSharedSpaces) {
  1387     return;
  1321     return;
  1388   }
  1322   }
  1389 
  1323 
  1390   if (os::is_server_class_machine() && !force_client_mode ) {
  1324   if (os::is_server_class_machine() && !force_client_mode ) {
  1391     // If no other collector is requested explicitly,
  1325     // If no other collector is requested explicitly,
  1688               name, val, min, max);
  1622               name, val, min, max);
  1689   return false;
  1623   return false;
  1690 }
  1624 }
  1691 
  1625 
  1692 bool Arguments::verify_min_value(intx val, intx min, const char* name) {
  1626 bool Arguments::verify_min_value(intx val, intx min, const char* name) {
  1693   // Returns true if given value is greater than specified min threshold
  1627   // Returns true if given value is at least specified min threshold
  1694   // false, otherwise.
  1628   // false, otherwise.
  1695   if (val >= min ) {
  1629   if (val >= min ) {
  1696       return true;
  1630       return true;
  1697   }
  1631   }
  1698   jio_fprintf(defaultStream::error_stream(),
  1632   jio_fprintf(defaultStream::error_stream(),
  1699               "%s of " INTX_FORMAT " is invalid; must be greater than " INTX_FORMAT "\n",
  1633               "%s of " INTX_FORMAT " is invalid; must be at least " INTX_FORMAT "\n",
  1700               name, val, min);
  1634               name, val, min);
  1701   return false;
  1635   return false;
  1702 }
  1636 }
  1703 
  1637 
  1704 bool Arguments::verify_percentage(uintx value, const char* name) {
  1638 bool Arguments::verify_percentage(uintx value, const char* name) {
  1843     // Turn off gc-overhead-limit-exceeded checks
  1777     // Turn off gc-overhead-limit-exceeded checks
  1844     FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
  1778     FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
  1845   }
  1779   }
  1846 
  1780 
  1847   status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit");
  1781   status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit");
  1848 
       
  1849   // Check whether user-specified sharing option conflicts with GC or page size.
       
  1850   // Both sharing and large pages are enabled by default on some platforms;
       
  1851   // large pages override sharing only if explicitly set on the command line.
       
  1852   const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
       
  1853           UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
       
  1854           UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
       
  1855   if (cannot_share) {
       
  1856     // Either force sharing on by forcing the other options off, or
       
  1857     // force sharing off.
       
  1858     if (DumpSharedSpaces || ForceSharedSpaces) {
       
  1859       jio_fprintf(defaultStream::error_stream(),
       
  1860                   "Using Serial GC and default page size because of %s\n",
       
  1861                   ForceSharedSpaces ? "-Xshare:on" : "-Xshare:dump");
       
  1862       force_serial_gc();
       
  1863       FLAG_SET_DEFAULT(UseLargePages, false);
       
  1864     } else {
       
  1865       if (UseSharedSpaces && Verbose) {
       
  1866         jio_fprintf(defaultStream::error_stream(),
       
  1867                     "Turning off use of shared archive because of "
       
  1868                     "choice of garbage collector or large pages\n");
       
  1869       }
       
  1870       no_shared_spaces();
       
  1871     }
       
  1872   } else if (UseLargePages && (UseSharedSpaces || DumpSharedSpaces)) {
       
  1873     FLAG_SET_DEFAULT(UseLargePages, false);
       
  1874   }
       
  1875 
  1782 
  1876   status = status && check_gc_consistency();
  1783   status = status && check_gc_consistency();
  1877   status = status && check_stack_pages();
  1784   status = status && check_stack_pages();
  1878 
  1785 
  1879   if (_has_alloc_profile) {
  1786   if (_has_alloc_profile) {
  1947     jio_fprintf(defaultStream::error_stream(),
  1854     jio_fprintf(defaultStream::error_stream(),
  1948                 "error: +ExplictGCInvokesConcurrent[AndUnloadsClasses] conflicts"
  1855                 "error: +ExplictGCInvokesConcurrent[AndUnloadsClasses] conflicts"
  1949                 " with -UseAsyncConcMarkSweepGC");
  1856                 " with -UseAsyncConcMarkSweepGC");
  1950     status = false;
  1857     status = false;
  1951   }
  1858   }
       
  1859 
       
  1860   status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk");
  1952 
  1861 
  1953 #ifndef SERIALGC
  1862 #ifndef SERIALGC
  1954   if (UseG1GC) {
  1863   if (UseG1GC) {
  1955     status = status && verify_percentage(InitiatingHeapOccupancyPercent,
  1864     status = status && verify_percentage(InitiatingHeapOccupancyPercent,
  1956                                          "InitiatingHeapOccupancyPercent");
  1865                                          "InitiatingHeapOccupancyPercent");
  2411 #endif
  2320 #endif
  2412     // -Xshare:on
  2321     // -Xshare:on
  2413     } else if (match_option(option, "-Xshare:on", &tail)) {
  2322     } else if (match_option(option, "-Xshare:on", &tail)) {
  2414       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
  2323       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
  2415       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
  2324       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
  2416 #ifdef TIERED
       
  2417       FLAG_SET_CMDLINE(bool, ForceSharedSpaces, true);
       
  2418 #endif // TIERED
       
  2419     // -Xshare:auto
  2325     // -Xshare:auto
  2420     } else if (match_option(option, "-Xshare:auto", &tail)) {
  2326     } else if (match_option(option, "-Xshare:auto", &tail)) {
  2421       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
  2327       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
  2422       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
  2328       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
  2423     // -Xshare:off
  2329     // -Xshare:off
  2910     return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR));
  2816     return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR));
  2911   }
  2817   }
  2912   return JNI_OK;
  2818   return JNI_OK;
  2913 }
  2819 }
  2914 
  2820 
       
  2821 void Arguments::set_shared_spaces_flags() {
       
  2822   // Check whether class data sharing settings conflict with GC, compressed oops
       
  2823   // or page size, and fix them up.  Explicit sharing options override other
       
  2824   // settings.
       
  2825   const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
       
  2826     UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
       
  2827     UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
       
  2828   const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
       
  2829   const bool might_share = must_share || UseSharedSpaces;
       
  2830   if (cannot_share) {
       
  2831     if (must_share) {
       
  2832       warning("selecting serial gc and disabling large pages %s"
       
  2833               "because of %s", "" LP64_ONLY("and compressed oops "),
       
  2834               DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
       
  2835       force_serial_gc();
       
  2836       FLAG_SET_CMDLINE(bool, UseLargePages, false);
       
  2837       LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
       
  2838     } else {
       
  2839       if (UseSharedSpaces && Verbose) {
       
  2840         warning("turning off use of shared archive because of "
       
  2841                 "choice of garbage collector or large pages");
       
  2842       }
       
  2843       no_shared_spaces();
       
  2844     }
       
  2845   } else if (UseLargePages && might_share) {
       
  2846     // Disable large pages to allow shared spaces.  This is sub-optimal, since
       
  2847     // there may not even be a shared archive to use.
       
  2848     FLAG_SET_DEFAULT(UseLargePages, false);
       
  2849   }
       
  2850 }
  2915 
  2851 
  2916 // Parse entry point called from JNI_CreateJavaVM
  2852 // Parse entry point called from JNI_CreateJavaVM
  2917 
  2853 
  2918 jint Arguments::parse(const JavaVMInitArgs* args) {
  2854 jint Arguments::parse(const JavaVMInitArgs* args) {
  2919 
  2855 
  3057 #endif // KERNEL
  2993 #endif // KERNEL
  3058 
  2994 
  3059   // Set flags based on ergonomics.
  2995   // Set flags based on ergonomics.
  3060   set_ergonomics_flags();
  2996   set_ergonomics_flags();
  3061 
  2997 
  3062   if (UseCompressedOops) {
  2998   set_shared_spaces_flags();
  3063     check_compressed_oops_compat();
       
  3064   }
       
  3065 
  2999 
  3066   // Check the GC selections again.
  3000   // Check the GC selections again.
  3067   if (!check_gc_consistency()) {
  3001   if (!check_gc_consistency()) {
  3068     return JNI_EINVAL;
  3002     return JNI_EINVAL;
  3069   }
  3003   }
  3077         "Incompatible compilation policy selected", NULL);
  3011         "Incompatible compilation policy selected", NULL);
  3078     }
  3012     }
  3079   }
  3013   }
  3080 
  3014 
  3081 #ifndef KERNEL
  3015 #ifndef KERNEL
  3082   if (UseConcMarkSweepGC) {
  3016   // Set heap size based on available physical memory
  3083     // Set flags for CMS and ParNew.  Check UseConcMarkSweep first
  3017   set_heap_size();
  3084     // to ensure that when both UseConcMarkSweepGC and UseParNewGC
  3018   // Set per-collector flags
  3085     // are true, we don't call set_parnew_gc_flags() as well.
  3019   if (UseParallelGC || UseParallelOldGC) {
       
  3020     set_parallel_gc_flags();
       
  3021   } else if (UseConcMarkSweepGC) { // should be done before ParNew check below
  3086     set_cms_and_parnew_gc_flags();
  3022     set_cms_and_parnew_gc_flags();
  3087   } else {
  3023   } else if (UseParNewGC) {  // skipped if CMS is set above
  3088     // Set heap size based on available physical memory
  3024     set_parnew_gc_flags();
  3089     set_heap_size();
  3025   } else if (UseG1GC) {
  3090     // Set per-collector flags
  3026     set_g1_gc_flags();
  3091     if (UseParallelGC || UseParallelOldGC) {
       
  3092       set_parallel_gc_flags();
       
  3093     } else if (UseParNewGC) {
       
  3094       set_parnew_gc_flags();
       
  3095     } else if (UseG1GC) {
       
  3096       set_g1_gc_flags();
       
  3097     }
       
  3098   }
  3027   }
  3099 #endif // KERNEL
  3028 #endif // KERNEL
  3100 
  3029 
  3101 #ifdef SERIALGC
  3030 #ifdef SERIALGC
  3102   assert(verify_serial_gc_flags(), "SerialGC unset");
  3031   assert(verify_serial_gc_flags(), "SerialGC unset");