< prev index next >

src/share/vm/runtime/arguments.cpp

Print this page
rev 10500 : [backport] Rework ClassUnloading* flags handling
rev 10502 : [backport] ClassUnloadingWithConcurrentMark should be opt-in with Shenandoah
rev 10516 : [backport] Disable UseFastJNIAccessors for Shenandoah
rev 10583 : [backport] TLAB sizing policy should converge faster with Shenandoah
rev 10588 : [backport] Check and ensure that Shenandoah-enabled compilations succeed
* * *
[backport] Filter out not compilable methods to avoid false assertion
rev 10589 : [backport] Purge support for ShenandoahConcurrentEvacCodeRoots and ShenandoahBarriersForConst
rev 10592 : [backport] Fix Minimal and Zero builds
rev 10638 : [backport] Remove NMethodSizeLimit adjustment for Shenandoah


1817 #else
1818   guarantee(!ShenandoahVerifyOptoBarriers, "Should be disabled");
1819 #endif // ASSERT
1820 #endif // COMPILER2
1821 
1822 #if INCLUDE_ALL_GCS
1823   if (AlwaysPreTouch) {
1824     // Shenandoah handles pre-touch on its own. It does not let the
1825     // generic storage code to do the pre-touch before Shenandoah has
1826     // a chance to do it on its own.
1827     FLAG_SET_DEFAULT(AlwaysPreTouch, false);
1828     FLAG_SET_DEFAULT(ShenandoahAlwaysPreTouch, true);
1829   }
1830 
1831   if (ShenandoahAlwaysPreTouch) {
1832     if (!FLAG_IS_DEFAULT(ShenandoahUncommit)) {
1833       warning("AlwaysPreTouch is enabled, disabling ShenandoahUncommit");
1834     }
1835     FLAG_SET_DEFAULT(ShenandoahUncommit, false);
1836   }




































