< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page
rev 47569 : imported patch jdk10-hs-single.patch
rev 47570 : [mq]: GCArguments_v2


  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  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/moduleEntry.hpp"
  29 #include "classfile/stringTable.hpp"
  30 #include "classfile/symbolTable.hpp"
  31 #include "gc/shared/cardTableRS.hpp"
  32 #include "gc/shared/genCollectedHeap.hpp"
  33 #include "gc/shared/referenceProcessor.hpp"
  34 #include "gc/shared/taskqueue.hpp"
  35 #include "logging/log.hpp"
  36 #include "logging/logConfiguration.hpp"
  37 #include "logging/logStream.hpp"
  38 #include "logging/logTag.hpp"
  39 #include "memory/allocation.inline.hpp"
  40 #include "memory/universe.inline.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "prims/jvm.h"
  43 #include "prims/jvmtiExport.hpp"
  44 #include "runtime/arguments.hpp"
  45 #include "runtime/arguments_ext.hpp"
  46 #include "runtime/commandLineFlagConstraintList.hpp"
  47 #include "runtime/commandLineFlagWriteableList.hpp"
  48 #include "runtime/commandLineFlagRangeList.hpp"
  49 #include "runtime/globals.hpp"
  50 #include "runtime/globals_extension.hpp"
  51 #include "runtime/java.hpp"
  52 #include "runtime/os.hpp"
  53 #include "runtime/vm_version.hpp"
  54 #include "services/management.hpp"
  55 #include "services/memTracker.hpp"
  56 #include "utilities/align.hpp"
  57 #include "utilities/defaultStream.hpp"
  58 #include "utilities/macros.hpp"
  59 #include "utilities/stringUtils.hpp"
  60 #if INCLUDE_JVMCI
  61 #include "jvmci/jvmciRuntime.hpp"
  62 #endif
  63 #if INCLUDE_ALL_GCS
  64 #include "gc/cms/compactibleFreeListSpace.hpp"
  65 #include "gc/g1/g1CollectedHeap.inline.hpp"
  66 #include "gc/parallel/parallelScavengeHeap.hpp"
  67 #endif // INCLUDE_ALL_GCS
  68 
  69 // Note: This is a special bug reporting site for the JVM
  70 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
  71 #define DEFAULT_JAVA_LAUNCHER  "generic"
  72 
  73 char*  Arguments::_jvm_flags_file               = NULL;
  74 char** Arguments::_jvm_flags_array              = NULL;
  75 int    Arguments::_num_jvm_flags                = 0;
  76 char** Arguments::_jvm_args_array               = NULL;
  77 int    Arguments::_num_jvm_args                 = 0;
  78 char*  Arguments::_java_command                 = NULL;
  79 SystemProperty* Arguments::_system_properties   = NULL;
  80 const char*  Arguments::_gc_log_filename        = NULL;
  81 size_t Arguments::_conservative_max_heap_alignment = 0;
  82 size_t Arguments::_min_heap_size                = 0;
  83 Arguments::Mode Arguments::_mode                = _mixed;
  84 bool   Arguments::_java_compiler                = false;
  85 bool   Arguments::_xdebug_mode                  = false;
  86 const char*  Arguments::_java_vendor_url_bug    = DEFAULT_VENDOR_URL_BUG;
  87 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;


