< prev index next >

src/share/vm/runtime/arguments.cpp

Print this page

        

*** 119,129 **** // Check if head of 'option' matches 'name', and sets 'tail' to the remaining // part of the option string. static bool match_option(const JavaVMOption *option, const char* name, const char** tail) { ! int len = (int)strlen(name); if (strncmp(option->optionString, name, len) == 0) { *tail = option->optionString + len; return true; } else { return false; --- 119,129 ---- // Check if head of 'option' matches 'name', and sets 'tail' to the remaining // part of the option string. static bool match_option(const JavaVMOption *option, const char* name, const char** tail) { ! size_t len = strlen(name); if (strncmp(option->optionString, name, len) == 0) { *tail = option->optionString + len; return true; } else { return false;
*** 220,262 **** // Update/Initialize System properties after JDK version number is known void Arguments::init_version_specific_system_properties() { enum { bufsz = 16 }; char buffer[bufsz]; ! const char* spec_vendor = "Sun Microsystems Inc."; ! uint32_t spec_version = 0; - spec_vendor = "Oracle Corporation"; - spec_version = JDK_Version::current().major_version(); jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version); PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.vendor", spec_vendor, false)); PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.version", buffer, false)); PropertyList_add(&_system_properties, new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false)); } ! /** ! * Provide a slightly more user-friendly way of eliminating -XX flags. ! * When a flag is eliminated, it can be added to this list in order to ! * continue accepting this flag on the command-line, while issuing a warning ! * and ignoring the value. Once the JDK version reaches the 'accept_until' ! * limit, we flatly refuse to admit the existence of the flag. This allows ! * a flag to die correctly over JDK releases using HSX. ! * But now that HSX is no longer supported only options with a future ! * accept_until value need to be listed, and the list can be pruned ! * on each major release. */ typedef struct { const char* name; ! JDK_Version obsoleted_in; // when the flag went away ! JDK_Version accept_until; // which version to start denying the existence ! } ObsoleteFlag; ! ! static ObsoleteFlag obsolete_jvm_flags[] = { { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "SafepointPollOffset", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "UseBoundThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "DefaultThreadPriority", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "NoYieldsInMicrolock", JDK_Version::jdk(9), JDK_Version::jdk(10) }, --- 220,297 ---- // Update/Initialize System properties after JDK version number is known void Arguments::init_version_specific_system_properties() { enum { bufsz = 16 }; char buffer[bufsz]; ! const char* spec_vendor = "Oracle Corporation"; ! uint32_t spec_version = JDK_Version::current().major_version(); jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version); PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.vendor", spec_vendor, false)); PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.version", buffer, false)); PropertyList_add(&_system_properties, new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false)); } ! /* ! * -XX argument processing: ! * ! * -XX arguments are defined in several places, such as: ! * globals.hpp, globals_<cpu>.hpp, globals_<os>.hpp, <compiler>_globals.hpp, or <gc>_globals.hpp. ! * -XX arguments are parsed in parse_argument(). ! * -XX argument bounds checking is done in check_vm_args_consistency(). ! * ! * Over time -XX arguments may change. There are mechanisms to handle common cases: ! * ! * ALIAS: An option may be renamed or replaced by another option. The old name can be supported by ! * adding the old and new option names to the "aliased_jvm_flags" table. Delete the old ! * variable from globals.hpp. This is often part of the process of deprecating a flag, but ! * not all aliases need to be deprecated. ! * ! * DEPRECATED: An option may be supported, but a warning is printed to let the user know that support may ! * be removed in the future. Both regular and aliased options may be deprecated. ! * Add a deprecation warning for an option (or alias) by adding an entry in the ! * "deprecated_jvm_flags" table. Specify the option name, the jdk version that deprecated the ! * option, and the jdk version that will expire the option (use "undefined()" if removal has ! * been not scheduled). ! * ! * OBSOLETE: An option may be removed (and deleted from globals.hpp), but still be accepted on the command ! * line. A warning is printed to let the user know that support may be removed in the future. ! * Add an obsolete warning for an option (or alias) by adding an entry in the ! * "obsolete_jvm_flags" table. Specify the option name, the jdk version that obsoleted the option, ! * and the jdk version that will expire the option (use "undefined()" if removal has been not ! * scheduled). ! * ! * EXPIRED: When the current JDK version is equal or greater to the "accept_until" version of a deprecated ! * or obsolete option, the system will flatly refuse to admit the existence of the flag. This ! * allows a flag to die correctly over JDK releases. ! * Note that manual cleanup of expired options should be done at major JDK version upgrades: ! * - Expired options can be removed from the obsolete_jvm_flags, deprecated_jvm_flags tables, ! * and aliased_jvm_flags tables. ! * - Removed options may have global variable definitions that should also be ! * removed (in globals.hpp, etc). ! * ! * Tests: Aliases are tested in VMAliasOptions.java. ! * Deprecated options are tested in VMDeprecatedOptions.java. ! * Obsolete options are tested in various files. */ + + // Obsolete or deprecated -XX flag. typedef struct { const char* name; ! JDK_Version obsoleted_in; // When the warning started (obsolete or deprecated). ! JDK_Version accept_until; // Which version to start denying the existence of the flag (if scheduled). ! } SpecialFlag; ! ! // When a flag is eliminated, it can be added to this list in order to ! // continue accepting this flag on the command-line, while issuing a warning ! // and ignoring the value. Once the JDK version reaches the 'accept_until' ! // limit, we flatly refuse to admit the existence of the flag. ! static SpecialFlag const obsolete_jvm_flags[] = { { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "SafepointPollOffset", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "UseBoundThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "DefaultThreadPriority", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "NoYieldsInMicrolock", JDK_Version::jdk(9), JDK_Version::jdk(10) },
*** 280,311 **** { "StarvationMonitorInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "PreInflateSpin", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { NULL, JDK_Version(0), JDK_Version(0) } }; ! // Returns true if the flag is obsolete and fits into the range specified ! // for being ignored. In the case that the flag is ignored, the 'version' ! // value is filled in with the version number when the flag became ! // obsolete so that that value can be displayed to the user. ! bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) { ! int i = 0; assert(version != NULL, "Must provide a version buffer"); ! while (obsolete_jvm_flags[i].name != NULL) { ! const ObsoleteFlag& flag_status = obsolete_jvm_flags[i]; ! // <flag>=xxx form ! // [-|+]<flag> form ! size_t len = strlen(flag_status.name); ! if ((strncmp(flag_status.name, s, len) == 0) && ! (strlen(s) == len)){ ! if (JDK_Version::current().compare(flag_status.accept_until) == -1) { *version = flag_status.obsoleted_in; ! return true; } } - i++; } ! return false; } // Constructs the system class path (aka boot class path) from the following // components, in order: // --- 315,398 ---- { "StarvationMonitorInterval", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "PreInflateSpin", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { NULL, JDK_Version(0), JDK_Version(0) } }; ! // When a flag is deprecated, it can be added to this list in order to issuing a warning when the flag is used. ! // Once the JDK version reaches the 'accept_until' limit, we flatly refuse to admit the existence of the flag. ! static SpecialFlag const deprecated_jvm_flags[] = { ! // deprecated non-alias flags: ! { "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined() }, ! { "UseParNewGC", JDK_Version::jdk(9), JDK_Version::jdk(10) }, ! ! // deprecated alias flags (see also aliased_jvm_flags): ! { "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined() }, ! { "CMSMarkStackSizeMax", JDK_Version::jdk(9), JDK_Version::jdk(10) }, ! { "CMSMarkStackSize", JDK_Version::jdk(9), JDK_Version::jdk(10) }, ! { "G1MarkStackSize", JDK_Version::jdk(9), JDK_Version::jdk(10) }, ! { "ParallelMarkingThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) }, ! { "ParallelCMSThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) }, ! { "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined() }, ! { NULL, JDK_Version(0), JDK_Version(0) } ! }; ! ! // Flags that are aliases for other flags. ! typedef struct { ! const char* alias_name; ! const char* real_name; ! } AliasedFlag; ! ! static AliasedFlag const aliased_jvm_flags[] = { ! { "DefaultMaxRAMFraction", "MaxRAMFraction" }, ! { "CMSMarkStackSizeMax", "MarkStackSizeMax" }, ! { "CMSMarkStackSize", "MarkStackSize" }, ! { "G1MarkStackSize", "MarkStackSize" }, ! { "ParallelMarkingThreads", "ConcGCThreads" }, ! { "ParallelCMSThreads", "ConcGCThreads" }, ! { "CreateMinidumpOnCrash", "CreateCoredumpOnCrash" }, ! { NULL, NULL} ! }; ! ! // Returns 1 if the flag is special and jdk version is in the range specified. ! // In this case the 'version' buffer is filled in with the version number when ! // the flag became special. ! // Returns -1 if the flag is special and has expired (should be ignored). ! // Returns 0 if the flag is not special. ! // Flag "flag_name" is a flag name stripped of '+', '-', and '='. ! static int is_special_flag(const SpecialFlag special_table[], const char *flag_name, JDK_Version* version) { assert(version != NULL, "Must provide a version buffer"); ! for (size_t i = 0; special_table[i].name != NULL; i++) { ! const SpecialFlag& flag_status = special_table[i]; ! if ((strcmp(flag_status.name, flag_name) == 0)) { ! if (flag_status.accept_until.is_undefined() || ! JDK_Version::current().compare(flag_status.accept_until) == -1) { *version = flag_status.obsoleted_in; ! return 1; ! } else { ! return -1; } } } ! return 0; ! } ! ! bool Arguments::is_newly_obsolete(const char *flag_name, JDK_Version* version) { ! return (is_special_flag(obsolete_jvm_flags, flag_name, version) == 1); ! } ! ! int Arguments::is_deprecated_flag(const char *flag_name, JDK_Version* version) { ! return is_special_flag(deprecated_jvm_flags, flag_name, version); ! } ! ! const char* Arguments::real_flag_name(const char *flag_name) { ! for (size_t i = 0; aliased_jvm_flags[i].alias_name != NULL; i++) { ! const AliasedFlag& flag_status = aliased_jvm_flags[i]; ! if (strcmp(flag_status.alias_name, flag_name) == 0) { ! return flag_status.real_name; ! } ! } ! return flag_name; } // Constructs the system class path (aka boot class path) from the following // components, in order: //
*** 572,590 **** default: ShouldNotReachHere(); } } ! static bool set_bool_flag(char* name, bool value, Flag::Flags origin) { if (CommandLineFlags::boolAtPut(name, &value, origin) == Flag::SUCCESS) { return true; } else { return false; } } ! static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) { double v; if (sscanf(value, "%lf", &v) != 1) { return false; } --- 659,677 ---- default: ShouldNotReachHere(); } } ! static bool set_bool_flag(const char* name, bool value, Flag::Flags origin) { if (CommandLineFlags::boolAtPut(name, &value, origin) == Flag::SUCCESS) { return true; } else { return false; } } ! static bool set_fp_numeric_flag(const char* name, char* value, Flag::Flags origin) { double v; if (sscanf(value, "%lf", &v) != 1) { return false; }
*** 592,602 **** return true; } return false; } ! static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) { julong v; int int_v; intx intx_v; bool is_neg = false; // Check the sign first since atomull() parses only unsigned values. --- 679,689 ---- return true; } return false; } ! static bool set_numeric_flag(const char* name, char* value, Flag::Flags origin) { julong v; int int_v; intx intx_v; bool is_neg = false; // Check the sign first since atomull() parses only unsigned values.
*** 641,658 **** return true; } return false; } ! static bool set_string_flag(char* name, const char* value, Flag::Flags origin) { if (CommandLineFlags::ccstrAtPut(name, &value, origin) != Flag::SUCCESS) return false; // Contract: CommandLineFlags always returns a pointer that needs freeing. FREE_C_HEAP_ARRAY(char, value); return true; } ! static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags origin) { const char* old_value = ""; if (CommandLineFlags::ccstrAt(name, &old_value) != Flag::SUCCESS) return false; size_t old_len = old_value != NULL ? strlen(old_value) : 0; size_t new_len = strlen(new_value); const char* value; --- 728,745 ---- return true; } return false; } ! static bool set_string_flag(const char* name, const char* value, Flag::Flags origin) { if (CommandLineFlags::ccstrAtPut(name, &value, origin) != Flag::SUCCESS) return false; // Contract: CommandLineFlags always returns a pointer that needs freeing. FREE_C_HEAP_ARRAY(char, value); return true; } ! static bool append_to_string_flag(const char* name, const char* new_value, Flag::Flags origin) { const char* old_value = ""; if (CommandLineFlags::ccstrAt(name, &old_value) != Flag::SUCCESS) return false; size_t old_len = old_value != NULL ? strlen(old_value) : 0; size_t new_len = strlen(new_value); const char* value;
*** 676,740 **** FREE_C_HEAP_ARRAY(char, free_this_too); } return true; } bool Arguments::parse_argument(const char* arg, Flag::Flags origin) { // range of acceptable characters spelled out for portability reasons #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" #define BUFLEN 255 char name[BUFLEN+1]; char dummy; if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) { ! return set_bool_flag(name, false, origin); } if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) { ! return set_bool_flag(name, true, origin); } char punct; if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "%c", name, &punct) == 2 && punct == '=') { const char* value = strchr(arg, '=') + 1; ! Flag* flag = Flag::find_flag(name, strlen(name)); if (flag != NULL && flag->is_ccstr()) { if (flag->ccstr_accumulates()) { ! return append_to_string_flag(name, value, origin); } else { if (value[0] == '\0') { value = NULL; } ! return set_string_flag(name, value, origin); } } } if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE ":%c", name, &punct) == 2 && punct == '=') { const char* value = strchr(arg, '=') + 1; // -XX:Foo:=xxx will reset the string flag to the given value. if (value[0] == '\0') { value = NULL; } ! return set_string_flag(name, value, origin); } #define SIGNED_FP_NUMBER_RANGE "[-0123456789.]" #define SIGNED_NUMBER_RANGE "[-0123456789]" #define NUMBER_RANGE "[0123456789]" char value[BUFLEN + 1]; char value2[BUFLEN + 1]; if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_NUMBER_RANGE "." "%" XSTR(BUFLEN) NUMBER_RANGE "%c", name, value, value2, &dummy) == 3) { // Looks like a floating-point number -- try again with more lenient format string if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_FP_NUMBER_RANGE "%c", name, value, &dummy) == 2) { ! return set_fp_numeric_flag(name, value, origin); } } #define VALUE_RANGE "[-kmgtxKMGTX0123456789abcdefABCDEF]" if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) VALUE_RANGE "%c", name, value, &dummy) == 2) { ! return set_numeric_flag(name, value, origin); } return false; } --- 763,885 ---- FREE_C_HEAP_ARRAY(char, free_this_too); } return true; } + const char* Arguments::handle_aliases_and_deprecation(const char* arg, bool warn) { + const char* real_name = real_flag_name(arg); + JDK_Version since = JDK_Version(); + switch (is_deprecated_flag(arg, &since)) { + case -1: + return NULL; + case 0: + return real_name; + case 1: { + if (warn) { + char version[256]; + since.to_string(version, sizeof(version)); + if (real_name != arg) { + warning("Option %s was deprecated in version %s and will likely be removed in a future release. Use option %s instead.", + arg, version, real_name); + } else { + warning("Option %s was deprecated in version %s and will likely be removed in a future release.", + arg, version); + } + } + return real_name; + } + } + ShouldNotReachHere(); + return NULL; + } + bool Arguments::parse_argument(const char* arg, Flag::Flags origin) { // range of acceptable characters spelled out for portability reasons #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" #define BUFLEN 255 char name[BUFLEN+1]; char dummy; + const char* real_name; + bool warn_if_deprecated = true; if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) { ! real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); ! if (real_name == NULL) { ! return false; // "name" is a deprecated option that has expired. ! } ! return set_bool_flag(real_name, false, origin); } if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) { ! real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); ! if (real_name == NULL) { ! return false; ! } ! return set_bool_flag(real_name, true, origin); } char punct; if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "%c", name, &punct) == 2 && punct == '=') { const char* value = strchr(arg, '=') + 1; ! Flag* flag; ! ! // this scanf pattern matches both strings (handled here) and numbers (handled later)) ! real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); ! if (real_name == NULL) { ! return false; ! } ! flag = Flag::find_flag(real_name); if (flag != NULL && flag->is_ccstr()) { if (flag->ccstr_accumulates()) { ! return append_to_string_flag(real_name, value, origin); } else { if (value[0] == '\0') { value = NULL; } ! return set_string_flag(real_name, value, origin); } + } else { + warn_if_deprecated = false; // if arg is deprecated, we've already done warning... } } if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE ":%c", name, &punct) == 2 && punct == '=') { const char* value = strchr(arg, '=') + 1; // -XX:Foo:=xxx will reset the string flag to the given value. if (value[0] == '\0') { value = NULL; } ! real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); ! if (real_name == NULL) { ! return false; ! } ! return set_string_flag(real_name, value, origin); } #define SIGNED_FP_NUMBER_RANGE "[-0123456789.]" #define SIGNED_NUMBER_RANGE "[-0123456789]" #define NUMBER_RANGE "[0123456789]" char value[BUFLEN + 1]; char value2[BUFLEN + 1]; if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_NUMBER_RANGE "." "%" XSTR(BUFLEN) NUMBER_RANGE "%c", name, value, value2, &dummy) == 3) { // Looks like a floating-point number -- try again with more lenient format string if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_FP_NUMBER_RANGE "%c", name, value, &dummy) == 2) { ! real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); ! if (real_name == NULL) { ! return false; ! } ! return set_fp_numeric_flag(real_name, value, origin); } } #define VALUE_RANGE "[-kmgtxKMGTX0123456789abcdefABCDEF]" if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) VALUE_RANGE "%c", name, value, &dummy) == 2) { ! real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); ! if (real_name == NULL) { ! return false; ! } ! return set_numeric_flag(real_name, value, origin); } return false; }
*** 817,828 **** st->cr(); } } bool Arguments::process_argument(const char* arg, ! jboolean ignore_unrecognized, Flag::Flags origin) { ! JDK_Version since = JDK_Version(); if (parse_argument(arg, origin) || ignore_unrecognized) { return true; } --- 962,973 ---- st->cr(); } } bool Arguments::process_argument(const char* arg, ! jboolean ignore_unrecognized, ! Flag::Flags origin) { JDK_Version since = JDK_Version(); if (parse_argument(arg, origin) || ignore_unrecognized) { return true; }
*** 847,857 **** stripped_argname[arg_len] = '\0'; // strncpy may not null terminate. if (is_newly_obsolete(stripped_argname, &since)) { char version[256]; since.to_string(version, sizeof(version)); ! warning("ignoring option %s; support was removed in %s", stripped_argname, version); return true; } } // For locked flags, report a custom error message if available. --- 992,1002 ---- stripped_argname[arg_len] = '\0'; // strncpy may not null terminate. if (is_newly_obsolete(stripped_argname, &since)) { char version[256]; since.to_string(version, sizeof(version)); ! warning("Ignoring option %s; support was removed in %s", stripped_argname, version); return true; } } // For locked flags, report a custom error message if available.
*** 1233,1243 **** #if INCLUDE_ALL_GCS static void disable_adaptive_size_policy(const char* collector_name) { if (UseAdaptiveSizePolicy) { if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { ! warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", collector_name); } FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); } } --- 1378,1388 ---- #if INCLUDE_ALL_GCS static void disable_adaptive_size_policy(const char* collector_name) { if (UseAdaptiveSizePolicy) { if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { ! warning("Disabling UseAdaptiveSizePolicy; it is incompatible with %s.", collector_name); } FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); } }
*** 1710,1720 **** } else if (UseConcMarkSweepGC) { set_cms_and_parnew_gc_flags(); } else if (UseG1GC) { set_g1_gc_flags(); } - check_deprecated_gc_flags(); if (AssumeMP && !UseSerialGC) { if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) { warning("If the number of processors is expected to increase from one, then" " you should configure the number of parallel GC threads appropriately" " using -XX:ParallelGCThreads=N"); --- 1855,1864 ----
*** 1740,1754 **** // Use static initialization to get the default before parsing static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress; void Arguments::set_heap_size() { - if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { - // Deprecated flag - FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); - } - const julong phys_mem = FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM) : (julong)MaxRAM; // If the maximum heap size has not been set with -Xmx, --- 1884,1893 ----
*** 1847,1857 **** } } } } ! // Set up runtime image flags void Arguments::set_runtime_image_flags() { #ifdef _LP64 // Memory map image file by default on 64 bit machines. if (FLAG_IS_DEFAULT(MemoryMapImage)) { FLAG_SET_ERGO(bool, MemoryMapImage, true); --- 1986,2112 ---- } } } } ! // This option inspects the machine and attempts to set various ! // parameters to be optimal for long-running, memory allocation ! // intensive jobs. It is intended for machines with large ! // amounts of cpu and memory. ! jint Arguments::set_aggressive_heap_flags() { ! // initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit ! // VM, but we may not be able to represent the total physical memory ! // available (like having 8gb of memory on a box but using a 32bit VM). ! // Thus, we need to make sure we're using a julong for intermediate ! // calculations. ! julong initHeapSize; ! julong total_memory = os::physical_memory(); ! ! if (total_memory < (julong) 256 * M) { ! jio_fprintf(defaultStream::error_stream(), ! "You need at least 256mb of memory to use -XX:+AggressiveHeap\n"); ! vm_exit(1); ! } ! ! // The heap size is half of available memory, or (at most) ! // all of possible memory less 160mb (leaving room for the OS ! // when using ISM). This is the maximum; because adaptive sizing ! // is turned on below, the actual space used may be smaller. ! ! initHeapSize = MIN2(total_memory / (julong) 2, ! total_memory - (julong) 160 * M); ! ! initHeapSize = limit_by_allocatable_memory(initHeapSize); ! ! if (FLAG_IS_DEFAULT(MaxHeapSize)) { ! if (FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! if (FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! // Currently the minimum size and the initial heap sizes are the same. ! set_min_heap_size(initHeapSize); ! } ! if (FLAG_IS_DEFAULT(NewSize)) { ! // Make the young generation 3/8ths of the total heap. ! if (FLAG_SET_CMDLINE(size_t, NewSize, ! ((julong) MaxHeapSize / (julong) 8) * (julong) 3) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! if (FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! } ! ! #if !defined(_ALLBSD_SOURCE) && !defined(AIX) // UseLargePages is not yet supported on BSD and AIX. ! FLAG_SET_DEFAULT(UseLargePages, true); ! #endif ! ! // Increase some data structure sizes for efficiency ! if (FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! if (FLAG_SET_CMDLINE(bool, ResizeTLAB, false) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! if (FLAG_SET_CMDLINE(size_t, TLABSize, 256 * K) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! ! // See the OldPLABSize comment below, but replace 'after promotion' ! // with 'after copying'. YoungPLABSize is the size of the survivor ! // space per-gc-thread buffers. The default is 4kw. ! if (FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256 * K) != Flag::SUCCESS) { // Note: this is in words ! return JNI_EINVAL; ! } ! ! // OldPLABSize is the size of the buffers in the old gen that ! // UseParallelGC uses to promote live data that doesn't fit in the ! // survivor spaces. At any given time, there's one for each gc thread. ! // The default size is 1kw. These buffers are rarely used, since the ! // survivor spaces are usually big enough. For specjbb, however, there ! // are occasions when there's lots of live data in the young gen ! // and we end up promoting some of it. We don't have a definite ! // explanation for why bumping OldPLABSize helps, but the theory ! // is that a bigger PLAB results in retaining something like the ! // original allocation order after promotion, which improves mutator ! // locality. A minor effect may be that larger PLABs reduce the ! // number of PLAB allocation events during gc. The value of 8kw ! // was arrived at by experimenting with specjbb. ! if (FLAG_SET_CMDLINE(size_t, OldPLABSize, 8 * K) != Flag::SUCCESS) { // Note: this is in words ! return JNI_EINVAL; ! } ! ! // Enable parallel GC and adaptive generation sizing ! if (FLAG_SET_CMDLINE(bool, UseParallelGC, true) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! FLAG_SET_DEFAULT(ParallelGCThreads, ! Abstract_VM_Version::parallel_worker_threads()); ! ! // Encourage steady state memory management ! if (FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! ! // This appears to improve mutator locality ! if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! ! // Get around early Solaris scheduling bug ! // (affinity vs other jobs on system) ! // but disallow DR and offlining (5008695). ! if (FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! ! return JNI_OK; ! } ! ! // Set up runtime image flags void Arguments::set_runtime_image_flags() { #ifdef _LP64 // Memory map image file by default on 64 bit machines. if (FLAG_IS_DEFAULT(MemoryMapImage)) { FLAG_SET_ERGO(bool, MemoryMapImage, true);
*** 2036,2059 **** } return true; } - void Arguments::check_deprecated_gc_flags() { - if (FLAG_IS_CMDLINE(UseParNewGC)) { - warning("The UseParNewGC flag is deprecated and will likely be removed in a future release"); - } - if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) { - warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated" - "and will likely be removed in future release"); - } - if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) { - warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. " - "Use MaxRAMFraction instead."); - } - } - // Check the consistency of vm_init_args bool Arguments::check_vm_args_consistency() { // Method for adding checks for flag consistency. // The intent is to warn the user of all possible conflicts, // before returning an error. --- 2291,2300 ----
*** 2586,2596 **** match_option(option, "-Xoptimize") || match_option(option, "-Xboundthreads")) { // All these options are deprecated in JDK 9 and will be removed in a future release char version[256]; JDK_Version::jdk(9).to_string(version, sizeof(version)); ! warning("ignoring option %s; support was removed in %s", option->optionString, version); } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) { julong long_CodeCacheExpansionSize = 0; ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size()); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), --- 2827,2837 ---- match_option(option, "-Xoptimize") || match_option(option, "-Xboundthreads")) { // All these options are deprecated in JDK 9 and will be removed in a future release char version[256]; JDK_Version::jdk(9).to_string(version, sizeof(version)); ! warning("Ignoring option %s; support was removed in %s", option->optionString, version); } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) { julong long_CodeCacheExpansionSize = 0; ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size()); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(),
*** 2853,2976 **** _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo); } else if (match_option(option, "abort")) { _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo); // -XX:+AggressiveHeap } else if (match_option(option, "-XX:+AggressiveHeap")) { ! ! // This option inspects the machine and attempts to set various ! // parameters to be optimal for long-running, memory allocation ! // intensive jobs. It is intended for machines with large ! // amounts of cpu and memory. ! ! // initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit ! // VM, but we may not be able to represent the total physical memory ! // available (like having 8gb of memory on a box but using a 32bit VM). ! // Thus, we need to make sure we're using a julong for intermediate ! // calculations. ! julong initHeapSize; ! julong total_memory = os::physical_memory(); ! ! if (total_memory < (julong)256*M) { ! jio_fprintf(defaultStream::error_stream(), ! "You need at least 256mb of memory to use -XX:+AggressiveHeap\n"); ! vm_exit(1); ! } ! ! // The heap size is half of available memory, or (at most) ! // all of possible memory less 160mb (leaving room for the OS ! // when using ISM). This is the maximum; because adaptive sizing ! // is turned on below, the actual space used may be smaller. ! ! initHeapSize = MIN2(total_memory / (julong)2, ! total_memory - (julong)160*M); ! ! initHeapSize = limit_by_allocatable_memory(initHeapSize); ! ! if (FLAG_IS_DEFAULT(MaxHeapSize)) { ! if (FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! if (FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! // Currently the minimum size and the initial heap sizes are the same. ! set_min_heap_size(initHeapSize); ! } ! if (FLAG_IS_DEFAULT(NewSize)) { ! // Make the young generation 3/8ths of the total heap. ! if (FLAG_SET_CMDLINE(size_t, NewSize, ! ((julong)MaxHeapSize / (julong)8) * (julong)3) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! if (FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! } ! ! #if !defined(_ALLBSD_SOURCE) && !defined(AIX) // UseLargePages is not yet supported on BSD and AIX. ! FLAG_SET_DEFAULT(UseLargePages, true); ! #endif ! ! // Increase some data structure sizes for efficiency ! if (FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! if (FLAG_SET_CMDLINE(bool, ResizeTLAB, false) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! if (FLAG_SET_CMDLINE(size_t, TLABSize, 256*K) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! ! // See the OldPLABSize comment below, but replace 'after promotion' ! // with 'after copying'. YoungPLABSize is the size of the survivor ! // space per-gc-thread buffers. The default is 4kw. ! if (FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256*K) != Flag::SUCCESS) { // Note: this is in words ! return JNI_EINVAL; ! } ! ! // OldPLABSize is the size of the buffers in the old gen that ! // UseParallelGC uses to promote live data that doesn't fit in the ! // survivor spaces. At any given time, there's one for each gc thread. ! // The default size is 1kw. These buffers are rarely used, since the ! // survivor spaces are usually big enough. For specjbb, however, there ! // are occasions when there's lots of live data in the young gen ! // and we end up promoting some of it. We don't have a definite ! // explanation for why bumping OldPLABSize helps, but the theory ! // is that a bigger PLAB results in retaining something like the ! // original allocation order after promotion, which improves mutator ! // locality. A minor effect may be that larger PLABs reduce the ! // number of PLAB allocation events during gc. The value of 8kw ! // was arrived at by experimenting with specjbb. ! if (FLAG_SET_CMDLINE(size_t, OldPLABSize, 8*K) != Flag::SUCCESS) { // Note: this is in words ! return JNI_EINVAL; ! } ! ! // Enable parallel GC and adaptive generation sizing ! if (FLAG_SET_CMDLINE(bool, UseParallelGC, true) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! FLAG_SET_DEFAULT(ParallelGCThreads, ! Abstract_VM_Version::parallel_worker_threads()); ! ! // Encourage steady state memory management ! if (FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! ! // This appears to improve mutator locality ! if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) { ! return JNI_EINVAL; ! } ! ! // Get around early Solaris scheduling bug ! // (affinity vs other jobs on system) ! // but disallow DR and offlining (5008695). ! if (FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true) != Flag::SUCCESS) { ! return JNI_EINVAL; } - // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure; // and the last option wins. } else if (match_option(option, "-XX:+NeverTenure")) { if (FLAG_SET_CMDLINE(bool, NeverTenure, true) != Flag::SUCCESS) { return JNI_EINVAL; --- 3094,3107 ---- _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo); } else if (match_option(option, "abort")) { _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo); // -XX:+AggressiveHeap } else if (match_option(option, "-XX:+AggressiveHeap")) { ! jint result = set_aggressive_heap_flags(); ! if (result != JNI_OK) { ! return result; } // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure; // and the last option wins. } else if (match_option(option, "-XX:+NeverTenure")) { if (FLAG_SET_CMDLINE(bool, NeverTenure, true) != Flag::SUCCESS) { return JNI_EINVAL;
*** 3059,3114 **** // disable scavenge before parallel mark-compact if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) { return JNI_EINVAL; } #endif - } else if (match_option(option, "-XX:CMSMarkStackSize=", &tail) || - match_option(option, "-XX:G1MarkStackSize=", &tail)) { - julong stack_size = 0; - ArgsRange errcode = parse_memory_size(tail, &stack_size, 1); - if (errcode != arg_in_range) { - jio_fprintf(defaultStream::error_stream(), - "Invalid mark stack size: %s\n", option->optionString); - describe_range_error(errcode); - return JNI_EINVAL; - } - jio_fprintf(defaultStream::error_stream(), - "Please use -XX:MarkStackSize in place of " - "-XX:CMSMarkStackSize or -XX:G1MarkStackSize in the future\n"); - if (FLAG_SET_CMDLINE(size_t, MarkStackSize, stack_size) != Flag::SUCCESS) { - return JNI_EINVAL; - } - } else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) { - julong max_stack_size = 0; - ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1); - if (errcode != arg_in_range) { - jio_fprintf(defaultStream::error_stream(), - "Invalid maximum mark stack size: %s\n", - option->optionString); - describe_range_error(errcode); - return JNI_EINVAL; - } - jio_fprintf(defaultStream::error_stream(), - "Please use -XX:MarkStackSizeMax in place of " - "-XX:CMSMarkStackSizeMax in the future\n"); - if (FLAG_SET_CMDLINE(size_t, MarkStackSizeMax, max_stack_size) != Flag::SUCCESS) { - return JNI_EINVAL; - } - } else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) || - match_option(option, "-XX:ParallelCMSThreads=", &tail)) { - uintx conc_threads = 0; - if (!parse_uintx(tail, &conc_threads, 1)) { - jio_fprintf(defaultStream::error_stream(), - "Invalid concurrent threads: %s\n", option->optionString); - return JNI_EINVAL; - } - jio_fprintf(defaultStream::error_stream(), - "Please use -XX:ConcGCThreads in place of " - "-XX:ParallelMarkingThreads or -XX:ParallelCMSThreads in the future\n"); - if (FLAG_SET_CMDLINE(uint, ConcGCThreads, conc_threads) != Flag::SUCCESS) { - return JNI_EINVAL; - } } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) { julong max_direct_memory_size = 0; ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), --- 3190,3199 ----
*** 3124,3146 **** } else if (match_option(option, "-XX:+ManagementServer")) { jio_fprintf(defaultStream::error_stream(), "ManagementServer is not supported in this VM.\n"); return JNI_ERR; #endif // INCLUDE_MANAGEMENT - // CreateMinidumpOnCrash is removed, and replaced by CreateCoredumpOnCrash - } else if (match_option(option, "-XX:+CreateMinidumpOnCrash")) { - if (FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, true) != Flag::SUCCESS) { - return JNI_EINVAL; - } - jio_fprintf(defaultStream::output_stream(), - "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is on\n"); - } else if (match_option(option, "-XX:-CreateMinidumpOnCrash")) { - if (FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, false) != Flag::SUCCESS) { - return JNI_EINVAL; - } - jio_fprintf(defaultStream::output_stream(), - "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is off\n"); } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx // Skip -XX:Flags= since that case has already been handled if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { if (!process_argument(tail, args->ignoreUnrecognized, origin)) { return JNI_EINVAL; --- 3209,3218 ----
*** 3488,3498 **** } void Arguments::set_shared_spaces_flags() { if (DumpSharedSpaces) { if (RequireSharedSpaces) { ! warning("cannot dump shared archive while using shared archive"); } UseSharedSpaces = false; #ifdef _LP64 if (!UseCompressedOops || !UseCompressedClassPointers) { vm_exit_during_initialization( --- 3560,3570 ---- } void Arguments::set_shared_spaces_flags() { if (DumpSharedSpaces) { if (RequireSharedSpaces) { ! warning("Cannot dump shared archive while using shared archive"); } UseSharedSpaces = false; #ifdef _LP64 if (!UseCompressedOops || !UseCompressedClassPointers) { vm_exit_during_initialization(
*** 3723,3733 **** } #endif // PRODUCT if (ScavengeRootsInCode == 0) { if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) { ! warning("forcing ScavengeRootsInCode non-zero"); } ScavengeRootsInCode = 1; } if (PrintGCDetails) { --- 3795,3805 ---- } #endif // PRODUCT if (ScavengeRootsInCode == 0) { if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) { ! warning("Forcing ScavengeRootsInCode non-zero"); } ScavengeRootsInCode = 1; } if (PrintGCDetails) {
< prev index next >