831 default: |
831 default: |
832 ShouldNotReachHere(); |
832 ShouldNotReachHere(); |
833 } |
833 } |
834 } |
834 } |
835 |
835 |
836 static bool set_bool_flag(const char* name, bool value, Flag::Flags origin) { |
836 static bool set_bool_flag(const char* name, bool value, JVMFlag::Flags origin) { |
837 if (CommandLineFlags::boolAtPut(name, &value, origin) == Flag::SUCCESS) { |
837 if (JVMFlag::boolAtPut(name, &value, origin) == JVMFlag::SUCCESS) { |
838 return true; |
838 return true; |
839 } else { |
839 } else { |
840 return false; |
840 return false; |
841 } |
841 } |
842 } |
842 } |
843 |
843 |
844 static bool set_fp_numeric_flag(const char* name, char* value, Flag::Flags origin) { |
844 static bool set_fp_numeric_flag(const char* name, char* value, JVMFlag::Flags origin) { |
845 char* end; |
845 char* end; |
846 errno = 0; |
846 errno = 0; |
847 double v = strtod(value, &end); |
847 double v = strtod(value, &end); |
848 if ((errno != 0) || (*end != 0)) { |
848 if ((errno != 0) || (*end != 0)) { |
849 return false; |
849 return false; |
850 } |
850 } |
851 |
851 |
852 if (CommandLineFlags::doubleAtPut(name, &v, origin) == Flag::SUCCESS) { |
852 if (JVMFlag::doubleAtPut(name, &v, origin) == JVMFlag::SUCCESS) { |
853 return true; |
853 return true; |
854 } |
854 } |
855 return false; |
855 return false; |
856 } |
856 } |
857 |
857 |
858 static bool set_numeric_flag(const char* name, char* value, Flag::Flags origin) { |
858 static bool set_numeric_flag(const char* name, char* value, JVMFlag::Flags origin) { |
859 julong v; |
859 julong v; |
860 int int_v; |
860 int int_v; |
861 intx intx_v; |
861 intx intx_v; |
862 bool is_neg = false; |
862 bool is_neg = false; |
863 Flag* result = Flag::find_flag(name, strlen(name)); |
863 JVMFlag* result = JVMFlag::find_flag(name, strlen(name)); |
864 |
864 |
865 if (result == NULL) { |
865 if (result == NULL) { |
866 return false; |
866 return false; |
867 } |
867 } |
868 |
868 |
880 if (result->is_int()) { |
880 if (result->is_int()) { |
881 int_v = (int) v; |
881 int_v = (int) v; |
882 if (is_neg) { |
882 if (is_neg) { |
883 int_v = -int_v; |
883 int_v = -int_v; |
884 } |
884 } |
885 return CommandLineFlags::intAtPut(result, &int_v, origin) == Flag::SUCCESS; |
885 return JVMFlag::intAtPut(result, &int_v, origin) == JVMFlag::SUCCESS; |
886 } else if (result->is_uint()) { |
886 } else if (result->is_uint()) { |
887 uint uint_v = (uint) v; |
887 uint uint_v = (uint) v; |
888 return CommandLineFlags::uintAtPut(result, &uint_v, origin) == Flag::SUCCESS; |
888 return JVMFlag::uintAtPut(result, &uint_v, origin) == JVMFlag::SUCCESS; |
889 } else if (result->is_intx()) { |
889 } else if (result->is_intx()) { |
890 intx_v = (intx) v; |
890 intx_v = (intx) v; |
891 if (is_neg) { |
891 if (is_neg) { |
892 intx_v = -intx_v; |
892 intx_v = -intx_v; |
893 } |
893 } |
894 return CommandLineFlags::intxAtPut(result, &intx_v, origin) == Flag::SUCCESS; |
894 return JVMFlag::intxAtPut(result, &intx_v, origin) == JVMFlag::SUCCESS; |
895 } else if (result->is_uintx()) { |
895 } else if (result->is_uintx()) { |
896 uintx uintx_v = (uintx) v; |
896 uintx uintx_v = (uintx) v; |
897 return CommandLineFlags::uintxAtPut(result, &uintx_v, origin) == Flag::SUCCESS; |
897 return JVMFlag::uintxAtPut(result, &uintx_v, origin) == JVMFlag::SUCCESS; |
898 } else if (result->is_uint64_t()) { |
898 } else if (result->is_uint64_t()) { |
899 uint64_t uint64_t_v = (uint64_t) v; |
899 uint64_t uint64_t_v = (uint64_t) v; |
900 return CommandLineFlags::uint64_tAtPut(result, &uint64_t_v, origin) == Flag::SUCCESS; |
900 return JVMFlag::uint64_tAtPut(result, &uint64_t_v, origin) == JVMFlag::SUCCESS; |
901 } else if (result->is_size_t()) { |
901 } else if (result->is_size_t()) { |
902 size_t size_t_v = (size_t) v; |
902 size_t size_t_v = (size_t) v; |
903 return CommandLineFlags::size_tAtPut(result, &size_t_v, origin) == Flag::SUCCESS; |
903 return JVMFlag::size_tAtPut(result, &size_t_v, origin) == JVMFlag::SUCCESS; |
904 } else if (result->is_double()) { |
904 } else if (result->is_double()) { |
905 double double_v = (double) v; |
905 double double_v = (double) v; |
906 return CommandLineFlags::doubleAtPut(result, &double_v, origin) == Flag::SUCCESS; |
906 return JVMFlag::doubleAtPut(result, &double_v, origin) == JVMFlag::SUCCESS; |
907 } else { |
907 } else { |
908 return false; |
908 return false; |
909 } |
909 } |
910 } |
910 } |
911 |
911 |
912 static bool set_string_flag(const char* name, const char* value, Flag::Flags origin) { |
912 static bool set_string_flag(const char* name, const char* value, JVMFlag::Flags origin) { |
913 if (CommandLineFlags::ccstrAtPut(name, &value, origin) != Flag::SUCCESS) return false; |
913 if (JVMFlag::ccstrAtPut(name, &value, origin) != JVMFlag::SUCCESS) return false; |
914 // Contract: CommandLineFlags always returns a pointer that needs freeing. |
914 // Contract: JVMFlag always returns a pointer that needs freeing. |
915 FREE_C_HEAP_ARRAY(char, value); |
915 FREE_C_HEAP_ARRAY(char, value); |
916 return true; |
916 return true; |
917 } |
917 } |
918 |
918 |
919 static bool append_to_string_flag(const char* name, const char* new_value, Flag::Flags origin) { |
919 static bool append_to_string_flag(const char* name, const char* new_value, JVMFlag::Flags origin) { |
920 const char* old_value = ""; |
920 const char* old_value = ""; |
921 if (CommandLineFlags::ccstrAt(name, &old_value) != Flag::SUCCESS) return false; |
921 if (JVMFlag::ccstrAt(name, &old_value) != JVMFlag::SUCCESS) return false; |
922 size_t old_len = old_value != NULL ? strlen(old_value) : 0; |
922 size_t old_len = old_value != NULL ? strlen(old_value) : 0; |
923 size_t new_len = strlen(new_value); |
923 size_t new_len = strlen(new_value); |
924 const char* value; |
924 const char* value; |
925 char* free_this_too = NULL; |
925 char* free_this_too = NULL; |
926 if (old_len == 0) { |
926 if (old_len == 0) { |
1264 #endif //PRODUCT |
1264 #endif //PRODUCT |
1265 } |
1265 } |
1266 |
1266 |
1267 // For locked flags, report a custom error message if available. |
1267 // For locked flags, report a custom error message if available. |
1268 // Otherwise, report the standard unrecognized VM option. |
1268 // Otherwise, report the standard unrecognized VM option. |
1269 Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true, true); |
1269 JVMFlag* found_flag = JVMFlag::find_flag((const char*)argname, arg_len, true, true); |
1270 if (found_flag != NULL) { |
1270 if (found_flag != NULL) { |
1271 char locked_message_buf[BUFLEN]; |
1271 char locked_message_buf[BUFLEN]; |
1272 Flag::MsgType msg_type = found_flag->get_locked_message(locked_message_buf, BUFLEN); |
1272 JVMFlag::MsgType msg_type = found_flag->get_locked_message(locked_message_buf, BUFLEN); |
1273 if (strlen(locked_message_buf) == 0) { |
1273 if (strlen(locked_message_buf) == 0) { |
1274 if (found_flag->is_bool() && !has_plus_minus) { |
1274 if (found_flag->is_bool() && !has_plus_minus) { |
1275 jio_fprintf(defaultStream::error_stream(), |
1275 jio_fprintf(defaultStream::error_stream(), |
1276 "Missing +/- setting for VM option '%s'\n", argname); |
1276 "Missing +/- setting for VM option '%s'\n", argname); |
1277 } else if (!found_flag->is_bool() && has_plus_minus) { |
1277 } else if (!found_flag->is_bool() && has_plus_minus) { |
1989 total_memory - (julong) 160 * M); |
1989 total_memory - (julong) 160 * M); |
1990 |
1990 |
1991 initHeapSize = limit_by_allocatable_memory(initHeapSize); |
1991 initHeapSize = limit_by_allocatable_memory(initHeapSize); |
1992 |
1992 |
1993 if (FLAG_IS_DEFAULT(MaxHeapSize)) { |
1993 if (FLAG_IS_DEFAULT(MaxHeapSize)) { |
1994 if (FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize) != Flag::SUCCESS) { |
1994 if (FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize) != JVMFlag::SUCCESS) { |
1995 return JNI_EINVAL; |
1995 return JNI_EINVAL; |
1996 } |
1996 } |
1997 if (FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize) != Flag::SUCCESS) { |
1997 if (FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize) != JVMFlag::SUCCESS) { |
1998 return JNI_EINVAL; |
1998 return JNI_EINVAL; |
1999 } |
1999 } |
2000 // Currently the minimum size and the initial heap sizes are the same. |
2000 // Currently the minimum size and the initial heap sizes are the same. |
2001 set_min_heap_size(initHeapSize); |
2001 set_min_heap_size(initHeapSize); |
2002 } |
2002 } |
2003 if (FLAG_IS_DEFAULT(NewSize)) { |
2003 if (FLAG_IS_DEFAULT(NewSize)) { |
2004 // Make the young generation 3/8ths of the total heap. |
2004 // Make the young generation 3/8ths of the total heap. |
2005 if (FLAG_SET_CMDLINE(size_t, NewSize, |
2005 if (FLAG_SET_CMDLINE(size_t, NewSize, |
2006 ((julong) MaxHeapSize / (julong) 8) * (julong) 3) != Flag::SUCCESS) { |
2006 ((julong) MaxHeapSize / (julong) 8) * (julong) 3) != JVMFlag::SUCCESS) { |
2007 return JNI_EINVAL; |
2007 return JNI_EINVAL; |
2008 } |
2008 } |
2009 if (FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize) != Flag::SUCCESS) { |
2009 if (FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize) != JVMFlag::SUCCESS) { |
2010 return JNI_EINVAL; |
2010 return JNI_EINVAL; |
2011 } |
2011 } |
2012 } |
2012 } |
2013 |
2013 |
2014 #if !defined(_ALLBSD_SOURCE) && !defined(AIX) // UseLargePages is not yet supported on BSD and AIX. |
2014 #if !defined(_ALLBSD_SOURCE) && !defined(AIX) // UseLargePages is not yet supported on BSD and AIX. |
2015 FLAG_SET_DEFAULT(UseLargePages, true); |
2015 FLAG_SET_DEFAULT(UseLargePages, true); |
2016 #endif |
2016 #endif |
2017 |
2017 |
2018 // Increase some data structure sizes for efficiency |
2018 // Increase some data structure sizes for efficiency |
2019 if (FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize) != Flag::SUCCESS) { |
2019 if (FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize) != JVMFlag::SUCCESS) { |
2020 return JNI_EINVAL; |
2020 return JNI_EINVAL; |
2021 } |
2021 } |
2022 if (FLAG_SET_CMDLINE(bool, ResizeTLAB, false) != Flag::SUCCESS) { |
2022 if (FLAG_SET_CMDLINE(bool, ResizeTLAB, false) != JVMFlag::SUCCESS) { |
2023 return JNI_EINVAL; |
2023 return JNI_EINVAL; |
2024 } |
2024 } |
2025 if (FLAG_SET_CMDLINE(size_t, TLABSize, 256 * K) != Flag::SUCCESS) { |
2025 if (FLAG_SET_CMDLINE(size_t, TLABSize, 256 * K) != JVMFlag::SUCCESS) { |
2026 return JNI_EINVAL; |
2026 return JNI_EINVAL; |
2027 } |
2027 } |
2028 |
2028 |
2029 // See the OldPLABSize comment below, but replace 'after promotion' |
2029 // See the OldPLABSize comment below, but replace 'after promotion' |
2030 // with 'after copying'. YoungPLABSize is the size of the survivor |
2030 // with 'after copying'. YoungPLABSize is the size of the survivor |
2031 // space per-gc-thread buffers. The default is 4kw. |
2031 // space per-gc-thread buffers. The default is 4kw. |
2032 if (FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256 * K) != Flag::SUCCESS) { // Note: this is in words |
2032 if (FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256 * K) != JVMFlag::SUCCESS) { // Note: this is in words |
2033 return JNI_EINVAL; |
2033 return JNI_EINVAL; |
2034 } |
2034 } |
2035 |
2035 |
2036 // OldPLABSize is the size of the buffers in the old gen that |
2036 // OldPLABSize is the size of the buffers in the old gen that |
2037 // UseParallelGC uses to promote live data that doesn't fit in the |
2037 // UseParallelGC uses to promote live data that doesn't fit in the |
2044 // is that a bigger PLAB results in retaining something like the |
2044 // is that a bigger PLAB results in retaining something like the |
2045 // original allocation order after promotion, which improves mutator |
2045 // original allocation order after promotion, which improves mutator |
2046 // locality. A minor effect may be that larger PLABs reduce the |
2046 // locality. A minor effect may be that larger PLABs reduce the |
2047 // number of PLAB allocation events during gc. The value of 8kw |
2047 // number of PLAB allocation events during gc. The value of 8kw |
2048 // was arrived at by experimenting with specjbb. |
2048 // was arrived at by experimenting with specjbb. |
2049 if (FLAG_SET_CMDLINE(size_t, OldPLABSize, 8 * K) != Flag::SUCCESS) { // Note: this is in words |
2049 if (FLAG_SET_CMDLINE(size_t, OldPLABSize, 8 * K) != JVMFlag::SUCCESS) { // Note: this is in words |
2050 return JNI_EINVAL; |
2050 return JNI_EINVAL; |
2051 } |
2051 } |
2052 |
2052 |
2053 // Enable parallel GC and adaptive generation sizing |
2053 // Enable parallel GC and adaptive generation sizing |
2054 if (FLAG_SET_CMDLINE(bool, UseParallelGC, true) != Flag::SUCCESS) { |
2054 if (FLAG_SET_CMDLINE(bool, UseParallelGC, true) != JVMFlag::SUCCESS) { |
2055 return JNI_EINVAL; |
2055 return JNI_EINVAL; |
2056 } |
2056 } |
2057 |
2057 |
2058 // Encourage steady state memory management |
2058 // Encourage steady state memory management |
2059 if (FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100) != Flag::SUCCESS) { |
2059 if (FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100) != JVMFlag::SUCCESS) { |
2060 return JNI_EINVAL; |
2060 return JNI_EINVAL; |
2061 } |
2061 } |
2062 |
2062 |
2063 // This appears to improve mutator locality |
2063 // This appears to improve mutator locality |
2064 if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) { |
2064 if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != JVMFlag::SUCCESS) { |
2065 return JNI_EINVAL; |
2065 return JNI_EINVAL; |
2066 } |
2066 } |
2067 |
2067 |
2068 // Get around early Solaris scheduling bug |
2068 // Get around early Solaris scheduling bug |
2069 // (affinity vs other jobs on system) |
2069 // (affinity vs other jobs on system) |
2070 // but disallow DR and offlining (5008695). |
2070 // but disallow DR and offlining (5008695). |
2071 if (FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true) != Flag::SUCCESS) { |
2071 if (FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true) != JVMFlag::SUCCESS) { |
2072 return JNI_EINVAL; |
2072 return JNI_EINVAL; |
2073 } |
2073 } |
2074 |
2074 |
2075 return JNI_OK; |
2075 return JNI_OK; |
2076 } |
2076 } |
2407 // Setup flags for mixed which is the default |
2407 // Setup flags for mixed which is the default |
2408 set_mode_flags(_mixed); |
2408 set_mode_flags(_mixed); |
2409 |
2409 |
2410 // Parse args structure generated from JAVA_TOOL_OPTIONS environment |
2410 // Parse args structure generated from JAVA_TOOL_OPTIONS environment |
2411 // variable (if present). |
2411 // variable (if present). |
2412 jint result = parse_each_vm_init_arg(java_tool_options_args, &patch_mod_javabase, Flag::ENVIRON_VAR); |
2412 jint result = parse_each_vm_init_arg(java_tool_options_args, &patch_mod_javabase, JVMFlag::ENVIRON_VAR); |
2413 if (result != JNI_OK) { |
2413 if (result != JNI_OK) { |
2414 return result; |
2414 return result; |
2415 } |
2415 } |
2416 |
2416 |
2417 // Parse args structure generated from the command line flags. |
2417 // Parse args structure generated from the command line flags. |
2418 result = parse_each_vm_init_arg(cmd_line_args, &patch_mod_javabase, Flag::COMMAND_LINE); |
2418 result = parse_each_vm_init_arg(cmd_line_args, &patch_mod_javabase, JVMFlag::COMMAND_LINE); |
2419 if (result != JNI_OK) { |
2419 if (result != JNI_OK) { |
2420 return result; |
2420 return result; |
2421 } |
2421 } |
2422 |
2422 |
2423 // Parse args structure generated from the _JAVA_OPTIONS environment |
2423 // Parse args structure generated from the _JAVA_OPTIONS environment |
2424 // variable (if present) (mimics classic VM) |
2424 // variable (if present) (mimics classic VM) |
2425 result = parse_each_vm_init_arg(java_options_args, &patch_mod_javabase, Flag::ENVIRON_VAR); |
2425 result = parse_each_vm_init_arg(java_options_args, &patch_mod_javabase, JVMFlag::ENVIRON_VAR); |
2426 if (result != JNI_OK) { |
2426 if (result != JNI_OK) { |
2427 return result; |
2427 return result; |
2428 } |
2428 } |
2429 |
2429 |
2430 // We need to ensure processor and memory resources have been properly |
2430 // We need to ensure processor and memory resources have been properly |
2597 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, load)); |
2597 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, load)); |
2598 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, unload)); |
2598 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, unload)); |
2599 } else if (!strcmp(tail, ":gc")) { |
2599 } else if (!strcmp(tail, ":gc")) { |
2600 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); |
2600 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); |
2601 } else if (!strcmp(tail, ":jni")) { |
2601 } else if (!strcmp(tail, ":jni")) { |
2602 if (FLAG_SET_CMDLINE(bool, PrintJNIResolving, true) != Flag::SUCCESS) { |
2602 if (FLAG_SET_CMDLINE(bool, PrintJNIResolving, true) != JVMFlag::SUCCESS) { |
2603 return JNI_EINVAL; |
2603 return JNI_EINVAL; |
2604 } |
2604 } |
2605 } |
2605 } |
2606 // -da / -ea / -disableassertions / -enableassertions |
2606 // -da / -ea / -disableassertions / -enableassertions |
2607 // These accept an optional class/package name separated by a colon, e.g., |
2607 // These accept an optional class/package name separated by a colon, e.g., |
2734 // --enable_preview |
2734 // --enable_preview |
2735 } else if (match_option(option, "--enable-preview")) { |
2735 } else if (match_option(option, "--enable-preview")) { |
2736 set_enable_preview(); |
2736 set_enable_preview(); |
2737 // -Xnoclassgc |
2737 // -Xnoclassgc |
2738 } else if (match_option(option, "-Xnoclassgc")) { |
2738 } else if (match_option(option, "-Xnoclassgc")) { |
2739 if (FLAG_SET_CMDLINE(bool, ClassUnloading, false) != Flag::SUCCESS) { |
2739 if (FLAG_SET_CMDLINE(bool, ClassUnloading, false) != JVMFlag::SUCCESS) { |
2740 return JNI_EINVAL; |
2740 return JNI_EINVAL; |
2741 } |
2741 } |
2742 // -Xconcgc |
2742 // -Xconcgc |
2743 } else if (match_option(option, "-Xconcgc")) { |
2743 } else if (match_option(option, "-Xconcgc")) { |
2744 if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true) != Flag::SUCCESS) { |
2744 if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true) != JVMFlag::SUCCESS) { |
2745 return JNI_EINVAL; |
2745 return JNI_EINVAL; |
2746 } |
2746 } |
2747 handle_extra_cms_flags("-Xconcgc uses UseConcMarkSweepGC"); |
2747 handle_extra_cms_flags("-Xconcgc uses UseConcMarkSweepGC"); |
2748 // -Xnoconcgc |
2748 // -Xnoconcgc |
2749 } else if (match_option(option, "-Xnoconcgc")) { |
2749 } else if (match_option(option, "-Xnoconcgc")) { |
2750 if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false) != Flag::SUCCESS) { |
2750 if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false) != JVMFlag::SUCCESS) { |
2751 return JNI_EINVAL; |
2751 return JNI_EINVAL; |
2752 } |
2752 } |
2753 handle_extra_cms_flags("-Xnoconcgc uses UseConcMarkSweepGC"); |
2753 handle_extra_cms_flags("-Xnoconcgc uses UseConcMarkSweepGC"); |
2754 // -Xbatch |
2754 // -Xbatch |
2755 } else if (match_option(option, "-Xbatch")) { |
2755 } else if (match_option(option, "-Xbatch")) { |
2756 if (FLAG_SET_CMDLINE(bool, BackgroundCompilation, false) != Flag::SUCCESS) { |
2756 if (FLAG_SET_CMDLINE(bool, BackgroundCompilation, false) != JVMFlag::SUCCESS) { |
2757 return JNI_EINVAL; |
2757 return JNI_EINVAL; |
2758 } |
2758 } |
2759 // -Xmn for compatibility with other JVM vendors |
2759 // -Xmn for compatibility with other JVM vendors |
2760 } else if (match_option(option, "-Xmn", &tail)) { |
2760 } else if (match_option(option, "-Xmn", &tail)) { |
2761 julong long_initial_young_size = 0; |
2761 julong long_initial_young_size = 0; |
2824 jio_fprintf(defaultStream::error_stream(), |
2824 jio_fprintf(defaultStream::error_stream(), |
2825 "Bad min heap free percentage size: %s\n", |
2825 "Bad min heap free percentage size: %s\n", |
2826 option->optionString); |
2826 option->optionString); |
2827 return JNI_EINVAL; |
2827 return JNI_EINVAL; |
2828 } else { |
2828 } else { |
2829 if (FLAG_SET_CMDLINE(uintx, MinHeapFreeRatio, minf) != Flag::SUCCESS) { |
2829 if (FLAG_SET_CMDLINE(uintx, MinHeapFreeRatio, minf) != JVMFlag::SUCCESS) { |
2830 return JNI_EINVAL; |
2830 return JNI_EINVAL; |
2831 } |
2831 } |
2832 } |
2832 } |
2833 // -Xss |
2833 // -Xss |
2834 } else if (match_option(option, "-Xss", &tail)) { |
2834 } else if (match_option(option, "-Xss", &tail)) { |
2835 intx value = 0; |
2835 intx value = 0; |
2836 jint err = parse_xss(option, tail, &value); |
2836 jint err = parse_xss(option, tail, &value); |
2837 if (err != JNI_OK) { |
2837 if (err != JNI_OK) { |
2838 return err; |
2838 return err; |
2839 } |
2839 } |
2840 if (FLAG_SET_CMDLINE(intx, ThreadStackSize, value) != Flag::SUCCESS) { |
2840 if (FLAG_SET_CMDLINE(intx, ThreadStackSize, value) != JVMFlag::SUCCESS) { |
2841 return JNI_EINVAL; |
2841 return JNI_EINVAL; |
2842 } |
2842 } |
2843 } else if (match_option(option, "-Xmaxjitcodesize", &tail) || |
2843 } else if (match_option(option, "-Xmaxjitcodesize", &tail) || |
2844 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { |
2844 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { |
2845 julong long_ReservedCodeCacheSize = 0; |
2845 julong long_ReservedCodeCacheSize = 0; |
2862 } else if (match_option(option, "-native")) { |
2862 } else if (match_option(option, "-native")) { |
2863 // HotSpot always uses native threads, ignore silently for compatibility |
2863 // HotSpot always uses native threads, ignore silently for compatibility |
2864 // -Xrs |
2864 // -Xrs |
2865 } else if (match_option(option, "-Xrs")) { |
2865 } else if (match_option(option, "-Xrs")) { |
2866 // Classic/EVM option, new functionality |
2866 // Classic/EVM option, new functionality |
2867 if (FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true) != Flag::SUCCESS) { |
2867 if (FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true) != JVMFlag::SUCCESS) { |
2868 return JNI_EINVAL; |
2868 return JNI_EINVAL; |
2869 } |
2869 } |
2870 // -Xprof |
2870 // -Xprof |
2871 } else if (match_option(option, "-Xprof")) { |
2871 } else if (match_option(option, "-Xprof")) { |
2872 char version[256]; |
2872 char version[256]; |
2873 // Obsolete in JDK 10 |
2873 // Obsolete in JDK 10 |
2874 JDK_Version::jdk(10).to_string(version, sizeof(version)); |
2874 JDK_Version::jdk(10).to_string(version, sizeof(version)); |
2875 warning("Ignoring option %s; support was removed in %s", option->optionString, version); |
2875 warning("Ignoring option %s; support was removed in %s", option->optionString, version); |
2876 // -Xconcurrentio |
2876 // -Xconcurrentio |
2877 } else if (match_option(option, "-Xconcurrentio")) { |
2877 } else if (match_option(option, "-Xconcurrentio")) { |
2878 if (FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true) != Flag::SUCCESS) { |
2878 if (FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true) != JVMFlag::SUCCESS) { |
2879 return JNI_EINVAL; |
2879 return JNI_EINVAL; |
2880 } |
2880 } |
2881 if (FLAG_SET_CMDLINE(bool, BackgroundCompilation, false) != Flag::SUCCESS) { |
2881 if (FLAG_SET_CMDLINE(bool, BackgroundCompilation, false) != JVMFlag::SUCCESS) { |
2882 return JNI_EINVAL; |
2882 return JNI_EINVAL; |
2883 } |
2883 } |
2884 SafepointSynchronize::set_defer_thr_suspend_loop_count(); |
2884 SafepointSynchronize::set_defer_thr_suspend_loop_count(); |
2885 if (FLAG_SET_CMDLINE(bool, UseTLAB, false) != Flag::SUCCESS) { |
2885 if (FLAG_SET_CMDLINE(bool, UseTLAB, false) != JVMFlag::SUCCESS) { |
2886 return JNI_EINVAL; |
2886 return JNI_EINVAL; |
2887 } |
2887 } |
2888 if (FLAG_SET_CMDLINE(size_t, NewSizeThreadIncrease, 16 * K) != Flag::SUCCESS) { // 20Kb per thread added to new generation |
2888 if (FLAG_SET_CMDLINE(size_t, NewSizeThreadIncrease, 16 * K) != JVMFlag::SUCCESS) { // 20Kb per thread added to new generation |
2889 return JNI_EINVAL; |
2889 return JNI_EINVAL; |
2890 } |
2890 } |
2891 |
2891 |
2892 // -Xinternalversion |
2892 // -Xinternalversion |
2893 } else if (match_option(option, "-Xinternalversion")) { |
2893 } else if (match_option(option, "-Xinternalversion")) { |
2955 } else if (match_option(option, "-Xcomp")) { |
2955 } else if (match_option(option, "-Xcomp")) { |
2956 // for testing the compiler; turn off all flags that inhibit compilation |
2956 // for testing the compiler; turn off all flags that inhibit compilation |
2957 set_mode_flags(_comp); |
2957 set_mode_flags(_comp); |
2958 // -Xshare:dump |
2958 // -Xshare:dump |
2959 } else if (match_option(option, "-Xshare:dump")) { |
2959 } else if (match_option(option, "-Xshare:dump")) { |
2960 if (FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true) != Flag::SUCCESS) { |
2960 if (FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true) != JVMFlag::SUCCESS) { |
2961 return JNI_EINVAL; |
2961 return JNI_EINVAL; |
2962 } |
2962 } |
2963 set_mode_flags(_int); // Prevent compilation, which creates objects |
2963 set_mode_flags(_int); // Prevent compilation, which creates objects |
2964 // -Xshare:on |
2964 // -Xshare:on |
2965 } else if (match_option(option, "-Xshare:on")) { |
2965 } else if (match_option(option, "-Xshare:on")) { |
2966 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) { |
2966 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != JVMFlag::SUCCESS) { |
2967 return JNI_EINVAL; |
2967 return JNI_EINVAL; |
2968 } |
2968 } |
2969 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true) != Flag::SUCCESS) { |
2969 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true) != JVMFlag::SUCCESS) { |
2970 return JNI_EINVAL; |
2970 return JNI_EINVAL; |
2971 } |
2971 } |
2972 // -Xshare:auto |
2972 // -Xshare:auto |
2973 } else if (match_option(option, "-Xshare:auto")) { |
2973 } else if (match_option(option, "-Xshare:auto")) { |
2974 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) { |
2974 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != JVMFlag::SUCCESS) { |
2975 return JNI_EINVAL; |
2975 return JNI_EINVAL; |
2976 } |
2976 } |
2977 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false) != Flag::SUCCESS) { |
2977 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false) != JVMFlag::SUCCESS) { |
2978 return JNI_EINVAL; |
2978 return JNI_EINVAL; |
2979 } |
2979 } |
2980 // -Xshare:off |
2980 // -Xshare:off |
2981 } else if (match_option(option, "-Xshare:off")) { |
2981 } else if (match_option(option, "-Xshare:off")) { |
2982 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, false) != Flag::SUCCESS) { |
2982 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, false) != JVMFlag::SUCCESS) { |
2983 return JNI_EINVAL; |
2983 return JNI_EINVAL; |
2984 } |
2984 } |
2985 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false) != Flag::SUCCESS) { |
2985 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false) != JVMFlag::SUCCESS) { |
2986 return JNI_EINVAL; |
2986 return JNI_EINVAL; |
2987 } |
2987 } |
2988 // -Xverify |
2988 // -Xverify |
2989 } else if (match_option(option, "-Xverify", &tail)) { |
2989 } else if (match_option(option, "-Xverify", &tail)) { |
2990 if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) { |
2990 if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) { |
2991 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true) != Flag::SUCCESS) { |
2991 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true) != JVMFlag::SUCCESS) { |
2992 return JNI_EINVAL; |
2992 return JNI_EINVAL; |
2993 } |
2993 } |
2994 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true) != Flag::SUCCESS) { |
2994 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true) != JVMFlag::SUCCESS) { |
2995 return JNI_EINVAL; |
2995 return JNI_EINVAL; |
2996 } |
2996 } |
2997 } else if (strcmp(tail, ":remote") == 0) { |
2997 } else if (strcmp(tail, ":remote") == 0) { |
2998 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false) != Flag::SUCCESS) { |
2998 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false) != JVMFlag::SUCCESS) { |
2999 return JNI_EINVAL; |
2999 return JNI_EINVAL; |
3000 } |
3000 } |
3001 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true) != Flag::SUCCESS) { |
3001 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true) != JVMFlag::SUCCESS) { |
3002 return JNI_EINVAL; |
3002 return JNI_EINVAL; |
3003 } |
3003 } |
3004 } else if (strcmp(tail, ":none") == 0) { |
3004 } else if (strcmp(tail, ":none") == 0) { |
3005 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false) != Flag::SUCCESS) { |
3005 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false) != JVMFlag::SUCCESS) { |
3006 return JNI_EINVAL; |
3006 return JNI_EINVAL; |
3007 } |
3007 } |
3008 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false) != Flag::SUCCESS) { |
3008 if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false) != JVMFlag::SUCCESS) { |
3009 return JNI_EINVAL; |
3009 return JNI_EINVAL; |
3010 } |
3010 } |
3011 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) { |
3011 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) { |
3012 return JNI_EINVAL; |
3012 return JNI_EINVAL; |
3013 } |
3013 } |
3062 } else if (match_option(option, "abort")) { |
3062 } else if (match_option(option, "abort")) { |
3063 _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo); |
3063 _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo); |
3064 // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure; |
3064 // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure; |
3065 // and the last option wins. |
3065 // and the last option wins. |
3066 } else if (match_option(option, "-XX:+NeverTenure")) { |
3066 } else if (match_option(option, "-XX:+NeverTenure")) { |
3067 if (FLAG_SET_CMDLINE(bool, NeverTenure, true) != Flag::SUCCESS) { |
3067 if (FLAG_SET_CMDLINE(bool, NeverTenure, true) != JVMFlag::SUCCESS) { |
3068 return JNI_EINVAL; |
3068 return JNI_EINVAL; |
3069 } |
3069 } |
3070 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, false) != Flag::SUCCESS) { |
3070 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, false) != JVMFlag::SUCCESS) { |
3071 return JNI_EINVAL; |
3071 return JNI_EINVAL; |
3072 } |
3072 } |
3073 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1) != Flag::SUCCESS) { |
3073 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1) != JVMFlag::SUCCESS) { |
3074 return JNI_EINVAL; |
3074 return JNI_EINVAL; |
3075 } |
3075 } |
3076 } else if (match_option(option, "-XX:+AlwaysTenure")) { |
3076 } else if (match_option(option, "-XX:+AlwaysTenure")) { |
3077 if (FLAG_SET_CMDLINE(bool, NeverTenure, false) != Flag::SUCCESS) { |
3077 if (FLAG_SET_CMDLINE(bool, NeverTenure, false) != JVMFlag::SUCCESS) { |
3078 return JNI_EINVAL; |
3078 return JNI_EINVAL; |
3079 } |
3079 } |
3080 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, true) != Flag::SUCCESS) { |
3080 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, true) != JVMFlag::SUCCESS) { |
3081 return JNI_EINVAL; |
3081 return JNI_EINVAL; |
3082 } |
3082 } |
3083 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0) != Flag::SUCCESS) { |
3083 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0) != JVMFlag::SUCCESS) { |
3084 return JNI_EINVAL; |
3084 return JNI_EINVAL; |
3085 } |
3085 } |
3086 } else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) { |
3086 } else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) { |
3087 uintx max_tenuring_thresh = 0; |
3087 uintx max_tenuring_thresh = 0; |
3088 if (!parse_uintx(tail, &max_tenuring_thresh, 0)) { |
3088 if (!parse_uintx(tail, &max_tenuring_thresh, 0)) { |
3089 jio_fprintf(defaultStream::error_stream(), |
3089 jio_fprintf(defaultStream::error_stream(), |
3090 "Improperly specified VM option \'MaxTenuringThreshold=%s\'\n", tail); |
3090 "Improperly specified VM option \'MaxTenuringThreshold=%s\'\n", tail); |
3091 return JNI_EINVAL; |
3091 return JNI_EINVAL; |
3092 } |
3092 } |
3093 |
3093 |
3094 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, max_tenuring_thresh) != Flag::SUCCESS) { |
3094 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, max_tenuring_thresh) != JVMFlag::SUCCESS) { |
3095 return JNI_EINVAL; |
3095 return JNI_EINVAL; |
3096 } |
3096 } |
3097 |
3097 |
3098 if (MaxTenuringThreshold == 0) { |
3098 if (MaxTenuringThreshold == 0) { |
3099 if (FLAG_SET_CMDLINE(bool, NeverTenure, false) != Flag::SUCCESS) { |
3099 if (FLAG_SET_CMDLINE(bool, NeverTenure, false) != JVMFlag::SUCCESS) { |
3100 return JNI_EINVAL; |
3100 return JNI_EINVAL; |
3101 } |
3101 } |
3102 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, true) != Flag::SUCCESS) { |
3102 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, true) != JVMFlag::SUCCESS) { |
3103 return JNI_EINVAL; |
3103 return JNI_EINVAL; |
3104 } |
3104 } |
3105 } else { |
3105 } else { |
3106 if (FLAG_SET_CMDLINE(bool, NeverTenure, false) != Flag::SUCCESS) { |
3106 if (FLAG_SET_CMDLINE(bool, NeverTenure, false) != JVMFlag::SUCCESS) { |
3107 return JNI_EINVAL; |
3107 return JNI_EINVAL; |
3108 } |
3108 } |
3109 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, false) != Flag::SUCCESS) { |
3109 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, false) != JVMFlag::SUCCESS) { |
3110 return JNI_EINVAL; |
3110 return JNI_EINVAL; |
3111 } |
3111 } |
3112 } |
3112 } |
3113 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr")) { |
3113 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr")) { |
3114 if (FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false) != Flag::SUCCESS) { |
3114 if (FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false) != JVMFlag::SUCCESS) { |
3115 return JNI_EINVAL; |
3115 return JNI_EINVAL; |
3116 } |
3116 } |
3117 if (FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true) != Flag::SUCCESS) { |
3117 if (FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true) != JVMFlag::SUCCESS) { |
3118 return JNI_EINVAL; |
3118 return JNI_EINVAL; |
3119 } |
3119 } |
3120 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout")) { |
3120 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout")) { |
3121 if (FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false) != Flag::SUCCESS) { |
3121 if (FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false) != JVMFlag::SUCCESS) { |
3122 return JNI_EINVAL; |
3122 return JNI_EINVAL; |
3123 } |
3123 } |
3124 if (FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true) != Flag::SUCCESS) { |
3124 if (FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true) != JVMFlag::SUCCESS) { |
3125 return JNI_EINVAL; |
3125 return JNI_EINVAL; |
3126 } |
3126 } |
3127 } else if (match_option(option, "-XX:+ExtendedDTraceProbes")) { |
3127 } else if (match_option(option, "-XX:+ExtendedDTraceProbes")) { |
3128 #if defined(DTRACE_ENABLED) |
3128 #if defined(DTRACE_ENABLED) |
3129 if (FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true) != Flag::SUCCESS) { |
3129 if (FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true) != JVMFlag::SUCCESS) { |
3130 return JNI_EINVAL; |
3130 return JNI_EINVAL; |
3131 } |
3131 } |
3132 if (FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true) != Flag::SUCCESS) { |
3132 if (FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true) != JVMFlag::SUCCESS) { |
3133 return JNI_EINVAL; |
3133 return JNI_EINVAL; |
3134 } |
3134 } |
3135 if (FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true) != Flag::SUCCESS) { |
3135 if (FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true) != JVMFlag::SUCCESS) { |
3136 return JNI_EINVAL; |
3136 return JNI_EINVAL; |
3137 } |
3137 } |
3138 if (FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true) != Flag::SUCCESS) { |
3138 if (FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true) != JVMFlag::SUCCESS) { |
3139 return JNI_EINVAL; |
3139 return JNI_EINVAL; |
3140 } |
3140 } |
3141 #else // defined(DTRACE_ENABLED) |
3141 #else // defined(DTRACE_ENABLED) |
3142 jio_fprintf(defaultStream::error_stream(), |
3142 jio_fprintf(defaultStream::error_stream(), |
3143 "ExtendedDTraceProbes flag is not applicable for this configuration\n"); |
3143 "ExtendedDTraceProbes flag is not applicable for this configuration\n"); |
3144 return JNI_EINVAL; |
3144 return JNI_EINVAL; |
3145 #endif // defined(DTRACE_ENABLED) |
3145 #endif // defined(DTRACE_ENABLED) |
3146 #ifdef ASSERT |
3146 #ifdef ASSERT |
3147 } else if (match_option(option, "-XX:+FullGCALot")) { |
3147 } else if (match_option(option, "-XX:+FullGCALot")) { |
3148 if (FLAG_SET_CMDLINE(bool, FullGCALot, true) != Flag::SUCCESS) { |
3148 if (FLAG_SET_CMDLINE(bool, FullGCALot, true) != JVMFlag::SUCCESS) { |
3149 return JNI_EINVAL; |
3149 return JNI_EINVAL; |
3150 } |
3150 } |
3151 // disable scavenge before parallel mark-compact |
3151 // disable scavenge before parallel mark-compact |
3152 if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) { |
3152 if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != JVMFlag::SUCCESS) { |
3153 return JNI_EINVAL; |
3153 return JNI_EINVAL; |
3154 } |
3154 } |
3155 #endif |
3155 #endif |
3156 #if !INCLUDE_MANAGEMENT |
3156 #if !INCLUDE_MANAGEMENT |
3157 } else if (match_option(option, "-XX:+ManagementServer")) { |
3157 } else if (match_option(option, "-XX:+ManagementServer")) { |