1482     FLAG_SET_ERGO(intx, Tier3BackEdgeThreshold, scaled_compile_threshold(Tier3BackEdgeThreshold));
1483 
1484     // Tier2{Invocation,MinInvocation,Compile,Backedge}Threshold should be scaled here
1485     // once these thresholds become supported.
1486 
1487     FLAG_SET_ERGO(intx, Tier2InvokeNotifyFreqLog, scaled_freq_log(Tier2InvokeNotifyFreqLog));
1488     FLAG_SET_ERGO(intx, Tier2BackedgeNotifyFreqLog, scaled_freq_log(Tier2BackedgeNotifyFreqLog));
1489 
1490     FLAG_SET_ERGO(intx, Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog));
1491     FLAG_SET_ERGO(intx, Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog));
1492 
1493     FLAG_SET_ERGO(intx, Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog));
1494 
1495     FLAG_SET_ERGO(intx, Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));
1496     FLAG_SET_ERGO(intx, Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));
1497     FLAG_SET_ERGO(intx, Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));
1498     FLAG_SET_ERGO(intx, Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));
1499   }
1500 }
1501 
1502 #if INCLUDE_ALL_GCS
1503 static void disable_adaptive_size_policy(const char* collector_name) {
1504   if (UseAdaptiveSizePolicy) {
1505     if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
1506       warning("Disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
1507               collector_name);
1508     }
1509     FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
1510   }
1511 }
1512 
1513 void Arguments::set_parnew_gc_flags() {
1514   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
1515          "control point invariant");
1516   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
1517 
1518   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
1519     FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
1520     assert(ParallelGCThreads > 0, "We should always have at least one thread by default");
1521   } else if (ParallelGCThreads == 0) {
1522     jio_fprintf(defaultStream::error_stream(),
1523         "The ParNew GC can not be combined with -XX:ParallelGCThreads=0\n");
1524     vm_exit(1);
1525   }
1526 
1527   // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
1528   // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
1529   // we set them to 1024 and 1024.
1530   // See CR 6362902.
1531   if (FLAG_IS_DEFAULT(YoungPLABSize)) {
1532     FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
1533   }
1534   if (FLAG_IS_DEFAULT(OldPLABSize)) {
1535     FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
1536   }
1537 
1538   // When using compressed oops, we use local overflow stacks,
1539   // rather than using a global overflow list chained through
1540   // the klass word of the object's pre-image.
1541   if (UseCompressedOops && !ParGCUseLocalOverflow) {
1542     if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) {
1543       warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references");
1544     }
1545     FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true);
1546   }
1547   assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error");
1548 }
1549 
1550 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on
1551 // sparc/solaris for certain applications, but would gain from
1552 // further optimization and tuning efforts, and would almost
1553 // certainly gain from analysis of platform and environment.
1554 void Arguments::set_cms_and_parnew_gc_flags() {
1555   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
1556   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
1557 
1558   // Turn off AdaptiveSizePolicy by default for cms until it is complete.
1559   disable_adaptive_size_policy("UseConcMarkSweepGC");
1560 
1561   set_parnew_gc_flags();
1562 
1563   size_t max_heap = align_down(MaxHeapSize,
1564                                CardTableRS::ct_max_alignment_constraint());
1565 
1566   // Now make adjustments for CMS
1567   intx   tenuring_default = (intx)6;
1568   size_t young_gen_per_worker = CMSYoungGenPerWorker;
1569 
1570   // Preferred young gen size for "short" pauses:
1571   // upper bound depends on # of threads and NewRatio.
1572   const size_t preferred_max_new_size_unaligned =
1573     MIN2(max_heap/(NewRatio+1), ScaleForWordSize(young_gen_per_worker * ParallelGCThreads));
1574   size_t preferred_max_new_size =
1575     align_up(preferred_max_new_size_unaligned, os::vm_page_size());
1576 
1577   // Unless explicitly requested otherwise, size young gen
1578   // for "short" pauses ~ CMSYoungGenPerWorker*ParallelGCThreads
1579 
1580   // If either MaxNewSize or NewRatio is set on the command line,
1581   // assume the user is trying to set the size of the young gen.
1582   if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) {
1583 
1584     // Set MaxNewSize to our calculated preferred_max_new_size unless
1585     // NewSize was set on the command line and it is larger than
1586     // preferred_max_new_size.
1587     if (!FLAG_IS_DEFAULT(NewSize)) {   // NewSize explicitly set at command-line
1588       FLAG_SET_ERGO(size_t, MaxNewSize, MAX2(NewSize, preferred_max_new_size));
1589     } else {
1590       FLAG_SET_ERGO(size_t, MaxNewSize, preferred_max_new_size);
1591     }
1592     log_trace(gc, heap)("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
1593 
1594     // Code along this path potentially sets NewSize and OldSize
1595     log_trace(gc, heap)("CMS set min_heap_size: " SIZE_FORMAT " initial_heap_size:  " SIZE_FORMAT " max_heap: " SIZE_FORMAT,
1596                         min_heap_size(), InitialHeapSize, max_heap);
1597     size_t min_new = preferred_max_new_size;
1598     if (FLAG_IS_CMDLINE(NewSize)) {
1599       min_new = NewSize;
1600     }
1601     if (max_heap > min_new && min_heap_size() > min_new) {
1602       // Unless explicitly requested otherwise, make young gen
1603       // at least min_new, and at most preferred_max_new_size.
1604       if (FLAG_IS_DEFAULT(NewSize)) {
1605         FLAG_SET_ERGO(size_t, NewSize, MAX2(NewSize, min_new));
1606         FLAG_SET_ERGO(size_t, NewSize, MIN2(preferred_max_new_size, NewSize));
1607         log_trace(gc, heap)("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
1608       }
1609       // Unless explicitly requested otherwise, size old gen
1610       // so it's NewRatio x of NewSize.
1611       if (FLAG_IS_DEFAULT(OldSize)) {
1612         if (max_heap > NewSize) {
1613           FLAG_SET_ERGO(size_t, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
1614           log_trace(gc, heap)("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);
1615         }
1616       }
1617     }
1618   }
1619   // Unless explicitly requested otherwise, definitely
1620   // promote all objects surviving "tenuring_default" scavenges.
1621   if (FLAG_IS_DEFAULT(MaxTenuringThreshold) &&
1622       FLAG_IS_DEFAULT(SurvivorRatio)) {
1623     FLAG_SET_ERGO(uintx, MaxTenuringThreshold, tenuring_default);
1624   }
1625   // If we decided above (or user explicitly requested)
1626   // `promote all' (via MaxTenuringThreshold := 0),
1627   // prefer minuscule survivor spaces so as not to waste
1628   // space for (non-existent) survivors
1629   if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) {
1630     FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx)1024, SurvivorRatio));
1631   }
1632 
1633   // OldPLABSize is interpreted in CMS as not the size of the PLAB in words,
1634   // but rather the number of free blocks of a given size that are used when
1635   // replenishing the local per-worker free list caches.
1636   if (FLAG_IS_DEFAULT(OldPLABSize)) {
1637     if (!FLAG_IS_DEFAULT(ResizeOldPLAB) && !ResizeOldPLAB) {
1638       // OldPLAB sizing manually turned off: Use a larger default setting,
1639       // unless it was manually specified. This is because a too-low value
1640       // will slow down scavenges.
1641       FLAG_SET_ERGO(size_t, OldPLABSize, CompactibleFreeListSpaceLAB::_default_static_old_plab_size); // default value before 6631166
1642     } else {
1643       FLAG_SET_DEFAULT(OldPLABSize, CompactibleFreeListSpaceLAB::_default_dynamic_old_plab_size); // old CMSParPromoteBlocksToClaim default
1644     }
1645   }
1646 
1647   // If either of the static initialization defaults have changed, note this
1648   // modification.
1649   if (!FLAG_IS_DEFAULT(OldPLABSize) || !FLAG_IS_DEFAULT(OldPLABWeight)) {
1650     CompactibleFreeListSpaceLAB::modify_initialization(OldPLABSize, OldPLABWeight);
1651   }
1652 
1653   log_trace(gc)("MarkStackSize: %uk  MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1654 }
1655 #endif // INCLUDE_ALL_GCS
1656 
1657 void set_object_alignment() {
1658   // Object alignment.
1659   assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2");
1660   MinObjAlignmentInBytes     = ObjectAlignmentInBytes;
1661   assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small");
1662   MinObjAlignment            = MinObjAlignmentInBytes / HeapWordSize;
1663   assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect");
1664   MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1;
1665 
1666   LogMinObjAlignmentInBytes  = exact_log2(ObjectAlignmentInBytes);
1667   LogMinObjAlignment         = LogMinObjAlignmentInBytes - LogHeapWordSize;
1668 
1669   // Oop encoding heap max
1670   OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes;
1671 
1672   if (SurvivorAlignmentInBytes == 0) {
1673     SurvivorAlignmentInBytes = ObjectAlignmentInBytes;
1674   }
1675 
1676 #if INCLUDE_ALL_GCS
1677   // Set CMS global values
1678   CompactibleFreeListSpace::set_cms_values();
1679 #endif // INCLUDE_ALL_GCS
1680 }
1681 
1682 size_t Arguments::max_heap_for_compressed_oops() {
1683   // Avoid sign flip.
1684   assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1685   // We need to fit both the NULL page and the heap into the memory budget, while
1686   // keeping alignment constraints of the heap. To guarantee the latter, as the
1687   // NULL page is located before the heap, we pad the NULL page to the conservative
1688   // maximum alignment that the GC may ever impose upon the heap.
1689   size_t displacement_due_to_null_page = align_up((size_t)os::vm_page_size(),
1690                                                   _conservative_max_heap_alignment);
1691 
1692   LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1693   NOT_LP64(ShouldNotReachHere(); return 0);
1694 }
1695 
1696 void Arguments::set_use_compressed_oops() {
1697 #ifndef ZERO
1698 #ifdef _LP64
1699   // MaxHeapSize is not set up properly at this point, but


1735     if (FLAG_IS_DEFAULT(UseCompressedClassPointers)) {
1736       FLAG_SET_ERGO(bool, UseCompressedClassPointers, true);
1737     }
1738     // Check the CompressedClassSpaceSize to make sure we use compressed klass ptrs.
1739     if (UseCompressedClassPointers) {
1740       if (CompressedClassSpaceSize > KlassEncodingMetaspaceMax) {
1741         warning("CompressedClassSpaceSize is too large for UseCompressedClassPointers");
1742         FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
1743       }
1744     }
1745   }
1746 #endif // _LP64
1747 #endif // !ZERO
1748 }
1749 
1750 void Arguments::set_conservative_max_heap_alignment() {
1751   // The conservative maximum required alignment for the heap is the maximum of
1752   // the alignments imposed by several sources: any requirements from the heap
1753   // itself, the collector policy and the maximum page size we may run the VM
1754   // with.
1755   size_t heap_alignment = GenCollectedHeap::conservative_max_heap_alignment();
1756 #if INCLUDE_ALL_GCS
1757   if (UseParallelGC) {
1758     heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment();
1759   } else if (UseG1GC) {
1760     heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
1761   }
1762 #endif // INCLUDE_ALL_GCS
1763   _conservative_max_heap_alignment = MAX4(heap_alignment,
1764                                           (size_t)os::vm_allocation_granularity(),
1765                                           os::max_page_size(),
1766                                           CollectorPolicy::compute_heap_alignment());
1767 }
1768 
1769 bool Arguments::gc_selected() {
1770 #if INCLUDE_ALL_GCS
1771   return UseSerialGC || UseParallelGC || UseParallelOldGC || UseConcMarkSweepGC || UseG1GC;
1772 #else
1773   return UseSerialGC;
1774 #endif // INCLUDE_ALL_GCS
1775 }
1776 
1777 #ifdef TIERED
1778 bool Arguments::compilation_mode_selected() {
1779  return !FLAG_IS_DEFAULT(TieredCompilation) || !FLAG_IS_DEFAULT(TieredStopAtLevel) ||
1780         !FLAG_IS_DEFAULT(UseAOT) JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler));
1781 
1782 }
1783 
1784 void Arguments::select_compilation_mode_ergonomically() {
1785 #if defined(_WINDOWS) && !defined(_LP64)
1786   if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {
1787     FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true);
1788   }
1789 #endif
1790   if (NeverActAsServerClassMachine) {
1791     set_client_compilation_mode();
1792   }
1793 }
1794 #endif //TIERED
1795 
1796 void Arguments::select_gc_ergonomically() {
1797 #if INCLUDE_ALL_GCS
1798   if (os::is_server_class_machine()) {
1799     FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
1800   } else {
1801     FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
1802   }
1803 #else
1804   UNSUPPORTED_OPTION(UseG1GC);
1805   UNSUPPORTED_OPTION(UseParallelGC);
1806   UNSUPPORTED_OPTION(UseParallelOldGC);
1807   UNSUPPORTED_OPTION(UseConcMarkSweepGC);
1808   FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
1809 #endif // INCLUDE_ALL_GCS
1810 }
1811 
1812 void Arguments::select_gc() {
1813   if (!gc_selected()) {
1814     select_gc_ergonomically();
1815     if (!gc_selected()) {
1816       vm_exit_during_initialization("Garbage collector not selected (default collector explicitly disabled)", NULL);
1817     }
1818   }
1819 }
1820 
1821 #if INCLUDE_JVMCI
1822 void Arguments::set_jvmci_specific_flags() {
1823   if (UseJVMCICompiler) {
1824     if (FLAG_IS_DEFAULT(TypeProfileWidth)) {
1825       FLAG_SET_DEFAULT(TypeProfileWidth, 8);
1826     }
1827     if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
1828       FLAG_SET_DEFAULT(OnStackReplacePercentage, 933);
1829     }
1830     if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
1831       FLAG_SET_DEFAULT(ReservedCodeCacheSize, 64*M);
1832     }
1833     if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
1834       FLAG_SET_DEFAULT(InitialCodeCacheSize, 16*M);
1835     }
1836     if (FLAG_IS_DEFAULT(MetaspaceSize)) {
1837       FLAG_SET_DEFAULT(MetaspaceSize, 12*M);
1838     }
1839     if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) {
1840       FLAG_SET_DEFAULT(NewSizeThreadIncrease, 4*K);
1841     }
1842     if (TieredStopAtLevel != CompLevel_full_optimization) {
1843       // Currently JVMCI compiler can only work at the full optimization level
1844       warning("forcing TieredStopAtLevel to full optimization because JVMCI is enabled");
1845       TieredStopAtLevel = CompLevel_full_optimization;
1846     }
1847     if (FLAG_IS_DEFAULT(TypeProfileLevel)) {
1848       FLAG_SET_DEFAULT(TypeProfileLevel, 0);
1849     }
1850   }
1851 }
1852 #endif
1853 
1854 void Arguments::set_ergonomics_flags() {
1855 #ifdef TIERED
1856   if (!compilation_mode_selected()) {
1857     select_compilation_mode_ergonomically();
1858   }
1859 #endif
1860   select_gc();




1861 
1862 #if defined(COMPILER2) || INCLUDE_JVMCI
1863   // Shared spaces work fine with other GCs but causes bytecode rewriting
1864   // to be disabled, which hurts interpreter performance and decreases
1865   // server performance.  When -server is specified, keep the default off
1866   // unless it is asked for.  Future work: either add bytecode rewriting
1867   // at link time, or rewrite bytecodes in non-shared methods.
1868   if (is_server_compilation_mode_vm() && !DumpSharedSpaces && !RequireSharedSpaces &&
1869       (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
1870     no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on.");
1871   }
1872 #endif
1873 
1874   set_conservative_max_heap_alignment();
1875 
1876 #ifndef ZERO
1877 #ifdef _LP64
1878   set_use_compressed_oops();
1879 
1880   // set_use_compressed_klass_ptrs() must be called after calling
1881   // set_use_compressed_oops().
1882   set_use_compressed_klass_ptrs();
1883 
1884   // Also checks that certain machines are slower with compressed oops
1885   // in vm_version initialization code.
1886 #endif // _LP64
1887 #endif // !ZERO
1888 
1889 }
1890 
1891 void Arguments::set_parallel_gc_flags() {
1892   assert(UseParallelGC || UseParallelOldGC, "Error");
1893   // Enable ParallelOld unless it was explicitly disabled (cmd line or rc file).
1894   if (FLAG_IS_DEFAULT(UseParallelOldGC)) {
1895     FLAG_SET_DEFAULT(UseParallelOldGC, true);
1896   }
1897   FLAG_SET_DEFAULT(UseParallelGC, true);
1898 
1899   // If no heap maximum was requested explicitly, use some reasonable fraction
1900   // of the physical memory, up to a maximum of 1GB.
1901   FLAG_SET_DEFAULT(ParallelGCThreads,
1902                    Abstract_VM_Version::parallel_worker_threads());
1903   if (ParallelGCThreads == 0) {
1904     jio_fprintf(defaultStream::error_stream(),
1905         "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n");
1906     vm_exit(1);
1907   }
1908 
1909   if (UseAdaptiveSizePolicy) {
1910     // We don't want to limit adaptive heap sizing's freedom to adjust the heap
1911     // unless the user actually sets these flags.
1912     if (FLAG_IS_DEFAULT(MinHeapFreeRatio)) {
1913       FLAG_SET_DEFAULT(MinHeapFreeRatio, 0);
1914     }
1915     if (FLAG_IS_DEFAULT(MaxHeapFreeRatio)) {
1916       FLAG_SET_DEFAULT(MaxHeapFreeRatio, 100);
1917     }
1918   }
1919 
1920   // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
1921   // SurvivorRatio has been set, reset their default values to SurvivorRatio +
1922   // 2.  By doing this we make SurvivorRatio also work for Parallel Scavenger.
1923   // See CR 6362902 for details.
1924   if (!FLAG_IS_DEFAULT(SurvivorRatio)) {
1925     if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) {
1926        FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2);
1927     }
1928     if (FLAG_IS_DEFAULT(MinSurvivorRatio)) {
1929       FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2);
1930     }
1931   }
1932 
1933   if (UseParallelOldGC) {
1934     // Par compact uses lower default values since they are treated as
1935     // minimums.  These are different defaults because of the different
1936     // interpretation and are not ergonomically set.
1937     if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
1938       FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
1939     }
1940   }
1941 }
1942 
1943 void Arguments::set_g1_gc_flags() {
1944   assert(UseG1GC, "Error");
1945 #if defined(COMPILER1) || INCLUDE_JVMCI
1946   FastTLABRefill = false;
1947 #endif
1948   FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
1949   if (ParallelGCThreads == 0) {
1950     assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0.");
1951     vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
1952   }
1953 
1954 #if INCLUDE_ALL_GCS
1955   if (FLAG_IS_DEFAULT(G1ConcRefinementThreads)) {
1956     FLAG_SET_ERGO(uint, G1ConcRefinementThreads, ParallelGCThreads);
1957   }
1958 #endif
1959 
1960   // MarkStackSize will be set (if it hasn't been set by the user)
1961   // when concurrent marking is initialized.
1962   // Its value will be based upon the number of parallel marking threads.
1963   // But we do set the maximum mark stack size here.
1964   if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
1965     FLAG_SET_DEFAULT(MarkStackSizeMax, 128 * TASKQUEUE_SIZE);
1966   }
1967 
1968   if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
1969     // In G1, we want the default GC overhead goal to be higher than
1970     // it is for PS, or the heap might be expanded too aggressively.
1971     // We set it here to ~8%.
1972     FLAG_SET_DEFAULT(GCTimeRatio, 12);
1973   }
1974 
1975   // Below, we might need to calculate the pause time interval based on
1976   // the pause target. When we do so we are going to give G1 maximum
1977   // flexibility and allow it to do pauses when it needs to. So, we'll
1978   // arrange that the pause interval to be pause time target + 1 to
1979   // ensure that a) the pause time target is maximized with respect to
1980   // the pause interval and b) we maintain the invariant that pause
1981   // time target < pause interval. If the user does not want this
1982   // maximum flexibility, they will have to set the pause interval
1983   // explicitly.
1984 
1985   if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
1986     // The default pause time target in G1 is 200ms
1987     FLAG_SET_DEFAULT(MaxGCPauseMillis, 200);
1988   }
1989 
1990   // Then, if the interval parameter was not set, set it according to
1991   // the pause time target (this will also deal with the case when the
1992   // pause time target is the default value).
1993   if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
1994     FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1);
1995   }
1996 
1997   log_trace(gc)("MarkStackSize: %uk  MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1998 }
1999 
2000 void Arguments::set_gc_specific_flags() {
2001 #if INCLUDE_ALL_GCS
2002   // Set per-collector flags
2003   if (UseParallelGC || UseParallelOldGC) {
2004     set_parallel_gc_flags();
2005   } else if (UseConcMarkSweepGC) {
2006     set_cms_and_parnew_gc_flags();
2007   } else if (UseG1GC) {
2008     set_g1_gc_flags();
2009   }
2010   if (AssumeMP && !UseSerialGC) {
2011     if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
2012       warning("If the number of processors is expected to increase from one, then"
2013               " you should configure the number of parallel GC threads appropriately"
2014               " using -XX:ParallelGCThreads=N");
2015     }
2016   }
2017   if (MinHeapFreeRatio == 100) {
2018     // Keeping the heap 100% free is hard ;-) so limit it to 99%.
2019     FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
2020   }
2021 
2022   // If class unloading is disabled, also disable concurrent class unloading.
2023   if (!ClassUnloading) {
2024     FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
2025     FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
2026   }
2027 #endif // INCLUDE_ALL_GCS
2028 }
2029 
2030 julong Arguments::limit_by_allocatable_memory(julong limit) {
2031   julong max_allocatable;
2032   julong result = limit;
2033   if (os::has_allocatable_memory_limit(&max_allocatable)) {
2034     result = MIN2(result, max_allocatable / MaxVirtMemFraction);
2035   }
2036   return result;
2037 }
2038 
2039 // Use static initialization to get the default before parsing
2040 static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress;
2041 
2042 void Arguments::set_heap_size() {
2043   julong phys_mem =
2044     FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM)
2045                             : (julong)MaxRAM;
2046 
2047   // Experimental support for CGroup memory limits


