src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8059557_open Sdiff src/share/vm/runtime

src/share/vm/runtime/arguments.cpp

Print this page




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "classfile/javaAssertions.hpp"
  28 #include "classfile/stringTable.hpp"
  29 #include "classfile/symbolTable.hpp"
  30 #include "compiler/compilerOracle.hpp"
  31 #include "memory/allocation.inline.hpp"
  32 #include "memory/cardTableRS.hpp"
  33 #include "memory/genCollectedHeap.hpp"
  34 #include "memory/referenceProcessor.hpp"
  35 #include "memory/universe.inline.hpp"
  36 #include "oops/oop.inline.hpp"
  37 #include "prims/jvmtiExport.hpp"
  38 #include "runtime/arguments.hpp"
  39 #include "runtime/arguments_ext.hpp"



  40 #include "runtime/globals_extension.hpp"
  41 #include "runtime/java.hpp"
  42 #include "runtime/os.hpp"
  43 #include "runtime/vm_version.hpp"
  44 #include "services/management.hpp"
  45 #include "services/memTracker.hpp"
  46 #include "utilities/defaultStream.hpp"
  47 #include "utilities/macros.hpp"
  48 #include "utilities/stringUtils.hpp"
  49 #include "utilities/taskqueue.hpp"
  50 #if INCLUDE_ALL_GCS
  51 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
  52 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  53 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
  54 #endif // INCLUDE_ALL_GCS
  55 
  56 // Note: This is a special bug reporting site for the JVM
  57 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
  58 #define DEFAULT_JAVA_LAUNCHER  "generic"
  59 


 170 
 171     if (match_option(option, "-Dsun.java.launcher=", &tail)) {
 172       process_java_launcher_argument(tail, option->extraInfo);
 173       continue;
 174     }
 175     if (match_option(option, "-Dsun.java.launcher.is_altjvm=", &tail)) {
 176       if (strcmp(tail, "true") == 0) {
 177         _sun_java_launcher_is_altjvm = true;
 178       }
 179       continue;
 180     }
 181     if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) {
 182       _sun_java_launcher_pid = atoi(tail);
 183       continue;
 184     }
 185   }
 186 }
 187 
 188 // Initialize system properties key and value.
 189 void Arguments::init_system_properties() {
 190 
 191   PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name",
 192                                                                  "Java Virtual Machine Specification",  false));
 193   PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(),  false));
 194   PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(),  false));
 195   PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(),  true));
 196 
 197   // Following are JVMTI agent writable properties.
 198   // Properties values are set to NULL and they are
 199   // os specific they are initialized in os::init_system_properties_values().
 200   _sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL,  true);
 201   _java_library_path = new SystemProperty("java.library.path", NULL,  true);
 202   _java_home =  new SystemProperty("java.home", NULL,  true);
 203   _sun_boot_class_path = new SystemProperty("sun.boot.class.path", NULL,  true);
 204 
 205   _java_class_path = new SystemProperty("java.class.path", "",  true);
 206 
 207   // Add to System Property list.
 208   PropertyList_add(&_system_properties, _sun_boot_library_path);
 209   PropertyList_add(&_system_properties, _java_library_path);
 210   PropertyList_add(&_system_properties, _java_home);
 211   PropertyList_add(&_system_properties, _java_class_path);
 212   PropertyList_add(&_system_properties, _sun_boot_class_path);
 213 
 214   // Set OS specific system properties values
 215   os::init_system_properties_values();
 216 }
 217 
 218 
 219   // Update/Initialize System properties after JDK version number is known
 220 void Arguments::init_version_specific_system_properties() {
 221   enum { bufsz = 16 };
 222   char buffer[bufsz];
 223   const char* spec_vendor = "Sun Microsystems Inc.";
 224   uint32_t spec_version = 0;
 225 
 226   spec_vendor = "Oracle Corporation";
 227   spec_version = JDK_Version::current().major_version();
 228   jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version);
 229 
 230   PropertyList_add(&_system_properties,
 231       new SystemProperty("java.vm.specification.vendor",  spec_vendor, false));
 232   PropertyList_add(&_system_properties,
 233       new SystemProperty("java.vm.specification.version", buffer, false));
 234   PropertyList_add(&_system_properties,
 235       new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(),  false));
 236 }
 237 
 238 /**
 239  * Provide a slightly more user-friendly way of eliminating -XX flags.


 552 
 553 // Describe an argument out of range error
 554 void Arguments::describe_range_error(ArgsRange errcode) {
 555   switch(errcode) {
 556   case arg_too_big:
 557     jio_fprintf(defaultStream::error_stream(),
 558                 "The specified size exceeds the maximum "
 559                 "representable size.\n");
 560     break;
 561   case arg_too_small:
 562   case arg_unreadable:
 563   case arg_in_range:
 564     // do nothing for now
 565     break;
 566   default:
 567     ShouldNotReachHere();
 568   }
 569 }
 570 
 571 static bool set_bool_flag(char* name, bool value, Flag::Flags origin) {
 572   return CommandLineFlags::boolAtPut(name, &value, origin);




 573 }
 574 
 575 static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) {
 576   double v;
 577   if (sscanf(value, "%lf", &v) != 1) {
 578     return false;
 579   }
 580 
 581   if (CommandLineFlags::doubleAtPut(name, &v, origin)) {
 582     return true;
 583   }
 584   return false;
 585 }
 586 
 587 static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
 588   julong v;
 589   intx intx_v;
 590   bool is_neg = false;
 591   // Check the sign first since atomull() parses only unsigned values.
 592   if (*value == '-') {
 593     if (!CommandLineFlags::intxAt(name, &intx_v)) {
 594       return false;
 595     }
 596     value++;
 597     is_neg = true;
 598   }
 599   if (!atomull(value, &v)) {
 600     return false;
 601   }
 602   intx_v = (intx) v;
 603   if (is_neg) {
 604     intx_v = -intx_v;
 605   }
 606   if (CommandLineFlags::intxAtPut(name, &intx_v, origin)) {
 607     return true;
 608   }
 609   uintx uintx_v = (uintx) v;
 610   if (!is_neg && CommandLineFlags::uintxAtPut(name, &uintx_v, origin)) {
 611     return true;
 612   }
 613   uint64_t uint64_t_v = (uint64_t) v;
 614   if (!is_neg && CommandLineFlags::uint64_tAtPut(name, &uint64_t_v, origin)) {
 615     return true;
 616   }
 617   size_t size_t_v = (size_t) v;
 618   if (!is_neg && CommandLineFlags::size_tAtPut(name, &size_t_v, origin)) {
 619     return true;
 620   }
 621   return false;
 622 }
 623 
 624 static bool set_string_flag(char* name, const char* value, Flag::Flags origin) {
 625   if (!CommandLineFlags::ccstrAtPut(name, &value, origin))  return false;
 626   // Contract:  CommandLineFlags always returns a pointer that needs freeing.
 627   FREE_C_HEAP_ARRAY(char, value);
 628   return true;
 629 }
 630 
 631 static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags origin) {
 632   const char* old_value = "";
 633   if (!CommandLineFlags::ccstrAt(name, &old_value))  return false;
 634   size_t old_len = old_value != NULL ? strlen(old_value) : 0;
 635   size_t new_len = strlen(new_value);
 636   const char* value;
 637   char* free_this_too = NULL;
 638   if (old_len == 0) {
 639     value = new_value;
 640   } else if (new_len == 0) {
 641     value = old_value;
 642   } else {
 643     char* buf = NEW_C_HEAP_ARRAY(char, old_len + 1 + new_len + 1, mtInternal);
 644     // each new setting adds another LINE to the switch:
 645     sprintf(buf, "%s\n%s", old_value, new_value);
 646     value = buf;
 647     free_this_too = buf;
 648   }
 649   (void) CommandLineFlags::ccstrAtPut(name, &value, origin);
 650   // CommandLineFlags always returns a pointer that needs freeing.
 651   FREE_C_HEAP_ARRAY(char, value);
 652   if (free_this_too != NULL) {
 653     // CommandLineFlags made its own copy, so I must delete my own temp. buffer.


1380     tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads);
1381   }
1382 }
1383 #endif // INCLUDE_ALL_GCS
1384 
1385 void set_object_alignment() {
1386   // Object alignment.
1387   assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2");
1388   MinObjAlignmentInBytes     = ObjectAlignmentInBytes;
1389   assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small");
1390   MinObjAlignment            = MinObjAlignmentInBytes / HeapWordSize;
1391   assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect");
1392   MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1;
1393 
1394   LogMinObjAlignmentInBytes  = exact_log2(ObjectAlignmentInBytes);
1395   LogMinObjAlignment         = LogMinObjAlignmentInBytes - LogHeapWordSize;
1396 
1397   // Oop encoding heap max
1398   OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes;
1399 




1400 #if INCLUDE_ALL_GCS
1401   // Set CMS global values
1402   CompactibleFreeListSpace::set_cms_values();
1403 #endif // INCLUDE_ALL_GCS
1404 }
1405 
1406 bool verify_object_alignment() {
1407   // Object alignment.
1408   if (!is_power_of_2(ObjectAlignmentInBytes)) {
1409     jio_fprintf(defaultStream::error_stream(),
1410                 "error: ObjectAlignmentInBytes=%d must be power of 2\n",
1411                 (int)ObjectAlignmentInBytes);
1412     return false;
1413   }
1414   if ((int)ObjectAlignmentInBytes < BytesPerLong) {
1415     jio_fprintf(defaultStream::error_stream(),
1416                 "error: ObjectAlignmentInBytes=%d must be greater or equal %d\n",
1417                 (int)ObjectAlignmentInBytes, BytesPerLong);
1418     return false;
1419   }
1420   // It does not make sense to have big object alignment
1421   // since a space lost due to alignment will be greater
1422   // then a saved space from compressed oops.
1423   if ((int)ObjectAlignmentInBytes > 256) {
1424     jio_fprintf(defaultStream::error_stream(),
1425                 "error: ObjectAlignmentInBytes=%d must not be greater than 256\n",
1426                 (int)ObjectAlignmentInBytes);
1427     return false;
1428   }
1429   // In case page size is very small.
1430   if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
1431     jio_fprintf(defaultStream::error_stream(),
1432                 "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
1433                 (int)ObjectAlignmentInBytes, os::vm_page_size());
1434     return false;
1435   }
1436   if(SurvivorAlignmentInBytes == 0) {
1437     SurvivorAlignmentInBytes = ObjectAlignmentInBytes;
1438   } else {
1439     if (!is_power_of_2(SurvivorAlignmentInBytes)) {
1440       jio_fprintf(defaultStream::error_stream(),
1441             "error: SurvivorAlignmentInBytes=%d must be power of 2\n",
1442             (int)SurvivorAlignmentInBytes);
1443       return false;
1444     }
1445     if (SurvivorAlignmentInBytes < ObjectAlignmentInBytes) {
1446       jio_fprintf(defaultStream::error_stream(),
1447           "error: SurvivorAlignmentInBytes=%d must be greater than ObjectAlignmentInBytes=%d \n",
1448           (int)SurvivorAlignmentInBytes, (int)ObjectAlignmentInBytes);
1449       return false;
1450     }
1451   }
1452   return true;
1453 }
1454 
1455 size_t Arguments::max_heap_for_compressed_oops() {
1456   // Avoid sign flip.
1457   assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1458   // We need to fit both the NULL page and the heap into the memory budget, while
1459   // keeping alignment constraints of the heap. To guarantee the latter, as the
1460   // NULL page is located before the heap, we pad the NULL page to the conservative
1461   // maximum alignment that the GC may ever impose upon the heap.
1462   size_t displacement_due_to_null_page = align_size_up_(os::vm_page_size(),
1463                                                         _conservative_max_heap_alignment);
1464 
1465   LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1466   NOT_LP64(ShouldNotReachHere(); return 0);
1467 }
1468 
1469 bool Arguments::should_auto_select_low_pause_collector() {
1470   if (UseAutoGCSelectPolicy &&
1471       !FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
1472       (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
1473     if (PrintGCDetails) {
1474       // Cannot use gclog_or_tty yet.


1917     set_java_compiler(true);    // "-Djava.compiler[=...]" most recently seen.
1918   }
1919 }
1920 
1921 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
1922   _sun_java_launcher = os::strdup_check_oom(launcher);
1923 }
1924 
1925 bool Arguments::created_by_java_launcher() {
1926   assert(_sun_java_launcher != NULL, "property must have value");
1927   return strcmp(DEFAULT_JAVA_LAUNCHER, _sun_java_launcher) != 0;
1928 }
1929 
1930 bool Arguments::sun_java_launcher_is_altjvm() {
1931   return _sun_java_launcher_is_altjvm;
1932 }
1933 
1934 //===========================================================================================================
1935 // Parsing of main arguments
1936 
1937 bool Arguments::verify_interval(uintx val, uintx min,
1938                                 uintx max, const char* name) {
1939   // Returns true iff value is in the inclusive interval [min..max]
1940   // false, otherwise.
1941   if (val >= min && val <= max) {
1942     return true;
1943   }
1944   jio_fprintf(defaultStream::error_stream(),
1945               "%s of " UINTX_FORMAT " is invalid; must be between " UINTX_FORMAT
1946               " and " UINTX_FORMAT "\n",
1947               name, val, min, max);
1948   return false;
1949 }
1950 
1951 bool Arguments::verify_min_value(intx val, intx min, const char* name) {
1952   // Returns true if given value is at least specified min threshold
1953   // false, otherwise.
1954   if (val >= min ) {
1955       return true;
1956   }
1957   jio_fprintf(defaultStream::error_stream(),
1958               "%s of " INTX_FORMAT " is invalid; must be at least " INTX_FORMAT "\n",
1959               name, val, min);
1960   return false;
1961 }
1962 
1963 bool Arguments::verify_percentage(uintx value, const char* name) {
1964   if (is_percentage(value)) {
1965     return true;
1966   }
1967   jio_fprintf(defaultStream::error_stream(),
1968               "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n",
1969               name, value);
1970   return false;
1971 }
1972 
1973 // check if do gclog rotation
1974 // +UseGCLogFileRotation is a must,
1975 // no gc log rotation when log file not supplied or
1976 // NumberOfGCLogFiles is 0
1977 void check_gclog_consistency() {
1978   if (UseGCLogFileRotation) {
1979     if ((Arguments::gc_log_filename() == NULL) || (NumberOfGCLogFiles == 0)) {
1980       jio_fprintf(defaultStream::output_stream(),
1981                   "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files>\n"
1982                   "where num_of_file > 0\n"
1983                   "GC log rotation is turned off\n");
1984       UseGCLogFileRotation = false;
1985     }
1986   }
1987 
1988   if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8*K)) {
1989     FLAG_SET_CMDLINE(size_t, GCLogFileSize, 8*K);
1990     jio_fprintf(defaultStream::output_stream(),
1991                 "GCLogFileSize changed to minimum 8K\n");
1992   }

1993 }
1994 
1995 // This function is called for -Xloggc:<filename>, it can be used
1996 // to check if a given file name(or string) conforms to the following
1997 // specification:
1998 // A valid string only contains "[A-Z][a-z][0-9].-_%[p|t]"
1999 // %p and %t only allowed once. We only limit usage of filename not path
2000 bool is_filename_valid(const char *file_name) {
2001   const char* p = file_name;
2002   char file_sep = os::file_separator()[0];
2003   const char* cp;
2004   // skip prefix path
2005   for (cp = file_name; *cp != '\0'; cp++) {
2006     if (*cp == '/' || *cp == file_sep) {
2007       p = cp + 1;
2008     }
2009   }
2010 
2011   int count_p = 0;
2012   int count_t = 0;


2020        p++;
2021        continue;
2022     }
2023     if (*p == '%') {
2024       if(*(p + 1) == 'p') {
2025         p += 2;
2026         count_p ++;
2027         continue;
2028       }
2029       if (*(p + 1) == 't') {
2030         p += 2;
2031         count_t ++;
2032         continue;
2033       }
2034     }
2035     return false;
2036   }
2037   return count_p < 2 && count_t < 2;
2038 }
2039 
2040 bool Arguments::verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio) {
2041   if (!is_percentage(min_heap_free_ratio)) {
2042     err_msg.print("MinHeapFreeRatio must have a value between 0 and 100");
2043     return false;
2044   }
2045   if (min_heap_free_ratio > MaxHeapFreeRatio) {
2046     err_msg.print("MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
2047                   "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")", min_heap_free_ratio,
2048                   MaxHeapFreeRatio);
2049     return false;
2050   }
2051   // This does not set the flag itself, but stores the value in a safe place for later usage.
2052   _min_heap_free_ratio = min_heap_free_ratio;
2053   return true;
2054 }
2055 
2056 bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio) {
2057   if (!is_percentage(max_heap_free_ratio)) {
2058     err_msg.print("MaxHeapFreeRatio must have a value between 0 and 100");
2059     return false;
2060   }
2061   if (max_heap_free_ratio < MinHeapFreeRatio) {
2062     err_msg.print("MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or "
2063                   "equal to MinHeapFreeRatio (" UINTX_FORMAT ")", max_heap_free_ratio,
2064                   MinHeapFreeRatio);
2065     return false;
2066   }
2067   // This does not set the flag itself, but stores the value in a safe place for later usage.
2068   _max_heap_free_ratio = max_heap_free_ratio;
2069   return true;
2070 }
2071 
2072 // Check consistency of GC selection
2073 bool Arguments::check_gc_consistency() {
2074   check_gclog_consistency();
2075   // Ensure that the user has not selected conflicting sets
2076   // of collectors.
2077   uint i = 0;
2078   if (UseSerialGC)                       i++;
2079   if (UseConcMarkSweepGC)                i++;
2080   if (UseParallelGC || UseParallelOldGC) i++;
2081   if (UseG1GC)                           i++;
2082   if (i > 1) {
2083     jio_fprintf(defaultStream::error_stream(),
2084                 "Conflicting collector combinations in option list; "
2085                 "please refer to the release notes for the combinations "
2086                 "allowed\n");
2087     return false;
2088   }
2089 
2090   if (UseConcMarkSweepGC && !UseParNewGC) {
2091     jio_fprintf(defaultStream::error_stream(),


2099     return false;
2100   }
2101 
2102   return true;
2103 }
2104 
2105 void Arguments::check_deprecated_gc_flags() {
2106   if (FLAG_IS_CMDLINE(UseParNewGC)) {
2107     warning("The UseParNewGC flag is deprecated and will likely be removed in a future release");
2108   }
2109   if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
2110     warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
2111             "and will likely be removed in future release");
2112   }
2113   if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) {
2114     warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
2115         "Use MaxRAMFraction instead.");
2116   }
2117 }
2118 
2119 // Check stack pages settings
2120 bool Arguments::check_stack_pages()
2121 {
2122   bool status = true;
2123   status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages");
2124   status = status && verify_min_value(StackRedPages, 1, "StackRedPages");
2125   // greater stack shadow pages can't generate instruction to bang stack
2126   status = status && verify_interval(StackShadowPages, 1, 50, "StackShadowPages");
2127   return status;
2128 }
2129 
2130 // Check the consistency of vm_init_args
2131 bool Arguments::check_vm_args_consistency() {
2132   // Method for adding checks for flag consistency.
2133   // The intent is to warn the user of all possible conflicts,
2134   // before returning an error.
2135   // Note: Needs platform-dependent factoring.
2136   bool status = true;
2137 
2138   if (TLABRefillWasteFraction == 0) {
2139     jio_fprintf(defaultStream::error_stream(),
2140                 "TLABRefillWasteFraction should be a denominator, "
2141                 "not " SIZE_FORMAT "\n",
2142                 TLABRefillWasteFraction);
2143     status = false;
2144   }
2145 
2146   status = status && verify_interval(AdaptiveSizePolicyWeight, 0, 100,
2147                               "AdaptiveSizePolicyWeight");
2148   status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance");
2149 
2150   // Divide by bucket size to prevent a large size from causing rollover when
2151   // calculating amount of memory needed to be allocated for the String table.
2152   status = status && verify_interval(StringTableSize, minimumStringTableSize,
2153     (max_uintx / StringTable::bucket_size()), "StringTable size");
2154 
2155   status = status && verify_interval(SymbolTableSize, minimumSymbolTableSize,
2156     (max_uintx / SymbolTable::bucket_size()), "SymbolTable size");
2157 
2158   {
2159     // Using "else if" below to avoid printing two error messages if min > max.
2160     // This will also prevent us from reporting both min>100 and max>100 at the
2161     // same time, but that is less annoying than printing two identical errors IMHO.
2162     FormatBuffer<80> err_msg("%s","");
2163     if (!verify_MinHeapFreeRatio(err_msg, MinHeapFreeRatio)) {
2164       jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
2165       status = false;
2166     } else if (!verify_MaxHeapFreeRatio(err_msg, MaxHeapFreeRatio)) {
2167       jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
2168       status = false;
2169     }
2170   }
2171 
2172   // Min/MaxMetaspaceFreeRatio
2173   status = status && verify_percentage(MinMetaspaceFreeRatio, "MinMetaspaceFreeRatio");
2174   status = status && verify_percentage(MaxMetaspaceFreeRatio, "MaxMetaspaceFreeRatio");
2175 
2176   if (MinMetaspaceFreeRatio > MaxMetaspaceFreeRatio) {
2177     jio_fprintf(defaultStream::error_stream(),
2178                 "MinMetaspaceFreeRatio (%s" UINTX_FORMAT ") must be less than or "
2179                 "equal to MaxMetaspaceFreeRatio (%s" UINTX_FORMAT ")\n",
2180                 FLAG_IS_DEFAULT(MinMetaspaceFreeRatio) ? "Default: " : "",
2181                 MinMetaspaceFreeRatio,
2182                 FLAG_IS_DEFAULT(MaxMetaspaceFreeRatio) ? "Default: " : "",
2183                 MaxMetaspaceFreeRatio);
2184     status = false;
2185   }
2186 
2187   // Trying to keep 100% free is not practical
2188   MinMetaspaceFreeRatio = MIN2(MinMetaspaceFreeRatio, (uintx) 99);
2189 
2190   if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) {
2191     MarkSweepAlwaysCompactCount = 1;  // Move objects every gc.
2192   }
2193 
2194   if (UseParallelOldGC && ParallelOldGCSplitALot) {
2195     // Settings to encourage splitting.
2196     if (!FLAG_IS_CMDLINE(NewRatio)) {
2197       FLAG_SET_CMDLINE(uintx, NewRatio, 2);


2198     }
2199     if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) {
2200       FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);


2201     }
2202   }
2203 
2204   if (!(UseParallelGC || UseParallelOldGC) && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) {
2205     FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false);
2206   }
2207 
2208   status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit");
2209   status = status && verify_percentage(GCTimeLimit, "GCTimeLimit");
2210   if (GCTimeLimit == 100) {
2211     // Turn off gc-overhead-limit-exceeded checks
2212     FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
2213   }
2214 
2215   status = status && check_gc_consistency();
2216   status = status && check_stack_pages();
2217 
2218   status = status && verify_percentage(CMSIncrementalSafetyFactor,
2219                                     "CMSIncrementalSafetyFactor");
2220 
2221   // CMS space iteration, which FLSVerifyAllHeapreferences entails,
2222   // insists that we hold the requisite locks so that the iteration is
2223   // MT-safe. For the verification at start-up and shut-down, we don't
2224   // yet have a good way of acquiring and releasing these locks,
2225   // which are not visible at the CollectedHeap level. We want to
2226   // be able to acquire these locks and then do the iteration rather
2227   // than just disable the lock verification. This will be fixed under
2228   // bug 4788986.
2229   if (UseConcMarkSweepGC && FLSVerifyAllHeapReferences) {
2230     if (VerifyDuringStartup) {
2231       warning("Heap verification at start-up disabled "
2232               "(due to current incompatibility with FLSVerifyAllHeapReferences)");
2233       VerifyDuringStartup = false; // Disable verification at start-up
2234     }
2235 
2236     if (VerifyBeforeExit) {
2237       warning("Heap verification at shutdown disabled "
2238               "(due to current incompatibility with FLSVerifyAllHeapReferences)");
2239       VerifyBeforeExit = false; // Disable verification at shutdown
2240     }
2241   }
2242 
2243   // Note: only executed in non-PRODUCT mode
2244   if (!UseAsyncConcMarkSweepGC &&
2245       (ExplicitGCInvokesConcurrent ||
2246        ExplicitGCInvokesConcurrentAndUnloadsClasses)) {
2247     jio_fprintf(defaultStream::error_stream(),
2248                 "error: +ExplicitGCInvokesConcurrent[AndUnloadsClasses] conflicts"
2249                 " with -UseAsyncConcMarkSweepGC");
2250     status = false;
2251   }
2252 
2253   status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk");
2254 
2255 #if INCLUDE_ALL_GCS
2256   if (UseG1GC) {
2257     status = status && verify_percentage(G1NewSizePercent, "G1NewSizePercent");
2258     status = status && verify_percentage(G1MaxNewSizePercent, "G1MaxNewSizePercent");
2259     status = status && verify_interval(G1NewSizePercent, 0, G1MaxNewSizePercent, "G1NewSizePercent");
2260 
2261     status = status && verify_percentage(G1ConfidencePercent, "G1ConfidencePercent");
2262     status = status && verify_percentage(InitiatingHeapOccupancyPercent,
2263                                          "InitiatingHeapOccupancyPercent");
2264     status = status && verify_min_value(G1RefProcDrainInterval, 1,
2265                                         "G1RefProcDrainInterval");
2266     status = status && verify_min_value((intx)G1ConcMarkStepDurationMillis, 1,
2267                                         "G1ConcMarkStepDurationMillis");
2268     status = status && verify_interval(G1ConcRSHotCardLimit, 0, max_jubyte,
2269                                        "G1ConcRSHotCardLimit");
2270     status = status && verify_interval(G1ConcRSLogCacheSize, 0, 27,
2271                                        "G1ConcRSLogCacheSize");
2272     status = status && verify_interval(StringDeduplicationAgeThreshold, 1, markOopDesc::max_age,
2273                                        "StringDeduplicationAgeThreshold");
2274   }
2275   if (UseConcMarkSweepGC) {
2276     status = status && verify_min_value(CMSOldPLABNumRefills, 1, "CMSOldPLABNumRefills");
2277     status = status && verify_min_value(CMSOldPLABToleranceFactor, 1, "CMSOldPLABToleranceFactor");
2278     status = status && verify_min_value(CMSOldPLABMax, 1, "CMSOldPLABMax");
2279     status = status && verify_interval(CMSOldPLABMin, 1, CMSOldPLABMax, "CMSOldPLABMin");
2280 
2281     status = status && verify_min_value(CMSYoungGenPerWorker, 1, "CMSYoungGenPerWorker");
2282 
2283     status = status && verify_min_value(CMSSamplingGrain, 1, "CMSSamplingGrain");
2284     status = status && verify_interval(CMS_SweepWeight, 0, 100, "CMS_SweepWeight");
2285     status = status && verify_interval(CMS_FLSWeight, 0, 100, "CMS_FLSWeight");
2286 
2287     status = status && verify_interval(FLSCoalescePolicy, 0, 4, "FLSCoalescePolicy");
2288 
2289     status = status && verify_min_value(CMSRescanMultiple, 1, "CMSRescanMultiple");
2290     status = status && verify_min_value(CMSConcMarkMultiple, 1, "CMSConcMarkMultiple");
2291 
2292     status = status && verify_interval(CMSPrecleanIter, 0, 9, "CMSPrecleanIter");
2293     status = status && verify_min_value(CMSPrecleanDenominator, 1, "CMSPrecleanDenominator");
2294     status = status && verify_interval(CMSPrecleanNumerator, 0, CMSPrecleanDenominator - 1, "CMSPrecleanNumerator");
2295 
2296     status = status && verify_percentage(CMSBootstrapOccupancy, "CMSBootstrapOccupancy");
2297 
2298     status = status && verify_min_value(CMSPrecleanThreshold, 100, "CMSPrecleanThreshold");
2299 
2300     status = status && verify_percentage(CMSScheduleRemarkEdenPenetration, "CMSScheduleRemarkEdenPenetration");
2301     status = status && verify_min_value(CMSScheduleRemarkSamplingRatio, 1, "CMSScheduleRemarkSamplingRatio");
2302     status = status && verify_min_value(CMSBitMapYieldQuantum, 1, "CMSBitMapYieldQuantum");
2303     status = status && verify_percentage(CMSTriggerRatio, "CMSTriggerRatio");
2304     status = status && verify_percentage(CMSIsTooFullPercentage, "CMSIsTooFullPercentage");
2305   }
2306 
2307   if (UseParallelGC || UseParallelOldGC) {
2308     status = status && verify_interval(ParallelOldDeadWoodLimiterMean, 0, 100, "ParallelOldDeadWoodLimiterMean");
2309     status = status && verify_interval(ParallelOldDeadWoodLimiterStdDev, 0, 100, "ParallelOldDeadWoodLimiterStdDev");
2310 
2311     status = status && verify_percentage(YoungGenerationSizeIncrement, "YoungGenerationSizeIncrement");
2312     status = status && verify_percentage(TenuredGenerationSizeIncrement, "TenuredGenerationSizeIncrement");
2313 
2314     status = status && verify_min_value(YoungGenerationSizeSupplementDecay, 1, "YoungGenerationSizeSupplementDecay");
2315     status = status && verify_min_value(TenuredGenerationSizeSupplementDecay, 1, "TenuredGenerationSizeSupplementDecay");
2316 
2317     status = status && verify_min_value(ParGCCardsPerStrideChunk, 1, "ParGCCardsPerStrideChunk");
2318 
2319     status = status && verify_min_value(ParallelOldGCSplitInterval, 0, "ParallelOldGCSplitInterval");
2320   }
2321 #endif // INCLUDE_ALL_GCS
2322 
2323   status = status && verify_interval(RefDiscoveryPolicy,
2324                                      ReferenceProcessor::DiscoveryPolicyMin,
2325                                      ReferenceProcessor::DiscoveryPolicyMax,
2326                                      "RefDiscoveryPolicy");
2327 
2328   // Limit the lower bound of this flag to 1 as it is used in a division
2329   // expression.
2330   status = status && verify_interval(TLABWasteTargetPercent,
2331                                      1, 100, "TLABWasteTargetPercent");
2332 
2333   status = status && verify_object_alignment();
2334 
2335   status = status && verify_interval(CompressedClassSpaceSize, 1*M, 3*G,
2336                                       "CompressedClassSpaceSize");
2337 
2338   status = status && verify_interval(MarkStackSizeMax,
2339                                   1, (max_jint - 1), "MarkStackSizeMax");
2340   status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight");
2341 
2342   status = status && verify_min_value(LogEventsBufferEntries, 1, "LogEventsBufferEntries");
2343 
2344   status = status && verify_min_value(HeapSizePerGCThread, (size_t) os::vm_page_size(), "HeapSizePerGCThread");
2345 
2346   status = status && verify_min_value(GCTaskTimeStampEntries, 1, "GCTaskTimeStampEntries");
2347 
2348   status = status && verify_percentage(ParallelGCBufferWastePct, "ParallelGCBufferWastePct");
2349   status = status && verify_interval(TargetPLABWastePct, 1, 100, "TargetPLABWastePct");
2350 
2351   status = status && verify_min_value(ParGCStridesPerThread, 1, "ParGCStridesPerThread");
2352 
2353   status = status && verify_min_value(MinRAMFraction, 1, "MinRAMFraction");
2354   status = status && verify_min_value(InitialRAMFraction, 1, "InitialRAMFraction");
2355   status = status && verify_min_value(MaxRAMFraction, 1, "MaxRAMFraction");
2356   status = status && verify_min_value(DefaultMaxRAMFraction, 1, "DefaultMaxRAMFraction");
2357 
2358   status = status && verify_interval(AdaptiveTimeWeight, 0, 100, "AdaptiveTimeWeight");
2359   status = status && verify_min_value(AdaptiveSizeDecrementScaleFactor, 1, "AdaptiveSizeDecrementScaleFactor");
2360 
2361   status = status && verify_interval(TLABAllocationWeight, 0, 100, "TLABAllocationWeight");
2362   status = status && verify_min_value(MinTLABSize, 1, "MinTLABSize");
2363   status = status && verify_min_value(TLABRefillWasteFraction, 1, "TLABRefillWasteFraction");
2364 
2365   status = status && verify_percentage(YoungGenerationSizeSupplement, "YoungGenerationSizeSupplement");
2366   status = status && verify_percentage(TenuredGenerationSizeSupplement, "TenuredGenerationSizeSupplement");
2367 
2368   status = status && verify_interval(MaxTenuringThreshold, 0, markOopDesc::max_age + 1, "MaxTenuringThreshold");
2369   status = status && verify_interval(InitialTenuringThreshold, 0, MaxTenuringThreshold, "InitialTenuringThreshold");
2370   status = status && verify_percentage(TargetSurvivorRatio, "TargetSurvivorRatio");
2371   status = status && verify_percentage(MarkSweepDeadRatio, "MarkSweepDeadRatio");
2372 
2373   status = status && verify_min_value(MarkSweepAlwaysCompactCount, 1, "MarkSweepAlwaysCompactCount");
2374 #ifdef COMPILER1
2375   status = status && verify_min_value(ValueMapInitialSize, 1, "ValueMapInitialSize");
2376 #endif
2377   status = status && verify_min_value(HeapSearchSteps, 1, "HeapSearchSteps");
2378 
2379   if (PrintNMTStatistics) {
2380 #if INCLUDE_NMT
2381     if (MemTracker::tracking_level() == NMT_off) {
2382 #endif // INCLUDE_NMT
2383       warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled");
2384       PrintNMTStatistics = false;
2385 #if INCLUDE_NMT
2386     }
2387 #endif
2388   }
2389 
2390   // Need to limit the extent of the padding to reasonable size.
2391   // 8K is well beyond the reasonable HW cache line size, even with the
2392   // aggressive prefetching, while still leaving the room for segregating
2393   // among the distinct pages.
2394   if (ContendedPaddingWidth < 0 || ContendedPaddingWidth > 8192) {
2395     jio_fprintf(defaultStream::error_stream(),
2396                 "ContendedPaddingWidth=" INTX_FORMAT " must be in between %d and %d\n",
2397                 ContendedPaddingWidth, 0, 8192);
2398     status = false;
2399   }
2400 
2401   // Need to enforce the padding not to break the existing field alignments.
2402   // It is sufficient to check against the largest type size.
2403   if ((ContendedPaddingWidth % BytesPerLong) != 0) {
2404     jio_fprintf(defaultStream::error_stream(),
2405                 "ContendedPaddingWidth=" INTX_FORMAT " must be a multiple of %d\n",
2406                 ContendedPaddingWidth, BytesPerLong);
2407     status = false;
2408   }
2409 
2410   // Check lower bounds of the code cache
2411   // Template Interpreter code is approximately 3X larger in debug builds.
2412   uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
2413   if (InitialCodeCacheSize < (uintx)os::vm_page_size()) {
2414     jio_fprintf(defaultStream::error_stream(),
2415                 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2416                 os::vm_page_size()/K);
2417     status = false;
2418   } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2419     jio_fprintf(defaultStream::error_stream(),
2420                 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2421                 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2422     status = false;
2423   } else if (ReservedCodeCacheSize < min_code_cache_size) {
2424     jio_fprintf(defaultStream::error_stream(),
2425                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2426                 min_code_cache_size/K);
2427     status = false;
2428   } else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) {
2429     // Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported.
2430     jio_fprintf(defaultStream::error_stream(),
2431                 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2432                 CODE_CACHE_SIZE_LIMIT/M);
2433     status = false;
2434   } else if (NonNMethodCodeHeapSize < min_code_cache_size){
2435     jio_fprintf(defaultStream::error_stream(),
2436                 "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,
2437                 min_code_cache_size/K);
2438     status = false;
2439   } else if ((!FLAG_IS_DEFAULT(NonNMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
2440              && (NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
2441     jio_fprintf(defaultStream::error_stream(),
2442                 "Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
2443                 NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
2444                 (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
2445     status = false;
2446   }
2447 
2448   status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
2449   status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
2450   status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
2451   status &= verify_interval(StartAggressiveSweepingAt, 0, 100, "StartAggressiveSweepingAt");
2452 
2453 
2454   int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
2455   // The default CICompilerCount's value is CI_COMPILER_COUNT.
2456   assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
2457   // Check the minimum number of compiler threads
2458   status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
2459 
2460   if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
2461     warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
2462   }
2463 
2464   return status;
2465 }
2466 
2467 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
2468   const char* option_type) {
2469   if (ignore) return false;
2470 
2471   const char* spacer = " ";
2472   if (option_type == NULL) {
2473     option_type = ++spacer; // Set both to the empty string.
2474   }
2475 
2476   if (os::obsolete_option(option)) {
2477     jio_fprintf(defaultStream::error_stream(),
2478                 "Obsolete %s%soption: %s\n", option_type, spacer,


2631   for (int index = 0; index < args->nOptions; index++) {
2632     bool is_absolute_path = false;  // for -agentpath vs -agentlib
2633 
2634     const JavaVMOption* option = args->options + index;
2635 
2636     if (!match_option(option, "-Djava.class.path", &tail) &&
2637         !match_option(option, "-Dsun.java.command", &tail) &&
2638         !match_option(option, "-Dsun.java.launcher", &tail)) {
2639 
2640         // add all jvm options to the jvm_args string. This string
2641         // is used later to set the java.vm.args PerfData string constant.
2642         // the -Djava.class.path and the -Dsun.java.command options are
2643         // omitted from jvm_args string as each have their own PerfData
2644         // string constant object.
2645         build_jvm_args(option->optionString);
2646     }
2647 
2648     // -verbose:[class/gc/jni]
2649     if (match_option(option, "-verbose", &tail)) {
2650       if (!strcmp(tail, ":class") || !strcmp(tail, "")) {
2651         FLAG_SET_CMDLINE(bool, TraceClassLoading, true);
2652         FLAG_SET_CMDLINE(bool, TraceClassUnloading, true);




2653       } else if (!strcmp(tail, ":gc")) {
2654         FLAG_SET_CMDLINE(bool, PrintGC, true);


2655       } else if (!strcmp(tail, ":jni")) {
2656         FLAG_SET_CMDLINE(bool, PrintJNIResolving, true);


2657       }
2658     // -da / -ea / -disableassertions / -enableassertions
2659     // These accept an optional class/package name separated by a colon, e.g.,
2660     // -da:java.lang.Thread.
2661     } else if (match_option(option, user_assertion_options, &tail, true)) {
2662       bool enable = option->optionString[1] == 'e';     // char after '-' is 'e'
2663       if (*tail == '\0') {
2664         JavaAssertions::setUserClassDefault(enable);
2665       } else {
2666         assert(*tail == ':', "bogus match by match_option()");
2667         JavaAssertions::addOption(tail + 1, enable);
2668       }
2669     // -dsa / -esa / -disablesystemassertions / -enablesystemassertions
2670     } else if (match_option(option, system_assertion_options, &tail, false)) {
2671       bool enable = option->optionString[1] == 'e';     // char after '-' is 'e'
2672       JavaAssertions::setSystemClassDefault(enable);
2673     // -bootclasspath:
2674     } else if (match_option(option, "-Xbootclasspath:", &tail)) {
2675       scp_p->reset_path(tail);
2676       *scp_assembly_required_p = true;


2723             "Profiling and debugging agents are not supported in this VM\n");
2724           return JNI_ERR;
2725         }
2726 #endif // !INCLUDE_JVMTI
2727         add_init_agent(name, options, is_absolute_path);
2728       }
2729     // -javaagent
2730     } else if (match_option(option, "-javaagent:", &tail)) {
2731 #if !INCLUDE_JVMTI
2732       jio_fprintf(defaultStream::error_stream(),
2733         "Instrumentation agents are not supported in this VM\n");
2734       return JNI_ERR;
2735 #else
2736       if(tail != NULL) {
2737         char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
2738         add_init_agent("instrument", options, false);
2739       }
2740 #endif // !INCLUDE_JVMTI
2741     // -Xnoclassgc
2742     } else if (match_option(option, "-Xnoclassgc")) {
2743       FLAG_SET_CMDLINE(bool, ClassUnloading, false);


2744     // -Xconcgc
2745     } else if (match_option(option, "-Xconcgc")) {
2746       FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);


2747     // -Xnoconcgc
2748     } else if (match_option(option, "-Xnoconcgc")) {
2749       FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false);


2750     // -Xbatch
2751     } else if (match_option(option, "-Xbatch")) {
2752       FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);


2753     // -Xmn for compatibility with other JVM vendors
2754     } else if (match_option(option, "-Xmn", &tail)) {
2755       julong long_initial_young_size = 0;
2756       ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2757       if (errcode != arg_in_range) {
2758         jio_fprintf(defaultStream::error_stream(),
2759                     "Invalid initial young generation size: %s\n", option->optionString);
2760         describe_range_error(errcode);
2761         return JNI_EINVAL;
2762       }
2763       FLAG_SET_CMDLINE(size_t, MaxNewSize, (size_t)long_initial_young_size);
2764       FLAG_SET_CMDLINE(size_t, NewSize, (size_t)long_initial_young_size);




2765     // -Xms
2766     } else if (match_option(option, "-Xms", &tail)) {
2767       julong long_initial_heap_size = 0;
2768       // an initial heap size of 0 means automatically determine
2769       ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0);
2770       if (errcode != arg_in_range) {
2771         jio_fprintf(defaultStream::error_stream(),
2772                     "Invalid initial heap size: %s\n", option->optionString);
2773         describe_range_error(errcode);
2774         return JNI_EINVAL;
2775       }
2776       set_min_heap_size((size_t)long_initial_heap_size);
2777       // Currently the minimum size and the initial heap sizes are the same.
2778       // Can be overridden with -XX:InitialHeapSize.
2779       FLAG_SET_CMDLINE(size_t, InitialHeapSize, (size_t)long_initial_heap_size);


2780     // -Xmx
2781     } else if (match_option(option, "-Xmx", &tail) || match_option(option, "-XX:MaxHeapSize=", &tail)) {
2782       julong long_max_heap_size = 0;
2783       ArgsRange errcode = parse_memory_size(tail, &long_max_heap_size, 1);
2784       if (errcode != arg_in_range) {
2785         jio_fprintf(defaultStream::error_stream(),
2786                     "Invalid maximum heap size: %s\n", option->optionString);
2787         describe_range_error(errcode);
2788         return JNI_EINVAL;
2789       }
2790       FLAG_SET_CMDLINE(size_t, MaxHeapSize, (size_t)long_max_heap_size);


2791     // Xmaxf
2792     } else if (match_option(option, "-Xmaxf", &tail)) {
2793       char* err;
2794       int maxf = (int)(strtod(tail, &err) * 100);
2795       if (*err != '\0' || *tail == '\0' || maxf < 0 || maxf > 100) {
2796         jio_fprintf(defaultStream::error_stream(),
2797                     "Bad max heap free percentage size: %s\n",
2798                     option->optionString);
2799         return JNI_EINVAL;
2800       } else {
2801         FLAG_SET_CMDLINE(uintx, MaxHeapFreeRatio, maxf);


2802       }
2803     // Xminf
2804     } else if (match_option(option, "-Xminf", &tail)) {
2805       char* err;
2806       int minf = (int)(strtod(tail, &err) * 100);
2807       if (*err != '\0' || *tail == '\0' || minf < 0 || minf > 100) {
2808         jio_fprintf(defaultStream::error_stream(),
2809                     "Bad min heap free percentage size: %s\n",
2810                     option->optionString);
2811         return JNI_EINVAL;
2812       } else {
2813         FLAG_SET_CMDLINE(uintx, MinHeapFreeRatio, minf);


2814       }
2815     // -Xss
2816     } else if (match_option(option, "-Xss", &tail)) {
2817       julong long_ThreadStackSize = 0;
2818       ArgsRange errcode = parse_memory_size(tail, &long_ThreadStackSize, 1000);
2819       if (errcode != arg_in_range) {
2820         jio_fprintf(defaultStream::error_stream(),
2821                     "Invalid thread stack size: %s\n", option->optionString);
2822         describe_range_error(errcode);
2823         return JNI_EINVAL;
2824       }
2825       // Internally track ThreadStackSize in units of 1024 bytes.
2826       FLAG_SET_CMDLINE(intx, ThreadStackSize,
2827                               round_to((int)long_ThreadStackSize, K) / K);


2828     // -Xoss
2829     } else if (match_option(option, "-Xoss", &tail)) {
2830           // HotSpot does not have separate native and Java stacks, ignore silently for compatibility
2831     } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
2832       julong long_CodeCacheExpansionSize = 0;
2833       ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2834       if (errcode != arg_in_range) {
2835         jio_fprintf(defaultStream::error_stream(),
2836                    "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2837                    os::vm_page_size()/K);
2838         return JNI_EINVAL;
2839       }
2840       FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);


2841     } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2842                match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2843       julong long_ReservedCodeCacheSize = 0;
2844 
2845       ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2846       if (errcode != arg_in_range) {
2847         jio_fprintf(defaultStream::error_stream(),
2848                     "Invalid maximum code cache size: %s.\n", option->optionString);
2849         return JNI_EINVAL;
2850       }
2851       FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);


2852       // -XX:NonNMethodCodeHeapSize=
2853     } else if (match_option(option, "-XX:NonNMethodCodeHeapSize=", &tail)) {
2854       julong long_NonNMethodCodeHeapSize = 0;
2855 
2856       ArgsRange errcode = parse_memory_size(tail, &long_NonNMethodCodeHeapSize, 1);
2857       if (errcode != arg_in_range) {
2858         jio_fprintf(defaultStream::error_stream(),
2859                     "Invalid maximum non-nmethod code heap size: %s.\n", option->optionString);
2860         return JNI_EINVAL;
2861       }
2862       FLAG_SET_CMDLINE(uintx, NonNMethodCodeHeapSize, (uintx)long_NonNMethodCodeHeapSize);


2863       // -XX:ProfiledCodeHeapSize=
2864     } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
2865       julong long_ProfiledCodeHeapSize = 0;
2866 
2867       ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1);
2868       if (errcode != arg_in_range) {
2869         jio_fprintf(defaultStream::error_stream(),
2870                     "Invalid maximum profiled code heap size: %s.\n", option->optionString);
2871         return JNI_EINVAL;
2872       }
2873       FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize);


2874       // -XX:NonProfiledCodeHeapSizee=
2875     } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) {
2876       julong long_NonProfiledCodeHeapSize = 0;
2877 
2878       ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
2879       if (errcode != arg_in_range) {
2880         jio_fprintf(defaultStream::error_stream(),
2881                     "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
2882         return JNI_EINVAL;
2883       }
2884       FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize);
2885       //-XX:IncreaseFirstTierCompileThresholdAt=
2886     } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2887         uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2888         if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2889           jio_fprintf(defaultStream::error_stream(),
2890                       "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2891                       option->optionString);
2892           return JNI_EINVAL;
2893         }
2894         FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2895     // -green
2896     } else if (match_option(option, "-green")) {
2897       jio_fprintf(defaultStream::error_stream(),
2898                   "Green threads support not available\n");
2899           return JNI_EINVAL;
2900     // -native
2901     } else if (match_option(option, "-native")) {
2902           // HotSpot always uses native threads, ignore silently for compatibility
2903     // -Xsqnopause
2904     } else if (match_option(option, "-Xsqnopause")) {
2905           // EVM option, ignore silently for compatibility
2906     // -Xrs
2907     } else if (match_option(option, "-Xrs")) {
2908           // Classic/EVM option, new functionality
2909       FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true);


2910     } else if (match_option(option, "-Xusealtsigs")) {
2911           // change default internal VM signals used - lower case for back compat
2912       FLAG_SET_CMDLINE(bool, UseAltSigs, true);


2913     // -Xoptimize
2914     } else if (match_option(option, "-Xoptimize")) {
2915           // EVM option, ignore silently for compatibility
2916     // -Xprof
2917     } else if (match_option(option, "-Xprof")) {
2918 #if INCLUDE_FPROF
2919       _has_profile = true;
2920 #else // INCLUDE_FPROF
2921       jio_fprintf(defaultStream::error_stream(),
2922         "Flat profiling is not supported in this VM.\n");
2923       return JNI_ERR;
2924 #endif // INCLUDE_FPROF
2925     // -Xconcurrentio
2926     } else if (match_option(option, "-Xconcurrentio")) {
2927       FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true);
2928       FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
2929       FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1);
2930       FLAG_SET_CMDLINE(bool, UseTLAB, false);
2931       FLAG_SET_CMDLINE(size_t, NewSizeThreadIncrease, 16 * K);  // 20Kb per thread added to new generation










2932 
2933       // -Xinternalversion
2934     } else if (match_option(option, "-Xinternalversion")) {
2935       jio_fprintf(defaultStream::output_stream(), "%s\n",
2936                   VM_Version::internal_vm_info_string());
2937       vm_exit(0);
2938 #ifndef PRODUCT
2939     // -Xprintflags
2940     } else if (match_option(option, "-Xprintflags")) {
2941       CommandLineFlags::printFlags(tty, false);
2942       vm_exit(0);
2943 #endif
2944     // -D
2945     } else if (match_option(option, "-D", &tail)) {
2946       const char* value;
2947       if (match_option(option, "-Djava.endorsed.dirs=", &value) &&
2948             *value!= '\0' && strcmp(value, "\"\"") != 0) {
2949         // abort if -Djava.endorsed.dirs is set
2950         jio_fprintf(defaultStream::output_stream(),
2951           "-Djava.endorsed.dirs=%s is not supported. Endorsed standards and standalone APIs\n"
2952           "in modular form will be supported via the concept of upgradeable modules.\n", value);
2953         return JNI_EINVAL;
2954       }
2955       if (match_option(option, "-Djava.ext.dirs=", &value) &&
2956             *value != '\0' && strcmp(value, "\"\"") != 0) {
2957         // abort if -Djava.ext.dirs is set
2958         jio_fprintf(defaultStream::output_stream(),
2959           "-Djava.ext.dirs=%s is not supported.  Use -classpath instead.\n", value);
2960         return JNI_EINVAL;
2961       }
2962 
2963       if (!add_property(tail)) {
2964         return JNI_ENOMEM;
2965       }
2966       // Out of the box management support
2967       if (match_option(option, "-Dcom.sun.management", &tail)) {
2968 #if INCLUDE_MANAGEMENT
2969         FLAG_SET_CMDLINE(bool, ManagementServer, true);


2970 #else
2971         jio_fprintf(defaultStream::output_stream(),
2972           "-Dcom.sun.management is not supported in this VM.\n");
2973         return JNI_ERR;
2974 #endif
2975       }
2976     // -Xint
2977     } else if (match_option(option, "-Xint")) {
2978           set_mode_flags(_int);
2979     // -Xmixed
2980     } else if (match_option(option, "-Xmixed")) {
2981           set_mode_flags(_mixed);
2982     // -Xcomp
2983     } else if (match_option(option, "-Xcomp")) {
2984       // for testing the compiler; turn off all flags that inhibit compilation
2985           set_mode_flags(_comp);
2986     // -Xshare:dump
2987     } else if (match_option(option, "-Xshare:dump")) {
2988       FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);


2989       set_mode_flags(_int);     // Prevent compilation, which creates objects
2990     // -Xshare:on
2991     } else if (match_option(option, "-Xshare:on")) {
2992       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
2993       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);




2994     // -Xshare:auto
2995     } else if (match_option(option, "-Xshare:auto")) {
2996       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
2997       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);




2998     // -Xshare:off
2999     } else if (match_option(option, "-Xshare:off")) {
3000       FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
3001       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);




3002     // -Xverify
3003     } else if (match_option(option, "-Xverify", &tail)) {
3004       if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) {
3005         FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true);
3006         FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);




3007       } else if (strcmp(tail, ":remote") == 0) {
3008         FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false);
3009         FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);




3010       } else if (strcmp(tail, ":none") == 0) {
3011         FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false);
3012         FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false);




3013       } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
3014         return JNI_EINVAL;
3015       }
3016     // -Xdebug
3017     } else if (match_option(option, "-Xdebug")) {
3018       // note this flag has been used, then ignore
3019       set_xdebug_mode(true);
3020     // -Xnoagent
3021     } else if (match_option(option, "-Xnoagent")) {
3022       // For compatibility with classic. HotSpot refuses to load the old style agent.dll.
3023     } else if (match_option(option, "-Xboundthreads")) {
3024       // Ignore silently for compatibility
3025     } else if (match_option(option, "-Xloggc:", &tail)) {
3026       // Redirect GC output to the file. -Xloggc:<filename>
3027       // ostream_init_log(), when called will use this filename
3028       // to initialize a fileStream.
3029       _gc_log_filename = os::strdup_check_oom(tail);
3030      if (!is_filename_valid(_gc_log_filename)) {
3031        jio_fprintf(defaultStream::output_stream(),
3032                   "Invalid file name for use with -Xloggc: Filename can only contain the "
3033                   "characters [A-Z][a-z][0-9]-_.%%[p|t] but it has been %s\n"
3034                   "Note %%p or %%t can only be used once\n", _gc_log_filename);
3035         return JNI_EINVAL;
3036       }
3037       FLAG_SET_CMDLINE(bool, PrintGC, true);
3038       FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true);
3039 



3040     // JNI hooks
3041     } else if (match_option(option, "-Xcheck", &tail)) {
3042       if (!strcmp(tail, ":jni")) {
3043 #if !INCLUDE_JNI_CHECK
3044         warning("JNI CHECKING is not supported in this VM");
3045 #else
3046         CheckJNICalls = true;
3047 #endif // INCLUDE_JNI_CHECK
3048       } else if (is_bad_option(option, args->ignoreUnrecognized,
3049                                      "check")) {
3050         return JNI_EINVAL;
3051       }
3052     } else if (match_option(option, "vfprintf")) {
3053       _vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo);
3054     } else if (match_option(option, "exit")) {
3055       _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo);
3056     } else if (match_option(option, "abort")) {
3057       _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo);
3058     // -XX:+AggressiveHeap
3059     } else if (match_option(option, "-XX:+AggressiveHeap")) {


3071       julong initHeapSize;
3072       julong total_memory = os::physical_memory();
3073 
3074       if (total_memory < (julong)256*M) {
3075         jio_fprintf(defaultStream::error_stream(),
3076                     "You need at least 256mb of memory to use -XX:+AggressiveHeap\n");
3077         vm_exit(1);
3078       }
3079 
3080       // The heap size is half of available memory, or (at most)
3081       // all of possible memory less 160mb (leaving room for the OS
3082       // when using ISM).  This is the maximum; because adaptive sizing
3083       // is turned on below, the actual space used may be smaller.
3084 
3085       initHeapSize = MIN2(total_memory / (julong)2,
3086                           total_memory - (julong)160*M);
3087 
3088       initHeapSize = limit_by_allocatable_memory(initHeapSize);
3089 
3090       if (FLAG_IS_DEFAULT(MaxHeapSize)) {
3091          FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize);
3092          FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize);




3093          // Currently the minimum size and the initial heap sizes are the same.
3094          set_min_heap_size(initHeapSize);
3095       }
3096       if (FLAG_IS_DEFAULT(NewSize)) {
3097          // Make the young generation 3/8ths of the total heap.
3098          FLAG_SET_CMDLINE(size_t, NewSize,
3099                                 ((julong)MaxHeapSize / (julong)8) * (julong)3);
3100          FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize);




3101       }
3102 
3103 #if !defined(_ALLBSD_SOURCE) && !defined(AIX)  // UseLargePages is not yet supported on BSD and AIX.
3104       FLAG_SET_DEFAULT(UseLargePages, true);
3105 #endif
3106 
3107       // Increase some data structure sizes for efficiency
3108       FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize);
3109       FLAG_SET_CMDLINE(bool, ResizeTLAB, false);
3110       FLAG_SET_CMDLINE(size_t, TLABSize, 256*K);






3111 
3112       // See the OldPLABSize comment below, but replace 'after promotion'
3113       // with 'after copying'.  YoungPLABSize is the size of the survivor
3114       // space per-gc-thread buffers.  The default is 4kw.
3115       FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256*K);      // Note: this is in words


3116 
3117       // OldPLABSize is the size of the buffers in the old gen that
3118       // UseParallelGC uses to promote live data that doesn't fit in the
3119       // survivor spaces.  At any given time, there's one for each gc thread.
3120       // The default size is 1kw. These buffers are rarely used, since the
3121       // survivor spaces are usually big enough.  For specjbb, however, there
3122       // are occasions when there's lots of live data in the young gen
3123       // and we end up promoting some of it.  We don't have a definite
3124       // explanation for why bumping OldPLABSize helps, but the theory
3125       // is that a bigger PLAB results in retaining something like the
3126       // original allocation order after promotion, which improves mutator
3127       // locality.  A minor effect may be that larger PLABs reduce the
3128       // number of PLAB allocation events during gc.  The value of 8kw
3129       // was arrived at by experimenting with specjbb.
3130       FLAG_SET_CMDLINE(size_t, OldPLABSize, 8*K);  // Note: this is in words


3131 
3132       // Enable parallel GC and adaptive generation sizing
3133       FLAG_SET_CMDLINE(bool, UseParallelGC, true);


3134       FLAG_SET_DEFAULT(ParallelGCThreads,
3135                        Abstract_VM_Version::parallel_worker_threads());
3136 
3137       // Encourage steady state memory management
3138       FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100);


3139 
3140       // This appears to improve mutator locality
3141       FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);


3142 
3143       // Get around early Solaris scheduling bug
3144       // (affinity vs other jobs on system)
3145       // but disallow DR and offlining (5008695).
3146       FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true);


3147 
3148     // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure;
3149     // and the last option wins.
3150     } else if (match_option(option, "-XX:+NeverTenure")) {
3151       FLAG_SET_CMDLINE(bool, NeverTenure, true);
3152       FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
3153       FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1);






3154     } else if (match_option(option, "-XX:+AlwaysTenure")) {
3155       FLAG_SET_CMDLINE(bool, NeverTenure, false);
3156       FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
3157       FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);






3158     } else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) {
3159       uintx max_tenuring_thresh = 0;
3160       if(!parse_uintx(tail, &max_tenuring_thresh, 0)) {
3161         jio_fprintf(defaultStream::error_stream(),
3162           "Improperly specified VM option 'MaxTenuringThreshold=%s'\n", tail);




3163         return JNI_EINVAL;
3164       }
3165       FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, max_tenuring_thresh);
3166 
3167       if (MaxTenuringThreshold == 0) {
3168         FLAG_SET_CMDLINE(bool, NeverTenure, false);
3169         FLAG_SET_CMDLINE(bool, AlwaysTenure, true);




3170       } else {
3171         FLAG_SET_CMDLINE(bool, NeverTenure, false);
3172         FLAG_SET_CMDLINE(bool, AlwaysTenure, false);




3173       }
3174     } else if (match_option(option, "-XX:+DisplayVMOutputToStderr")) {
3175       FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false);
3176       FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true);




3177     } else if (match_option(option, "-XX:+DisplayVMOutputToStdout")) {
3178       FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false);
3179       FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true);




3180     } else if (match_option(option, "-XX:+ExtendedDTraceProbes")) {
3181 #if defined(DTRACE_ENABLED)
3182       FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true);
3183       FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true);
3184       FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true);
3185       FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true);








3186 #else // defined(DTRACE_ENABLED)
3187       jio_fprintf(defaultStream::error_stream(),
3188                   "ExtendedDTraceProbes flag is not applicable for this configuration\n");
3189       return JNI_EINVAL;
3190 #endif // defined(DTRACE_ENABLED)
3191 #ifdef ASSERT
3192     } else if (match_option(option, "-XX:+FullGCALot")) {
3193       FLAG_SET_CMDLINE(bool, FullGCALot, true);


3194       // disable scavenge before parallel mark-compact
3195       FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);


3196 #endif
3197     } else if (match_option(option, "-XX:CMSMarkStackSize=", &tail) ||
3198                match_option(option, "-XX:G1MarkStackSize=", &tail)) {
3199       julong stack_size = 0;
3200       ArgsRange errcode = parse_memory_size(tail, &stack_size, 1);
3201       if (errcode != arg_in_range) {
3202         jio_fprintf(defaultStream::error_stream(),
3203                     "Invalid mark stack size: %s\n", option->optionString);
3204         describe_range_error(errcode);
3205         return JNI_EINVAL;
3206       }
3207       jio_fprintf(defaultStream::error_stream(),
3208         "Please use -XX:MarkStackSize in place of "
3209         "-XX:CMSMarkStackSize or -XX:G1MarkStackSize in the future\n");
3210       FLAG_SET_CMDLINE(size_t, MarkStackSize, stack_size);


3211     } else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) {
3212       julong max_stack_size = 0;
3213       ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1);
3214       if (errcode != arg_in_range) {
3215         jio_fprintf(defaultStream::error_stream(),
3216                     "Invalid maximum mark stack size: %s\n",
3217                     option->optionString);
3218         describe_range_error(errcode);
3219         return JNI_EINVAL;
3220       }
3221       jio_fprintf(defaultStream::error_stream(),
3222          "Please use -XX:MarkStackSizeMax in place of "
3223          "-XX:CMSMarkStackSizeMax in the future\n");
3224       FLAG_SET_CMDLINE(size_t, MarkStackSizeMax, max_stack_size);


3225     } else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) ||
3226                match_option(option, "-XX:ParallelCMSThreads=", &tail)) {
3227       uintx conc_threads = 0;
3228       if (!parse_uintx(tail, &conc_threads, 1)) {
3229         jio_fprintf(defaultStream::error_stream(),
3230                     "Invalid concurrent threads: %s\n", option->optionString);
3231         return JNI_EINVAL;
3232       }
3233       jio_fprintf(defaultStream::error_stream(),
3234         "Please use -XX:ConcGCThreads in place of "
3235         "-XX:ParallelMarkingThreads or -XX:ParallelCMSThreads in the future\n");
3236       FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);


3237     } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
3238       julong max_direct_memory_size = 0;
3239       ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
3240       if (errcode != arg_in_range) {
3241         jio_fprintf(defaultStream::error_stream(),
3242                     "Invalid maximum direct memory size: %s\n",
3243                     option->optionString);
3244         describe_range_error(errcode);
3245         return JNI_EINVAL;
3246       }
3247       FLAG_SET_CMDLINE(size_t, MaxDirectMemorySize, max_direct_memory_size);


3248 #if !INCLUDE_MANAGEMENT
3249     } else if (match_option(option, "-XX:+ManagementServer")) {
3250         jio_fprintf(defaultStream::error_stream(),
3251           "ManagementServer is not supported in this VM.\n");
3252         return JNI_ERR;
3253 #endif // INCLUDE_MANAGEMENT
3254     // CreateMinidumpOnCrash is removed, and replaced by CreateCoredumpOnCrash
3255     } else if (match_option(option, "-XX:+CreateMinidumpOnCrash")) {
3256       FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, true);
3257       jio_fprintf(defaultStream::output_stream(),
3258           "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is on\n");
3259     } else if (match_option(option, "-XX:-CreateMinidumpOnCrash")) {
3260       FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, false);
3261       jio_fprintf(defaultStream::output_stream(),
3262           "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is off\n");
3263     } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
3264       // Skip -XX:Flags= since that case has already been handled
3265       if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
3266         if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
3267           return JNI_EINVAL;
3268         }
3269       }
3270     // Unknown option
3271     } else if (is_bad_option(option, args->ignoreUnrecognized)) {
3272       return JNI_ERR;
3273     }
3274   }
3275 
3276   // PrintSharedArchiveAndExit will turn on
3277   //   -Xshare:on
3278   //   -XX:+TraceClassPaths
3279   if (PrintSharedArchiveAndExit) {
3280     FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
3281     FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
3282     FLAG_SET_CMDLINE(bool, TraceClassPaths, true);






3283   }
3284 
3285   // Change the default value for flags  which have different default values
3286   // when working with older JDKs.
3287 #ifdef LINUX
3288  if (JDK_Version::current().compare_major(6) <= 0 &&
3289       FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) {
3290     FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false);
3291   }
3292 #endif // LINUX
3293   fix_appclasspath();
3294   return JNI_OK;
3295 }
3296 
3297 // Remove all empty paths from the app classpath (if IgnoreEmptyClassPaths is enabled)
3298 //
3299 // This is necessary because some apps like to specify classpath like -cp foo.jar:${XYZ}:bar.jar
3300 // in their start-up scripts. If XYZ is empty, the classpath will look like "-cp foo.jar::bar.jar".
3301 // Java treats such empty paths as if the user specified "-cp foo.jar:.:bar.jar". I.e., an empty
3302 // path is treated as the current directory.


3669 #ifdef COMPILER1
3670   if (PrintC1Statistics) {
3671     return true;
3672   }
3673 #endif // COMPILER1
3674 
3675 #ifdef COMPILER2
3676   if (PrintOptoAssembly || PrintOptoStatistics) {
3677     return true;
3678   }
3679 #endif // COMPILER2
3680 
3681   return false;
3682 }
3683 #endif // PRODUCT
3684 
3685 // Parse entry point called from JNI_CreateJavaVM
3686 
3687 jint Arguments::parse(const JavaVMInitArgs* args) {
3688 




3689   // Remaining part of option string
3690   const char* tail;
3691 
3692   // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
3693   const char* hotspotrc = ".hotspotrc";
3694   bool settings_file_specified = false;
3695   bool needs_hotspotrc_warning = false;
3696 
3697   const char* flags_file;
3698   int index;
3699   for (index = 0; index < args->nOptions; index++) {
3700     const JavaVMOption *option = args->options + index;
3701     if (ArgumentsExt::process_options(option)) {
3702       continue;
3703     }
3704     if (match_option(option, "-XX:Flags=", &tail)) {
3705       flags_file = tail;
3706       settings_file_specified = true;
3707       continue;
3708     }


4003     if (UseParallelGC || UseParallelOldGC) {
4004       if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
4005          FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
4006       }
4007     }
4008     // UseNUMAInterleaving is set to ON for all collectors and
4009     // platforms when UseNUMA is set to ON. NUMA-aware collectors
4010     // such as the parallel collector for Linux and Solaris will
4011     // interleave old gen and survivor spaces on top of NUMA
4012     // allocation policy for the eden space.
4013     // Non NUMA-aware collectors such as CMS, G1 and Serial-GC on
4014     // all platforms and ParallelGC on Windows will interleave all
4015     // of the heap spaces across NUMA nodes.
4016     if (FLAG_IS_DEFAULT(UseNUMAInterleaving)) {
4017       FLAG_SET_ERGO(bool, UseNUMAInterleaving, true);
4018     }
4019   }
4020   return JNI_OK;
4021 }
4022 









4023 int Arguments::PropertyList_count(SystemProperty* pl) {
4024   int count = 0;
4025   while(pl != NULL) {
4026     count++;
4027     pl = pl->next();
4028   }
4029   return count;
4030 }
4031 
4032 const char* Arguments::PropertyList_get_value(SystemProperty *pl, const char* key) {
4033   assert(key != NULL, "just checking");
4034   SystemProperty* prop;
4035   for (prop = pl; prop != NULL; prop = prop->next()) {
4036     if (strcmp(key, prop->key()) == 0) return prop->value();
4037   }
4038   return NULL;
4039 }
4040 
4041 const char* Arguments::PropertyList_get_key_at(SystemProperty *pl, int index) {
4042   int count = 0;


src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File