Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/arguments.cpp @ 2362:a2c2eac1ca62
7018056: large pages not always enabled by default
Reviewed-by: phh, kvn
author | jcoomes |
---|---|
date | Sun, 06 Mar 2011 11:37:18 -0800 |
parents | da091bb67459 |
children | 1fb790245268 |
comparison
equal
deleted
inserted
replaced
2361:1216415d8e35 | 2362:a2c2eac1ca62 |
---|---|
240 JDK_Version::jdk_update(6,22), JDK_Version::jdk(7) }, | 240 JDK_Version::jdk_update(6,22), JDK_Version::jdk(7) }, |
241 { "HandlePromotionFailure", | 241 { "HandlePromotionFailure", |
242 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, | 242 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, |
243 { "MaxLiveObjectEvacuationRatio", | 243 { "MaxLiveObjectEvacuationRatio", |
244 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, | 244 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, |
245 { "ForceSharedSpaces", JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) }, | |
245 { NULL, JDK_Version(0), JDK_Version(0) } | 246 { NULL, JDK_Version(0), JDK_Version(0) } |
246 }; | 247 }; |
247 | 248 |
248 // Returns true if the flag is obsolete and fits into the range specified | 249 // Returns true if the flag is obsolete and fits into the range specified |
249 // for being ignored. In the case that the flag is ignored, the 'version' | 250 // for being ignored. In the case that the flag is ignored, the 'version' |
1001 } else { | 1002 } else { |
1002 FLAG_SET_DEFAULT(UseSharedSpaces, false); | 1003 FLAG_SET_DEFAULT(UseSharedSpaces, false); |
1003 } | 1004 } |
1004 } | 1005 } |
1005 | 1006 |
1006 void Arguments::check_compressed_oops_compat() { | |
1007 #ifdef _LP64 | |
1008 assert(UseCompressedOops, "Precondition"); | |
1009 // Is it on by default or set on ergonomically | |
1010 bool is_on_by_default = FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops); | |
1011 | |
1012 // If dumping an archive or forcing its use, disable compressed oops if possible | |
1013 if (DumpSharedSpaces || RequireSharedSpaces) { | |
1014 if (is_on_by_default) { | |
1015 FLAG_SET_DEFAULT(UseCompressedOops, false); | |
1016 return; | |
1017 } else { | |
1018 vm_exit_during_initialization( | |
1019 "Class Data Sharing is not supported with compressed oops yet", NULL); | |
1020 } | |
1021 } else if (UseSharedSpaces) { | |
1022 // UseSharedSpaces is on by default. With compressed oops, we turn it off. | |
1023 FLAG_SET_DEFAULT(UseSharedSpaces, false); | |
1024 } | |
1025 #endif | |
1026 } | |
1027 | |
1028 void Arguments::set_tiered_flags() { | 1007 void Arguments::set_tiered_flags() { |
1029 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { | 1008 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { |
1030 FLAG_SET_DEFAULT(CompilationPolicyChoice, 2); | 1009 FLAG_SET_DEFAULT(CompilationPolicyChoice, 2); |
1031 } | 1010 } |
1032 if (CompilationPolicyChoice < 2) { | 1011 if (CompilationPolicyChoice < 2) { |
1380 } | 1359 } |
1381 | 1360 |
1382 void Arguments::set_ergonomics_flags() { | 1361 void Arguments::set_ergonomics_flags() { |
1383 // Parallel GC is not compatible with sharing. If one specifies | 1362 // Parallel GC is not compatible with sharing. If one specifies |
1384 // that they want sharing explicitly, do not set ergonomics flags. | 1363 // that they want sharing explicitly, do not set ergonomics flags. |
1385 if (DumpSharedSpaces || ForceSharedSpaces) { | 1364 if (DumpSharedSpaces || RequireSharedSpaces) { |
1386 return; | 1365 return; |
1387 } | 1366 } |
1388 | 1367 |
1389 if (os::is_server_class_machine() && !force_client_mode ) { | 1368 if (os::is_server_class_machine() && !force_client_mode ) { |
1390 // If no other collector is requested explicitly, | 1369 // If no other collector is requested explicitly, |
1842 // Turn off gc-overhead-limit-exceeded checks | 1821 // Turn off gc-overhead-limit-exceeded checks |
1843 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); | 1822 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); |
1844 } | 1823 } |
1845 | 1824 |
1846 status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); | 1825 status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); |
1847 | |
1848 // Check whether user-specified sharing option conflicts with GC or page size. | |
1849 // Both sharing and large pages are enabled by default on some platforms; | |
1850 // large pages override sharing only if explicitly set on the command line. | |
1851 const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode || | |
1852 UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC || | |
1853 UseLargePages && FLAG_IS_CMDLINE(UseLargePages); | |
1854 if (cannot_share) { | |
1855 // Either force sharing on by forcing the other options off, or | |
1856 // force sharing off. | |
1857 if (DumpSharedSpaces || ForceSharedSpaces) { | |
1858 jio_fprintf(defaultStream::error_stream(), | |
1859 "Using Serial GC and default page size because of %s\n", | |
1860 ForceSharedSpaces ? "-Xshare:on" : "-Xshare:dump"); | |
1861 force_serial_gc(); | |
1862 FLAG_SET_DEFAULT(UseLargePages, false); | |
1863 } else { | |
1864 if (UseSharedSpaces && Verbose) { | |
1865 jio_fprintf(defaultStream::error_stream(), | |
1866 "Turning off use of shared archive because of " | |
1867 "choice of garbage collector or large pages\n"); | |
1868 } | |
1869 no_shared_spaces(); | |
1870 } | |
1871 } else if (UseLargePages && (UseSharedSpaces || DumpSharedSpaces)) { | |
1872 FLAG_SET_DEFAULT(UseLargePages, false); | |
1873 } | |
1874 | 1826 |
1875 status = status && check_gc_consistency(); | 1827 status = status && check_gc_consistency(); |
1876 status = status && check_stack_pages(); | 1828 status = status && check_stack_pages(); |
1877 | 1829 |
1878 if (_has_alloc_profile) { | 1830 if (_has_alloc_profile) { |
2410 #endif | 2362 #endif |
2411 // -Xshare:on | 2363 // -Xshare:on |
2412 } else if (match_option(option, "-Xshare:on", &tail)) { | 2364 } else if (match_option(option, "-Xshare:on", &tail)) { |
2413 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true); | 2365 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true); |
2414 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true); | 2366 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true); |
2415 #ifdef TIERED | |
2416 FLAG_SET_CMDLINE(bool, ForceSharedSpaces, true); | |
2417 #endif // TIERED | |
2418 // -Xshare:auto | 2367 // -Xshare:auto |
2419 } else if (match_option(option, "-Xshare:auto", &tail)) { | 2368 } else if (match_option(option, "-Xshare:auto", &tail)) { |
2420 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true); | 2369 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true); |
2421 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false); | 2370 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false); |
2422 // -Xshare:off | 2371 // -Xshare:off |
2913 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR)); | 2862 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR)); |
2914 } | 2863 } |
2915 return JNI_OK; | 2864 return JNI_OK; |
2916 } | 2865 } |
2917 | 2866 |
2867 void Arguments::set_shared_spaces_flags() { | |
2868 // Check whether class data sharing settings conflict with GC, compressed oops | |
2869 // or page size, and fix them up. Explicit sharing options override other | |
2870 // settings. | |
2871 const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode || | |
2872 UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC || | |
2873 UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages); | |
2874 const bool must_share = DumpSharedSpaces || RequireSharedSpaces; | |
2875 const bool might_share = must_share || UseSharedSpaces; | |
2876 if (cannot_share) { | |
2877 if (must_share) { | |
2878 warning("selecting serial gc and disabling large pages %s" | |
2879 "because of %s", "" LP64_ONLY("and compressed oops "), | |
2880 DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on"); | |
2881 force_serial_gc(); | |
2882 FLAG_SET_CMDLINE(bool, UseLargePages, false); | |
2883 LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false)); | |
2884 } else { | |
2885 if (UseSharedSpaces && Verbose) { | |
2886 warning("turning off use of shared archive because of " | |
2887 "choice of garbage collector or large pages"); | |
2888 } | |
2889 no_shared_spaces(); | |
2890 } | |
2891 } else if (UseLargePages && might_share) { | |
2892 // Disable large pages to allow shared spaces. This is sub-optimal, since | |
2893 // there may not even be a shared archive to use. | |
2894 FLAG_SET_DEFAULT(UseLargePages, false); | |
2895 } | |
2896 } | |
2918 | 2897 |
2919 // Parse entry point called from JNI_CreateJavaVM | 2898 // Parse entry point called from JNI_CreateJavaVM |
2920 | 2899 |
2921 jint Arguments::parse(const JavaVMInitArgs* args) { | 2900 jint Arguments::parse(const JavaVMInitArgs* args) { |
2922 | 2901 |
3060 #endif // KERNEL | 3039 #endif // KERNEL |
3061 | 3040 |
3062 // Set flags based on ergonomics. | 3041 // Set flags based on ergonomics. |
3063 set_ergonomics_flags(); | 3042 set_ergonomics_flags(); |
3064 | 3043 |
3065 if (UseCompressedOops) { | 3044 set_shared_spaces_flags(); |
3066 check_compressed_oops_compat(); | |
3067 } | |
3068 | 3045 |
3069 // Check the GC selections again. | 3046 // Check the GC selections again. |
3070 if (!check_gc_consistency()) { | 3047 if (!check_gc_consistency()) { |
3071 return JNI_EINVAL; | 3048 return JNI_EINVAL; |
3072 } | 3049 } |