Mercurial > hg > truffle
comparison src/share/vm/runtime/arguments.cpp @ 11198:1e6d5dec4a4e
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 05 Aug 2013 13:20:06 +0200 |
parents | 0630959b64e8 |
children | e28663a9f5ef |
comparison
equal
deleted
inserted
replaced
11197:3479ab380552 | 11198:1e6d5dec4a4e |
---|---|
70 #endif | 70 #endif |
71 char* Arguments::_java_command = NULL; | 71 char* Arguments::_java_command = NULL; |
72 SystemProperty* Arguments::_system_properties = NULL; | 72 SystemProperty* Arguments::_system_properties = NULL; |
73 const char* Arguments::_gc_log_filename = NULL; | 73 const char* Arguments::_gc_log_filename = NULL; |
74 bool Arguments::_has_profile = false; | 74 bool Arguments::_has_profile = false; |
75 bool Arguments::_has_alloc_profile = false; | |
76 uintx Arguments::_min_heap_size = 0; | 75 uintx Arguments::_min_heap_size = 0; |
77 Arguments::Mode Arguments::_mode = _mixed; | 76 Arguments::Mode Arguments::_mode = _mixed; |
78 bool Arguments::_java_compiler = false; | 77 bool Arguments::_java_compiler = false; |
79 bool Arguments::_xdebug_mode = false; | 78 bool Arguments::_xdebug_mode = false; |
80 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; | 79 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; |
263 { "MaxPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | 262 { "MaxPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
264 { "CMSRevisitStackSize", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | 263 { "CMSRevisitStackSize", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
265 { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | 264 { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
266 { "UseVectoredExceptions", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | 265 { "UseVectoredExceptions", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
267 { "UseSplitVerifier", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | 266 { "UseSplitVerifier", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
267 { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | |
268 { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | |
269 { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | |
270 { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) }, | |
268 #ifdef PRODUCT | 271 #ifdef PRODUCT |
269 { "DesiredMethodLimit", | 272 { "DesiredMethodLimit", |
270 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, | 273 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, |
271 #endif // PRODUCT | 274 #endif // PRODUCT |
272 { NULL, JDK_Version(0), JDK_Version(0) } | 275 { NULL, JDK_Version(0), JDK_Version(0) } |
856 arg_len = strlen(argname); | 859 arg_len = strlen(argname); |
857 } else { | 860 } else { |
858 arg_len = equal_sign - argname; | 861 arg_len = equal_sign - argname; |
859 } | 862 } |
860 | 863 |
861 Flag* found_flag = Flag::find_flag((char*)argname, arg_len, true); | 864 Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true); |
862 if (found_flag != NULL) { | 865 if (found_flag != NULL) { |
863 char locked_message_buf[BUFLEN]; | 866 char locked_message_buf[BUFLEN]; |
864 found_flag->get_locked_message(locked_message_buf, BUFLEN); | 867 found_flag->get_locked_message(locked_message_buf, BUFLEN); |
865 if (strlen(locked_message_buf) == 0) { | 868 if (strlen(locked_message_buf) == 0) { |
866 if (found_flag->is_bool() && !has_plus_minus) { | 869 if (found_flag->is_bool() && !has_plus_minus) { |
877 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf); | 880 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf); |
878 } | 881 } |
879 } else { | 882 } else { |
880 jio_fprintf(defaultStream::error_stream(), | 883 jio_fprintf(defaultStream::error_stream(), |
881 "Unrecognized VM option '%s'\n", argname); | 884 "Unrecognized VM option '%s'\n", argname); |
885 Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true); | |
886 if (fuzzy_matched != NULL) { | |
887 jio_fprintf(defaultStream::error_stream(), | |
888 "Did you mean '%s%s%s'?\n", | |
889 (fuzzy_matched->is_bool()) ? "(+/-)" : "", | |
890 fuzzy_matched->name, | |
891 (fuzzy_matched->is_bool()) ? "" : "=<value>"); | |
892 } | |
882 } | 893 } |
883 | 894 |
884 // allow for commandline "commenting out" options like -XX:#+Verbose | 895 // allow for commandline "commenting out" options like -XX:#+Verbose |
885 return arg[0] == '#'; | 896 return arg[0] == '#'; |
886 } | 897 } |
1573 result = MIN2(result, max_allocatable / MaxVirtMemFraction); | 1584 result = MIN2(result, max_allocatable / MaxVirtMemFraction); |
1574 } | 1585 } |
1575 return result; | 1586 return result; |
1576 } | 1587 } |
1577 | 1588 |
1589 void Arguments::set_heap_base_min_address() { | |
1590 if (FLAG_IS_DEFAULT(HeapBaseMinAddress) && UseG1GC && HeapBaseMinAddress < 1*G) { | |
1591 // By default HeapBaseMinAddress is 2G on all platforms except Solaris x86. | |
1592 // G1 currently needs a lot of C-heap, so on Solaris we have to give G1 | |
1593 // some extra space for the C-heap compared to other collectors. | |
1594 // Use FLAG_SET_DEFAULT here rather than FLAG_SET_ERGO to make sure that | |
1595 // code that checks for default values work correctly. | |
1596 FLAG_SET_DEFAULT(HeapBaseMinAddress, 1*G); | |
1597 } | |
1598 } | |
1599 | |
1578 void Arguments::set_heap_size() { | 1600 void Arguments::set_heap_size() { |
1579 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { | 1601 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { |
1580 // Deprecated flag | 1602 // Deprecated flag |
1581 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); | 1603 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); |
1582 } | 1604 } |
1843 jio_fprintf(defaultStream::error_stream(), | 1865 jio_fprintf(defaultStream::error_stream(), |
1844 "Conflicting collector combinations in option list; " | 1866 "Conflicting collector combinations in option list; " |
1845 "please refer to the release notes for the combinations " | 1867 "please refer to the release notes for the combinations " |
1846 "allowed\n"); | 1868 "allowed\n"); |
1847 status = false; | 1869 status = false; |
1848 } | 1870 } else if (ReservedCodeCacheSize > 2*G) { |
1849 | 1871 // Code cache size larger than MAXINT is not supported. |
1872 jio_fprintf(defaultStream::error_stream(), | |
1873 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, | |
1874 (2*G)/M); | |
1875 status = false; | |
1876 } | |
1850 return status; | 1877 return status; |
1851 } | 1878 } |
1852 | 1879 |
1853 void Arguments::check_deprecated_gcs() { | 1880 void Arguments::check_deprecated_gcs() { |
1854 if (UseConcMarkSweepGC && !UseParNewGC) { | 1881 if (UseConcMarkSweepGC && !UseParNewGC) { |
1892 // The intent is to warn the user of all possible conflicts, | 1919 // The intent is to warn the user of all possible conflicts, |
1893 // before returning an error. | 1920 // before returning an error. |
1894 // Note: Needs platform-dependent factoring. | 1921 // Note: Needs platform-dependent factoring. |
1895 bool status = true; | 1922 bool status = true; |
1896 | 1923 |
1897 #if ( (defined(COMPILER2) && defined(SPARC))) | |
1898 // NOTE: The call to VM_Version_init depends on the fact that VM_Version_init | |
1899 // on sparc doesn't require generation of a stub as is the case on, e.g., | |
1900 // x86. Normally, VM_Version_init must be called from init_globals in | |
1901 // init.cpp, which is called by the initial java thread *after* arguments | |
1902 // have been parsed. VM_Version_init gets called twice on sparc. | |
1903 extern void VM_Version_init(); | |
1904 VM_Version_init(); | |
1905 if (!VM_Version::has_v9()) { | |
1906 jio_fprintf(defaultStream::error_stream(), | |
1907 "V8 Machine detected, Server requires V9\n"); | |
1908 status = false; | |
1909 } | |
1910 #endif /* COMPILER2 && SPARC */ | |
1911 | |
1912 // Allow both -XX:-UseStackBanging and -XX:-UseBoundThreads in non-product | 1924 // Allow both -XX:-UseStackBanging and -XX:-UseBoundThreads in non-product |
1913 // builds so the cost of stack banging can be measured. | 1925 // builds so the cost of stack banging can be measured. |
1914 #if (defined(PRODUCT) && defined(SOLARIS)) | 1926 #if (defined(PRODUCT) && defined(SOLARIS)) |
1915 if (!UseBoundThreads && !UseStackBanging) { | 1927 if (!UseBoundThreads && !UseStackBanging) { |
1916 jio_fprintf(defaultStream::error_stream(), | 1928 jio_fprintf(defaultStream::error_stream(), |
1988 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); | 2000 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); |
1989 } | 2001 } |
1990 | 2002 |
1991 status = status && check_gc_consistency(); | 2003 status = status && check_gc_consistency(); |
1992 status = status && check_stack_pages(); | 2004 status = status && check_stack_pages(); |
1993 | |
1994 if (_has_alloc_profile) { | |
1995 if (UseParallelGC || UseParallelOldGC) { | |
1996 jio_fprintf(defaultStream::error_stream(), | |
1997 "error: invalid argument combination.\n" | |
1998 "Allocation profiling (-Xaprof) cannot be used together with " | |
1999 "Parallel GC (-XX:+UseParallelGC or -XX:+UseParallelOldGC).\n"); | |
2000 status = false; | |
2001 } | |
2002 if (UseConcMarkSweepGC) { | |
2003 jio_fprintf(defaultStream::error_stream(), | |
2004 "error: invalid argument combination.\n" | |
2005 "Allocation profiling (-Xaprof) cannot be used together with " | |
2006 "the CMS collector (-XX:+UseConcMarkSweepGC).\n"); | |
2007 status = false; | |
2008 } | |
2009 } | |
2010 | 2005 |
2011 if (CMSIncrementalMode) { | 2006 if (CMSIncrementalMode) { |
2012 if (!UseConcMarkSweepGC) { | 2007 if (!UseConcMarkSweepGC) { |
2013 jio_fprintf(defaultStream::error_stream(), | 2008 jio_fprintf(defaultStream::error_stream(), |
2014 "error: invalid argument combination.\n" | 2009 "error: invalid argument combination.\n" |
2222 if (!ScavengeRootsInCode) { | 2217 if (!ScavengeRootsInCode) { |
2223 warning("forcing ScavengeRootsInCode non-zero because Graal is enabled"); | 2218 warning("forcing ScavengeRootsInCode non-zero because Graal is enabled"); |
2224 ScavengeRootsInCode = 1; | 2219 ScavengeRootsInCode = 1; |
2225 } | 2220 } |
2226 | 2221 |
2222 if (UseCRC32Intrinsics) { | |
2223 // For some yet to be determined reason, enabling CRC32 intrinsics causes | |
2224 // a Graal compiled call to 'static java.util.zip.CRC32.update(int crc, int b)' | |
2225 // to crash the VM | |
2226 warning("disabling CRC32 intrinsics because Graal is enabled"); | |
2227 } | |
2228 // This prevents the flag being set to true by VM_Version::get_processor_features() | |
2229 FLAG_SET_CMDLINE(bool, UseCRC32Intrinsics, false); | |
2227 #endif | 2230 #endif |
2231 | |
2232 // Need to limit the extent of the padding to reasonable size. | |
2233 // 8K is well beyond the reasonable HW cache line size, even with the | |
2234 // aggressive prefetching, while still leaving the room for segregating | |
2235 // among the distinct pages. | |
2236 if (ContendedPaddingWidth < 0 || ContendedPaddingWidth > 8192) { | |
2237 jio_fprintf(defaultStream::error_stream(), | |
2238 "ContendedPaddingWidth=" INTX_FORMAT " must be the between %d and %d\n", | |
2239 ContendedPaddingWidth, 0, 8192); | |
2240 status = false; | |
2241 } | |
2242 | |
2243 // Need to enforce the padding not to break the existing field alignments. | |
2244 // It is sufficient to check against the largest type size. | |
2245 if ((ContendedPaddingWidth % BytesPerLong) != 0) { | |
2246 jio_fprintf(defaultStream::error_stream(), | |
2247 "ContendedPaddingWidth=" INTX_FORMAT " must be the multiple of %d\n", | |
2248 ContendedPaddingWidth, BytesPerLong); | |
2249 status = false; | |
2250 } | |
2251 | |
2252 // Check lower bounds of the code cache | |
2253 // Template Interpreter code is approximately 3X larger in debug builds. | |
2254 uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace; | |
2255 if (InitialCodeCacheSize < (uintx)os::vm_page_size()) { | |
2256 jio_fprintf(defaultStream::error_stream(), | |
2257 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K, | |
2258 os::vm_page_size()/K); | |
2259 status = false; | |
2260 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) { | |
2261 jio_fprintf(defaultStream::error_stream(), | |
2262 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", | |
2263 ReservedCodeCacheSize/K, InitialCodeCacheSize/K); | |
2264 status = false; | |
2265 } else if (ReservedCodeCacheSize < min_code_cache_size) { | |
2266 jio_fprintf(defaultStream::error_stream(), | |
2267 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, | |
2268 min_code_cache_size/K); | |
2269 status = false; | |
2270 } else if (ReservedCodeCacheSize > 2*G) { | |
2271 // Code cache size larger than MAXINT is not supported. | |
2272 jio_fprintf(defaultStream::error_stream(), | |
2273 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, | |
2274 (2*G)/M); | |
2275 status = false; | |
2276 } | |
2277 | |
2228 return status; | 2278 return status; |
2229 } | 2279 } |
2230 | 2280 |
2231 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, | 2281 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, |
2232 const char* option_type) { | 2282 const char* option_type) { |
2621 FLAG_SET_CMDLINE(intx, ThreadStackSize, | 2671 FLAG_SET_CMDLINE(intx, ThreadStackSize, |
2622 round_to((int)long_ThreadStackSize, K) / K); | 2672 round_to((int)long_ThreadStackSize, K) / K); |
2623 // -Xoss | 2673 // -Xoss |
2624 } else if (match_option(option, "-Xoss", &tail)) { | 2674 } else if (match_option(option, "-Xoss", &tail)) { |
2625 // HotSpot does not have separate native and Java stacks, ignore silently for compatibility | 2675 // HotSpot does not have separate native and Java stacks, ignore silently for compatibility |
2626 // -Xmaxjitcodesize | 2676 } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) { |
2677 julong long_CodeCacheExpansionSize = 0; | |
2678 ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size()); | |
2679 if (errcode != arg_in_range) { | |
2680 jio_fprintf(defaultStream::error_stream(), | |
2681 "Invalid argument: %s. Must be at least %luK.\n", option->optionString, | |
2682 os::vm_page_size()/K); | |
2683 return JNI_EINVAL; | |
2684 } | |
2685 FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize); | |
2627 } else if (match_option(option, "-Xmaxjitcodesize", &tail) || | 2686 } else if (match_option(option, "-Xmaxjitcodesize", &tail) || |
2628 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { | 2687 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { |
2629 julong long_ReservedCodeCacheSize = 0; | 2688 julong long_ReservedCodeCacheSize = 0; |
2689 | |
2630 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1); | 2690 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1); |
2631 if (errcode != arg_in_range) { | 2691 if (errcode != arg_in_range) { |
2632 jio_fprintf(defaultStream::error_stream(), | 2692 jio_fprintf(defaultStream::error_stream(), |
2633 "Invalid maximum code cache size: %s.\n", option->optionString); | 2693 "Invalid maximum code cache size: %s.\n", option->optionString); |
2634 return JNI_EINVAL; | 2694 return JNI_EINVAL; |
2672 #else // INCLUDE_FPROF | 2732 #else // INCLUDE_FPROF |
2673 jio_fprintf(defaultStream::error_stream(), | 2733 jio_fprintf(defaultStream::error_stream(), |
2674 "Flat profiling is not supported in this VM.\n"); | 2734 "Flat profiling is not supported in this VM.\n"); |
2675 return JNI_ERR; | 2735 return JNI_ERR; |
2676 #endif // INCLUDE_FPROF | 2736 #endif // INCLUDE_FPROF |
2677 // -Xaprof | |
2678 } else if (match_option(option, "-Xaprof", &tail)) { | |
2679 _has_alloc_profile = true; | |
2680 // -Xconcurrentio | 2737 // -Xconcurrentio |
2681 } else if (match_option(option, "-Xconcurrentio", &tail)) { | 2738 } else if (match_option(option, "-Xconcurrentio", &tail)) { |
2682 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true); | 2739 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true); |
2683 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); | 2740 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); |
2684 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1); | 2741 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1); |
2929 // No longer used. | 2986 // No longer used. |
2930 } else if (match_option(option, "-XX:+UseTLE", &tail)) { | 2987 } else if (match_option(option, "-XX:+UseTLE", &tail)) { |
2931 FLAG_SET_CMDLINE(bool, UseTLAB, true); | 2988 FLAG_SET_CMDLINE(bool, UseTLAB, true); |
2932 } else if (match_option(option, "-XX:-UseTLE", &tail)) { | 2989 } else if (match_option(option, "-XX:-UseTLE", &tail)) { |
2933 FLAG_SET_CMDLINE(bool, UseTLAB, false); | 2990 FLAG_SET_CMDLINE(bool, UseTLAB, false); |
2934 SOLARIS_ONLY( | |
2935 } else if (match_option(option, "-XX:+UsePermISM", &tail)) { | |
2936 warning("-XX:+UsePermISM is obsolete."); | |
2937 FLAG_SET_CMDLINE(bool, UseISM, true); | |
2938 } else if (match_option(option, "-XX:-UsePermISM", &tail)) { | |
2939 FLAG_SET_CMDLINE(bool, UseISM, false); | |
2940 ) | |
2941 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) { | 2991 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) { |
2942 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false); | 2992 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false); |
2943 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); | 2993 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); |
2944 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { | 2994 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { |
2945 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); | 2995 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); |
3119 MaxHeapSize < LargePageHeapSizeThreshold) { | 3169 MaxHeapSize < LargePageHeapSizeThreshold) { |
3120 // No need for large granularity pages w/small heaps. | 3170 // No need for large granularity pages w/small heaps. |
3121 // Note that large pages are enabled/disabled for both the | 3171 // Note that large pages are enabled/disabled for both the |
3122 // Java heap and the code cache. | 3172 // Java heap and the code cache. |
3123 FLAG_SET_DEFAULT(UseLargePages, false); | 3173 FLAG_SET_DEFAULT(UseLargePages, false); |
3124 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseMPSS, false)); | |
3125 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); | |
3126 } | 3174 } |
3127 | 3175 |
3128 // Tiered compilation is undefined with C1. | 3176 // Tiered compilation is undefined with C1. |
3129 TieredCompilation = false; | 3177 TieredCompilation = false; |
3130 #else | 3178 #else |
3535 vm_exit_during_initialization( | 3583 vm_exit_during_initialization( |
3536 "Incompatible compilation policy selected", NULL); | 3584 "Incompatible compilation policy selected", NULL); |
3537 } | 3585 } |
3538 } | 3586 } |
3539 | 3587 |
3588 set_heap_base_min_address(); | |
3589 | |
3540 // Set heap size based on available physical memory | 3590 // Set heap size based on available physical memory |
3541 set_heap_size(); | 3591 set_heap_size(); |
3542 | 3592 |
3543 #if INCLUDE_ALL_GCS | 3593 #if INCLUDE_ALL_GCS |
3544 // Set per-collector flags | 3594 // Set per-collector flags |