Mercurial > hg > truffle
comparison src/share/vm/runtime/arguments.cpp @ 11173:6b0fd0964b87
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 31 Jul 2013 11:00:54 +0200 |
parents | df4d86530e21 02d7aa1456c9 |
children | 0630959b64e8 |
comparison
equal
deleted
inserted
replaced
10912:4ea54634f03e | 11173:6b0fd0964b87 |
---|---|
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" |
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 |
2227 #endif | 2222 #endif |
2223 | |
2224 // Need to limit the extent of the padding to reasonable size. | |
2225 // 8K is well beyond the reasonable HW cache line size, even with the | |
2226 // aggressive prefetching, while still leaving the room for segregating | |
2227 // among the distinct pages. | |
2228 if (ContendedPaddingWidth < 0 || ContendedPaddingWidth > 8192) { | |
2229 jio_fprintf(defaultStream::error_stream(), | |
2230 "ContendedPaddingWidth=" INTX_FORMAT " must be the between %d and %d\n", | |
2231 ContendedPaddingWidth, 0, 8192); | |
2232 status = false; | |
2233 } | |
2234 | |
2235 // Need to enforce the padding not to break the existing field alignments. | |
2236 // It is sufficient to check against the largest type size. | |
2237 if ((ContendedPaddingWidth % BytesPerLong) != 0) { | |
2238 jio_fprintf(defaultStream::error_stream(), | |
2239 "ContendedPaddingWidth=" INTX_FORMAT " must be the multiple of %d\n", | |
2240 ContendedPaddingWidth, BytesPerLong); | |
2241 status = false; | |
2242 } | |
2243 | |
2244 // Check lower bounds of the code cache | |
2245 // Template Interpreter code is approximately 3X larger in debug builds. | |
2246 uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace; | |
2247 if (InitialCodeCacheSize < (uintx)os::vm_page_size()) { | |
2248 jio_fprintf(defaultStream::error_stream(), | |
2249 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K, | |
2250 os::vm_page_size()/K); | |
2251 status = false; | |
2252 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) { | |
2253 jio_fprintf(defaultStream::error_stream(), | |
2254 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", | |
2255 ReservedCodeCacheSize/K, InitialCodeCacheSize/K); | |
2256 status = false; | |
2257 } else if (ReservedCodeCacheSize < min_code_cache_size) { | |
2258 jio_fprintf(defaultStream::error_stream(), | |
2259 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, | |
2260 min_code_cache_size/K); | |
2261 status = false; | |
2262 } else if (ReservedCodeCacheSize > 2*G) { | |
2263 // Code cache size larger than MAXINT is not supported. | |
2264 jio_fprintf(defaultStream::error_stream(), | |
2265 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, | |
2266 (2*G)/M); | |
2267 status = false; | |
2268 } | |
2269 | |
2228 return status; | 2270 return status; |
2229 } | 2271 } |
2230 | 2272 |
2231 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, | 2273 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, |
2232 const char* option_type) { | 2274 const char* option_type) { |
2621 FLAG_SET_CMDLINE(intx, ThreadStackSize, | 2663 FLAG_SET_CMDLINE(intx, ThreadStackSize, |
2622 round_to((int)long_ThreadStackSize, K) / K); | 2664 round_to((int)long_ThreadStackSize, K) / K); |
2623 // -Xoss | 2665 // -Xoss |
2624 } else if (match_option(option, "-Xoss", &tail)) { | 2666 } else if (match_option(option, "-Xoss", &tail)) { |
2625 // HotSpot does not have separate native and Java stacks, ignore silently for compatibility | 2667 // HotSpot does not have separate native and Java stacks, ignore silently for compatibility |
2626 // -Xmaxjitcodesize | 2668 } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) { |
2669 julong long_CodeCacheExpansionSize = 0; | |
2670 ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size()); | |
2671 if (errcode != arg_in_range) { | |
2672 jio_fprintf(defaultStream::error_stream(), | |
2673 "Invalid argument: %s. Must be at least %luK.\n", option->optionString, | |
2674 os::vm_page_size()/K); | |
2675 return JNI_EINVAL; | |
2676 } | |
2677 FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize); | |
2627 } else if (match_option(option, "-Xmaxjitcodesize", &tail) || | 2678 } else if (match_option(option, "-Xmaxjitcodesize", &tail) || |
2628 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { | 2679 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { |
2629 julong long_ReservedCodeCacheSize = 0; | 2680 julong long_ReservedCodeCacheSize = 0; |
2681 | |
2630 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1); | 2682 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1); |
2631 if (errcode != arg_in_range) { | 2683 if (errcode != arg_in_range) { |
2632 jio_fprintf(defaultStream::error_stream(), | 2684 jio_fprintf(defaultStream::error_stream(), |
2633 "Invalid maximum code cache size: %s.\n", option->optionString); | 2685 "Invalid maximum code cache size: %s.\n", option->optionString); |
2634 return JNI_EINVAL; | 2686 return JNI_EINVAL; |
2672 #else // INCLUDE_FPROF | 2724 #else // INCLUDE_FPROF |
2673 jio_fprintf(defaultStream::error_stream(), | 2725 jio_fprintf(defaultStream::error_stream(), |
2674 "Flat profiling is not supported in this VM.\n"); | 2726 "Flat profiling is not supported in this VM.\n"); |
2675 return JNI_ERR; | 2727 return JNI_ERR; |
2676 #endif // INCLUDE_FPROF | 2728 #endif // INCLUDE_FPROF |
2677 // -Xaprof | |
2678 } else if (match_option(option, "-Xaprof", &tail)) { | |
2679 _has_alloc_profile = true; | |
2680 // -Xconcurrentio | 2729 // -Xconcurrentio |
2681 } else if (match_option(option, "-Xconcurrentio", &tail)) { | 2730 } else if (match_option(option, "-Xconcurrentio", &tail)) { |
2682 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true); | 2731 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true); |
2683 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); | 2732 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); |
2684 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1); | 2733 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1); |
2929 // No longer used. | 2978 // No longer used. |
2930 } else if (match_option(option, "-XX:+UseTLE", &tail)) { | 2979 } else if (match_option(option, "-XX:+UseTLE", &tail)) { |
2931 FLAG_SET_CMDLINE(bool, UseTLAB, true); | 2980 FLAG_SET_CMDLINE(bool, UseTLAB, true); |
2932 } else if (match_option(option, "-XX:-UseTLE", &tail)) { | 2981 } else if (match_option(option, "-XX:-UseTLE", &tail)) { |
2933 FLAG_SET_CMDLINE(bool, UseTLAB, false); | 2982 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)) { | 2983 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) { |
2942 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false); | 2984 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false); |
2943 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); | 2985 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); |
2944 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { | 2986 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { |
2945 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); | 2987 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); |
3119 MaxHeapSize < LargePageHeapSizeThreshold) { | 3161 MaxHeapSize < LargePageHeapSizeThreshold) { |
3120 // No need for large granularity pages w/small heaps. | 3162 // No need for large granularity pages w/small heaps. |
3121 // Note that large pages are enabled/disabled for both the | 3163 // Note that large pages are enabled/disabled for both the |
3122 // Java heap and the code cache. | 3164 // Java heap and the code cache. |
3123 FLAG_SET_DEFAULT(UseLargePages, false); | 3165 FLAG_SET_DEFAULT(UseLargePages, false); |
3124 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseMPSS, false)); | |
3125 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); | |
3126 } | 3166 } |
3127 | 3167 |
3128 // Tiered compilation is undefined with C1. | 3168 // Tiered compilation is undefined with C1. |
3129 TieredCompilation = false; | 3169 TieredCompilation = false; |
3130 #else | 3170 #else |
3535 vm_exit_during_initialization( | 3575 vm_exit_during_initialization( |
3536 "Incompatible compilation policy selected", NULL); | 3576 "Incompatible compilation policy selected", NULL); |
3537 } | 3577 } |
3538 } | 3578 } |
3539 | 3579 |
3580 set_heap_base_min_address(); | |
3581 | |
3540 // Set heap size based on available physical memory | 3582 // Set heap size based on available physical memory |
3541 set_heap_size(); | 3583 set_heap_size(); |
3542 | 3584 |
3543 #if INCLUDE_ALL_GCS | 3585 #if INCLUDE_ALL_GCS |
3544 // Set per-collector flags | 3586 // Set per-collector flags |