comparison src/share/vm/runtime/arguments.cpp @ 8701:b95ad0610fef

Merge
author asaha
date Fri, 26 Oct 2012 09:27:25 -0700
parents e4d10261499c 5876f980ea19
children b5cb079ecaa4
comparison
equal deleted inserted replaced
6908:5a3a6dac85e2 8701:b95ad0610fef
243 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, 243 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
244 { "UseParallelOldGCDensePrefix", 244 { "UseParallelOldGCDensePrefix",
245 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, 245 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
246 { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) }, 246 { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) },
247 { "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) }, 247 { "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) },
248 { "CMSPermGenPrecleaningEnabled", JDK_Version::jdk(8), JDK_Version::jdk(9) },
249 { "CMSTriggerPermRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) },
250 { "CMSInitiatingPermOccupancyFraction", JDK_Version::jdk(8), JDK_Version::jdk(9) },
251 { "AdaptivePermSizeWeight", JDK_Version::jdk(8), JDK_Version::jdk(9) },
252 { "PermGenPadding", JDK_Version::jdk(8), JDK_Version::jdk(9) },
253 { "PermMarkSweepDeadRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) },
254 { "PermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
255 { "MaxPermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
256 { "MinPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) },
257 { "MaxPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) },
258 { "CMSRevisitStackSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
259 { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) },
248 #ifdef PRODUCT 260 #ifdef PRODUCT
249 { "DesiredMethodLimit", 261 { "DesiredMethodLimit",
250 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, 262 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
251 #endif // PRODUCT 263 #endif // PRODUCT
252 { NULL, JDK_Version(0), JDK_Version(0) } 264 { NULL, JDK_Version(0), JDK_Version(0) }
1052 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { 1064 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
1053 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); 1065 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2);
1054 } 1066 }
1055 } 1067 }
1056 1068
1057 #ifndef KERNEL 1069 #if INCLUDE_ALTERNATE_GCS
1058 static void disable_adaptive_size_policy(const char* collector_name) { 1070 static void disable_adaptive_size_policy(const char* collector_name) {
1059 if (UseAdaptiveSizePolicy) { 1071 if (UseAdaptiveSizePolicy) {
1060 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { 1072 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
1061 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", 1073 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
1062 collector_name); 1074 collector_name);
1084 FLAG_SET_DEFAULT(UseParNewGC, false); 1096 FLAG_SET_DEFAULT(UseParNewGC, false);
1085 FLAG_SET_DEFAULT(ParallelGCThreads, 0); 1097 FLAG_SET_DEFAULT(ParallelGCThreads, 0);
1086 } 1098 }
1087 } 1099 }
1088 if (UseParNewGC) { 1100 if (UseParNewGC) {
1089 // CDS doesn't work with ParNew yet
1090 no_shared_spaces();
1091
1092 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively, 1101 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
1093 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration 1102 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
1094 // we set them to 1024 and 1024. 1103 // we set them to 1024 and 1024.
1095 // See CR 6362902. 1104 // See CR 6362902.
1096 if (FLAG_IS_DEFAULT(YoungPLABSize)) { 1105 if (FLAG_IS_DEFAULT(YoungPLABSize)) {
1101 } 1110 }
1102 1111
1103 // AlwaysTenure flag should make ParNew promote all at first collection. 1112 // AlwaysTenure flag should make ParNew promote all at first collection.
1104 // See CR 6362902. 1113 // See CR 6362902.
1105 if (AlwaysTenure) { 1114 if (AlwaysTenure) {
1106 FLAG_SET_CMDLINE(intx, MaxTenuringThreshold, 0); 1115 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
1107 } 1116 }
1108 // When using compressed oops, we use local overflow stacks, 1117 // When using compressed oops, we use local overflow stacks,
1109 // rather than using a global overflow list chained through 1118 // rather than using a global overflow list chained through
1110 // the klass word of the object's pre-image. 1119 // the klass word of the object's pre-image.
1111 if (UseCompressedOops && !ParGCUseLocalOverflow) { 1120 if (UseCompressedOops && !ParGCUseLocalOverflow) {
1130 // unless explicitly forbidden. 1139 // unless explicitly forbidden.
1131 if (FLAG_IS_DEFAULT(UseParNewGC)) { 1140 if (FLAG_IS_DEFAULT(UseParNewGC)) {
1132 FLAG_SET_ERGO(bool, UseParNewGC, true); 1141 FLAG_SET_ERGO(bool, UseParNewGC, true);
1133 } 1142 }
1134 1143
1135 // Turn off AdaptiveSizePolicy for CMS until it is complete. 1144 // Turn off AdaptiveSizePolicy by default for cms until it is complete.
1136 disable_adaptive_size_policy("UseConcMarkSweepGC"); 1145 disable_adaptive_size_policy("UseConcMarkSweepGC");
1137 1146
1138 // In either case, adjust ParallelGCThreads and/or UseParNewGC 1147 // In either case, adjust ParallelGCThreads and/or UseParNewGC
1139 // as needed. 1148 // as needed.
1140 if (UseParNewGC) { 1149 if (UseParNewGC) {
1220 } 1229 }
1221 // Unless explicitly requested otherwise, definitely 1230 // Unless explicitly requested otherwise, definitely
1222 // promote all objects surviving "tenuring_default" scavenges. 1231 // promote all objects surviving "tenuring_default" scavenges.
1223 if (FLAG_IS_DEFAULT(MaxTenuringThreshold) && 1232 if (FLAG_IS_DEFAULT(MaxTenuringThreshold) &&
1224 FLAG_IS_DEFAULT(SurvivorRatio)) { 1233 FLAG_IS_DEFAULT(SurvivorRatio)) {
1225 FLAG_SET_ERGO(intx, MaxTenuringThreshold, tenuring_default); 1234 FLAG_SET_ERGO(uintx, MaxTenuringThreshold, tenuring_default);
1226 } 1235 }
1227 // If we decided above (or user explicitly requested) 1236 // If we decided above (or user explicitly requested)
1228 // `promote all' (via MaxTenuringThreshold := 0), 1237 // `promote all' (via MaxTenuringThreshold := 0),
1229 // prefer minuscule survivor spaces so as not to waste 1238 // prefer minuscule survivor spaces so as not to waste
1230 // space for (non-existent) survivors 1239 // space for (non-existent) survivors
1272 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", 1281 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
1273 MarkStackSize / K, MarkStackSizeMax / K); 1282 MarkStackSize / K, MarkStackSizeMax / K);
1274 tty->print_cr("ConcGCThreads: %u", ConcGCThreads); 1283 tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
1275 } 1284 }
1276 } 1285 }
1277 #endif // KERNEL 1286 #endif // INCLUDE_ALTERNATE_GCS
1278 1287
1279 void set_object_alignment() { 1288 void set_object_alignment() {
1280 // Object alignment. 1289 // Object alignment.
1281 assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); 1290 assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2");
1282 MinObjAlignmentInBytes = ObjectAlignmentInBytes; 1291 MinObjAlignmentInBytes = ObjectAlignmentInBytes;
1289 LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize; 1298 LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize;
1290 1299
1291 // Oop encoding heap max 1300 // Oop encoding heap max
1292 OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes; 1301 OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes;
1293 1302
1294 #ifndef KERNEL 1303 #if INCLUDE_ALTERNATE_GCS
1295 // Set CMS global values 1304 // Set CMS global values
1296 CompactibleFreeListSpace::set_cms_values(); 1305 CompactibleFreeListSpace::set_cms_values();
1297 #endif // KERNEL 1306 #endif // INCLUDE_ALTERNATE_GCS
1298 } 1307 }
1299 1308
1300 bool verify_object_alignment() { 1309 bool verify_object_alignment() {
1301 // Object alignment. 1310 // Object alignment.
1302 if (!is_power_of_2(ObjectAlignmentInBytes)) { 1311 if (!is_power_of_2(ObjectAlignmentInBytes)) {
1330 return true; 1339 return true;
1331 } 1340 }
1332 1341
1333 inline uintx max_heap_for_compressed_oops() { 1342 inline uintx max_heap_for_compressed_oops() {
1334 // Avoid sign flip. 1343 // Avoid sign flip.
1335 if (OopEncodingHeapMax < MaxPermSize + os::vm_page_size()) { 1344 if (OopEncodingHeapMax < ClassMetaspaceSize + os::vm_page_size()) {
1336 return 0; 1345 return 0;
1337 } 1346 }
1338 LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size()); 1347 LP64_ONLY(return OopEncodingHeapMax - ClassMetaspaceSize - os::vm_page_size());
1339 NOT_LP64(ShouldNotReachHere(); return 0); 1348 NOT_LP64(ShouldNotReachHere(); return 0);
1340 } 1349 }
1341 1350
1342 bool Arguments::should_auto_select_low_pause_collector() { 1351 bool Arguments::should_auto_select_low_pause_collector() {
1343 if (UseAutoGCSelectPolicy && 1352 if (UseAutoGCSelectPolicy &&
1352 } 1361 }
1353 return false; 1362 return false;
1354 } 1363 }
1355 1364
1356 void Arguments::set_ergonomics_flags() { 1365 void Arguments::set_ergonomics_flags() {
1357 // Parallel GC is not compatible with sharing. If one specifies
1358 // that they want sharing explicitly, do not set ergonomics flags.
1359 if (DumpSharedSpaces || RequireSharedSpaces) {
1360 return;
1361 }
1362 1366
1363 if (os::is_server_class_machine()) { 1367 if (os::is_server_class_machine()) {
1364 // If no other collector is requested explicitly, 1368 // If no other collector is requested explicitly,
1365 // let the VM select the collector based on 1369 // let the VM select the collector based on
1366 // machine class and automatic selection policy. 1370 // machine class and automatic selection policy.
1367 if (!UseSerialGC && 1371 if (!UseSerialGC &&
1368 !UseConcMarkSweepGC && 1372 !UseConcMarkSweepGC &&
1369 !UseG1GC && 1373 !UseG1GC &&
1370 !UseParNewGC && 1374 !UseParNewGC &&
1371 !DumpSharedSpaces &&
1372 FLAG_IS_DEFAULT(UseParallelGC)) { 1375 FLAG_IS_DEFAULT(UseParallelGC)) {
1373 if (should_auto_select_low_pause_collector()) { 1376 if (should_auto_select_low_pause_collector()) {
1374 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true); 1377 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true);
1375 } else { 1378 } else {
1376 FLAG_SET_ERGO(bool, UseParallelGC, true); 1379 FLAG_SET_ERGO(bool, UseParallelGC, true);
1377 } 1380 }
1381 }
1382 // Shared spaces work fine with other GCs but causes bytecode rewriting
1383 // to be disabled, which hurts interpreter performance and decreases
1384 // server performance. On server class machines, keep the default
1385 // off unless it is asked for. Future work: either add bytecode rewriting
1386 // at link time, or rewrite bytecodes in non-shared methods.
1387 if (!DumpSharedSpaces && !RequireSharedSpaces) {
1378 no_shared_spaces(); 1388 no_shared_spaces();
1379 } 1389 }
1380 } 1390 }
1381 1391
1382 #ifndef ZERO 1392 #ifndef ZERO
1400 #endif // _WIN64 1410 #endif // _WIN64
1401 } else { 1411 } else {
1402 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { 1412 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1403 warning("Max heap size too large for Compressed Oops"); 1413 warning("Max heap size too large for Compressed Oops");
1404 FLAG_SET_DEFAULT(UseCompressedOops, false); 1414 FLAG_SET_DEFAULT(UseCompressedOops, false);
1415 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1416 }
1417 }
1418 // UseCompressedOops must be on for UseCompressedKlassPointers to be on.
1419 if (!UseCompressedOops) {
1420 if (UseCompressedKlassPointers) {
1421 warning("UseCompressedKlassPointers requires UseCompressedOops");
1422 }
1423 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1424 } else {
1425 // Turn on UseCompressedKlassPointers too
1426 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
1427 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
1428 }
1429 // Set the ClassMetaspaceSize to something that will not need to be
1430 // expanded, since it cannot be expanded.
1431 if (UseCompressedKlassPointers && FLAG_IS_DEFAULT(ClassMetaspaceSize)) {
1432 // 100,000 classes seems like a good size, so 100M assumes around 1K
1433 // per klass. The vtable and oopMap is embedded so we don't have a fixed
1434 // size per klass. Eventually, this will be parameterized because it
1435 // would also be useful to determine the optimal size of the
1436 // systemDictionary.
1437 FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M);
1405 } 1438 }
1406 } 1439 }
1407 // Also checks that certain machines are slower with compressed oops 1440 // Also checks that certain machines are slower with compressed oops
1408 // in vm_version initialization code. 1441 // in vm_version initialization code.
1409 #endif // _LP64 1442 #endif // _LP64
1441 // Par compact uses lower default values since they are treated as 1474 // Par compact uses lower default values since they are treated as
1442 // minimums. These are different defaults because of the different 1475 // minimums. These are different defaults because of the different
1443 // interpretation and are not ergonomically set. 1476 // interpretation and are not ergonomically set.
1444 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) { 1477 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
1445 FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1); 1478 FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
1446 }
1447 if (FLAG_IS_DEFAULT(PermMarkSweepDeadRatio)) {
1448 FLAG_SET_DEFAULT(PermMarkSweepDeadRatio, 5);
1449 } 1479 }
1450 } 1480 }
1451 } 1481 }
1452 if (UseNUMA) { 1482 if (UseNUMA) {
1453 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { 1483 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
1468 Abstract_VM_Version::parallel_worker_threads()); 1498 Abstract_VM_Version::parallel_worker_threads());
1469 if (ParallelGCThreads == 0) { 1499 if (ParallelGCThreads == 0) {
1470 FLAG_SET_DEFAULT(ParallelGCThreads, 1500 FLAG_SET_DEFAULT(ParallelGCThreads,
1471 Abstract_VM_Version::parallel_worker_threads()); 1501 Abstract_VM_Version::parallel_worker_threads());
1472 } 1502 }
1473 no_shared_spaces();
1474 1503
1475 if (FLAG_IS_DEFAULT(MarkStackSize)) { 1504 if (FLAG_IS_DEFAULT(MarkStackSize)) {
1476 FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); 1505 FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE);
1477 } 1506 }
1478 if (PrintGCDetails && Verbose) { 1507 if (PrintGCDetails && Verbose) {
1804 status = false; 1833 status = false;
1805 } 1834 }
1806 1835
1807 status = status && verify_percentage(AdaptiveSizePolicyWeight, 1836 status = status && verify_percentage(AdaptiveSizePolicyWeight,
1808 "AdaptiveSizePolicyWeight"); 1837 "AdaptiveSizePolicyWeight");
1809 status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight");
1810 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); 1838 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance");
1811 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio"); 1839 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio");
1812 status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio"); 1840 status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio");
1813 1841
1814 if (MinHeapFreeRatio > MaxHeapFreeRatio) { 1842 if (MinHeapFreeRatio > MaxHeapFreeRatio) {
1943 // expression. 1971 // expression.
1944 status = status && verify_interval(TLABWasteTargetPercent, 1972 status = status && verify_interval(TLABWasteTargetPercent,
1945 1, 100, "TLABWasteTargetPercent"); 1973 1, 100, "TLABWasteTargetPercent");
1946 1974
1947 status = status && verify_object_alignment(); 1975 status = status && verify_object_alignment();
1976
1977 status = status && verify_min_value(ClassMetaspaceSize, 1*M,
1978 "ClassMetaspaceSize");
1979
1980 #ifdef SPARC
1981 if (UseConcMarkSweepGC || UseG1GC) {
1982 // Issue a stern warning if the user has explicitly set
1983 // UseMemSetInBOT (it is known to cause issues), but allow
1984 // use for experimentation and debugging.
1985 if (VM_Version::is_sun4v() && UseMemSetInBOT) {
1986 assert(!FLAG_IS_DEFAULT(UseMemSetInBOT), "Error");
1987 warning("Experimental flag -XX:+UseMemSetInBOT is known to cause instability"
1988 " on sun4v; please understand that you are using at your own risk!");
1989 }
1990 }
1991 #endif // SPARC
1992
1993 if (PrintNMTStatistics) {
1994 #if INCLUDE_NMT
1995 if (MemTracker::tracking_level() == MemTracker::NMT_off) {
1996 #endif // INCLUDE_NMT
1997 warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled");
1998 PrintNMTStatistics = false;
1999 #if INCLUDE_NMT
2000 }
2001 #endif
2002 }
1948 2003
1949 return status; 2004 return status;
1950 } 2005 }
1951 2006
1952 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, 2007 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2168 char *options = NULL; 2223 char *options = NULL;
2169 if(pos != NULL) { 2224 if(pos != NULL) {
2170 size_t len2 = strlen(pos+1) + 1; // options start after ':'. Final zero must be copied. 2225 size_t len2 = strlen(pos+1) + 1; // options start after ':'. Final zero must be copied.
2171 options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtInternal), pos+1, len2); 2226 options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtInternal), pos+1, len2);
2172 } 2227 }
2173 #ifdef JVMTI_KERNEL 2228 #if !INCLUDE_JVMTI
2174 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) { 2229 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
2175 warning("profiling and debugging agents are not supported with Kernel VM"); 2230 warning("profiling and debugging agents are not supported in this VM");
2176 } else 2231 } else
2177 #endif // JVMTI_KERNEL 2232 #endif // !INCLUDE_JVMTI
2178 add_init_library(name, options); 2233 add_init_library(name, options);
2179 } 2234 }
2180 // -agentlib and -agentpath 2235 // -agentlib and -agentpath
2181 } else if (match_option(option, "-agentlib:", &tail) || 2236 } else if (match_option(option, "-agentlib:", &tail) ||
2182 (is_absolute_path = match_option(option, "-agentpath:", &tail))) { 2237 (is_absolute_path = match_option(option, "-agentpath:", &tail))) {
2183 if(tail != NULL) { 2238 if(tail != NULL) {
2188 2243
2189 char *options = NULL; 2244 char *options = NULL;
2190 if(pos != NULL) { 2245 if(pos != NULL) {
2191 options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1, mtInternal), pos + 1); 2246 options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1, mtInternal), pos + 1);
2192 } 2247 }
2193 #ifdef JVMTI_KERNEL 2248 #if !INCLUDE_JVMTI
2194 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) { 2249 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
2195 warning("profiling and debugging agents are not supported with Kernel VM"); 2250 warning("profiling and debugging agents are not supported in this VM");
2196 } else 2251 } else
2197 #endif // JVMTI_KERNEL 2252 #endif // !INCLUDE_JVMTI
2198 add_init_agent(name, options, is_absolute_path); 2253 add_init_agent(name, options, is_absolute_path);
2199 2254
2200 } 2255 }
2201 // -javaagent 2256 // -javaagent
2202 } else if (match_option(option, "-javaagent:", &tail)) { 2257 } else if (match_option(option, "-javaagent:", &tail)) {
2258 #if !INCLUDE_JVMTI
2259 warning("Instrumentation agents are not supported in this VM");
2260 #else
2203 if(tail != NULL) { 2261 if(tail != NULL) {
2204 char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail); 2262 char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
2205 add_init_agent("instrument", options, false); 2263 add_init_agent("instrument", options, false);
2206 } 2264 }
2265 #endif // !INCLUDE_JVMTI
2207 // -Xnoclassgc 2266 // -Xnoclassgc
2208 } else if (match_option(option, "-Xnoclassgc", &tail)) { 2267 } else if (match_option(option, "-Xnoclassgc", &tail)) {
2209 FLAG_SET_CMDLINE(bool, ClassUnloading, false); 2268 FLAG_SET_CMDLINE(bool, ClassUnloading, false);
2210 // -Xincgc: i-CMS 2269 // -Xincgc: i-CMS
2211 } else if (match_option(option, "-Xincgc", &tail)) { 2270 } else if (match_option(option, "-Xincgc", &tail)) {
2333 // -Xoptimize 2392 // -Xoptimize
2334 } else if (match_option(option, "-Xoptimize", &tail)) { 2393 } else if (match_option(option, "-Xoptimize", &tail)) {
2335 // EVM option, ignore silently for compatibility 2394 // EVM option, ignore silently for compatibility
2336 // -Xprof 2395 // -Xprof
2337 } else if (match_option(option, "-Xprof", &tail)) { 2396 } else if (match_option(option, "-Xprof", &tail)) {
2338 #ifndef FPROF_KERNEL 2397 #if INCLUDE_FPROF
2339 _has_profile = true; 2398 _has_profile = true;
2340 #else // FPROF_KERNEL 2399 #else // INCLUDE_FPROF
2341 // do we have to exit? 2400 // do we have to exit?
2342 warning("Kernel VM does not support flat profiling."); 2401 warning("Flat profiling is not supported in this VM.");
2343 #endif // FPROF_KERNEL 2402 #endif // INCLUDE_FPROF
2344 // -Xaprof 2403 // -Xaprof
2345 } else if (match_option(option, "-Xaprof", &tail)) { 2404 } else if (match_option(option, "-Xaprof", &tail)) {
2346 _has_alloc_profile = true; 2405 _has_alloc_profile = true;
2347 // -Xconcurrentio 2406 // -Xconcurrentio
2348 } else if (match_option(option, "-Xconcurrentio", &tail)) { 2407 } else if (match_option(option, "-Xconcurrentio", &tail)) {
2383 // for testing the compiler; turn off all flags that inhibit compilation 2442 // for testing the compiler; turn off all flags that inhibit compilation
2384 set_mode_flags(_comp); 2443 set_mode_flags(_comp);
2385 2444
2386 // -Xshare:dump 2445 // -Xshare:dump
2387 } else if (match_option(option, "-Xshare:dump", &tail)) { 2446 } else if (match_option(option, "-Xshare:dump", &tail)) {
2388 #ifdef TIERED 2447 #if defined(KERNEL)
2389 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
2390 set_mode_flags(_int); // Prevent compilation, which creates objects
2391 #elif defined(COMPILER2)
2392 vm_exit_during_initialization(
2393 "Dumping a shared archive is not supported on the Server JVM.", NULL);
2394 #elif defined(KERNEL)
2395 vm_exit_during_initialization( 2448 vm_exit_during_initialization(
2396 "Dumping a shared archive is not supported on the Kernel JVM.", NULL); 2449 "Dumping a shared archive is not supported on the Kernel JVM.", NULL);
2450 #elif !INCLUDE_CDS
2451 vm_exit_during_initialization(
2452 "Dumping a shared archive is not supported in this VM.", NULL);
2397 #else 2453 #else
2398 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); 2454 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
2399 set_mode_flags(_int); // Prevent compilation, which creates objects 2455 set_mode_flags(_int); // Prevent compilation, which creates objects
2400 #endif 2456 #endif
2401 // -Xshare:on 2457 // -Xshare:on
2444 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true); 2500 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true);
2445 2501
2446 // JNI hooks 2502 // JNI hooks
2447 } else if (match_option(option, "-Xcheck", &tail)) { 2503 } else if (match_option(option, "-Xcheck", &tail)) {
2448 if (!strcmp(tail, ":jni")) { 2504 if (!strcmp(tail, ":jni")) {
2505 #if !INCLUDE_JNI_CHECK
2506 warning("JNI CHECKING is not supported in this VM");
2507 #else
2449 CheckJNICalls = true; 2508 CheckJNICalls = true;
2509 #endif // INCLUDE_JNI_CHECK
2450 } else if (is_bad_option(option, args->ignoreUnrecognized, 2510 } else if (is_bad_option(option, args->ignoreUnrecognized,
2451 "check")) { 2511 "check")) {
2452 return JNI_EINVAL; 2512 return JNI_EINVAL;
2453 } 2513 }
2454 } else if (match_option(option, "vfprintf", &tail)) { 2514 } else if (match_option(option, "vfprintf", &tail)) {
2488 total_memory - (julong)160*M); 2548 total_memory - (julong)160*M);
2489 2549
2490 // Make sure that if we have a lot of memory we cap the 32 bit 2550 // Make sure that if we have a lot of memory we cap the 32 bit
2491 // process space. The 64bit VM version of this function is a nop. 2551 // process space. The 64bit VM version of this function is a nop.
2492 initHeapSize = os::allocatable_physical_memory(initHeapSize); 2552 initHeapSize = os::allocatable_physical_memory(initHeapSize);
2493
2494 // The perm gen is separate but contiguous with the
2495 // object heap (and is reserved with it) so subtract it
2496 // from the heap size.
2497 if (initHeapSize > MaxPermSize) {
2498 initHeapSize = initHeapSize - MaxPermSize;
2499 } else {
2500 warning("AggressiveHeap and MaxPermSize values may conflict");
2501 }
2502 2553
2503 if (FLAG_IS_DEFAULT(MaxHeapSize)) { 2554 if (FLAG_IS_DEFAULT(MaxHeapSize)) {
2504 FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize); 2555 FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize);
2505 FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize); 2556 FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize);
2506 // Currently the minimum size and the initial heap sizes are the same. 2557 // Currently the minimum size and the initial heap sizes are the same.
2902 2953
2903 void Arguments::set_shared_spaces_flags() { 2954 void Arguments::set_shared_spaces_flags() {
2904 const bool must_share = DumpSharedSpaces || RequireSharedSpaces; 2955 const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
2905 const bool might_share = must_share || UseSharedSpaces; 2956 const bool might_share = must_share || UseSharedSpaces;
2906 2957
2907 // The string table is part of the shared archive so the size must match. 2958 // CompressedOops cannot be used with CDS. The offsets of oopmaps and
2908 if (!FLAG_IS_DEFAULT(StringTableSize)) { 2959 // static fields are incorrect in the archive. With some more clever
2909 // Disable sharing. 2960 // initialization, this restriction can probably be lifted.
2910 if (must_share) { 2961 // ??? UseLargePages might be okay now
2911 warning("disabling shared archive %s because of non-default " 2962 const bool cannot_share = UseCompressedOops ||
2912 "StringTableSize", DumpSharedSpaces ? "creation" : "use"); 2963 (UseLargePages && FLAG_IS_CMDLINE(UseLargePages));
2913 }
2914 if (might_share) {
2915 FLAG_SET_DEFAULT(DumpSharedSpaces, false);
2916 FLAG_SET_DEFAULT(RequireSharedSpaces, false);
2917 FLAG_SET_DEFAULT(UseSharedSpaces, false);
2918 }
2919 return;
2920 }
2921
2922 // Check whether class data sharing settings conflict with GC, compressed oops
2923 // or page size, and fix them up. Explicit sharing options override other
2924 // settings.
2925 const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
2926 UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
2927 UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
2928 if (cannot_share) { 2964 if (cannot_share) {
2929 if (must_share) { 2965 if (must_share) {
2930 warning("selecting serial gc and disabling large pages %s" 2966 warning("disabling large pages %s"
2931 "because of %s", "" LP64_ONLY("and compressed oops "), 2967 "because of %s", "" LP64_ONLY("and compressed oops "),
2932 DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on"); 2968 DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
2933 force_serial_gc();
2934 FLAG_SET_CMDLINE(bool, UseLargePages, false); 2969 FLAG_SET_CMDLINE(bool, UseLargePages, false);
2935 LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false)); 2970 LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
2971 LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false));
2936 } else { 2972 } else {
2973 // Prefer compressed oops and large pages to class data sharing
2937 if (UseSharedSpaces && Verbose) { 2974 if (UseSharedSpaces && Verbose) {
2938 warning("turning off use of shared archive because of " 2975 warning("turning off use of shared archive because of large pages%s",
2939 "choice of garbage collector or large pages"); 2976 "" LP64_ONLY(" and/or compressed oops"));
2940 } 2977 }
2941 no_shared_spaces(); 2978 no_shared_spaces();
2942 } 2979 }
2943 } else if (UseLargePages && might_share) { 2980 } else if (UseLargePages && might_share) {
2944 // Disable large pages to allow shared spaces. This is sub-optimal, since 2981 // Disable large pages to allow shared spaces. This is sub-optimal, since
2945 // there may not even be a shared archive to use. 2982 // there may not even be a shared archive to use.
2946 FLAG_SET_DEFAULT(UseLargePages, false); 2983 FLAG_SET_DEFAULT(UseLargePages, false);
2984 }
2985
2986 // Add 2M to any size for SharedReadOnlySize to get around the JPRT setting
2987 if (DumpSharedSpaces && !FLAG_IS_DEFAULT(SharedReadOnlySize)) {
2988 SharedReadOnlySize = 14*M;
2989 }
2990
2991 if (DumpSharedSpaces) {
2992 if (RequireSharedSpaces) {
2993 warning("cannot dump shared archive while using shared archive");
2994 }
2995 UseSharedSpaces = false;
2947 } 2996 }
2948 } 2997 }
2949 2998
2950 // Disable options not supported in this release, with a warning if they 2999 // Disable options not supported in this release, with a warning if they
2951 // were explicitly requested on the command-line 3000 // were explicitly requested on the command-line
3010 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) { 3059 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) {
3011 CommandLineFlags::printFlags(tty, false); 3060 CommandLineFlags::printFlags(tty, false);
3012 vm_exit(0); 3061 vm_exit(0);
3013 } 3062 }
3014 if (match_option(option, "-XX:NativeMemoryTracking", &tail)) { 3063 if (match_option(option, "-XX:NativeMemoryTracking", &tail)) {
3064 #if INCLUDE_NMT
3015 MemTracker::init_tracking_options(tail); 3065 MemTracker::init_tracking_options(tail);
3066 #else
3067 warning("Native Memory Tracking is not supported in this VM");
3068 #endif
3016 } 3069 }
3017 3070
3018 3071
3019 #ifndef PRODUCT 3072 #ifndef PRODUCT
3020 if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) { 3073 if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) {
3073 3126
3074 #if (defined JAVASE_EMBEDDED || defined ARM) 3127 #if (defined JAVASE_EMBEDDED || defined ARM)
3075 UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); 3128 UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
3076 #endif 3129 #endif
3077 3130
3131 #if !INCLUDE_ALTERNATE_GCS
3132 if (UseParallelGC) {
3133 warning("Parallel GC is not supported in this VM. Using Serial GC.");
3134 }
3135 if (UseParallelOldGC) {
3136 warning("Parallel Old GC is not supported in this VM. Using Serial GC.");
3137 }
3138 if (UseConcMarkSweepGC) {
3139 warning("Concurrent Mark Sweep GC is not supported in this VM. Using Serial GC.");
3140 }
3141 if (UseParNewGC) {
3142 warning("Par New GC is not supported in this VM. Using Serial GC.");
3143 }
3144 #endif // INCLUDE_ALTERNATE_GCS
3145
3078 #ifndef PRODUCT 3146 #ifndef PRODUCT
3079 if (TraceBytecodesAt != 0) { 3147 if (TraceBytecodesAt != 0) {
3080 TraceBytecodes = true; 3148 TraceBytecodes = true;
3081 } 3149 }
3082 if (CountCompiledCalls) { 3150 if (CountCompiledCalls) {
3101 if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) { 3169 if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
3102 warning("forcing ScavengeRootsInCode non-zero because EnableInvokeDynamic is true"); 3170 warning("forcing ScavengeRootsInCode non-zero because EnableInvokeDynamic is true");
3103 } 3171 }
3104 ScavengeRootsInCode = 1; 3172 ScavengeRootsInCode = 1;
3105 } 3173 }
3106 if (!JavaObjectsInPerm && ScavengeRootsInCode == 0) {
3107 if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
3108 warning("forcing ScavengeRootsInCode non-zero because JavaObjectsInPerm is false");
3109 }
3110 ScavengeRootsInCode = 1;
3111 }
3112 3174
3113 if (PrintGCDetails) { 3175 if (PrintGCDetails) {
3114 // Turn on -verbose:gc options as well 3176 // Turn on -verbose:gc options as well
3115 PrintGC = true; 3177 PrintGC = true;
3116 } 3178 }
3127 set_object_alignment(); 3189 set_object_alignment();
3128 3190
3129 #ifdef SERIALGC 3191 #ifdef SERIALGC
3130 force_serial_gc(); 3192 force_serial_gc();
3131 #endif // SERIALGC 3193 #endif // SERIALGC
3132 #ifdef KERNEL 3194 #if !INCLUDE_CDS
3133 no_shared_spaces(); 3195 no_shared_spaces();
3134 #endif // KERNEL 3196 #endif // INCLUDE_CDS
3135 3197
3136 // Set flags based on ergonomics. 3198 // Set flags based on ergonomics.
3137 set_ergonomics_flags(); 3199 set_ergonomics_flags();
3138 3200
3139 set_shared_spaces_flags(); 3201 set_shared_spaces_flags();
3151 vm_exit_during_initialization( 3213 vm_exit_during_initialization(
3152 "Incompatible compilation policy selected", NULL); 3214 "Incompatible compilation policy selected", NULL);
3153 } 3215 }
3154 } 3216 }
3155 3217
3156 #ifndef KERNEL
3157 // Set heap size based on available physical memory 3218 // Set heap size based on available physical memory
3158 set_heap_size(); 3219 set_heap_size();
3220
3221 #if INCLUDE_ALTERNATE_GCS
3159 // Set per-collector flags 3222 // Set per-collector flags
3160 if (UseParallelGC || UseParallelOldGC) { 3223 if (UseParallelGC || UseParallelOldGC) {
3161 set_parallel_gc_flags(); 3224 set_parallel_gc_flags();
3162 } else if (UseConcMarkSweepGC) { // should be done before ParNew check below 3225 } else if (UseConcMarkSweepGC) { // should be done before ParNew check below
3163 set_cms_and_parnew_gc_flags(); 3226 set_cms_and_parnew_gc_flags();
3164 } else if (UseParNewGC) { // skipped if CMS is set above 3227 } else if (UseParNewGC) { // skipped if CMS is set above
3165 set_parnew_gc_flags(); 3228 set_parnew_gc_flags();
3166 } else if (UseG1GC) { 3229 } else if (UseG1GC) {
3167 set_g1_gc_flags(); 3230 set_g1_gc_flags();
3168 } 3231 }
3169 #endif // KERNEL 3232 #endif // INCLUDE_ALTERNATE_GCS
3170 3233
3171 #ifdef SERIALGC 3234 #ifdef SERIALGC
3172 assert(verify_serial_gc_flags(), "SerialGC unset"); 3235 assert(verify_serial_gc_flags(), "SerialGC unset");
3173 #endif // SERIALGC 3236 #endif // SERIALGC
3174 3237
3198 #ifdef CC_INTERP 3261 #ifdef CC_INTERP
3199 // Clear flags not supported by the C++ interpreter 3262 // Clear flags not supported by the C++ interpreter
3200 FLAG_SET_DEFAULT(ProfileInterpreter, false); 3263 FLAG_SET_DEFAULT(ProfileInterpreter, false);
3201 FLAG_SET_DEFAULT(UseBiasedLocking, false); 3264 FLAG_SET_DEFAULT(UseBiasedLocking, false);
3202 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); 3265 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false));
3266 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedKlassPointers, false));
3203 #endif // CC_INTERP 3267 #endif // CC_INTERP
3204 3268
3205 #ifdef COMPILER2 3269 #ifdef COMPILER2
3206 if (!UseBiasedLocking || EmitSync != 0) { 3270 if (!UseBiasedLocking || EmitSync != 0) {
3207 UseOptoBiasInlining = false; 3271 UseOptoBiasInlining = false;