592 static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) { 593 julong v; 594 int int_v; 595 intx intx_v; 596 bool is_neg = false; 597 // Check the sign first since atomull() parses only unsigned values. 598 if (*value == '-') { 599 if ((CommandLineFlags::intxAt(name, &intx_v) != Flag::SUCCESS) && (CommandLineFlags::intAt(name, &int_v) != Flag::SUCCESS)) { 600 return false; 601 } 602 value++; 603 is_neg = true; 604 } 605 if (!atomull(value, &v)) { 606 return false; 607 } 608 int_v = (int) v; 609 if (is_neg) { 610 int_v = -int_v; 611 } 612 if (CommandLineFlags::intAtPut(name, &int_v, origin)) { 613 return true; 614 } 615 uint uint_v = (uint) v; 616 if (!is_neg && CommandLineFlags::uintAtPut(name, &uint_v, origin)) { 617 return true; 618 } 619 intx_v = (intx) v; 620 if (is_neg) { 621 intx_v = -intx_v; 622 } 623 if (CommandLineFlags::intxAtPut(name, &intx_v, origin) == Flag::SUCCESS) { 624 return true; 625 } 626 uintx uintx_v = (uintx) v; 627 if (!is_neg && (CommandLineFlags::uintxAtPut(name, &uintx_v, origin) == Flag::SUCCESS)) { 628 return true; 629 } 630 uint64_t uint64_t_v = (uint64_t) v; 631 if (!is_neg && (CommandLineFlags::uint64_tAtPut(name, &uint64_t_v, origin) == Flag::SUCCESS)) { 632 return true; 633 } 634 size_t size_t_v = (size_t) v; 635 if (!is_neg && (CommandLineFlags::size_tAtPut(name, &size_t_v, origin) == Flag::SUCCESS)) { 636 return true; 2026 // before returning an error. 2027 // Note: Needs platform-dependent factoring. 2028 bool status = true; 2029 2030 if (TLABRefillWasteFraction == 0) { 2031 jio_fprintf(defaultStream::error_stream(), 2032 "TLABRefillWasteFraction should be a denominator, " 2033 "not " SIZE_FORMAT "\n", 2034 TLABRefillWasteFraction); 2035 status = false; 2036 } 2037 2038 if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) { 2039 MarkSweepAlwaysCompactCount = 1; // Move objects every gc. 2040 } 2041 2042 if (UseParallelOldGC && ParallelOldGCSplitALot) { 2043 // Settings to encourage splitting. 2044 if (!FLAG_IS_CMDLINE(NewRatio)) { 2045 if (FLAG_SET_CMDLINE(uintx, NewRatio, 2) != Flag::SUCCESS) { 2046 return false; 2047 } 2048 } 2049 if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) { 2050 if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) { 2051 return false; 2052 } 2053 } 2054 } 2055 2056 if (!(UseParallelGC || UseParallelOldGC) && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) { 2057 FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false); 2058 } 2059 2060 if (GCTimeLimit == 100) { 2061 // Turn off gc-overhead-limit-exceeded checks 2062 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); 2063 } 2064 2065 status = status && check_gc_consistency(); 2066 2067 // CMS space iteration, which FLSVerifyAllHeapreferences entails, 2068 // insists that we hold the requisite locks so that the iteration is 2069 // MT-safe. For the verification at start-up and shut-down, we don't 2070 // yet have a good way of acquiring and releasing these locks, 2071 // which are not visible at the CollectedHeap level. We want to 3080 julong max_direct_memory_size = 0; 3081 ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0); 3082 if (errcode != arg_in_range) { 3083 jio_fprintf(defaultStream::error_stream(), 3084 "Invalid maximum direct memory size: %s\n", 3085 option->optionString); 3086 describe_range_error(errcode); 3087 return JNI_EINVAL; 3088 } 3089 if (FLAG_SET_CMDLINE(size_t, MaxDirectMemorySize, max_direct_memory_size) != Flag::SUCCESS) { 3090 return JNI_EINVAL; 3091 } 3092 #if !INCLUDE_MANAGEMENT 3093 } else if (match_option(option, "-XX:+ManagementServer")) { 3094 jio_fprintf(defaultStream::error_stream(), 3095 "ManagementServer is not supported in this VM.\n"); 3096 return JNI_ERR; 3097 #endif // INCLUDE_MANAGEMENT 3098 // CreateMinidumpOnCrash is removed, and replaced by CreateCoredumpOnCrash 3099 } else if (match_option(option, "-XX:+CreateMinidumpOnCrash")) { 3100 FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, true); 3101 jio_fprintf(defaultStream::output_stream(), 3102 "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is on\n"); 3103 } else if (match_option(option, "-XX:-CreateMinidumpOnCrash")) { 3104 FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, false); 3105 jio_fprintf(defaultStream::output_stream(), 3106 "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is off\n"); 3107 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx 3108 // Skip -XX:Flags= since that case has already been handled 3109 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { 3110 if (!process_argument(tail, args->ignoreUnrecognized, origin)) { 3111 return JNI_EINVAL; 3112 } 3113 } 3114 // Unknown option 3115 } else if (is_bad_option(option, args->ignoreUnrecognized)) { 3116 return JNI_ERR; 3117 } 3118 } 3119 3120 // PrintSharedArchiveAndExit will turn on 3121 // -Xshare:on 3122 // -XX:+TraceClassPaths 3123 if (PrintSharedArchiveAndExit) { 3124 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) { | 592 static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) { 593 julong v; 594 int int_v; 595 intx intx_v; 596 bool is_neg = false; 597 // Check the sign first since atomull() parses only unsigned values. 598 if (*value == '-') { 599 if ((CommandLineFlags::intxAt(name, &intx_v) != Flag::SUCCESS) && (CommandLineFlags::intAt(name, &int_v) != Flag::SUCCESS)) { 600 return false; 601 } 602 value++; 603 is_neg = true; 604 } 605 if (!atomull(value, &v)) { 606 return false; 607 } 608 int_v = (int) v; 609 if (is_neg) { 610 int_v = -int_v; 611 } 612 if (CommandLineFlags::intAtPut(name, &int_v, origin) == Flag::SUCCESS) { 613 return true; 614 } 615 uint uint_v = (uint) v; 616 if (!is_neg && CommandLineFlags::uintAtPut(name, &uint_v, origin) == Flag::SUCCESS) { 617 return true; 618 } 619 intx_v = (intx) v; 620 if (is_neg) { 621 intx_v = -intx_v; 622 } 623 if (CommandLineFlags::intxAtPut(name, &intx_v, origin) == Flag::SUCCESS) { 624 return true; 625 } 626 uintx uintx_v = (uintx) v; 627 if (!is_neg && (CommandLineFlags::uintxAtPut(name, &uintx_v, origin) == Flag::SUCCESS)) { 628 return true; 629 } 630 uint64_t uint64_t_v = (uint64_t) v; 631 if (!is_neg && (CommandLineFlags::uint64_tAtPut(name, &uint64_t_v, origin) == Flag::SUCCESS)) { 632 return true; 633 } 634 size_t size_t_v = (size_t) v; 635 if (!is_neg && (CommandLineFlags::size_tAtPut(name, &size_t_v, origin) == Flag::SUCCESS)) { 636 return true; 2026 // before returning an error. 2027 // Note: Needs platform-dependent factoring. 2028 bool status = true; 2029 2030 if (TLABRefillWasteFraction == 0) { 2031 jio_fprintf(defaultStream::error_stream(), 2032 "TLABRefillWasteFraction should be a denominator, " 2033 "not " SIZE_FORMAT "\n", 2034 TLABRefillWasteFraction); 2035 status = false; 2036 } 2037 2038 if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) { 2039 MarkSweepAlwaysCompactCount = 1; // Move objects every gc. 2040 } 2041 2042 if (UseParallelOldGC && ParallelOldGCSplitALot) { 2043 // Settings to encourage splitting. 2044 if (!FLAG_IS_CMDLINE(NewRatio)) { 2045 if (FLAG_SET_CMDLINE(uintx, NewRatio, 2) != Flag::SUCCESS) { 2046 status = false; 2047 } 2048 } 2049 if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) { 2050 if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) { 2051 status = false; 2052 } 2053 } 2054 } 2055 2056 if (!(UseParallelGC || UseParallelOldGC) && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) { 2057 FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false); 2058 } 2059 2060 if (GCTimeLimit == 100) { 2061 // Turn off gc-overhead-limit-exceeded checks 2062 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); 2063 } 2064 2065 status = status && check_gc_consistency(); 2066 2067 // CMS space iteration, which FLSVerifyAllHeapreferences entails, 2068 // insists that we hold the requisite locks so that the iteration is 2069 // MT-safe. For the verification at start-up and shut-down, we don't 2070 // yet have a good way of acquiring and releasing these locks, 2071 // which are not visible at the CollectedHeap level. We want to 3080 julong max_direct_memory_size = 0; 3081 ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0); 3082 if (errcode != arg_in_range) { 3083 jio_fprintf(defaultStream::error_stream(), 3084 "Invalid maximum direct memory size: %s\n", 3085 option->optionString); 3086 describe_range_error(errcode); 3087 return JNI_EINVAL; 3088 } 3089 if (FLAG_SET_CMDLINE(size_t, MaxDirectMemorySize, max_direct_memory_size) != Flag::SUCCESS) { 3090 return JNI_EINVAL; 3091 } 3092 #if !INCLUDE_MANAGEMENT 3093 } else if (match_option(option, "-XX:+ManagementServer")) { 3094 jio_fprintf(defaultStream::error_stream(), 3095 "ManagementServer is not supported in this VM.\n"); 3096 return JNI_ERR; 3097 #endif // INCLUDE_MANAGEMENT 3098 // CreateMinidumpOnCrash is removed, and replaced by CreateCoredumpOnCrash 3099 } else if (match_option(option, "-XX:+CreateMinidumpOnCrash")) { 3100 if (FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, true) != Flag::SUCCESS) { 3101 return JNI_EINVAL; 3102 } 3103 jio_fprintf(defaultStream::output_stream(), 3104 "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is on\n"); 3105 } else if (match_option(option, "-XX:-CreateMinidumpOnCrash")) { 3106 if (FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, false) != Flag::SUCCESS) { 3107 return JNI_EINVAL; 3108 } 3109 jio_fprintf(defaultStream::output_stream(), 3110 "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is off\n"); 3111 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx 3112 // Skip -XX:Flags= since that case has already been handled 3113 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { 3114 if (!process_argument(tail, args->ignoreUnrecognized, origin)) { 3115 return JNI_EINVAL; 3116 } 3117 } 3118 // Unknown option 3119 } else if (is_bad_option(option, args->ignoreUnrecognized)) { 3120 return JNI_ERR; 3121 } 3122 } 3123 3124 // PrintSharedArchiveAndExit will turn on 3125 // -Xshare:on 3126 // -XX:+TraceClassPaths 3127 if (PrintSharedArchiveAndExit) { 3128 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) { |