2034 return false; 2035 } 2036 } 2037 #endif 2038 2039 #ifndef SUPPORT_RESERVED_STACK_AREA 2040 if (StackReservedPages != 0) { 2041 FLAG_SET_CMDLINE(intx, StackReservedPages, 0); 2042 warning("Reserved Stack Area not supported on this platform"); 2043 } 2044 #endif 2045 2046 if (!FLAG_IS_DEFAULT(AllocateHeapAt)) { 2047 if ((UseNUMAInterleaving && !FLAG_IS_DEFAULT(UseNUMAInterleaving)) || (UseNUMA && !FLAG_IS_DEFAULT(UseNUMA))) { 2048 log_warning(arguments) ("NUMA support for Heap depends on the file system when AllocateHeapAt option is used.\n"); 2049 } 2050 } 2051 2052 status = status && GCArguments::check_args_consistency(); 2053 2054 return status; 2055 } 2056 2057 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, 2058 const char* option_type) { 2059 if (ignore) return false; 2060 2061 const char* spacer = " "; 2062 if (option_type == NULL) { 2063 option_type = ++spacer; // Set both to the empty string. 2064 } 2065 2066 jio_fprintf(defaultStream::error_stream(), 2067 "Unrecognized %s%soption: %s\n", option_type, spacer, 2068 option->optionString); 2069 return true; 2070 } 2071 2072 static const char* user_assertion_options[] = { 2073 "-da", "-ea", "-disableassertions", "-enableassertions", 0 2910 #endif // INCLUDE_MANAGEMENT 2911 #if INCLUDE_JFR 2912 } else if (match_jfr_option(&option)) { 2913 return JNI_EINVAL; 2914 #endif 2915 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx 2916 // Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have 2917 // already been handled 2918 if ((strncmp(tail, "Flags=", strlen("Flags=")) != 0) && 2919 (strncmp(tail, "VMOptionsFile=", strlen("VMOptionsFile=")) != 0)) { 2920 if (!process_argument(tail, args->ignoreUnrecognized, origin)) { 2921 return JNI_EINVAL; 2922 } 2923 } 2924 // Unknown option 2925 } else if (is_bad_option(option, args->ignoreUnrecognized)) { 2926 return JNI_ERR; 2927 } 2928 } 2929 2930 // PrintSharedArchiveAndExit will turn on 2931 // -Xshare:on 2932 // -Xlog:class+path=info 2933 if (PrintSharedArchiveAndExit) { 2934 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != JVMFlag::SUCCESS) { 2935 return JNI_EINVAL; 2936 } 2937 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true) != JVMFlag::SUCCESS) { 2938 return JNI_EINVAL; 2939 } 2940 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, path)); 2941 } 2942 2943 // Change the default value for flags which have different default values 2944 // when working with older JDKs. 2945 #ifdef LINUX 2946 if (JDK_Version::current().compare_major(6) <= 0 && 2947 FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) { 2948 FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false); 2949 } 3898 "; ignoring UseBiasedLocking flag." ); 3899 } 3900 UseBiasedLocking = false; 3901 } 3902 3903 #ifdef CC_INTERP 3904 // Clear flags not supported on zero. 3905 FLAG_SET_DEFAULT(ProfileInterpreter, false); 3906 FLAG_SET_DEFAULT(UseBiasedLocking, false); 3907 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); 3908 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedClassPointers, false)); 3909 #endif // CC_INTERP 3910 3911 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 3912 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); 3913 DebugNonSafepoints = true; 3914 } 3915 3916 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) { 3917 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used"); 3918 } 3919 3920 #ifndef PRODUCT 3921 if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { 3922 if (use_vm_log()) { 3923 LogVMOutput = true; 3924 } 3925 } 3926 #endif // PRODUCT 3927 3928 if (PrintCommandLineFlags) { 3929 JVMFlag::printSetFlags(tty); 3930 } 3931 3932 // Apply CPU specific policy for the BiasedLocking 3933 if (UseBiasedLocking) { 3934 if (!VM_Version::use_biased_locking() && 3935 !(FLAG_IS_CMDLINE(UseBiasedLocking))) { 3936 UseBiasedLocking = false; 3937 } | 2034 return false; 2035 } 2036 } 2037 #endif 2038 2039 #ifndef SUPPORT_RESERVED_STACK_AREA 2040 if (StackReservedPages != 0) { 2041 FLAG_SET_CMDLINE(intx, StackReservedPages, 0); 2042 warning("Reserved Stack Area not supported on this platform"); 2043 } 2044 #endif 2045 2046 if (!FLAG_IS_DEFAULT(AllocateHeapAt)) { 2047 if ((UseNUMAInterleaving && !FLAG_IS_DEFAULT(UseNUMAInterleaving)) || (UseNUMA && !FLAG_IS_DEFAULT(UseNUMA))) { 2048 log_warning(arguments) ("NUMA support for Heap depends on the file system when AllocateHeapAt option is used.\n"); 2049 } 2050 } 2051 2052 status = status && GCArguments::check_args_consistency(); 2053 2054 if (LP64_ONLY(false &&) !FLAG_IS_DEFAULT(ValueTypePassFieldsAsArgs)) { 2055 FLAG_SET_CMDLINE(bool, ValueTypePassFieldsAsArgs, false); 2056 warning("ValueTypePassFieldsAsArgs is not supported on this platform"); 2057 } 2058 2059 if (LP64_ONLY(false &&) !FLAG_IS_DEFAULT(ValueTypeReturnedAsFields)) { 2060 FLAG_SET_CMDLINE(bool, ValueTypeReturnedAsFields, false); 2061 warning("ValueTypeReturnedAsFields is not supported on this platform"); 2062 } 2063 2064 if (EnableValhalla) { 2065 if (!EnableValhallaC1) { 2066 // C1 support for value types is incomplete. Don't use it by default. 2067 if (!FLAG_IS_DEFAULT(TieredCompilation)) { 2068 warning("TieredCompilation disabled because value types are not supported by C1"); 2069 } 2070 FLAG_SET_CMDLINE(bool, TieredCompilation, false); 2071 } else { 2072 if (TieredStopAtLevel > 1) { 2073 warning("C1 doesn't work with C2 yet. Forcing TieredStopAtLevel=1"); 2074 FLAG_SET_CMDLINE(intx, TieredStopAtLevel, 1); 2075 } 2076 if (ValueTypePassFieldsAsArgs) { 2077 warning("C1 doesn't work with ValueTypePassFieldsAsArgs yet. Forcing ValueTypePassFieldsAsArgs=false"); 2078 FLAG_SET_CMDLINE(bool, ValueTypePassFieldsAsArgs, false); 2079 } 2080 if (ValueTypeReturnedAsFields) { 2081 warning("C1 doesn't work with ValueTypeReturnedAsFields yet. Forcing ValueTypeReturnedAsFields=false"); 2082 FLAG_SET_CMDLINE(bool, ValueTypeReturnedAsFields, false); 2083 } 2084 } 2085 } else { 2086 FLAG_SET_CMDLINE(bool, ValueArrayFlatten, false); 2087 } 2088 if (!EnableValhalla && ACmpOnValues != 3) { 2089 FLAG_SET_CMDLINE(uint, ACmpOnValues, 0); 2090 } 2091 return status; 2092 } 2093 2094 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, 2095 const char* option_type) { 2096 if (ignore) return false; 2097 2098 const char* spacer = " "; 2099 if (option_type == NULL) { 2100 option_type = ++spacer; // Set both to the empty string. 2101 } 2102 2103 jio_fprintf(defaultStream::error_stream(), 2104 "Unrecognized %s%soption: %s\n", option_type, spacer, 2105 option->optionString); 2106 return true; 2107 } 2108 2109 static const char* user_assertion_options[] = { 2110 "-da", "-ea", "-disableassertions", "-enableassertions", 0 2947 #endif // INCLUDE_MANAGEMENT 2948 #if INCLUDE_JFR 2949 } else if (match_jfr_option(&option)) { 2950 return JNI_EINVAL; 2951 #endif 2952 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx 2953 // Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have 2954 // already been handled 2955 if ((strncmp(tail, "Flags=", strlen("Flags=")) != 0) && 2956 (strncmp(tail, "VMOptionsFile=", strlen("VMOptionsFile=")) != 0)) { 2957 if (!process_argument(tail, args->ignoreUnrecognized, origin)) { 2958 return JNI_EINVAL; 2959 } 2960 } 2961 // Unknown option 2962 } else if (is_bad_option(option, args->ignoreUnrecognized)) { 2963 return JNI_ERR; 2964 } 2965 } 2966 2967 if (EnableValhalla) { 2968 if (!create_property("valhalla.enableValhalla", "true", InternalProperty)) { 2969 return JNI_ENOMEM; 2970 } 2971 } 2972 2973 // PrintSharedArchiveAndExit will turn on 2974 // -Xshare:on 2975 // -Xlog:class+path=info 2976 if (PrintSharedArchiveAndExit) { 2977 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != JVMFlag::SUCCESS) { 2978 return JNI_EINVAL; 2979 } 2980 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true) != JVMFlag::SUCCESS) { 2981 return JNI_EINVAL; 2982 } 2983 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, path)); 2984 } 2985 2986 // Change the default value for flags which have different default values 2987 // when working with older JDKs. 2988 #ifdef LINUX 2989 if (JDK_Version::current().compare_major(6) <= 0 && 2990 FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) { 2991 FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false); 2992 } 3941 "; ignoring UseBiasedLocking flag." ); 3942 } 3943 UseBiasedLocking = false; 3944 } 3945 3946 #ifdef CC_INTERP 3947 // Clear flags not supported on zero. 3948 FLAG_SET_DEFAULT(ProfileInterpreter, false); 3949 FLAG_SET_DEFAULT(UseBiasedLocking, false); 3950 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); 3951 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedClassPointers, false)); 3952 #endif // CC_INTERP 3953 3954 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 3955 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); 3956 DebugNonSafepoints = true; 3957 } 3958 3959 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) { 3960 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used"); 3961 } 3962 3963 if (!EnableValhalla || is_interpreter_only()) { 3964 // Disable calling convention optimizations if value types are not supported 3965 ValueTypePassFieldsAsArgs = false; 3966 ValueTypeReturnedAsFields = false; 3967 } 3968 3969 #ifndef PRODUCT 3970 if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { 3971 if (use_vm_log()) { 3972 LogVMOutput = true; 3973 } 3974 } 3975 #endif // PRODUCT 3976 3977 if (PrintCommandLineFlags) { 3978 JVMFlag::printSetFlags(tty); 3979 } 3980 3981 // Apply CPU specific policy for the BiasedLocking 3982 if (UseBiasedLocking) { 3983 if (!VM_Version::use_biased_locking() && 3984 !(FLAG_IS_CMDLINE(UseBiasedLocking))) { 3985 UseBiasedLocking = false; 3986 } |