4452 #if !INCLUDE_CDS
4453   if (DumpSharedSpaces || RequireSharedSpaces) {
4454     jio_fprintf(defaultStream::error_stream(),
4455       "Shared spaces are not supported in this VM\n");
4456     return JNI_ERR;
4457   }
4458   if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) ||
4459       log_is_enabled(Info, cds)) {
4460     warning("Shared spaces are not supported in this VM");
4461     FLAG_SET_DEFAULT(UseSharedSpaces, false);
4462     LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(cds));
4463   }
4464   no_shared_spaces("CDS Disabled");
4465 #endif // INCLUDE_CDS
4466 
4467   return JNI_OK;
4468 }
4469 
4470 jint Arguments::apply_ergo() {
4471   // Set flags based on ergonomics.
4472   set_ergonomics_flags();

4473 
4474 #if INCLUDE_JVMCI
4475   set_jvmci_specific_flags();
4476 #endif
4477 
4478   set_shared_spaces_flags();
4479 
4480   // Check the GC selections again.
4481   if (!check_gc_consistency()) {
4482     return JNI_EINVAL;
4483   }
4484 
4485   if (TieredCompilation) {
4486     set_tiered_flags();
4487   } else {
4488     int max_compilation_policy_choice = 1;
4489 #ifdef COMPILER2
4490     if (is_server_compilation_mode_vm()) {
4491       max_compilation_policy_choice = 2;
4492     }




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  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/moduleEntry.hpp"
  29 #include "classfile/stringTable.hpp"
  30 #include "classfile/symbolTable.hpp"
  31 #include "gc/shared/gcArguments.hpp"
  32 #include "gc/shared/genCollectedHeap.hpp"
  33 #include "gc/shared/referenceProcessor.hpp"
  34 #include "gc/shared/taskqueue.hpp"
  35 #include "logging/log.hpp"
  36 #include "logging/logConfiguration.hpp"
  37 #include "logging/logStream.hpp"
  38 #include "logging/logTag.hpp"
  39 #include "memory/allocation.inline.hpp"
  40 #include "memory/universe.inline.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "prims/jvm.h"
  43 #include "prims/jvmtiExport.hpp"
  44 #include "runtime/arguments.hpp"
  45 #include "runtime/arguments_ext.hpp"
  46 #include "runtime/commandLineFlagConstraintList.hpp"
  47 #include "runtime/commandLineFlagWriteableList.hpp"
  48 #include "runtime/commandLineFlagRangeList.hpp"
  49 #include "runtime/globals.hpp"
  50 #include "runtime/globals_extension.hpp"
  51 #include "runtime/java.hpp"
  52 #include "runtime/os.hpp"
  53 #include "runtime/vm_version.hpp"
  54 #include "services/management.hpp"
  55 #include "services/memTracker.hpp"
  56 #include "utilities/align.hpp"
  57 #include "utilities/defaultStream.hpp"
  58 #include "utilities/macros.hpp"
  59 #include "utilities/stringUtils.hpp"
  60 #if INCLUDE_JVMCI
  61 #include "jvmci/jvmciRuntime.hpp"
  62 #endif





  63 
  64 // Note: This is a special bug reporting site for the JVM
  65 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
  66 #define DEFAULT_JAVA_LAUNCHER  "generic"
  67 
  68 char*  Arguments::_jvm_flags_file               = NULL;
  69 char** Arguments::_jvm_flags_array              = NULL;
  70 int    Arguments::_num_jvm_flags                = 0;
  71 char** Arguments::_jvm_args_array               = NULL;
  72 int    Arguments::_num_jvm_args                 = 0;
  73 char*  Arguments::_java_command                 = NULL;
  74 SystemProperty* Arguments::_system_properties   = NULL;
  75 const char*  Arguments::_gc_log_filename        = NULL;
  76 size_t Arguments::_conservative_max_heap_alignment = 0;
  77 size_t Arguments::_min_heap_size                = 0;
  78 Arguments::Mode Arguments::_mode                = _mixed;
  79 bool   Arguments::_java_compiler                = false;
  80 bool   Arguments::_xdebug_mode                  = false;
  81 const char*  Arguments::_java_vendor_url_bug    = DEFAULT_VENDOR_URL_BUG;
  82 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;


1477     FLAG_SET_ERGO(intx, Tier3BackEdgeThreshold, scaled_compile_threshold(Tier3BackEdgeThreshold));
1478 
1479     // Tier2{Invocation,MinInvocation,Compile,Backedge}Threshold should be scaled here
1480     // once these thresholds become supported.
1481 
1482     FLAG_SET_ERGO(intx, Tier2InvokeNotifyFreqLog, scaled_freq_log(Tier2InvokeNotifyFreqLog));
1483     FLAG_SET_ERGO(intx, Tier2BackedgeNotifyFreqLog, scaled_freq_log(Tier2BackedgeNotifyFreqLog));
1484 
1485     FLAG_SET_ERGO(intx, Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog));
1486     FLAG_SET_ERGO(intx, Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog));
1487 
1488     FLAG_SET_ERGO(intx, Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog));
1489 
1490     FLAG_SET_ERGO(intx, Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));
1491     FLAG_SET_ERGO(intx, Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));
1492     FLAG_SET_ERGO(intx, Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));
1493     FLAG_SET_ERGO(intx, Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));
1494   }
1495 }
1496 



























































































































































