comparison src/share/vm/runtime/arguments.cpp @ 14518:d8041d695d19

Merged with jdk9/dev/hotspot changeset 3812c088b945
author twisti
date Tue, 11 Mar 2014 18:45:59 -0700
parents 49db2c1e3bee 16c705d792be
children b51e29501f30 4ca6dc0799b6
comparison
equal deleted inserted replaced
14141:f97c5ec83832 14518:d8041d695d19
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
49 # include "os_solaris.inline.hpp" 49 # include "os_solaris.inline.hpp"
50 #endif 50 #endif
51 #ifdef TARGET_OS_FAMILY_windows 51 #ifdef TARGET_OS_FAMILY_windows
52 # include "os_windows.inline.hpp" 52 # include "os_windows.inline.hpp"
53 #endif 53 #endif
54 #ifdef TARGET_OS_FAMILY_aix
55 # include "os_aix.inline.hpp"
56 #endif
54 #ifdef TARGET_OS_FAMILY_bsd 57 #ifdef TARGET_OS_FAMILY_bsd
55 # include "os_bsd.inline.hpp" 58 # include "os_bsd.inline.hpp"
56 #endif 59 #endif
57 #if INCLUDE_ALL_GCS 60 #if INCLUDE_ALL_GCS
58 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" 61 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
104 bool Arguments::_java_compiler = false; 107 bool Arguments::_java_compiler = false;
105 bool Arguments::_xdebug_mode = false; 108 bool Arguments::_xdebug_mode = false;
106 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; 109 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG;
107 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER; 110 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
108 int Arguments::_sun_java_launcher_pid = -1; 111 int Arguments::_sun_java_launcher_pid = -1;
109 bool Arguments::_created_by_gamma_launcher = false; 112 bool Arguments::_sun_java_launcher_is_altjvm = false;
110 113
111 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*) 114 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*)
112 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; 115 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
113 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement; 116 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement;
114 bool Arguments::_BackgroundCompilation = BackgroundCompilation; 117 bool Arguments::_BackgroundCompilation = BackgroundCompilation;
154 } 157 }
155 } 158 }
156 159
157 // Process java launcher properties. 160 // Process java launcher properties.
158 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) { 161 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
159 // See if sun.java.launcher or sun.java.launcher.pid is defined. 162 // See if sun.java.launcher, sun.java.launcher.is_altjvm or
163 // sun.java.launcher.pid is defined.
160 // Must do this before setting up other system properties, 164 // Must do this before setting up other system properties,
161 // as some of them may depend on launcher type. 165 // as some of them may depend on launcher type.
162 for (int index = 0; index < args->nOptions; index++) { 166 for (int index = 0; index < args->nOptions; index++) {
163 const JavaVMOption* option = args->options + index; 167 const JavaVMOption* option = args->options + index;
164 const char* tail; 168 const char* tail;
165 169
166 if (match_option(option, "-Dsun.java.launcher=", &tail)) { 170 if (match_option(option, "-Dsun.java.launcher=", &tail)) {
167 process_java_launcher_argument(tail, option->extraInfo); 171 process_java_launcher_argument(tail, option->extraInfo);
168 continue; 172 continue;
169 } 173 }
174 if (match_option(option, "-Dsun.java.launcher.is_altjvm=", &tail)) {
175 if (strcmp(tail, "true") == 0) {
176 _sun_java_launcher_is_altjvm = true;
177 }
178 continue;
179 }
170 if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) { 180 if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) {
171 _sun_java_launcher_pid = atoi(tail); 181 _sun_java_launcher_pid = atoi(tail);
172 continue; 182 continue;
173 } 183 }
174 } 184 }
181 "Java Virtual Machine Specification", false)); 191 "Java Virtual Machine Specification", false));
182 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false)); 192 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
183 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false)); 193 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false));
184 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true)); 194 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true));
185 195
186 // following are JVMTI agent writeable properties. 196 // Following are JVMTI agent writable properties.
187 // Properties values are set to NULL and they are 197 // Properties values are set to NULL and they are
188 // os specific they are initialized in os::init_system_properties_values(). 198 // os specific they are initialized in os::init_system_properties_values().
189 _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true); 199 _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true);
190 _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true); 200 _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true);
191 _sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true); 201 _sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true);
293 { "UseSplitVerifier", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 303 { "UseSplitVerifier", JDK_Version::jdk(8), JDK_Version::jdk(9) },
294 { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 304 { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
295 { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 305 { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
296 { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 306 { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) },
297 { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 307 { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) },
308 { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) },
298 #ifdef PRODUCT 309 #ifdef PRODUCT
299 { "DesiredMethodLimit", 310 { "DesiredMethodLimit",
300 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, 311 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
301 #endif // PRODUCT 312 #endif // PRODUCT
302 { NULL, JDK_Version(0), JDK_Version(0) } 313 { NULL, JDK_Version(0), JDK_Version(0) }
886 arg_len = strlen(argname); 897 arg_len = strlen(argname);
887 } else { 898 } else {
888 arg_len = equal_sign - argname; 899 arg_len = equal_sign - argname;
889 } 900 }
890 901
891 Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true); 902 Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true, true);
892 if (found_flag != NULL) { 903 if (found_flag != NULL) {
893 char locked_message_buf[BUFLEN]; 904 char locked_message_buf[BUFLEN];
894 found_flag->get_locked_message(locked_message_buf, BUFLEN); 905 found_flag->get_locked_message(locked_message_buf, BUFLEN);
895 if (strlen(locked_message_buf) == 0) { 906 if (strlen(locked_message_buf) == 0) {
896 if (found_flag->is_bool() && !has_plus_minus) { 907 if (found_flag->is_bool() && !has_plus_minus) {
1021 return true; 1032 return true;
1022 } else if (strcmp(key, "sun.java.command") == 0) { 1033 } else if (strcmp(key, "sun.java.command") == 0) {
1023 _java_command = value; 1034 _java_command = value;
1024 1035
1025 // Record value in Arguments, but let it get passed to Java. 1036 // Record value in Arguments, but let it get passed to Java.
1026 } else if (strcmp(key, "sun.java.launcher.pid") == 0) { 1037 } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0 ||
1027 // launcher.pid property is private and is processed 1038 strcmp(key, "sun.java.launcher.pid") == 0) {
1028 // in process_sun_java_launcher_properties(); 1039 // sun.java.launcher.is_altjvm and sun.java.launcher.pid property are
1040 // private and are processed in process_sun_java_launcher_properties();
1029 // the sun.java.launcher property is passed on to the java application 1041 // the sun.java.launcher property is passed on to the java application
1030 FreeHeap(key); 1042 FreeHeap(key);
1031 if (eq != NULL) { 1043 if (eq != NULL) {
1032 FreeHeap(value); 1044 FreeHeap(value);
1033 } 1045 }
1314 // with YoungPLABSize and OldPLABSize options. 1326 // with YoungPLABSize and OldPLABSize options.
1315 // See CR 6362902. 1327 // See CR 6362902.
1316 if (!FLAG_IS_DEFAULT(OldPLABSize)) { 1328 if (!FLAG_IS_DEFAULT(OldPLABSize)) {
1317 if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) { 1329 if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) {
1318 // OldPLABSize is not the default value but CMSParPromoteBlocksToClaim 1330 // OldPLABSize is not the default value but CMSParPromoteBlocksToClaim
1319 // is. In this situtation let CMSParPromoteBlocksToClaim follow 1331 // is. In this situation let CMSParPromoteBlocksToClaim follow
1320 // the value (either from the command line or ergonomics) of 1332 // the value (either from the command line or ergonomics) of
1321 // OldPLABSize. Following OldPLABSize is an ergonomics decision. 1333 // OldPLABSize. Following OldPLABSize is an ergonomics decision.
1322 FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, OldPLABSize); 1334 FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, OldPLABSize);
1323 } else { 1335 } else {
1324 // OldPLABSize and CMSParPromoteBlocksToClaim are both set. 1336 // OldPLABSize and CMSParPromoteBlocksToClaim are both set.
1577 jio_fprintf(defaultStream::error_stream(), 1589 jio_fprintf(defaultStream::error_stream(),
1578 "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n"); 1590 "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n");
1579 vm_exit(1); 1591 vm_exit(1);
1580 } 1592 }
1581 1593
1594 if (UseAdaptiveSizePolicy) {
1595 // We don't want to limit adaptive heap sizing's freedom to adjust the heap
1596 // unless the user actually sets these flags.
1597 if (FLAG_IS_DEFAULT(MinHeapFreeRatio)) {
1598 FLAG_SET_DEFAULT(MinHeapFreeRatio, 0);
1599 }
1600 if (FLAG_IS_DEFAULT(MaxHeapFreeRatio)) {
1601 FLAG_SET_DEFAULT(MaxHeapFreeRatio, 100);
1602 }
1603 }
1582 1604
1583 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the 1605 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
1584 // SurvivorRatio has been set, reset their default values to SurvivorRatio + 1606 // SurvivorRatio has been set, reset their default values to SurvivorRatio +
1585 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger. 1607 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger.
1586 // See CR 6362902 for details. 1608 // See CR 6362902 for details.
1647 result = MIN2(result, max_allocatable / MaxVirtMemFraction); 1669 result = MIN2(result, max_allocatable / MaxVirtMemFraction);
1648 } 1670 }
1649 return result; 1671 return result;
1650 } 1672 }
1651 1673
1674 // Use static initialization to get the default before parsing
1675 static const uintx DefaultHeapBaseMinAddress = HeapBaseMinAddress;
1676
1652 void Arguments::set_heap_size() { 1677 void Arguments::set_heap_size() {
1653 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { 1678 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) {
1654 // Deprecated flag 1679 // Deprecated flag
1655 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); 1680 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction);
1656 } 1681 }
1678 reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit); 1703 reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit);
1679 } 1704 }
1680 if (UseCompressedOops) { 1705 if (UseCompressedOops) {
1681 // Limit the heap size to the maximum possible when using compressed oops 1706 // Limit the heap size to the maximum possible when using compressed oops
1682 julong max_coop_heap = (julong)max_heap_for_compressed_oops(); 1707 julong max_coop_heap = (julong)max_heap_for_compressed_oops();
1708
1709 // HeapBaseMinAddress can be greater than default but not less than.
1710 if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
1711 if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
1712 if (PrintMiscellaneous && Verbose) { // matches compressed oops printing flags
1713 jio_fprintf(defaultStream::error_stream(),
1714 "HeapBaseMinAddress must be at least " UINTX_FORMAT
1715 " (" UINTX_FORMAT "G) which is greater than value given "
1716 UINTX_FORMAT "\n",
1717 DefaultHeapBaseMinAddress,
1718 DefaultHeapBaseMinAddress/G,
1719 HeapBaseMinAddress);
1720 }
1721 FLAG_SET_ERGO(uintx, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
1722 }
1723 }
1724
1683 if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) { 1725 if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) {
1684 // Heap should be above HeapBaseMinAddress to get zero based compressed oops 1726 // Heap should be above HeapBaseMinAddress to get zero based compressed oops
1685 // but it should be not less than default MaxHeapSize. 1727 // but it should be not less than default MaxHeapSize.
1686 max_coop_heap -= HeapBaseMinAddress; 1728 max_coop_heap -= HeapBaseMinAddress;
1687 } 1729 }
1808 } 1850 }
1809 } 1851 }
1810 1852
1811 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) { 1853 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
1812 _sun_java_launcher = strdup(launcher); 1854 _sun_java_launcher = strdup(launcher);
1813 if (strcmp("gamma", _sun_java_launcher) == 0) {
1814 _created_by_gamma_launcher = true;
1815 }
1816 } 1855 }
1817 1856
1818 bool Arguments::created_by_java_launcher() { 1857 bool Arguments::created_by_java_launcher() {
1819 assert(_sun_java_launcher != NULL, "property must have value"); 1858 assert(_sun_java_launcher != NULL, "property must have value");
1820 return strcmp(DEFAULT_JAVA_LAUNCHER, _sun_java_launcher) != 0; 1859 return strcmp(DEFAULT_JAVA_LAUNCHER, _sun_java_launcher) != 0;
1821 } 1860 }
1822 1861
1823 bool Arguments::created_by_gamma_launcher() { 1862 bool Arguments::sun_java_launcher_is_altjvm() {
1824 return _created_by_gamma_launcher; 1863 return _sun_java_launcher_is_altjvm;
1825 } 1864 }
1826 1865
1827 //=========================================================================================================== 1866 //===========================================================================================================
1828 // Parsing of main arguments 1867 // Parsing of main arguments
1829 1868
1852 name, val, min); 1891 name, val, min);
1853 return false; 1892 return false;
1854 } 1893 }
1855 1894
1856 bool Arguments::verify_percentage(uintx value, const char* name) { 1895 bool Arguments::verify_percentage(uintx value, const char* name) {
1857 if (value <= 100) { 1896 if (is_percentage(value)) {
1858 return true; 1897 return true;
1859 } 1898 }
1860 jio_fprintf(defaultStream::error_stream(), 1899 jio_fprintf(defaultStream::error_stream(),
1861 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n", 1900 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n",
1862 name, value); 1901 name, value);
1938 } 1977 }
1939 } 1978 }
1940 return false; 1979 return false;
1941 } 1980 }
1942 return count_p < 2 && count_t < 2; 1981 return count_p < 2 && count_t < 2;
1982 }
1983
1984 bool Arguments::verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio) {
1985 if (!is_percentage(min_heap_free_ratio)) {
1986 err_msg.print("MinHeapFreeRatio must have a value between 0 and 100");
1987 return false;
1988 }
1989 if (min_heap_free_ratio > MaxHeapFreeRatio) {
1990 err_msg.print("MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
1991 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")", min_heap_free_ratio,
1992 MaxHeapFreeRatio);
1993 return false;
1994 }
1995 return true;
1996 }
1997
1998 bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio) {
1999 if (!is_percentage(max_heap_free_ratio)) {
2000 err_msg.print("MaxHeapFreeRatio must have a value between 0 and 100");
2001 return false;
2002 }
2003 if (max_heap_free_ratio < MinHeapFreeRatio) {
2004 err_msg.print("MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or "
2005 "equal to MinHeapFreeRatio (" UINTX_FORMAT ")", max_heap_free_ratio,
2006 MinHeapFreeRatio);
2007 return false;
2008 }
2009 return true;
1943 } 2010 }
1944 2011
1945 // Check consistency of GC selection 2012 // Check consistency of GC selection
1946 bool Arguments::check_gc_consistency() { 2013 bool Arguments::check_gc_consistency() {
1947 check_gclog_consistency(); 2014 check_gclog_consistency();
2045 } 2112 }
2046 2113
2047 status = status && verify_interval(AdaptiveSizePolicyWeight, 0, 100, 2114 status = status && verify_interval(AdaptiveSizePolicyWeight, 0, 100,
2048 "AdaptiveSizePolicyWeight"); 2115 "AdaptiveSizePolicyWeight");
2049 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); 2116 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance");
2050 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio");
2051 status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio");
2052 2117
2053 // Divide by bucket size to prevent a large size from causing rollover when 2118 // Divide by bucket size to prevent a large size from causing rollover when
2054 // calculating amount of memory needed to be allocated for the String table. 2119 // calculating amount of memory needed to be allocated for the String table.
2055 status = status && verify_interval(StringTableSize, minimumStringTableSize, 2120 status = status && verify_interval(StringTableSize, minimumStringTableSize,
2056 (max_uintx / StringTable::bucket_size()), "StringTable size"); 2121 (max_uintx / StringTable::bucket_size()), "StringTable size");
2057 2122
2058 status = status && verify_interval(SymbolTableSize, minimumSymbolTableSize, 2123 status = status && verify_interval(SymbolTableSize, minimumSymbolTableSize,
2059 (max_uintx / SymbolTable::bucket_size()), "SymbolTable size"); 2124 (max_uintx / SymbolTable::bucket_size()), "SymbolTable size");
2060 2125
2061 if (MinHeapFreeRatio > MaxHeapFreeRatio) { 2126 {
2062 jio_fprintf(defaultStream::error_stream(), 2127 // Using "else if" below to avoid printing two error messages if min > max.
2063 "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " 2128 // This will also prevent us from reporting both min>100 and max>100 at the
2064 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", 2129 // same time, but that is less annoying than printing two identical errors IMHO.
2065 MinHeapFreeRatio, MaxHeapFreeRatio); 2130 FormatBuffer<80> err_msg("");
2066 status = false; 2131 if (!verify_MinHeapFreeRatio(err_msg, MinHeapFreeRatio)) {
2067 } 2132 jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
2068 // Keeping the heap 100% free is hard ;-) so limit it to 99%. 2133 status = false;
2069 MinHeapFreeRatio = MIN2(MinHeapFreeRatio, (uintx) 99); 2134 } else if (!verify_MaxHeapFreeRatio(err_msg, MaxHeapFreeRatio)) {
2135 jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
2136 status = false;
2137 }
2138 }
2070 2139
2071 // Min/MaxMetaspaceFreeRatio 2140 // Min/MaxMetaspaceFreeRatio
2072 status = status && verify_percentage(MinMetaspaceFreeRatio, "MinMetaspaceFreeRatio"); 2141 status = status && verify_percentage(MinMetaspaceFreeRatio, "MinMetaspaceFreeRatio");
2073 status = status && verify_percentage(MaxMetaspaceFreeRatio, "MaxMetaspaceFreeRatio"); 2142 status = status && verify_percentage(MaxMetaspaceFreeRatio, "MaxMetaspaceFreeRatio");
2074 2143
2367 status = false; 2436 status = false;
2368 } 2437 }
2369 2438
2370 status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction"); 2439 status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
2371 status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity"); 2440 status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2441
2442 // TieredCompilation needs at least 2 compiler threads.
2443 const int num_min_compiler_threads = (TieredCompilation) ? NOT_GRAAL(2) GRAAL_ONLY(1) : 1;
2444 status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount");
2372 2445
2373 return status; 2446 return status;
2374 } 2447 }
2375 2448
2376 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, 2449 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2729 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size); 2802 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
2730 // Xmaxf 2803 // Xmaxf
2731 } else if (match_option(option, "-Xmaxf", &tail)) { 2804 } else if (match_option(option, "-Xmaxf", &tail)) {
2732 char* err; 2805 char* err;
2733 int maxf = (int)(strtod(tail, &err) * 100); 2806 int maxf = (int)(strtod(tail, &err) * 100);
2734 if (*err != '\0' || maxf < 0 || maxf > 100) { 2807 if (*err != '\0' || *tail == '\0' || maxf < 0 || maxf > 100) {
2735 jio_fprintf(defaultStream::error_stream(), 2808 jio_fprintf(defaultStream::error_stream(),
2736 "Bad max heap free percentage size: %s\n", 2809 "Bad max heap free percentage size: %s\n",
2737 option->optionString); 2810 option->optionString);
2738 return JNI_EINVAL; 2811 return JNI_EINVAL;
2739 } else { 2812 } else {
2741 } 2814 }
2742 // Xminf 2815 // Xminf
2743 } else if (match_option(option, "-Xminf", &tail)) { 2816 } else if (match_option(option, "-Xminf", &tail)) {
2744 char* err; 2817 char* err;
2745 int minf = (int)(strtod(tail, &err) * 100); 2818 int minf = (int)(strtod(tail, &err) * 100);
2746 if (*err != '\0' || minf < 0 || minf > 100) { 2819 if (*err != '\0' || *tail == '\0' || minf < 0 || minf > 100) {
2747 jio_fprintf(defaultStream::error_stream(), 2820 jio_fprintf(defaultStream::error_stream(),
2748 "Bad min heap free percentage size: %s\n", 2821 "Bad min heap free percentage size: %s\n",
2749 option->optionString); 2822 option->optionString);
2750 return JNI_EINVAL; 2823 return JNI_EINVAL;
2751 } else { 2824 } else {
3697 3770
3698 #if INCLUDE_ALL_GCS 3771 #if INCLUDE_ALL_GCS
3699 // Set per-collector flags 3772 // Set per-collector flags
3700 if (UseParallelGC || UseParallelOldGC) { 3773 if (UseParallelGC || UseParallelOldGC) {
3701 set_parallel_gc_flags(); 3774 set_parallel_gc_flags();
3702 } else if (UseConcMarkSweepGC) { // should be done before ParNew check below 3775 } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
3703 set_cms_and_parnew_gc_flags(); 3776 set_cms_and_parnew_gc_flags();
3704 } else if (UseParNewGC) { // skipped if CMS is set above 3777 } else if (UseParNewGC) { // Skipped if CMS is set above
3705 set_parnew_gc_flags(); 3778 set_parnew_gc_flags();
3706 } else if (UseG1GC) { 3779 } else if (UseG1GC) {
3707 set_g1_gc_flags(); 3780 set_g1_gc_flags();
3708 } 3781 }
3709 check_deprecated_gcs(); 3782 check_deprecated_gcs();
3713 warning("If the number of processors is expected to increase from one, then" 3786 warning("If the number of processors is expected to increase from one, then"
3714 " you should configure the number of parallel GC threads appropriately" 3787 " you should configure the number of parallel GC threads appropriately"
3715 " using -XX:ParallelGCThreads=N"); 3788 " using -XX:ParallelGCThreads=N");
3716 } 3789 }
3717 } 3790 }
3791 if (MinHeapFreeRatio == 100) {
3792 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
3793 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
3794 }
3718 #else // INCLUDE_ALL_GCS 3795 #else // INCLUDE_ALL_GCS
3719 assert(verify_serial_gc_flags(), "SerialGC unset"); 3796 assert(verify_serial_gc_flags(), "SerialGC unset");
3720 #endif // INCLUDE_ALL_GCS 3797 #endif // INCLUDE_ALL_GCS
3721 3798
3722 // Initialize Metaspace flags and alignments. 3799 // Initialize Metaspace flags and alignments
3723 Metaspace::ergo_initialize(); 3800 Metaspace::ergo_initialize();
3724 3801
3725 // Set bytecode rewriting flags 3802 // Set bytecode rewriting flags
3726 set_bytecode_flags(); 3803 set_bytecode_flags();
3727 3804
3728 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled. 3805 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled
3729 set_aggressive_opts_flags(); 3806 set_aggressive_opts_flags();
3730 3807
3731 // Turn off biased locking for locking debug mode flags, 3808 // Turn off biased locking for locking debug mode flags,
3732 // which are subtlely different from each other but neither works with 3809 // which are subtly different from each other but neither works with
3733 // biased locking. 3810 // biased locking
3734 if (UseHeavyMonitors 3811 if (UseHeavyMonitors
3735 #ifdef COMPILER1 3812 #ifdef COMPILER1
3736 || !UseFastLocking 3813 || !UseFastLocking
3737 #endif // COMPILER1 3814 #endif // COMPILER1
3738 #ifdef GRAAL 3815 #ifdef GRAAL
3746 "; ignoring UseBiasedLocking flag." ); 3823 "; ignoring UseBiasedLocking flag." );
3747 } 3824 }
3748 UseBiasedLocking = false; 3825 UseBiasedLocking = false;
3749 } 3826 }
3750 3827
3751 #ifdef CC_INTERP 3828 #ifdef ZERO
3752 // Clear flags not supported by the C++ interpreter 3829 // Clear flags not supported on zero.
3753 FLAG_SET_DEFAULT(ProfileInterpreter, false); 3830 FLAG_SET_DEFAULT(ProfileInterpreter, false);
3754 FLAG_SET_DEFAULT(UseBiasedLocking, false); 3831 FLAG_SET_DEFAULT(UseBiasedLocking, false);
3755 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); 3832 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false));
3756 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedClassPointers, false)); 3833 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedClassPointers, false));
3757 #endif // CC_INTERP 3834 #endif // CC_INTERP
3781 } 3858 }
3782 if (UseTypeSpeculation && FLAG_IS_DEFAULT(ReplaceInParentMaps)) { 3859 if (UseTypeSpeculation && FLAG_IS_DEFAULT(ReplaceInParentMaps)) {
3783 // Doing the replace in parent maps helps speculation 3860 // Doing the replace in parent maps helps speculation
3784 FLAG_SET_DEFAULT(ReplaceInParentMaps, true); 3861 FLAG_SET_DEFAULT(ReplaceInParentMaps, true);
3785 } 3862 }
3786 #ifndef X86
3787 // Only on x86 for now
3788 FLAG_SET_DEFAULT(TypeProfileLevel, 0);
3789 #endif
3790 #endif 3863 #endif
3791 3864
3792 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 3865 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3793 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); 3866 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3794 DebugNonSafepoints = true; 3867 DebugNonSafepoints = true;
3823 !(FLAG_IS_CMDLINE(UseBiasedLocking))) { 3896 !(FLAG_IS_CMDLINE(UseBiasedLocking))) {
3824 UseBiasedLocking = false; 3897 UseBiasedLocking = false;
3825 } 3898 }
3826 } 3899 }
3827 3900
3828 // set PauseAtExit if the gamma launcher was used and a debugger is attached
3829 // but only if not already set on the commandline
3830 if (Arguments::created_by_gamma_launcher() && os::is_debugger_attached()) {
3831 bool set = false;
3832 CommandLineFlags::wasSetOnCmdline("PauseAtExit", &set);
3833 if (!set) {
3834 FLAG_SET_DEFAULT(PauseAtExit, true);
3835 }
3836 }
3837
3838 return JNI_OK; 3901 return JNI_OK;
3839 } 3902 }
3840 3903
3841 jint Arguments::adjust_after_os() { 3904 jint Arguments::adjust_after_os() {
3842 #if INCLUDE_ALL_GCS 3905 if (UseNUMA) {
3843 if (UseParallelGC || UseParallelOldGC) { 3906 if (UseParallelGC || UseParallelOldGC) {
3844 if (UseNUMA) {
3845 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { 3907 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
3846 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M); 3908 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
3847 } 3909 }
3848 // For those collectors or operating systems (eg, Windows) that do 3910 }
3849 // not support full UseNUMA, we will map to UseNUMAInterleaving for now 3911 // UseNUMAInterleaving is set to ON for all collectors and
3850 UseNUMAInterleaving = true; 3912 // platforms when UseNUMA is set to ON. NUMA-aware collectors
3851 } 3913 // such as the parallel collector for Linux and Solaris will
3852 } 3914 // interleave old gen and survivor spaces on top of NUMA
3853 #endif // INCLUDE_ALL_GCS 3915 // allocation policy for the eden space.
3916 // Non NUMA-aware collectors such as CMS, G1 and Serial-GC on
3917 // all platforms and ParallelGC on Windows will interleave all
3918 // of the heap spaces across NUMA nodes.
3919 if (FLAG_IS_DEFAULT(UseNUMAInterleaving)) {
3920 FLAG_SET_ERGO(bool, UseNUMAInterleaving, true);
3921 }
3922 }
3854 return JNI_OK; 3923 return JNI_OK;
3855 } 3924 }
3856 3925
3857 int Arguments::PropertyList_count(SystemProperty* pl) { 3926 int Arguments::PropertyList_count(SystemProperty* pl) {
3858 int count = 0; 3927 int count = 0;