comparison src/share/vm/runtime/arguments.cpp @ 14318:1020b892787b

Merge
author hseigel
date Sun, 02 Feb 2014 15:31:40 -0500
parents b59507f713e0 2c95095271e9
children 5e1086b5b726
comparison
equal deleted inserted replaced
14317:b59507f713e0 14318:1020b892787b
183 "Java Virtual Machine Specification", false)); 183 "Java Virtual Machine Specification", false));
184 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false)); 184 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
185 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false)); 185 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false));
186 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true)); 186 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true));
187 187
188 // following are JVMTI agent writeable properties. 188 // Following are JVMTI agent writable properties.
189 // Properties values are set to NULL and they are 189 // Properties values are set to NULL and they are
190 // os specific they are initialized in os::init_system_properties_values(). 190 // os specific they are initialized in os::init_system_properties_values().
191 _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true); 191 _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true);
192 _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true); 192 _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true);
193 _sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true); 193 _sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true);
1312 // with YoungPLABSize and OldPLABSize options. 1312 // with YoungPLABSize and OldPLABSize options.
1313 // See CR 6362902. 1313 // See CR 6362902.
1314 if (!FLAG_IS_DEFAULT(OldPLABSize)) { 1314 if (!FLAG_IS_DEFAULT(OldPLABSize)) {
1315 if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) { 1315 if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) {
1316 // OldPLABSize is not the default value but CMSParPromoteBlocksToClaim 1316 // OldPLABSize is not the default value but CMSParPromoteBlocksToClaim
1317 // is. In this situtation let CMSParPromoteBlocksToClaim follow 1317 // is. In this situation let CMSParPromoteBlocksToClaim follow
1318 // the value (either from the command line or ergonomics) of 1318 // the value (either from the command line or ergonomics) of
1319 // OldPLABSize. Following OldPLABSize is an ergonomics decision. 1319 // OldPLABSize. Following OldPLABSize is an ergonomics decision.
1320 FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, OldPLABSize); 1320 FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, OldPLABSize);
1321 } else { 1321 } else {
1322 // OldPLABSize and CMSParPromoteBlocksToClaim are both set. 1322 // OldPLABSize and CMSParPromoteBlocksToClaim are both set.
1575 jio_fprintf(defaultStream::error_stream(), 1575 jio_fprintf(defaultStream::error_stream(),
1576 "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n"); 1576 "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n");
1577 vm_exit(1); 1577 vm_exit(1);
1578 } 1578 }
1579 1579
1580 if (UseAdaptiveSizePolicy) {
1581 // We don't want to limit adaptive heap sizing's freedom to adjust the heap
1582 // unless the user actually sets these flags.
1583 if (FLAG_IS_DEFAULT(MinHeapFreeRatio)) {
1584 FLAG_SET_DEFAULT(MinHeapFreeRatio, 0);
1585 }
1586 if (FLAG_IS_DEFAULT(MaxHeapFreeRatio)) {
1587 FLAG_SET_DEFAULT(MaxHeapFreeRatio, 100);
1588 }
1589 }
1580 1590
1581 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the 1591 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
1582 // SurvivorRatio has been set, reset their default values to SurvivorRatio + 1592 // SurvivorRatio has been set, reset their default values to SurvivorRatio +
1583 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger. 1593 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger.
1584 // See CR 6362902 for details. 1594 // See CR 6362902 for details.
1847 name, val, min); 1857 name, val, min);
1848 return false; 1858 return false;
1849 } 1859 }
1850 1860
1851 bool Arguments::verify_percentage(uintx value, const char* name) { 1861 bool Arguments::verify_percentage(uintx value, const char* name) {
1852 if (value <= 100) { 1862 if (is_percentage(value)) {
1853 return true; 1863 return true;
1854 } 1864 }
1855 jio_fprintf(defaultStream::error_stream(), 1865 jio_fprintf(defaultStream::error_stream(),
1856 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n", 1866 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n",
1857 name, value); 1867 name, value);
1933 } 1943 }
1934 } 1944 }
1935 return false; 1945 return false;
1936 } 1946 }
1937 return count_p < 2 && count_t < 2; 1947 return count_p < 2 && count_t < 2;
1948 }
1949
1950 bool Arguments::verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio) {
1951 if (!is_percentage(min_heap_free_ratio)) {
1952 err_msg.print("MinHeapFreeRatio must have a value between 0 and 100");
1953 return false;
1954 }
1955 if (min_heap_free_ratio > MaxHeapFreeRatio) {
1956 err_msg.print("MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
1957 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")", min_heap_free_ratio,
1958 MaxHeapFreeRatio);
1959 return false;
1960 }
1961 return true;
1962 }
1963
1964 bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio) {
1965 if (!is_percentage(max_heap_free_ratio)) {
1966 err_msg.print("MaxHeapFreeRatio must have a value between 0 and 100");
1967 return false;
1968 }
1969 if (max_heap_free_ratio < MinHeapFreeRatio) {
1970 err_msg.print("MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or "
1971 "equal to MinHeapFreeRatio (" UINTX_FORMAT ")", max_heap_free_ratio,
1972 MinHeapFreeRatio);
1973 return false;
1974 }
1975 return true;
1938 } 1976 }
1939 1977
1940 // Check consistency of GC selection 1978 // Check consistency of GC selection
1941 bool Arguments::check_gc_consistency() { 1979 bool Arguments::check_gc_consistency() {
1942 check_gclog_consistency(); 1980 check_gclog_consistency();
2040 } 2078 }
2041 2079
2042 status = status && verify_interval(AdaptiveSizePolicyWeight, 0, 100, 2080 status = status && verify_interval(AdaptiveSizePolicyWeight, 0, 100,
2043 "AdaptiveSizePolicyWeight"); 2081 "AdaptiveSizePolicyWeight");
2044 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); 2082 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance");
2045 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio");
2046 status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio");
2047 2083
2048 // Divide by bucket size to prevent a large size from causing rollover when 2084 // Divide by bucket size to prevent a large size from causing rollover when
2049 // calculating amount of memory needed to be allocated for the String table. 2085 // calculating amount of memory needed to be allocated for the String table.
2050 status = status && verify_interval(StringTableSize, minimumStringTableSize, 2086 status = status && verify_interval(StringTableSize, minimumStringTableSize,
2051 (max_uintx / StringTable::bucket_size()), "StringTable size"); 2087 (max_uintx / StringTable::bucket_size()), "StringTable size");
2052 2088
2053 status = status && verify_interval(SymbolTableSize, minimumSymbolTableSize, 2089 status = status && verify_interval(SymbolTableSize, minimumSymbolTableSize,
2054 (max_uintx / SymbolTable::bucket_size()), "SymbolTable size"); 2090 (max_uintx / SymbolTable::bucket_size()), "SymbolTable size");
2055 2091
2056 if (MinHeapFreeRatio > MaxHeapFreeRatio) { 2092 {
2057 jio_fprintf(defaultStream::error_stream(), 2093 // Using "else if" below to avoid printing two error messages if min > max.
2058 "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " 2094 // This will also prevent us from reporting both min>100 and max>100 at the
2059 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", 2095 // same time, but that is less annoying than printing two identical errors IMHO.
2060 MinHeapFreeRatio, MaxHeapFreeRatio); 2096 FormatBuffer<80> err_msg("");
2061 status = false; 2097 if (!verify_MinHeapFreeRatio(err_msg, MinHeapFreeRatio)) {
2062 } 2098 jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
2063 // Keeping the heap 100% free is hard ;-) so limit it to 99%. 2099 status = false;
2064 MinHeapFreeRatio = MIN2(MinHeapFreeRatio, (uintx) 99); 2100 } else if (!verify_MaxHeapFreeRatio(err_msg, MaxHeapFreeRatio)) {
2101 jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
2102 status = false;
2103 }
2104 }
2065 2105
2066 // Min/MaxMetaspaceFreeRatio 2106 // Min/MaxMetaspaceFreeRatio
2067 status = status && verify_percentage(MinMetaspaceFreeRatio, "MinMetaspaceFreeRatio"); 2107 status = status && verify_percentage(MinMetaspaceFreeRatio, "MinMetaspaceFreeRatio");
2068 status = status && verify_percentage(MaxMetaspaceFreeRatio, "MaxMetaspaceFreeRatio"); 2108 status = status && verify_percentage(MaxMetaspaceFreeRatio, "MaxMetaspaceFreeRatio");
2069 2109
2692 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size); 2732 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
2693 // Xmaxf 2733 // Xmaxf
2694 } else if (match_option(option, "-Xmaxf", &tail)) { 2734 } else if (match_option(option, "-Xmaxf", &tail)) {
2695 char* err; 2735 char* err;
2696 int maxf = (int)(strtod(tail, &err) * 100); 2736 int maxf = (int)(strtod(tail, &err) * 100);
2697 if (*err != '\0' || maxf < 0 || maxf > 100) { 2737 if (*err != '\0' || *tail == '\0' || maxf < 0 || maxf > 100) {
2698 jio_fprintf(defaultStream::error_stream(), 2738 jio_fprintf(defaultStream::error_stream(),
2699 "Bad max heap free percentage size: %s\n", 2739 "Bad max heap free percentage size: %s\n",
2700 option->optionString); 2740 option->optionString);
2701 return JNI_EINVAL; 2741 return JNI_EINVAL;
2702 } else { 2742 } else {
2704 } 2744 }
2705 // Xminf 2745 // Xminf
2706 } else if (match_option(option, "-Xminf", &tail)) { 2746 } else if (match_option(option, "-Xminf", &tail)) {
2707 char* err; 2747 char* err;
2708 int minf = (int)(strtod(tail, &err) * 100); 2748 int minf = (int)(strtod(tail, &err) * 100);
2709 if (*err != '\0' || minf < 0 || minf > 100) { 2749 if (*err != '\0' || *tail == '\0' || minf < 0 || minf > 100) {
2710 jio_fprintf(defaultStream::error_stream(), 2750 jio_fprintf(defaultStream::error_stream(),
2711 "Bad min heap free percentage size: %s\n", 2751 "Bad min heap free percentage size: %s\n",
2712 option->optionString); 2752 option->optionString);
2713 return JNI_EINVAL; 2753 return JNI_EINVAL;
2714 } else { 2754 } else {
3649 3689
3650 #if INCLUDE_ALL_GCS 3690 #if INCLUDE_ALL_GCS
3651 // Set per-collector flags 3691 // Set per-collector flags
3652 if (UseParallelGC || UseParallelOldGC) { 3692 if (UseParallelGC || UseParallelOldGC) {
3653 set_parallel_gc_flags(); 3693 set_parallel_gc_flags();
3654 } else if (UseConcMarkSweepGC) { // should be done before ParNew check below 3694 } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
3655 set_cms_and_parnew_gc_flags(); 3695 set_cms_and_parnew_gc_flags();
3656 } else if (UseParNewGC) { // skipped if CMS is set above 3696 } else if (UseParNewGC) { // Skipped if CMS is set above
3657 set_parnew_gc_flags(); 3697 set_parnew_gc_flags();
3658 } else if (UseG1GC) { 3698 } else if (UseG1GC) {
3659 set_g1_gc_flags(); 3699 set_g1_gc_flags();
3660 } 3700 }
3661 check_deprecated_gcs(); 3701 check_deprecated_gcs();
3665 warning("If the number of processors is expected to increase from one, then" 3705 warning("If the number of processors is expected to increase from one, then"
3666 " you should configure the number of parallel GC threads appropriately" 3706 " you should configure the number of parallel GC threads appropriately"
3667 " using -XX:ParallelGCThreads=N"); 3707 " using -XX:ParallelGCThreads=N");
3668 } 3708 }
3669 } 3709 }
3710 if (MinHeapFreeRatio == 100) {
3711 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
3712 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
3713 }
3670 #else // INCLUDE_ALL_GCS 3714 #else // INCLUDE_ALL_GCS
3671 assert(verify_serial_gc_flags(), "SerialGC unset"); 3715 assert(verify_serial_gc_flags(), "SerialGC unset");
3672 #endif // INCLUDE_ALL_GCS 3716 #endif // INCLUDE_ALL_GCS
3673 3717
3674 // Initialize Metaspace flags and alignments. 3718 // Initialize Metaspace flags and alignments
3675 Metaspace::ergo_initialize(); 3719 Metaspace::ergo_initialize();
3676 3720
3677 // Set bytecode rewriting flags 3721 // Set bytecode rewriting flags
3678 set_bytecode_flags(); 3722 set_bytecode_flags();
3679 3723
3680 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled. 3724 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled
3681 set_aggressive_opts_flags(); 3725 set_aggressive_opts_flags();
3682 3726
3683 // Turn off biased locking for locking debug mode flags, 3727 // Turn off biased locking for locking debug mode flags,
3684 // which are subtlely different from each other but neither works with 3728 // which are subtly different from each other but neither works with
3685 // biased locking. 3729 // biased locking
3686 if (UseHeavyMonitors 3730 if (UseHeavyMonitors
3687 #ifdef COMPILER1 3731 #ifdef COMPILER1
3688 || !UseFastLocking 3732 || !UseFastLocking
3689 #endif // COMPILER1 3733 #endif // COMPILER1
3690 ) { 3734 ) {