1497 void set_object_alignment() {
1498   // Object alignment.
1499   assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2");
1500   MinObjAlignmentInBytes     = ObjectAlignmentInBytes;
1501   assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small");
1502   MinObjAlignment            = MinObjAlignmentInBytes / HeapWordSize;
1503   assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect");
1504   MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1;
1505 
1506   LogMinObjAlignmentInBytes  = exact_log2(ObjectAlignmentInBytes);
1507   LogMinObjAlignment         = LogMinObjAlignmentInBytes - LogHeapWordSize;
1508 
1509   // Oop encoding heap max
1510   OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes;
1511 
1512   if (SurvivorAlignmentInBytes == 0) {
1513     SurvivorAlignmentInBytes = ObjectAlignmentInBytes;
1514   }





1515 }
1516 
1517 size_t Arguments::max_heap_for_compressed_oops() {
1518   // Avoid sign flip.
1519   assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1520   // We need to fit both the NULL page and the heap into the memory budget, while
1521   // keeping alignment constraints of the heap. To guarantee the latter, as the
1522   // NULL page is located before the heap, we pad the NULL page to the conservative
1523   // maximum alignment that the GC may ever impose upon the heap.
1524   size_t displacement_due_to_null_page = align_up((size_t)os::vm_page_size(),
1525                                                   _conservative_max_heap_alignment);
1526 
1527   LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1528   NOT_LP64(ShouldNotReachHere(); return 0);
1529 }
1530 
1531 void Arguments::set_use_compressed_oops() {
1532 #ifndef ZERO
1533 #ifdef _LP64
1534   // MaxHeapSize is not set up properly at this point, but


1570     if (FLAG_IS_DEFAULT(UseCompressedClassPointers)) {
1571       FLAG_SET_ERGO(bool, UseCompressedClassPointers, true);
1572     }
1573     // Check the CompressedClassSpaceSize to make sure we use compressed klass ptrs.
1574     if (UseCompressedClassPointers) {
1575       if (CompressedClassSpaceSize > KlassEncodingMetaspaceMax) {
1576         warning("CompressedClassSpaceSize is too large for UseCompressedClassPointers");
1577         FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
1578       }
1579     }
1580   }
1581 #endif // _LP64
1582 #endif // !ZERO
1583 }
1584 
1585 void Arguments::set_conservative_max_heap_alignment() {
1586   // The conservative maximum required alignment for the heap is the maximum of
1587   // the alignments imposed by several sources: any requirements from the heap
1588   // itself, the collector policy and the maximum page size we may run the VM
1589   // with.
1590   size_t heap_alignment = GCArguments::instance()->conservative_max_heap_alignment();







1591   _conservative_max_heap_alignment = MAX4(heap_alignment,
1592                                           (size_t)os::vm_allocation_granularity(),
1593                                           os::max_page_size(),
1594                                           CollectorPolicy::compute_heap_alignment());
1595 }
1596 