1837 #endif
1838 }
1839 
1840 #if !INCLUDE_ALL_GCS
1841 #ifdef ASSERT
1842 static bool verify_serial_gc_flags() {
1843   return (UseSerialGC &&
1844         !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1845           UseParallelGC || UseParallelOldGC));
1846 }
1847 #endif // ASSERT
1848 #endif // INCLUDE_ALL_GCS
1849 
1850 void Arguments::set_gc_specific_flags() {
1851 #if INCLUDE_ALL_GCS
1852   // Set per-collector flags
1853   if (UseParallelGC || UseParallelOldGC) {
1854     set_parallel_gc_flags();
1855   } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
1856     set_cms_and_parnew_gc_flags();


2141       jio_fprintf(defaultStream::output_stream(),
2142                   "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files>\n"
2143                   "where num_of_file > 0\n"
2144                   "GC log rotation is turned off\n");
2145       UseGCLogFileRotation = false;
2146     }
2147   }
2148 
2149   if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8*K)) {
2150     FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K);
2151     jio_fprintf(defaultStream::output_stream(),
2152                 "GCLogFileSize changed to minimum 8K\n");
2153   }
2154 
2155   // Record more information about previous cycles for improved debugging pleasure
2156   if (FLAG_IS_DEFAULT(LogEventsBufferEntries)) {
2157     FLAG_SET_DEFAULT(LogEventsBufferEntries, 250);
2158   }
2159 
2160 #if INCLUDE_ALL_GCS
2161   if (ShenandoahConcurrentEvacCodeRoots) {
2162     if (!ShenandoahBarriersForConst) {
2163       if (FLAG_IS_DEFAULT(ShenandoahBarriersForConst)) {
2164         warning("Concurrent code cache evacuation is enabled, enabling barriers for constants.");
2165         FLAG_SET_DEFAULT(ShenandoahBarriersForConst, true);
2166       } else {
2167         warning("Concurrent code cache evacuation is enabled, but barriers for constants are disabled. "
2168                 "This may lead to surprising crashes.");
2169       }
2170     }
2171   } else {
2172     if (ShenandoahBarriersForConst) {
2173       if (FLAG_IS_DEFAULT(ShenandoahBarriersForConst)) {
2174         warning("Concurrent code cache evacuation is disabled, disabling barriers for constants.");
2175         FLAG_SET_DEFAULT(ShenandoahBarriersForConst, false);
2176       }
2177     }
2178   }
2179 
2180   if (AlwaysPreTouch || ShenandoahAlwaysPreTouch) {
2181     if (!FLAG_IS_DEFAULT(ShenandoahUncommitDelay)) {
2182       warning("AlwaysPreTouch is enabled, disabling ShenandoahUncommitDelay");
2183     }
2184     FLAG_SET_DEFAULT(ShenandoahUncommitDelay, max_uintx);
2185   }
2186 #endif
2187 }
2188 
2189 // This function is called for -Xloggc:<filename>, it can be used
2190 // to check if a given file name(or string) conforms to the following
2191 // specification:
2192 // A valid string only contains "[A-Z][a-z][0-9].-_%[p|t]"
2193 // %p and %t only allowed once. We only limit usage of filename not path
2194 bool is_filename_valid(const char *file_name) {
2195   const char* p = file_name;
2196   char file_sep = os::file_separator()[0];
2197   const char* cp;
2198   // skip prefix path
2199   for (cp = file_name; *cp != '\0'; cp++) {




1817 #else
1818   guarantee(!ShenandoahVerifyOptoBarriers, "Should be disabled");
1819 #endif // ASSERT
1820 #endif // COMPILER2
1821 
1822 #if INCLUDE_ALL_GCS
1823   if (AlwaysPreTouch) {
1824     // Shenandoah handles pre-touch on its own. It does not let the
1825     // generic storage code to do the pre-touch before Shenandoah has
1826     // a chance to do it on its own.
1827     FLAG_SET_DEFAULT(AlwaysPreTouch, false);
1828     FLAG_SET_DEFAULT(ShenandoahAlwaysPreTouch, true);
1829   }
1830 
1831   if (ShenandoahAlwaysPreTouch) {
1832     if (!FLAG_IS_DEFAULT(ShenandoahUncommit)) {
1833       warning("AlwaysPreTouch is enabled, disabling ShenandoahUncommit");
1834     }
1835     FLAG_SET_DEFAULT(ShenandoahUncommit, false);
1836   }
1837 
1838   // If class unloading is disabled, no unloading for concurrent cycles as well.
1839   // If class unloading is enabled, users should opt-in for unloading during
1840   // concurrent cycles.
1841   if (!ClassUnloading || !FLAG_IS_CMDLINE(ClassUnloadingWithConcurrentMark)) {
1842     if (PrintGC) {
1843       tty->print_cr("Consider -XX:+ClassUnloadingWithConcurrentMark if large pause times "
1844                     "are observed on class-unloading sensitive workloads");
1845     }
1846     FLAG_SET_DEFAULT(ClassUnloadingWithConcurrentMark, false);
1847   }
1848 
1849   // JNI fast get field stuff is not currently supported by Shenandoah.
1850   // It would introduce another heap memory access for reading the forwarding
1851   // pointer, which would have to be guarded by the signal handler machinery.
1852   // See:
1853   // http://mail.openjdk.java.net/pipermail/hotspot-dev/2018-June/032763.html
1854   FLAG_SET_DEFAULT(UseFastJNIAccessors, false);
1855 
1856   // TLAB sizing policy makes resizing decisions before each GC cycle. It averages
1857   // historical data, assigning more recent data the weight according to TLABAllocationWeight.
1858   // Current default is good for generational collectors that run frequent young GCs.
1859   // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
1860   // to converge faster over smaller number of resizing decisions.
1861   if (FLAG_IS_DEFAULT(TLABAllocationWeight)) {
1862     FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
1863   }
1864 
1865   // Shenandoah needs more C2 nodes to compile some methods with lots of barriers.
1866   // NodeLimitFudgeFactor needs to stay the same relative to MaxNodeLimit.
1867 #ifdef COMPILER2
1868   if (FLAG_IS_DEFAULT(MaxNodeLimit)) {
1869     FLAG_SET_DEFAULT(MaxNodeLimit, MaxNodeLimit * 3);
1870     FLAG_SET_DEFAULT(NodeLimitFudgeFactor, NodeLimitFudgeFactor * 3);
1871   }
1872 #endif
1873 #endif
1874 }
1875 
1876 #if !INCLUDE_ALL_GCS
1877 #ifdef ASSERT
1878 static bool verify_serial_gc_flags() {
1879   return (UseSerialGC &&
1880         !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1881           UseParallelGC || UseParallelOldGC));
1882 }
1883 #endif // ASSERT
1884 #endif // INCLUDE_ALL_GCS
1885 
1886 void Arguments::set_gc_specific_flags() {
1887 #if INCLUDE_ALL_GCS
1888   // Set per-collector flags
1889   if (UseParallelGC || UseParallelOldGC) {
1890     set_parallel_gc_flags();
1891   } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
1892     set_cms_and_parnew_gc_flags();


2177       jio_fprintf(defaultStream::output_stream(),
2178                   "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files>\n"
2179                   "where num_of_file > 0\n"
2180                   "GC log rotation is turned off\n");
2181       UseGCLogFileRotation = false;
2182     }
2183   }
2184 
2185   if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8*K)) {
2186     FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K);
2187     jio_fprintf(defaultStream::output_stream(),
2188                 "GCLogFileSize changed to minimum 8K\n");
2189   }
2190 
2191   // Record more information about previous cycles for improved debugging pleasure
2192   if (FLAG_IS_DEFAULT(LogEventsBufferEntries)) {
2193     FLAG_SET_DEFAULT(LogEventsBufferEntries, 250);
2194   }
2195 
2196 #if INCLUDE_ALL_GCS



















2197   if (AlwaysPreTouch || ShenandoahAlwaysPreTouch) {
2198     if (!FLAG_IS_DEFAULT(ShenandoahUncommitDelay)) {
2199       warning("AlwaysPreTouch is enabled, disabling ShenandoahUncommitDelay");
2200     }
2201     FLAG_SET_DEFAULT(ShenandoahUncommitDelay, max_uintx);
2202   }
2203 #endif
2204 }
2205 
2206 // This function is called for -Xloggc:<filename>, it can be used
2207 // to check if a given file name(or string) conforms to the following
2208 // specification:
2209 // A valid string only contains "[A-Z][a-z][0-9].-_%[p|t]"
2210 // %p and %t only allowed once. We only limit usage of filename not path
2211 bool is_filename_valid(const char *file_name) {
2212   const char* p = file_name;
2213   char file_sep = os::file_separator()[0];
2214   const char* cp;
2215   // skip prefix path
2216   for (cp = file_name; *cp != '\0'; cp++) {


< prev index next >