comparison src/share/vm/runtime/arguments.cpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 9ee881900cf5 4b41145051ab
children 12e94cba3696
comparison
equal deleted inserted replaced
20184:84105dcdb05b 20804:7848fc12602b
21 * questions. 21 * questions.
22 * 22 *
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "classfile/classLoader.hpp"
26 #include "classfile/javaAssertions.hpp" 27 #include "classfile/javaAssertions.hpp"
27 #include "classfile/symbolTable.hpp" 28 #include "classfile/symbolTable.hpp"
28 #include "compiler/compilerOracle.hpp" 29 #include "compiler/compilerOracle.hpp"
29 #include "memory/allocation.inline.hpp" 30 #include "memory/allocation.inline.hpp"
30 #include "memory/cardTableRS.hpp" 31 #include "memory/cardTableRS.hpp"
32 #include "memory/referenceProcessor.hpp" 33 #include "memory/referenceProcessor.hpp"
33 #include "memory/universe.inline.hpp" 34 #include "memory/universe.inline.hpp"
34 #include "oops/oop.inline.hpp" 35 #include "oops/oop.inline.hpp"
35 #include "prims/jvmtiExport.hpp" 36 #include "prims/jvmtiExport.hpp"
36 #include "runtime/arguments.hpp" 37 #include "runtime/arguments.hpp"
38 #include "runtime/arguments_ext.hpp"
37 #include "runtime/globals_extension.hpp" 39 #include "runtime/globals_extension.hpp"
38 #include "runtime/java.hpp" 40 #include "runtime/java.hpp"
39 #include "services/management.hpp" 41 #include "services/management.hpp"
40 #include "services/memTracker.hpp" 42 #include "services/memTracker.hpp"
41 #include "utilities/defaultStream.hpp" 43 #include "utilities/defaultStream.hpp"
42 #include "utilities/macros.hpp" 44 #include "utilities/macros.hpp"
45 #include "utilities/stringUtils.hpp"
43 #include "utilities/taskqueue.hpp" 46 #include "utilities/taskqueue.hpp"
44 #ifdef TARGET_OS_FAMILY_linux 47 #ifdef TARGET_OS_FAMILY_linux
45 # include "os_linux.inline.hpp" 48 # include "os_linux.inline.hpp"
46 #endif 49 #endif
47 #ifdef TARGET_OS_FAMILY_solaris 50 #ifdef TARGET_OS_FAMILY_solaris
61 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 64 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
62 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" 65 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
63 #endif // INCLUDE_ALL_GCS 66 #endif // INCLUDE_ALL_GCS
64 67
65 // Note: This is a special bug reporting site for the JVM 68 // Note: This is a special bug reporting site for the JVM
66 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" 69 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
67 #define DEFAULT_JAVA_LAUNCHER "generic" 70 #define DEFAULT_JAVA_LAUNCHER "generic"
68 71
69 // Disable options not supported in this release, with a warning if they 72 // Disable options not supported in this release, with a warning if they
70 // were explicitly requested on the command-line 73 // were explicitly requested on the command-line
71 #define UNSUPPORTED_OPTION(opt, description) \ 74 #define UNSUPPORTED_OPTION(opt, description) \
100 SystemProperty* Arguments::_system_properties = NULL; 103 SystemProperty* Arguments::_system_properties = NULL;
101 const char* Arguments::_gc_log_filename = NULL; 104 const char* Arguments::_gc_log_filename = NULL;
102 bool Arguments::_has_profile = false; 105 bool Arguments::_has_profile = false;
103 size_t Arguments::_conservative_max_heap_alignment = 0; 106 size_t Arguments::_conservative_max_heap_alignment = 0;
104 uintx Arguments::_min_heap_size = 0; 107 uintx Arguments::_min_heap_size = 0;
108 uintx Arguments::_min_heap_free_ratio = 0;
109 uintx Arguments::_max_heap_free_ratio = 0;
105 Arguments::Mode Arguments::_mode = _mixed; 110 Arguments::Mode Arguments::_mode = _mixed;
106 bool Arguments::_java_compiler = false; 111 bool Arguments::_java_compiler = false;
107 bool Arguments::_xdebug_mode = false; 112 bool Arguments::_xdebug_mode = false;
108 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; 113 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG;
109 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER; 114 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
303 { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 308 { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
304 { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 309 { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
305 { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 310 { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) },
306 { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 311 { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) },
307 { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) }, 312 { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) },
313 { "AutoShutdownNMT", JDK_Version::jdk(9), JDK_Version::jdk(10) },
314 { "CompilationRepeat", JDK_Version::jdk(8), JDK_Version::jdk(9) },
308 #ifdef PRODUCT 315 #ifdef PRODUCT
309 { "DesiredMethodLimit", 316 { "DesiredMethodLimit",
310 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, 317 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
311 #endif // PRODUCT 318 #endif // PRODUCT
312 { NULL, JDK_Version(0), JDK_Version(0) } 319 { NULL, JDK_Version(0), JDK_Version(0) }
1122 1129
1123 #if defined(COMPILER2) || defined(GRAAL) || defined(_LP64) || !INCLUDE_CDS 1130 #if defined(COMPILER2) || defined(GRAAL) || defined(_LP64) || !INCLUDE_CDS
1124 // Conflict: required to use shared spaces (-Xshare:on), but 1131 // Conflict: required to use shared spaces (-Xshare:on), but
1125 // incompatible command line options were chosen. 1132 // incompatible command line options were chosen.
1126 1133
1127 static void no_shared_spaces() { 1134 static void no_shared_spaces(const char* message) {
1128 if (RequireSharedSpaces) { 1135 if (RequireSharedSpaces) {
1129 jio_fprintf(defaultStream::error_stream(), 1136 jio_fprintf(defaultStream::error_stream(),
1130 "Class data sharing is inconsistent with other specified options.\n"); 1137 "Class data sharing is inconsistent with other specified options.\n");
1131 vm_exit_during_initialization("Unable to use shared archive.", NULL); 1138 vm_exit_during_initialization("Unable to use shared archive.", message);
1132 } else { 1139 } else {
1133 FLAG_SET_DEFAULT(UseSharedSpaces, false); 1140 FLAG_SET_DEFAULT(UseSharedSpaces, false);
1134 } 1141 }
1135 } 1142 }
1136 #endif 1143 #endif
1150 } 1157 }
1151 if (!UseInterpreter) { // -Xcomp 1158 if (!UseInterpreter) { // -Xcomp
1152 Tier3InvokeNotifyFreqLog = 0; 1159 Tier3InvokeNotifyFreqLog = 0;
1153 Tier4InvocationThreshold = 0; 1160 Tier4InvocationThreshold = 0;
1154 } 1161 }
1162 }
1163
1164 /**
1165 * Returns the minimum number of compiler threads needed to run the JVM. The following
1166 * configurations are possible.
1167 *
1168 * 1) The JVM is build using an interpreter only. As a result, the minimum number of
1169 * compiler threads is 0.
1170 * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
1171 * a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
1172 * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
1173 * the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
1174 * C1 can be used, so the minimum number of compiler threads is 1.
1175 * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
1176 * 'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,
1177 * the minimum number of compiler threads is 2.
1178 */
1179 int Arguments::get_min_number_of_compiler_threads() {
1180 #if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !defined(COMPILERGRAAL)
1181 return 0; // case 1
1182 #else
1183 if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
1184 return 1; // case 2 or case 3
1185 }
1186 return 2; // case 4 (tiered)
1187 #endif
1155 } 1188 }
1156 1189
1157 #if INCLUDE_ALL_GCS 1190 #if INCLUDE_ALL_GCS
1158 static void disable_adaptive_size_policy(const char* collector_name) { 1191 static void disable_adaptive_size_policy(const char* collector_name) {
1159 if (UseAdaptiveSizePolicy) { 1192 if (UseAdaptiveSizePolicy) {
1412 jio_fprintf(defaultStream::error_stream(), 1445 jio_fprintf(defaultStream::error_stream(),
1413 "error: ObjectAlignmentInBytes=%d must be less than page size %d\n", 1446 "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
1414 (int)ObjectAlignmentInBytes, os::vm_page_size()); 1447 (int)ObjectAlignmentInBytes, os::vm_page_size());
1415 return false; 1448 return false;
1416 } 1449 }
1450 if(SurvivorAlignmentInBytes == 0) {
1451 SurvivorAlignmentInBytes = ObjectAlignmentInBytes;
1452 } else {
1453 if (!is_power_of_2(SurvivorAlignmentInBytes)) {
1454 jio_fprintf(defaultStream::error_stream(),
1455 "error: SurvivorAlignmentInBytes=%d must be power of 2\n",
1456 (int)SurvivorAlignmentInBytes);
1457 return false;
1458 }
1459 if (SurvivorAlignmentInBytes < ObjectAlignmentInBytes) {
1460 jio_fprintf(defaultStream::error_stream(),
1461 "error: SurvivorAlignmentInBytes=%d must be greater than ObjectAlignmentInBytes=%d \n",
1462 (int)SurvivorAlignmentInBytes, (int)ObjectAlignmentInBytes);
1463 return false;
1464 }
1465 }
1417 return true; 1466 return true;
1418 } 1467 }
1419 1468
1420 uintx Arguments::max_heap_for_compressed_oops() { 1469 size_t Arguments::max_heap_for_compressed_oops() {
1421 // Avoid sign flip. 1470 // Avoid sign flip.
1422 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size"); 1471 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1423 // We need to fit both the NULL page and the heap into the memory budget, while 1472 // We need to fit both the NULL page and the heap into the memory budget, while
1424 // keeping alignment constraints of the heap. To guarantee the latter, as the 1473 // keeping alignment constraints of the heap. To guarantee the latter, as the
1425 // NULL page is located before the heap, we pad the NULL page to the conservative 1474 // NULL page is located before the heap, we pad the NULL page to the conservative
1523 heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment(); 1572 heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment();
1524 } else if (UseG1GC) { 1573 } else if (UseG1GC) {
1525 heap_alignment = G1CollectedHeap::conservative_max_heap_alignment(); 1574 heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
1526 } 1575 }
1527 #endif // INCLUDE_ALL_GCS 1576 #endif // INCLUDE_ALL_GCS
1528 _conservative_max_heap_alignment = MAX3(heap_alignment, os::max_page_size(), 1577 _conservative_max_heap_alignment = MAX4(heap_alignment,
1529 CollectorPolicy::compute_heap_alignment()); 1578 (size_t)os::vm_allocation_granularity(),
1579 os::max_page_size(),
1580 CollectorPolicy::compute_heap_alignment());
1581 }
1582
1583 void Arguments::select_gc_ergonomically() {
1584 if (os::is_server_class_machine()) {
1585 if (should_auto_select_low_pause_collector()) {
1586 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true);
1587 } else {
1588 FLAG_SET_ERGO(bool, UseParallelGC, true);
1589 }
1590 }
1591 }
1592
1593 void Arguments::select_gc() {
1594 if (!gc_selected()) {
1595 ArgumentsExt::select_gc_ergonomically();
1596 }
1530 } 1597 }
1531 1598
1532 void Arguments::set_ergonomics_flags() { 1599 void Arguments::set_ergonomics_flags() {
1533 1600 select_gc();
1534 if (os::is_server_class_machine()) { 1601
1535 // If no other collector is requested explicitly,
1536 // let the VM select the collector based on
1537 // machine class and automatic selection policy.
1538 if (!UseSerialGC &&
1539 !UseConcMarkSweepGC &&
1540 !UseG1GC &&
1541 !UseParNewGC &&
1542 FLAG_IS_DEFAULT(UseParallelGC)) {
1543 if (should_auto_select_low_pause_collector()) {
1544 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true);
1545 } else {
1546 FLAG_SET_ERGO(bool, UseParallelGC, true);
1547 }
1548 }
1549 }
1550 #if defined(COMPILER2) || defined(GRAAL) 1602 #if defined(COMPILER2) || defined(GRAAL)
1551 // Shared spaces work fine with other GCs but causes bytecode rewriting 1603 // Shared spaces work fine with other GCs but causes bytecode rewriting
1552 // to be disabled, which hurts interpreter performance and decreases 1604 // to be disabled, which hurts interpreter performance and decreases
1553 // server performance. When -server is specified, keep the default off 1605 // server performance. When -server is specified, keep the default off
1554 // unless it is asked for. Future work: either add bytecode rewriting 1606 // unless it is asked for. Future work: either add bytecode rewriting
1555 // at link time, or rewrite bytecodes in non-shared methods. 1607 // at link time, or rewrite bytecodes in non-shared methods.
1556 if (!DumpSharedSpaces && !RequireSharedSpaces && 1608 if (!DumpSharedSpaces && !RequireSharedSpaces &&
1557 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { 1609 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
1558 no_shared_spaces(); 1610 no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on.");
1559 } 1611 }
1560 #endif 1612 #endif
1561 1613
1562 set_conservative_max_heap_alignment(); 1614 set_conservative_max_heap_alignment();
1563 1615
1596 if (UseAdaptiveSizePolicy) { 1648 if (UseAdaptiveSizePolicy) {
1597 // We don't want to limit adaptive heap sizing's freedom to adjust the heap 1649 // We don't want to limit adaptive heap sizing's freedom to adjust the heap
1598 // unless the user actually sets these flags. 1650 // unless the user actually sets these flags.
1599 if (FLAG_IS_DEFAULT(MinHeapFreeRatio)) { 1651 if (FLAG_IS_DEFAULT(MinHeapFreeRatio)) {
1600 FLAG_SET_DEFAULT(MinHeapFreeRatio, 0); 1652 FLAG_SET_DEFAULT(MinHeapFreeRatio, 0);
1653 _min_heap_free_ratio = MinHeapFreeRatio;
1601 } 1654 }
1602 if (FLAG_IS_DEFAULT(MaxHeapFreeRatio)) { 1655 if (FLAG_IS_DEFAULT(MaxHeapFreeRatio)) {
1603 FLAG_SET_DEFAULT(MaxHeapFreeRatio, 100); 1656 FLAG_SET_DEFAULT(MaxHeapFreeRatio, 100);
1657 _max_heap_free_ratio = MaxHeapFreeRatio;
1604 } 1658 }
1605 } 1659 }
1606 1660
1607 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the 1661 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
1608 // SurvivorRatio has been set, reset their default values to SurvivorRatio + 1662 // SurvivorRatio has been set, reset their default values to SurvivorRatio +
1637 if (ParallelGCThreads == 0) { 1691 if (ParallelGCThreads == 0) {
1638 FLAG_SET_DEFAULT(ParallelGCThreads, 1692 FLAG_SET_DEFAULT(ParallelGCThreads,
1639 Abstract_VM_Version::parallel_worker_threads()); 1693 Abstract_VM_Version::parallel_worker_threads());
1640 } 1694 }
1641 1695
1696 #if INCLUDE_ALL_GCS
1697 if (G1ConcRefinementThreads == 0) {
1698 FLAG_SET_DEFAULT(G1ConcRefinementThreads, ParallelGCThreads);
1699 }
1700 #endif
1701
1642 // MarkStackSize will be set (if it hasn't been set by the user) 1702 // MarkStackSize will be set (if it hasn't been set by the user)
1643 // when concurrent marking is initialized. 1703 // when concurrent marking is initialized.
1644 // Its value will be based upon the number of parallel marking threads. 1704 // Its value will be based upon the number of parallel marking threads.
1645 // But we do set the maximum mark stack size here. 1705 // But we do set the maximum mark stack size here.
1646 if (FLAG_IS_DEFAULT(MarkStackSizeMax)) { 1706 if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
1660 if (PrintGCDetails && Verbose) { 1720 if (PrintGCDetails && Verbose) {
1661 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", 1721 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
1662 (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K)); 1722 (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1663 tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads); 1723 tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads);
1664 } 1724 }
1725 }
1726
1727 #if !INCLUDE_ALL_GCS
1728 #ifdef ASSERT
1729 static bool verify_serial_gc_flags() {
1730 return (UseSerialGC &&
1731 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1732 UseParallelGC || UseParallelOldGC));
1733 }
1734 #endif // ASSERT
1735 #endif // INCLUDE_ALL_GCS
1736
1737 void Arguments::set_gc_specific_flags() {
1738 #if INCLUDE_ALL_GCS
1739 // Set per-collector flags
1740 if (UseParallelGC || UseParallelOldGC) {
1741 set_parallel_gc_flags();
1742 } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
1743 set_cms_and_parnew_gc_flags();
1744 } else if (UseParNewGC) { // Skipped if CMS is set above
1745 set_parnew_gc_flags();
1746 } else if (UseG1GC) {
1747 set_g1_gc_flags();
1748 }
1749 check_deprecated_gcs();
1750 check_deprecated_gc_flags();
1751 if (AssumeMP && !UseSerialGC) {
1752 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
1753 warning("If the number of processors is expected to increase from one, then"
1754 " you should configure the number of parallel GC threads appropriately"
1755 " using -XX:ParallelGCThreads=N");
1756 }
1757 }
1758 if (MinHeapFreeRatio == 100) {
1759 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
1760 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
1761 }
1762 #else // INCLUDE_ALL_GCS
1763 assert(verify_serial_gc_flags(), "SerialGC unset");
1764 #endif // INCLUDE_ALL_GCS
1665 } 1765 }
1666 1766
1667 julong Arguments::limit_by_allocatable_memory(julong limit) { 1767 julong Arguments::limit_by_allocatable_memory(julong limit) {
1668 julong max_allocatable; 1768 julong max_allocatable;
1669 julong result = limit; 1769 julong result = limit;
1884 jio_fprintf(defaultStream::error_stream(), 1984 jio_fprintf(defaultStream::error_stream(),
1885 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n", 1985 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n",
1886 name, value); 1986 name, value);
1887 return false; 1987 return false;
1888 } 1988 }
1889
1890 #if !INCLUDE_ALL_GCS
1891 #ifdef ASSERT
1892 static bool verify_serial_gc_flags() {
1893 return (UseSerialGC &&
1894 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1895 UseParallelGC || UseParallelOldGC));
1896 }
1897 #endif // ASSERT
1898 #endif // INCLUDE_ALL_GCS
1899 1989
1900 // check if do gclog rotation 1990 // check if do gclog rotation
1901 // +UseGCLogFileRotation is a must, 1991 // +UseGCLogFileRotation is a must,
1902 // no gc log rotation when log file not supplied or 1992 // no gc log rotation when log file not supplied or
1903 // NumberOfGCLogFiles is 0 1993 // NumberOfGCLogFiles is 0
1973 err_msg.print("MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " 2063 err_msg.print("MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
1974 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")", min_heap_free_ratio, 2064 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")", min_heap_free_ratio,
1975 MaxHeapFreeRatio); 2065 MaxHeapFreeRatio);
1976 return false; 2066 return false;
1977 } 2067 }
2068 // This does not set the flag itself, but stores the value in a safe place for later usage.
2069 _min_heap_free_ratio = min_heap_free_ratio;
1978 return true; 2070 return true;
1979 } 2071 }
1980 2072
1981 bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio) { 2073 bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio) {
1982 if (!is_percentage(max_heap_free_ratio)) { 2074 if (!is_percentage(max_heap_free_ratio)) {
1987 err_msg.print("MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or " 2079 err_msg.print("MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or "
1988 "equal to MinHeapFreeRatio (" UINTX_FORMAT ")", max_heap_free_ratio, 2080 "equal to MinHeapFreeRatio (" UINTX_FORMAT ")", max_heap_free_ratio,
1989 MinHeapFreeRatio); 2081 MinHeapFreeRatio);
1990 return false; 2082 return false;
1991 } 2083 }
2084 // This does not set the flag itself, but stores the value in a safe place for later usage.
2085 _max_heap_free_ratio = max_heap_free_ratio;
1992 return true; 2086 return true;
1993 } 2087 }
1994 2088
1995 // Check consistency of GC selection 2089 // Check consistency of GC selection
1996 bool Arguments::check_gc_consistency() { 2090 bool Arguments::check_gc_consistency_user() {
1997 check_gclog_consistency(); 2091 check_gclog_consistency();
1998 bool status = true; 2092 bool status = true;
1999 // Ensure that the user has not selected conflicting sets 2093 // Ensure that the user has not selected conflicting sets
2000 // of collectors. [Note: this check is merely a user convenience; 2094 // of collectors. [Note: this check is merely a user convenience;
2001 // collectors over-ride each other so that only a non-conflicting 2095 // collectors over-ride each other so that only a non-conflicting
2157 if (GCTimeLimit == 100) { 2251 if (GCTimeLimit == 100) {
2158 // Turn off gc-overhead-limit-exceeded checks 2252 // Turn off gc-overhead-limit-exceeded checks
2159 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); 2253 FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
2160 } 2254 }
2161 2255
2162 status = status && check_gc_consistency(); 2256 status = status && check_gc_consistency_user();
2163 status = status && check_stack_pages(); 2257 status = status && check_stack_pages();
2164 2258
2165 if (CMSIncrementalMode) { 2259 if (CMSIncrementalMode) {
2166 if (!UseConcMarkSweepGC) { 2260 if (!UseConcMarkSweepGC) {
2167 jio_fprintf(defaultStream::error_stream(), 2261 jio_fprintf(defaultStream::error_stream(),
2340 status = status && verify_interval(InitialTenuringThreshold, 0, MaxTenuringThreshold, "MaxTenuringThreshold"); 2434 status = status && verify_interval(InitialTenuringThreshold, 0, MaxTenuringThreshold, "MaxTenuringThreshold");
2341 status = status && verify_percentage(TargetSurvivorRatio, "TargetSurvivorRatio"); 2435 status = status && verify_percentage(TargetSurvivorRatio, "TargetSurvivorRatio");
2342 status = status && verify_percentage(MarkSweepDeadRatio, "MarkSweepDeadRatio"); 2436 status = status && verify_percentage(MarkSweepDeadRatio, "MarkSweepDeadRatio");
2343 2437
2344 status = status && verify_min_value(MarkSweepAlwaysCompactCount, 1, "MarkSweepAlwaysCompactCount"); 2438 status = status && verify_min_value(MarkSweepAlwaysCompactCount, 1, "MarkSweepAlwaysCompactCount");
2439 #ifdef COMPILER1
2440 status = status && verify_min_value(ValueMapInitialSize, 1, "ValueMapInitialSize");
2441 #endif
2345 2442
2346 if (PrintNMTStatistics) { 2443 if (PrintNMTStatistics) {
2347 #if INCLUDE_NMT 2444 #if INCLUDE_NMT
2348 if (MemTracker::tracking_level() == MemTracker::NMT_off) { 2445 if (MemTracker::tracking_level() == NMT_off) {
2349 #endif // INCLUDE_NMT 2446 #endif // INCLUDE_NMT
2350 warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled"); 2447 warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled");
2351 PrintNMTStatistics = false; 2448 PrintNMTStatistics = false;
2352 #if INCLUDE_NMT 2449 #if INCLUDE_NMT
2353 } 2450 }
2429 } 2526 }
2430 2527
2431 #ifdef COMPILER1 2528 #ifdef COMPILER1
2432 status &= verify_interval(SafepointPollOffset, 0, os::vm_page_size() - BytesPerWord, "SafepointPollOffset"); 2529 status &= verify_interval(SafepointPollOffset, 0, os::vm_page_size() - BytesPerWord, "SafepointPollOffset");
2433 #endif 2530 #endif
2531
2532 int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
2533 // The default CICompilerCount's value is CI_COMPILER_COUNT.
2534 assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
2535 // Check the minimum number of compiler threads
2536 status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
2434 2537
2435 return status; 2538 return status;
2436 } 2539 }
2437 2540
2438 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, 2541 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2909 CommandLineFlags::printFlags(tty, false); 3012 CommandLineFlags::printFlags(tty, false);
2910 vm_exit(0); 3013 vm_exit(0);
2911 #endif 3014 #endif
2912 // -D 3015 // -D
2913 } else if (match_option(option, "-D", &tail)) { 3016 } else if (match_option(option, "-D", &tail)) {
3017 if (CheckEndorsedAndExtDirs) {
3018 if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
3019 // abort if -Djava.endorsed.dirs is set
3020 jio_fprintf(defaultStream::output_stream(),
3021 "-Djava.endorsed.dirs will not be supported in a future release.\n"
3022 "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
3023 return JNI_EINVAL;
3024 }
3025 if (match_option(option, "-Djava.ext.dirs=", &tail)) {
3026 // abort if -Djava.ext.dirs is set
3027 jio_fprintf(defaultStream::output_stream(),
3028 "-Djava.ext.dirs will not be supported in a future release.\n"
3029 "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
3030 return JNI_EINVAL;
3031 }
3032 }
3033
2914 if (!add_property(tail)) { 3034 if (!add_property(tail)) {
2915 return JNI_ENOMEM; 3035 return JNI_ENOMEM;
2916 } 3036 }
2917 // Out of the box management support 3037 // Out of the box management support
2918 if (match_option(option, "-Dcom.sun.management", &tail)) { 3038 if (match_option(option, "-Dcom.sun.management", &tail)) {
3287 else if (is_bad_option(option, args->ignoreUnrecognized)) { 3407 else if (is_bad_option(option, args->ignoreUnrecognized)) {
3288 return JNI_ERR; 3408 return JNI_ERR;
3289 } 3409 }
3290 } 3410 }
3291 3411
3412 // PrintSharedArchiveAndExit will turn on
3413 // -Xshare:on
3414 // -XX:+TraceClassPaths
3415 if (PrintSharedArchiveAndExit) {
3416 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
3417 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
3418 FLAG_SET_CMDLINE(bool, TraceClassPaths, true);
3419 }
3420
3292 // Change the default value for flags which have different default values 3421 // Change the default value for flags which have different default values
3293 // when working with older JDKs. 3422 // when working with older JDKs.
3294 #ifdef LINUX 3423 #ifdef LINUX
3295 if (JDK_Version::current().compare_major(6) <= 0 && 3424 if (JDK_Version::current().compare_major(6) <= 0 &&
3296 FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) { 3425 FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) {
3297 FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false); 3426 FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false);
3298 } 3427 }
3299 #endif // LINUX 3428 #endif // LINUX
3429 fix_appclasspath();
3300 return JNI_OK; 3430 return JNI_OK;
3431 }
3432
3433 // Remove all empty paths from the app classpath (if IgnoreEmptyClassPaths is enabled)
3434 //
3435 // This is necessary because some apps like to specify classpath like -cp foo.jar:${XYZ}:bar.jar
3436 // in their start-up scripts. If XYZ is empty, the classpath will look like "-cp foo.jar::bar.jar".
3437 // Java treats such empty paths as if the user specified "-cp foo.jar:.:bar.jar". I.e., an empty
3438 // path is treated as the current directory.
3439 //
3440 // This causes problems with CDS, which requires that all directories specified in the classpath
3441 // must be empty. In most cases, applications do NOT want to load classes from the current
3442 // directory anyway. Adding -XX:+IgnoreEmptyClassPaths will make these applications' start-up
3443 // scripts compatible with CDS.
3444 void Arguments::fix_appclasspath() {
3445 if (IgnoreEmptyClassPaths) {
3446 const char separator = *os::path_separator();
3447 const char* src = _java_class_path->value();
3448
3449 // skip over all the leading empty paths
3450 while (*src == separator) {
3451 src ++;
3452 }
3453
3454 char* copy = AllocateHeap(strlen(src) + 1, mtInternal);
3455 strncpy(copy, src, strlen(src) + 1);
3456
3457 // trim all trailing empty paths
3458 for (char* tail = copy + strlen(copy) - 1; tail >= copy && *tail == separator; tail--) {
3459 *tail = '\0';
3460 }
3461
3462 char from[3] = {separator, separator, '\0'};
3463 char to [2] = {separator, '\0'};
3464 while (StringUtils::replace_no_expand(copy, from, to) > 0) {
3465 // Keep replacing "::" -> ":" until we have no more "::" (non-windows)
3466 // Keep replacing ";;" -> ";" until we have no more ";;" (windows)
3467 }
3468
3469 _java_class_path->set_value(copy);
3470 FreeHeap(copy); // a copy was made by set_value, so don't need this anymore
3471 }
3472
3473 if (!PrintSharedArchiveAndExit) {
3474 ClassLoader::trace_class_path("[classpath: ", _java_class_path->value());
3475 }
3476 }
3477
3478 static bool has_jar_files(const char* directory) {
3479 DIR* dir = os::opendir(directory);
3480 if (dir == NULL) return false;
3481
3482 struct dirent *entry;
3483 char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
3484 bool hasJarFile = false;
3485 while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
3486 const char* name = entry->d_name;
3487 const char* ext = name + strlen(name) - 4;
3488 hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
3489 }
3490 FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
3491 os::closedir(dir);
3492 return hasJarFile ;
3493 }
3494
3495 // returns the number of directories in the given path containing JAR files
3496 // If the skip argument is not NULL, it will skip that directory
3497 static int check_non_empty_dirs(const char* path, const char* type, const char* skip) {
3498 const char separator = *os::path_separator();
3499 const char* const end = path + strlen(path);
3500 int nonEmptyDirs = 0;
3501 while (path < end) {
3502 const char* tmp_end = strchr(path, separator);
3503 if (tmp_end == NULL) {
3504 if ((skip == NULL || strcmp(path, skip) != 0) && has_jar_files(path)) {
3505 nonEmptyDirs++;
3506 jio_fprintf(defaultStream::output_stream(),
3507 "Non-empty %s directory: %s\n", type, path);
3508 }
3509 path = end;
3510 } else {
3511 char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
3512 memcpy(dirpath, path, tmp_end - path);
3513 dirpath[tmp_end - path] = '\0';
3514 if ((skip == NULL || strcmp(dirpath, skip) != 0) && has_jar_files(dirpath)) {
3515 nonEmptyDirs++;
3516 jio_fprintf(defaultStream::output_stream(),
3517 "Non-empty %s directory: %s\n", type, dirpath);
3518 }
3519 FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
3520 path = tmp_end + 1;
3521 }
3522 }
3523 return nonEmptyDirs;
3524 }
3525
3526 // Returns true if endorsed standards override mechanism and extension mechanism
3527 // are not used.
3528 static bool check_endorsed_and_ext_dirs() {
3529 if (!CheckEndorsedAndExtDirs)
3530 return true;
3531
3532 char endorsedDir[JVM_MAXPATHLEN];
3533 char extDir[JVM_MAXPATHLEN];
3534 const char* fileSep = os::file_separator();
3535 jio_snprintf(endorsedDir, sizeof(endorsedDir), "%s%slib%sendorsed",
3536 Arguments::get_java_home(), fileSep, fileSep);
3537 jio_snprintf(extDir, sizeof(extDir), "%s%slib%sext",
3538 Arguments::get_java_home(), fileSep, fileSep);
3539
3540 // check endorsed directory
3541 int nonEmptyDirs = check_non_empty_dirs(Arguments::get_endorsed_dir(), "endorsed", NULL);
3542
3543 // check the extension directories but skip the default lib/ext directory
3544 nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs(), "extension", extDir);
3545
3546 // List of JAR files installed in the default lib/ext directory.
3547 // -XX:+CheckEndorsedAndExtDirs checks if any non-JDK file installed
3548 static const char* jdk_ext_jars[] = {
3549 "access-bridge-32.jar",
3550 "access-bridge-64.jar",
3551 "access-bridge.jar",
3552 "cldrdata.jar",
3553 "dnsns.jar",
3554 "jaccess.jar",
3555 "jfxrt.jar",
3556 "localedata.jar",
3557 "nashorn.jar",
3558 "sunec.jar",
3559 "sunjce_provider.jar",
3560 "sunmscapi.jar",
3561 "sunpkcs11.jar",
3562 "ucrypto.jar",
3563 "zipfs.jar",
3564 NULL
3565 };
3566
3567 // check if the default lib/ext directory has any non-JDK jar files; if so, error
3568 DIR* dir = os::opendir(extDir);
3569 if (dir != NULL) {
3570 int num_ext_jars = 0;
3571 struct dirent *entry;
3572 char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(extDir), mtInternal);
3573 while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
3574 const char* name = entry->d_name;
3575 const char* ext = name + strlen(name) - 4;
3576 if (ext > name && (os::file_name_strcmp(ext, ".jar") == 0)) {
3577 bool is_jdk_jar = false;
3578 const char* jarfile = NULL;
3579 for (int i=0; (jarfile = jdk_ext_jars[i]) != NULL; i++) {
3580 if (os::file_name_strcmp(name, jarfile) == 0) {
3581 is_jdk_jar = true;
3582 break;
3583 }
3584 }
3585 if (!is_jdk_jar) {
3586 jio_fprintf(defaultStream::output_stream(),
3587 "%s installed in <JAVA_HOME>/lib/ext\n", name);
3588 num_ext_jars++;
3589 }
3590 }
3591 }
3592 FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
3593 os::closedir(dir);
3594 if (num_ext_jars > 0) {
3595 nonEmptyDirs += 1;
3596 }
3597 }
3598
3599 // check if the default lib/endorsed directory exists; if so, error
3600 dir = os::opendir(endorsedDir);
3601 if (dir != NULL) {
3602 jio_fprintf(defaultStream::output_stream(), "<JAVA_HOME>/lib/endorsed exists\n");
3603 os::closedir(dir);
3604 nonEmptyDirs += 1;
3605 }
3606
3607 if (nonEmptyDirs > 0) {
3608 jio_fprintf(defaultStream::output_stream(),
3609 "Endorsed standards override mechanism and extension mechanism "
3610 "will not be supported in a future release.\n"
3611 "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
3612 return false;
3613 }
3614
3615 return true;
3301 } 3616 }
3302 3617
3303 jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) { 3618 jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
3304 // This must be done after all -D arguments have been processed. 3619 // This must be done after all -D arguments have been processed.
3305 scp_p->expand_endorsed(); 3620 scp_p->expand_endorsed();
3314 #endif 3629 #endif
3315 3630
3316 if (scp_assembly_required || scp_p->get_endorsed() != NULL) { 3631 if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
3317 // Assemble the bootclasspath elements into the final path. 3632 // Assemble the bootclasspath elements into the final path.
3318 Arguments::set_sysclasspath(scp_p->combined_path()); 3633 Arguments::set_sysclasspath(scp_p->combined_path());
3634 }
3635
3636 if (!check_endorsed_and_ext_dirs()) {
3637 return JNI_ERR;
3319 } 3638 }
3320 3639
3321 // This must be done after all arguments have been processed. 3640 // This must be done after all arguments have been processed.
3322 // java_compiler() true means set to "NONE" or empty. 3641 // java_compiler() true means set to "NONE" or empty.
3323 if (java_compiler() && !xdebug_mode()) { 3642 if (java_compiler() && !xdebug_mode()) {
3477 if (!UseCompressedOops || !UseCompressedClassPointers) { 3796 if (!UseCompressedOops || !UseCompressedClassPointers) {
3478 vm_exit_during_initialization( 3797 vm_exit_during_initialization(
3479 "Cannot dump shared archive when UseCompressedOops or UseCompressedClassPointers is off.", NULL); 3798 "Cannot dump shared archive when UseCompressedOops or UseCompressedClassPointers is off.", NULL);
3480 } 3799 }
3481 } else { 3800 } else {
3482 // UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces.
3483 if (!UseCompressedOops || !UseCompressedClassPointers) { 3801 if (!UseCompressedOops || !UseCompressedClassPointers) {
3484 no_shared_spaces(); 3802 no_shared_spaces("UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces.");
3485 } 3803 }
3486 #endif 3804 #endif
3487 } 3805 }
3488 } 3806 }
3489 3807
3563 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. 3881 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
3564 const char* hotspotrc = ".hotspotrc"; 3882 const char* hotspotrc = ".hotspotrc";
3565 bool settings_file_specified = false; 3883 bool settings_file_specified = false;
3566 bool needs_hotspotrc_warning = false; 3884 bool needs_hotspotrc_warning = false;
3567 3885
3886 ArgumentsExt::process_options(args);
3887
3568 const char* flags_file; 3888 const char* flags_file;
3569 int index; 3889 int index;
3570 for (index = 0; index < args->nOptions; index++) { 3890 for (index = 0; index < args->nOptions; index++) {
3571 const JavaVMOption *option = args->options + index; 3891 const JavaVMOption *option = args->options + index;
3572 if (match_option(option, "-XX:Flags=", &tail)) { 3892 if (match_option(option, "-XX:Flags=", &tail)) {
3593 } 3913 }
3594 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) { 3914 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) {
3595 CommandLineFlags::printFlags(tty, false); 3915 CommandLineFlags::printFlags(tty, false);
3596 vm_exit(0); 3916 vm_exit(0);
3597 } 3917 }
3918 #if INCLUDE_NMT
3598 if (match_option(option, "-XX:NativeMemoryTracking", &tail)) { 3919 if (match_option(option, "-XX:NativeMemoryTracking", &tail)) {
3599 #if INCLUDE_NMT 3920 // The launcher did not setup nmt environment variable properly.
3600 MemTracker::init_tracking_options(tail); 3921 if (!MemTracker::check_launcher_nmt_support(tail)) {
3601 #else 3922 warning("Native Memory Tracking did not setup properly, using wrong launcher?");
3602 jio_fprintf(defaultStream::error_stream(), 3923 }
3603 "Native Memory Tracking is not supported in this VM\n"); 3924
3604 return JNI_ERR; 3925 // Verify if nmt option is valid.
3926 if (MemTracker::verify_nmt_option()) {
3927 // Late initialization, still in single-threaded mode.
3928 if (MemTracker::tracking_level() >= NMT_summary) {
3929 MemTracker::init();
3930 }
3931 } else {
3932 vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL);
3933 }
3934 }
3605 #endif 3935 #endif
3606 }
3607 3936
3608 3937
3609 #ifndef PRODUCT 3938 #ifndef PRODUCT
3610 if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) { 3939 if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) {
3611 CommandLineFlags::printFlags(tty, true); 3940 CommandLineFlags::printFlags(tty, true);
3739 if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) || PrintSharedSpaces) { 4068 if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) || PrintSharedSpaces) {
3740 warning("Shared spaces are not supported in this VM"); 4069 warning("Shared spaces are not supported in this VM");
3741 FLAG_SET_DEFAULT(UseSharedSpaces, false); 4070 FLAG_SET_DEFAULT(UseSharedSpaces, false);
3742 FLAG_SET_DEFAULT(PrintSharedSpaces, false); 4071 FLAG_SET_DEFAULT(PrintSharedSpaces, false);
3743 } 4072 }
3744 no_shared_spaces(); 4073 no_shared_spaces("CDS Disabled");
3745 #endif // INCLUDE_CDS 4074 #endif // INCLUDE_CDS
3746 4075
3747 return JNI_OK; 4076 return JNI_OK;
3748 } 4077 }
3749 4078
3753 set_ergonomics_flags(); 4082 set_ergonomics_flags();
3754 4083
3755 set_shared_spaces_flags(); 4084 set_shared_spaces_flags();
3756 4085
3757 // Check the GC selections again. 4086 // Check the GC selections again.
3758 if (!check_gc_consistency()) { 4087 if (!ArgumentsExt::check_gc_consistency_ergo()) {
3759 return JNI_EINVAL; 4088 return JNI_EINVAL;
3760 } 4089 }
3761 4090
3762 if (TieredCompilation) { 4091 if (TieredCompilation) {
3763 set_tiered_flags(); 4092 set_tiered_flags();
3775 4104
3776 4105
3777 // Set heap size based on available physical memory 4106 // Set heap size based on available physical memory
3778 set_heap_size(); 4107 set_heap_size();
3779 4108
3780 #if INCLUDE_ALL_GCS 4109 ArgumentsExt::set_gc_specific_flags();
3781 // Set per-collector flags
3782 if (UseParallelGC || UseParallelOldGC) {
3783 set_parallel_gc_flags();
3784 } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
3785 set_cms_and_parnew_gc_flags();
3786 } else if (UseParNewGC) { // Skipped if CMS is set above
3787 set_parnew_gc_flags();
3788 } else if (UseG1GC) {
3789 set_g1_gc_flags();
3790 }
3791 check_deprecated_gcs();
3792 check_deprecated_gc_flags();
3793 if (AssumeMP && !UseSerialGC) {
3794 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
3795 warning("If the number of processors is expected to increase from one, then"
3796 " you should configure the number of parallel GC threads appropriately"
3797 " using -XX:ParallelGCThreads=N");
3798 }
3799 }
3800 if (MinHeapFreeRatio == 100) {
3801 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
3802 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
3803 }
3804 #else // INCLUDE_ALL_GCS
3805 assert(verify_serial_gc_flags(), "SerialGC unset");
3806 #endif // INCLUDE_ALL_GCS
3807 4110
3808 // Initialize Metaspace flags and alignments. 4111 // Initialize Metaspace flags and alignments.
3809 Metaspace::ergo_initialize(); 4112 Metaspace::ergo_initialize();
3810 4113
3811 // Set bytecode rewriting flags 4114 // Set bytecode rewriting flags
3860 } 4163 }
3861 if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) { 4164 if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) {
3862 // nothing to use the profiling, turn if off 4165 // nothing to use the profiling, turn if off
3863 FLAG_SET_DEFAULT(TypeProfileLevel, 0); 4166 FLAG_SET_DEFAULT(TypeProfileLevel, 0);
3864 } 4167 }
3865 if (UseTypeSpeculation && FLAG_IS_DEFAULT(ReplaceInParentMaps)) {
3866 // Doing the replace in parent maps helps speculation
3867 FLAG_SET_DEFAULT(ReplaceInParentMaps, true);
3868 }
3869 #endif 4168 #endif
3870 4169
3871 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 4170 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3872 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); 4171 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3873 DebugNonSafepoints = true; 4172 DebugNonSafepoints = true;
3921 4220
3922 return JNI_OK; 4221 return JNI_OK;
3923 } 4222 }
3924 4223
3925 jint Arguments::adjust_after_os() { 4224 jint Arguments::adjust_after_os() {
3926 #if INCLUDE_ALL_GCS 4225 if (UseNUMA) {
3927 if (UseParallelGC || UseParallelOldGC) { 4226 if (UseParallelGC || UseParallelOldGC) {
3928 if (UseNUMA) {
3929 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { 4227 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
3930 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M); 4228 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
3931 } 4229 }
3932 // For those collectors or operating systems (eg, Windows) that do 4230 }
3933 // not support full UseNUMA, we will map to UseNUMAInterleaving for now 4231 // UseNUMAInterleaving is set to ON for all collectors and
3934 UseNUMAInterleaving = true; 4232 // platforms when UseNUMA is set to ON. NUMA-aware collectors
3935 } 4233 // such as the parallel collector for Linux and Solaris will
3936 } 4234 // interleave old gen and survivor spaces on top of NUMA
3937 #endif // INCLUDE_ALL_GCS 4235 // allocation policy for the eden space.
4236 // Non NUMA-aware collectors such as CMS, G1 and Serial-GC on
4237 // all platforms and ParallelGC on Windows will interleave all
4238 // of the heap spaces across NUMA nodes.
4239 if (FLAG_IS_DEFAULT(UseNUMAInterleaving)) {
4240 FLAG_SET_ERGO(bool, UseNUMAInterleaving, true);
4241 }
4242 }
3938 return JNI_OK; 4243 return JNI_OK;
3939 } 4244 }
3940 4245
3941 int Arguments::PropertyList_count(SystemProperty* pl) { 4246 int Arguments::PropertyList_count(SystemProperty* pl) {
3942 int count = 0; 4247 int count = 0;