1597 #ifdef TIERED
1598 bool Arguments::compilation_mode_selected() {
1599  return !FLAG_IS_DEFAULT(TieredCompilation) || !FLAG_IS_DEFAULT(TieredStopAtLevel) ||
1600         !FLAG_IS_DEFAULT(UseAOT) JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler));
1601 
1602 }
1603 
1604 void Arguments::select_compilation_mode_ergonomically() {
1605 #if defined(_WINDOWS) && !defined(_LP64)
1606   if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {
1607     FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true);
1608   }
1609 #endif
1610   if (NeverActAsServerClassMachine) {
1611     set_client_compilation_mode();
1612   }
1613 }
1614 #endif //TIERED
1615 

























1616 #if INCLUDE_JVMCI
1617 void Arguments::set_jvmci_specific_flags() {
1618   if (UseJVMCICompiler) {
1619     if (FLAG_IS_DEFAULT(TypeProfileWidth)) {
1620       FLAG_SET_DEFAULT(TypeProfileWidth, 8);
1621     }
1622     if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
1623       FLAG_SET_DEFAULT(OnStackReplacePercentage, 933);
1624     }
1625     if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
1626       FLAG_SET_DEFAULT(ReservedCodeCacheSize, 64*M);
1627     }
1628     if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
1629       FLAG_SET_DEFAULT(InitialCodeCacheSize, 16*M);
1630     }
1631     if (FLAG_IS_DEFAULT(MetaspaceSize)) {
1632       FLAG_SET_DEFAULT(MetaspaceSize, 12*M);
1633     }
1634     if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) {
1635       FLAG_SET_DEFAULT(NewSizeThreadIncrease, 4*K);
1636     }
1637     if (TieredStopAtLevel != CompLevel_full_optimization) {
1638       // Currently JVMCI compiler can only work at the full optimization level
1639       warning("forcing TieredStopAtLevel to full optimization because JVMCI is enabled");
1640       TieredStopAtLevel = CompLevel_full_optimization;
1641     }
1642     if (FLAG_IS_DEFAULT(TypeProfileLevel)) {
1643       FLAG_SET_DEFAULT(TypeProfileLevel, 0);
1644     }
1645   }
1646 }
1647 #endif
1648 
1649 jint Arguments::set_ergonomics_flags() {
1650 #ifdef TIERED
1651   if (!compilation_mode_selected()) {
1652     select_compilation_mode_ergonomically();
1653   }
1654 #endif
1655 
1656   jint gc_result = GCArguments::create_instance();
1657   if (gc_result != JNI_OK) {
1658     return gc_result;
1659   }
1660 
1661 #if defined(COMPILER2) || INCLUDE_JVMCI
1662   // Shared spaces work fine with other GCs but causes bytecode rewriting
1663   // to be disabled, which hurts interpreter performance and decreases
1664   // server performance.  When -server is specified, keep the default off
1665   // unless it is asked for.  Future work: either add bytecode rewriting
1666   // at link time, or rewrite bytecodes in non-shared methods.
1667   if (is_server_compilation_mode_vm() && !DumpSharedSpaces && !RequireSharedSpaces &&
1668       (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
1669     no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on.");
1670   }
1671 #endif
1672 
1673   set_conservative_max_heap_alignment();
1674 
1675 #ifndef ZERO
1676 #ifdef _LP64
1677   set_use_compressed_oops();
1678 
1679   // set_use_compressed_klass_ptrs() must be called after calling
1680   // set_use_compressed_oops().
1681   set_use_compressed_klass_ptrs();
1682 
1683   // Also checks that certain machines are slower with compressed oops
1684   // in vm_version initialization code.
1685 #endif // _LP64
1686 #endif // !ZERO
1687 
1688   return JNI_OK;












































































































1689 }
1690 
1691 void Arguments::set_gc_specific_flags() {
1692   // Set GC flags
1693   GCArguments::instance()->initialize_flags();

























1694 }
1695 
1696 julong Arguments::limit_by_allocatable_memory(julong limit) {
1697   julong max_allocatable;
1698   julong result = limit;
1699   if (os::has_allocatable_memory_limit(&max_allocatable)) {
1700     result = MIN2(result, max_allocatable / MaxVirtMemFraction);
1701   }
1702   return result;
1703 }
1704 
1705 // Use static initialization to get the default before parsing
1706 static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress;
1707 
1708 void Arguments::set_heap_size() {
1709   julong phys_mem =
1710     FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM)
1711                             : (julong)MaxRAM;
1712 
1713   // Experimental support for CGroup memory limits


4118 #if !INCLUDE_CDS
4119   if (DumpSharedSpaces || RequireSharedSpaces) {
4120     jio_fprintf(defaultStream::error_stream(),
4121       "Shared spaces are not supported in this VM\n");
4122     return JNI_ERR;
4123   }
4124   if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) ||
4125       log_is_enabled(Info, cds)) {
4126     warning("Shared spaces are not supported in this VM");
4127     FLAG_SET_DEFAULT(UseSharedSpaces, false);
4128     LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(cds));
4129   }
4130   no_shared_spaces("CDS Disabled");
4131 #endif // INCLUDE_CDS
4132 
4133   return JNI_OK;
4134 }
4135 
4136 jint Arguments::apply_ergo() {
4137   // Set flags based on ergonomics.
4138   jint result = set_ergonomics_flags();
4139   if (result != JNI_OK) return result;
4140 
4141 #if INCLUDE_JVMCI
4142   set_jvmci_specific_flags();
4143 #endif
4144 
4145   set_shared_spaces_flags();
4146 
4147   // Check the GC selections again.
4148   if (!check_gc_consistency()) {
4149     return JNI_EINVAL;
4150   }
4151 
4152   if (TieredCompilation) {
4153     set_tiered_flags();
4154   } else {
4155     int max_compilation_policy_choice = 1;
4156 #ifdef COMPILER2
4157     if (is_server_compilation_mode_vm()) {
4158       max_compilation_policy_choice = 2;
4159     }


< prev index next >