Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/arguments.cpp @ 4137:04b9a2566eec
Merge with hsx23/hotspot.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 17 Dec 2011 21:40:27 +0100 |
parents | d3ec27ea1b20 55d777c0860a |
children | 394404b2d9bd |
comparison
equal
deleted
inserted
replaced
3737:9dc19b7d89a3 | 4137:04b9a2566eec |
---|---|
35 #include "runtime/globals_extension.hpp" | 35 #include "runtime/globals_extension.hpp" |
36 #include "runtime/java.hpp" | 36 #include "runtime/java.hpp" |
37 #include "services/management.hpp" | 37 #include "services/management.hpp" |
38 #include "utilities/defaultStream.hpp" | 38 #include "utilities/defaultStream.hpp" |
39 #include "utilities/taskqueue.hpp" | 39 #include "utilities/taskqueue.hpp" |
40 #ifdef TARGET_ARCH_x86 | |
41 # include "vm_version_x86.hpp" | |
42 #endif | |
43 #ifdef TARGET_ARCH_sparc | |
44 # include "vm_version_sparc.hpp" | |
45 #endif | |
46 #ifdef TARGET_ARCH_zero | |
47 # include "vm_version_zero.hpp" | |
48 #endif | |
49 #ifdef TARGET_OS_FAMILY_linux | 40 #ifdef TARGET_OS_FAMILY_linux |
50 # include "os_linux.inline.hpp" | 41 # include "os_linux.inline.hpp" |
51 #endif | 42 #endif |
52 #ifdef TARGET_OS_FAMILY_solaris | 43 #ifdef TARGET_OS_FAMILY_solaris |
53 # include "os_solaris.inline.hpp" | 44 # include "os_solaris.inline.hpp" |
54 #endif | 45 #endif |
55 #ifdef TARGET_OS_FAMILY_windows | 46 #ifdef TARGET_OS_FAMILY_windows |
56 # include "os_windows.inline.hpp" | 47 # include "os_windows.inline.hpp" |
48 #endif | |
49 #ifdef TARGET_OS_FAMILY_bsd | |
50 # include "os_bsd.inline.hpp" | |
57 #endif | 51 #endif |
58 #ifndef SERIALGC | 52 #ifndef SERIALGC |
59 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" | 53 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" |
60 #endif | 54 #endif |
61 | 55 |
254 { "UseParallelDensePrefixUpdate", | 248 { "UseParallelDensePrefixUpdate", |
255 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, | 249 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, |
256 { "UseParallelOldGCDensePrefix", | 250 { "UseParallelOldGCDensePrefix", |
257 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, | 251 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, |
258 { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) }, | 252 { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) }, |
253 { "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) }, | |
254 #ifdef PRODUCT | |
255 { "DesiredMethodLimit", | |
256 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, | |
257 #endif // PRODUCT | |
259 { NULL, JDK_Version(0), JDK_Version(0) } | 258 { NULL, JDK_Version(0), JDK_Version(0) } |
260 }; | 259 }; |
261 | 260 |
262 // Returns true if the flag is obsolete and fits into the range specified | 261 // Returns true if the flag is obsolete and fits into the range specified |
263 // for being ignored. In the case that the flag is ignored, the 'version' | 262 // for being ignored. In the case that the flag is ignored, the 'version' |
1367 #ifdef _LP64 | 1366 #ifdef _LP64 |
1368 // Check that UseCompressedOops can be set with the max heap size allocated | 1367 // Check that UseCompressedOops can be set with the max heap size allocated |
1369 // by ergonomics. | 1368 // by ergonomics. |
1370 if (MaxHeapSize <= max_heap_for_compressed_oops()) { | 1369 if (MaxHeapSize <= max_heap_for_compressed_oops()) { |
1371 #if !defined(COMPILER1) || defined(TIERED) | 1370 #if !defined(COMPILER1) || defined(TIERED) |
1371 // disable UseCompressedOops by default on MacOS X until 7118647 is fixed | |
1372 #ifndef __APPLE__ | |
1372 if (FLAG_IS_DEFAULT(UseCompressedOops)) { | 1373 if (FLAG_IS_DEFAULT(UseCompressedOops)) { |
1373 FLAG_SET_ERGO(bool, UseCompressedOops, true); | 1374 FLAG_SET_ERGO(bool, UseCompressedOops, true); |
1374 } | 1375 } |
1376 #endif // !__APPLE__ | |
1375 #endif | 1377 #endif |
1376 #ifdef _WIN64 | 1378 #ifdef _WIN64 |
1377 if (UseLargePages && UseCompressedOops) { | 1379 if (UseLargePages && UseCompressedOops) { |
1378 // Cannot allocate guard pages for implicit checks in indexed addressing | 1380 // Cannot allocate guard pages for implicit checks in indexed addressing |
1379 // mode, when large pages are specified on windows. | 1381 // mode, when large pages are specified on windows. |
1402 } | 1404 } |
1403 | 1405 |
1404 // If no heap maximum was requested explicitly, use some reasonable fraction | 1406 // If no heap maximum was requested explicitly, use some reasonable fraction |
1405 // of the physical memory, up to a maximum of 1GB. | 1407 // of the physical memory, up to a maximum of 1GB. |
1406 if (UseParallelGC) { | 1408 if (UseParallelGC) { |
1407 FLAG_SET_ERGO(uintx, ParallelGCThreads, | 1409 FLAG_SET_DEFAULT(ParallelGCThreads, |
1408 Abstract_VM_Version::parallel_worker_threads()); | 1410 Abstract_VM_Version::parallel_worker_threads()); |
1409 | 1411 |
1410 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the | 1412 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the |
1411 // SurvivorRatio has been set, reset their default values to SurvivorRatio + | 1413 // SurvivorRatio has been set, reset their default values to SurvivorRatio + |
1412 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger. | 1414 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger. |
1413 // See CR 6362902 for details. | 1415 // See CR 6362902 for details. |
1434 } | 1436 } |
1435 if (UseNUMA) { | 1437 if (UseNUMA) { |
1436 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { | 1438 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { |
1437 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M); | 1439 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M); |
1438 } | 1440 } |
1441 // For those collectors or operating systems (eg, Windows) that do | |
1442 // not support full UseNUMA, we will map to UseNUMAInterleaving for now | |
1443 UseNUMAInterleaving = true; | |
1439 } | 1444 } |
1440 } | 1445 } |
1441 | 1446 |
1442 void Arguments::set_g1_gc_flags() { | 1447 void Arguments::set_g1_gc_flags() { |
1443 assert(UseG1GC, "Error"); | 1448 assert(UseG1GC, "Error"); |
1582 // Feed the cache size setting into the JDK | 1587 // Feed the cache size setting into the JDK |
1583 char buffer[1024]; | 1588 char buffer[1024]; |
1584 sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax); | 1589 sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax); |
1585 add_property(buffer); | 1590 add_property(buffer); |
1586 } | 1591 } |
1587 if (AggressiveOpts && FLAG_IS_DEFAULT(DoEscapeAnalysis)) { | |
1588 FLAG_SET_DEFAULT(DoEscapeAnalysis, true); | |
1589 } | |
1590 if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) { | 1592 if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) { |
1591 FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500); | 1593 FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500); |
1592 } | |
1593 if (AggressiveOpts && FLAG_IS_DEFAULT(OptimizeStringConcat)) { | |
1594 FLAG_SET_DEFAULT(OptimizeStringConcat, true); | |
1595 } | |
1596 if (AggressiveOpts && FLAG_IS_DEFAULT(OptimizeFill)) { | |
1597 FLAG_SET_DEFAULT(OptimizeFill, true); | |
1598 } | 1594 } |
1599 #endif | 1595 #endif |
1600 | 1596 |
1601 if (AggressiveOpts) { | 1597 if (AggressiveOpts) { |
1602 // Sample flag setting code | 1598 // Sample flag setting code |
1687 return (UseSerialGC && | 1683 return (UseSerialGC && |
1688 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || | 1684 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || |
1689 UseParallelGC || UseParallelOldGC)); | 1685 UseParallelGC || UseParallelOldGC)); |
1690 } | 1686 } |
1691 | 1687 |
1688 // check if do gclog rotation | |
1689 // +UseGCLogFileRotation is a must, | |
1690 // no gc log rotation when log file not supplied or | |
1691 // NumberOfGCLogFiles is 0, or GCLogFileSize is 0 | |
1692 void check_gclog_consistency() { | |
1693 if (UseGCLogFileRotation) { | |
1694 if ((Arguments::gc_log_filename() == NULL) || | |
1695 (NumberOfGCLogFiles == 0) || | |
1696 (GCLogFileSize == 0)) { | |
1697 jio_fprintf(defaultStream::output_stream(), | |
1698 "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files> -XX:GCLogFileSize=<num_of_size>\n" | |
1699 "where num_of_file > 0 and num_of_size > 0\n" | |
1700 "GC log rotation is turned off\n"); | |
1701 UseGCLogFileRotation = false; | |
1702 } | |
1703 } | |
1704 | |
1705 if (UseGCLogFileRotation && GCLogFileSize < 8*K) { | |
1706 FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K); | |
1707 jio_fprintf(defaultStream::output_stream(), | |
1708 "GCLogFileSize changed to minimum 8K\n"); | |
1709 } | |
1710 } | |
1711 | |
1692 // Check consistency of GC selection | 1712 // Check consistency of GC selection |
1693 bool Arguments::check_gc_consistency() { | 1713 bool Arguments::check_gc_consistency() { |
1714 check_gclog_consistency(); | |
1694 bool status = true; | 1715 bool status = true; |
1695 // Ensure that the user has not selected conflicting sets | 1716 // Ensure that the user has not selected conflicting sets |
1696 // of collectors. [Note: this check is merely a user convenience; | 1717 // of collectors. [Note: this check is merely a user convenience; |
1697 // collectors over-ride each other so that only a non-conflicting | 1718 // collectors over-ride each other so that only a non-conflicting |
1698 // set is selected; however what the user gets is not what they | 1719 // set is selected; however what the user gets is not what they |
2621 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); | 2642 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); |
2622 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { | 2643 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { |
2623 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); | 2644 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); |
2624 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true); | 2645 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true); |
2625 } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) { | 2646 } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) { |
2626 #ifdef SOLARIS | 2647 #if defined(DTRACE_ENABLED) |
2627 FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true); | 2648 FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true); |
2628 FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true); | 2649 FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true); |
2629 FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true); | 2650 FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true); |
2630 FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true); | 2651 FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true); |
2631 #else // ndef SOLARIS | 2652 #else // defined(DTRACE_ENABLED) |
2632 jio_fprintf(defaultStream::error_stream(), | 2653 jio_fprintf(defaultStream::error_stream(), |
2633 "ExtendedDTraceProbes flag is only applicable on Solaris\n"); | 2654 "ExtendedDTraceProbes flag is not applicable for this configuration\n"); |
2634 return JNI_EINVAL; | 2655 return JNI_EINVAL; |
2635 #endif // ndef SOLARIS | 2656 #endif // defined(DTRACE_ENABLED) |
2636 #ifdef ASSERT | 2657 #ifdef ASSERT |
2637 } else if (match_option(option, "-XX:+FullGCALot", &tail)) { | 2658 } else if (match_option(option, "-XX:+FullGCALot", &tail)) { |
2638 FLAG_SET_CMDLINE(bool, FullGCALot, true); | 2659 FLAG_SET_CMDLINE(bool, FullGCALot, true); |
2639 // disable scavenge before parallel mark-compact | 2660 // disable scavenge before parallel mark-compact |
2640 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false); | 2661 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false); |
2725 // Unknown option | 2746 // Unknown option |
2726 } else if (is_bad_option(option, args->ignoreUnrecognized)) { | 2747 } else if (is_bad_option(option, args->ignoreUnrecognized)) { |
2727 return JNI_ERR; | 2748 return JNI_ERR; |
2728 } | 2749 } |
2729 } | 2750 } |
2751 | |
2730 // Change the default value for flags which have different default values | 2752 // Change the default value for flags which have different default values |
2731 // when working with older JDKs. | 2753 // when working with older JDKs. |
2732 if (JDK_Version::current().compare_major(6) <= 0 && | 2754 if (JDK_Version::current().compare_major(6) <= 0 && |
2733 FLAG_IS_DEFAULT(UseVMInterruptibleIO)) { | 2755 FLAG_IS_DEFAULT(UseVMInterruptibleIO)) { |
2734 FLAG_SET_DEFAULT(UseVMInterruptibleIO, true); | 2756 FLAG_SET_DEFAULT(UseVMInterruptibleIO, true); |
2939 // there may not even be a shared archive to use. | 2961 // there may not even be a shared archive to use. |
2940 FLAG_SET_DEFAULT(UseLargePages, false); | 2962 FLAG_SET_DEFAULT(UseLargePages, false); |
2941 } | 2963 } |
2942 } | 2964 } |
2943 | 2965 |
2966 // Disable options not supported in this release, with a warning if they | |
2967 // were explicitly requested on the command-line | |
2968 #define UNSUPPORTED_OPTION(opt, description) \ | |
2969 do { \ | |
2970 if (opt) { \ | |
2971 if (FLAG_IS_CMDLINE(opt)) { \ | |
2972 warning(description " is disabled in this release."); \ | |
2973 } \ | |
2974 FLAG_SET_DEFAULT(opt, false); \ | |
2975 } \ | |
2976 } while(0) | |
2977 | |
2944 // Parse entry point called from JNI_CreateJavaVM | 2978 // Parse entry point called from JNI_CreateJavaVM |
2945 | 2979 |
2946 jint Arguments::parse(const JavaVMInitArgs* args) { | 2980 jint Arguments::parse(const JavaVMInitArgs* args) { |
2947 | 2981 |
2948 // Sharing support | 2982 // Sharing support |
3035 // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS | 3069 // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS |
3036 jint result = parse_vm_init_args(args); | 3070 jint result = parse_vm_init_args(args); |
3037 if (result != JNI_OK) { | 3071 if (result != JNI_OK) { |
3038 return result; | 3072 return result; |
3039 } | 3073 } |
3074 | |
3075 #ifdef JAVASE_EMBEDDED | |
3076 UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); | |
3077 #endif | |
3040 | 3078 |
3041 #ifndef PRODUCT | 3079 #ifndef PRODUCT |
3042 if (TraceBytecodesAt != 0) { | 3080 if (TraceBytecodesAt != 0) { |
3043 TraceBytecodes = true; | 3081 TraceBytecodes = true; |
3044 } | 3082 } |