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