1833 #if !INCLUDE_ALL_GCS
1834 #ifdef ASSERT
1835 static bool verify_serial_gc_flags() {
1836 return (UseSerialGC &&
1837 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1838 UseParallelGC || UseParallelOldGC));
1839 }
1840 #endif // ASSERT
1841 #endif // INCLUDE_ALL_GCS
1842
1843 // check if do gclog rotation
1844 // +UseGCLogFileRotation is a must,
1845 // no gc log rotation when log file not supplied or
1846 // NumberOfGCLogFiles is 0, or GCLogFileSize is 0
1847 void check_gclog_consistency() {
1848 if (UseGCLogFileRotation) {
1849 if ((Arguments::gc_log_filename() == NULL) ||
1850 (NumberOfGCLogFiles == 0) ||
1851 (GCLogFileSize == 0)) {
1852 jio_fprintf(defaultStream::output_stream(),
1853 "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files> -XX:GCLogFileSize=<num_of_size>\n"
1854 "where num_of_file > 0 and num_of_size > 0\n"
1855 "GC log rotation is turned off\n");
1856 UseGCLogFileRotation = false;
1857 }
1858 }
1859
1860 if (UseGCLogFileRotation && GCLogFileSize < 8*K) {
1861 FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K);
1862 jio_fprintf(defaultStream::output_stream(),
1863 "GCLogFileSize changed to minimum 8K\n");
1864 }
1865 }
1866
1867 // Check consistency of GC selection
1868 bool Arguments::check_gc_consistency() {
1869 check_gclog_consistency();
1870 bool status = true;
1871 // Ensure that the user has not selected conflicting sets
1872 // of collectors. [Note: this check is merely a user convenience;
1873 // collectors over-ride each other so that only a non-conflicting
1874 // set is selected; however what the user gets is not what they
1875 // may have expected from the combination they asked for. It's
1876 // better to reduce user confusion by not allowing them to
1877 // select conflicting combinations.
1878 uint i = 0;
1879 if (UseSerialGC) i++;
1880 if (UseConcMarkSweepGC || UseParNewGC) i++;
1881 if (UseParallelGC || UseParallelOldGC) i++;
1882 if (UseG1GC) i++;
1883 if (i > 1) {
1884 jio_fprintf(defaultStream::error_stream(),
1885 "Conflicting collector combinations in option list; "
1886 "please refer to the release notes for the combinations "
2800 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false);
2801 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false);
2802 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
2803 return JNI_EINVAL;
2804 }
2805 // -Xdebug
2806 } else if (match_option(option, "-Xdebug", &tail)) {
2807 // note this flag has been used, then ignore
2808 set_xdebug_mode(true);
2809 // -Xnoagent
2810 } else if (match_option(option, "-Xnoagent", &tail)) {
2811 // For compatibility with classic. HotSpot refuses to load the old style agent.dll.
2812 } else if (match_option(option, "-Xboundthreads", &tail)) {
2813 // Bind user level threads to kernel threads (Solaris only)
2814 FLAG_SET_CMDLINE(bool, UseBoundThreads, true);
2815 } else if (match_option(option, "-Xloggc:", &tail)) {
2816 // Redirect GC output to the file. -Xloggc:<filename>
2817 // ostream_init_log(), when called will use this filename
2818 // to initialize a fileStream.
2819 _gc_log_filename = strdup(tail);
2820 FLAG_SET_CMDLINE(bool, PrintGC, true);
2821 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true);
2822
2823 // JNI hooks
2824 } else if (match_option(option, "-Xcheck", &tail)) {
2825 if (!strcmp(tail, ":jni")) {
2826 #if !INCLUDE_JNI_CHECK
2827 warning("JNI CHECKING is not supported in this VM");
2828 #else
2829 CheckJNICalls = true;
2830 #endif // INCLUDE_JNI_CHECK
2831 } else if (is_bad_option(option, args->ignoreUnrecognized,
2832 "check")) {
2833 return JNI_EINVAL;
2834 }
2835 } else if (match_option(option, "vfprintf", &tail)) {
2836 _vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo);
2837 } else if (match_option(option, "exit", &tail)) {
2838 _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo);
2839 } else if (match_option(option, "abort", &tail)) {
|
1833 #if !INCLUDE_ALL_GCS
1834 #ifdef ASSERT
1835 static bool verify_serial_gc_flags() {
1836 return (UseSerialGC &&
1837 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1838 UseParallelGC || UseParallelOldGC));
1839 }
1840 #endif // ASSERT
1841 #endif // INCLUDE_ALL_GCS
1842
1843 // check if do gclog rotation
1844 // +UseGCLogFileRotation is a must,
1845 // no gc log rotation when log file not supplied or
1846 // NumberOfGCLogFiles is 0, or GCLogFileSize is 0
1847 void check_gclog_consistency() {
1848 if (UseGCLogFileRotation) {
1849 if ((Arguments::gc_log_filename() == NULL) ||
1850 (NumberOfGCLogFiles == 0) ||
1851 (GCLogFileSize == 0)) {
1852 jio_fprintf(defaultStream::output_stream(),
1853 "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files> -XX:GCLogFileSize=<num_of_size>[k|K|m|M|g|G]\n"
1854 "where num_of_file > 0 and num_of_size > 0\n"
1855 "GC log rotation is turned off\n");
1856 UseGCLogFileRotation = false;
1857 }
1858 }
1859
1860 if (UseGCLogFileRotation && GCLogFileSize < 8*K) {
1861 FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K);
1862 jio_fprintf(defaultStream::output_stream(),
1863 "GCLogFileSize changed to minimum 8K\n");
1864 }
1865 }
1866
1867 // This function is called for -Xloggc:<filename>, it can be used
1868 // to check if a given file name(or string) conforms to the following
1869 // specification:
1870 // A valid string only contains "[A-Z][a-z][0-9].-_%[p|t]"
1871 // %p and %t only allowed once.
1872 bool is_filename_valid(const char *file_name) {
1873 const char* p = file_name;
1874 int count_p = 0;
1875 int count_t = 0;
1876 while (*p != '\0') {
1877 if ((*p >= '0' && *p <= '9') ||
1878 (*p >= 'A' && *p <= 'Z') ||
1879 (*p >= 'a' && *p <= 'z') ||
1880 *p == '-' ||
1881 *p == '_' ||
1882 *p == '.') {
1883 p++;
1884 continue;
1885 }
1886 if (*p == '%') {
1887 if(*(p + 1) == 'p') {
1888 p += 2;
1889 count_p ++;
1890 continue;
1891 }
1892 if (*(p + 1) == 't') {
1893 p += 2;
1894 count_t ++;
1895 continue;
1896 }
1897 }
1898 return false;
1899 }
1900 return count_p < 2 && count_t < 2;
1901 }
1902
1903 // Check consistency of GC selection
1904 bool Arguments::check_gc_consistency() {
1905 check_gclog_consistency();
1906 bool status = true;
1907 // Ensure that the user has not selected conflicting sets
1908 // of collectors. [Note: this check is merely a user convenience;
1909 // collectors over-ride each other so that only a non-conflicting
1910 // set is selected; however what the user gets is not what they
1911 // may have expected from the combination they asked for. It's
1912 // better to reduce user confusion by not allowing them to
1913 // select conflicting combinations.
1914 uint i = 0;
1915 if (UseSerialGC) i++;
1916 if (UseConcMarkSweepGC || UseParNewGC) i++;
1917 if (UseParallelGC || UseParallelOldGC) i++;
1918 if (UseG1GC) i++;
1919 if (i > 1) {
1920 jio_fprintf(defaultStream::error_stream(),
1921 "Conflicting collector combinations in option list; "
1922 "please refer to the release notes for the combinations "
2836 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false);
2837 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false);
2838 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
2839 return JNI_EINVAL;
2840 }
2841 // -Xdebug
2842 } else if (match_option(option, "-Xdebug", &tail)) {
2843 // note this flag has been used, then ignore
2844 set_xdebug_mode(true);
2845 // -Xnoagent
2846 } else if (match_option(option, "-Xnoagent", &tail)) {
2847 // For compatibility with classic. HotSpot refuses to load the old style agent.dll.
2848 } else if (match_option(option, "-Xboundthreads", &tail)) {
2849 // Bind user level threads to kernel threads (Solaris only)
2850 FLAG_SET_CMDLINE(bool, UseBoundThreads, true);
2851 } else if (match_option(option, "-Xloggc:", &tail)) {
2852 // Redirect GC output to the file. -Xloggc:<filename>
2853 // ostream_init_log(), when called will use this filename
2854 // to initialize a fileStream.
2855 _gc_log_filename = strdup(tail);
2856 if (!is_filename_valid(_gc_log_filename)) {
2857 jio_fprintf(defaultStream::output_stream(),
2858 "Filename can only cantain [A-Z][a-z][0-9]-_.%%[p|t]\n"
2859 "%%p and %%t can only show up once\n" );
2860 return JNI_EINVAL;
2861 }
2862 FLAG_SET_CMDLINE(bool, PrintGC, true);
2863 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true);
2864
2865 // JNI hooks
2866 } else if (match_option(option, "-Xcheck", &tail)) {
2867 if (!strcmp(tail, ":jni")) {
2868 #if !INCLUDE_JNI_CHECK
2869 warning("JNI CHECKING is not supported in this VM");
2870 #else
2871 CheckJNICalls = true;
2872 #endif // INCLUDE_JNI_CHECK
2873 } else if (is_bad_option(option, args->ignoreUnrecognized,
2874 "check")) {
2875 return JNI_EINVAL;
2876 }
2877 } else if (match_option(option, "vfprintf", &tail)) {
2878 _vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo);
2879 } else if (match_option(option, "exit", &tail)) {
2880 _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo);
2881 } else if (match_option(option, "abort", &tail)) {
|