2131 #endif
2132 }
2133
2134 #if INCLUDE_JVMCI
2135 status = status && check_jvmci_args_consistency();
2136
2137 if (EnableJVMCI) {
2138 PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true",
2139 AddProperty, UnwriteableProperty, InternalProperty);
2140
2141 if (!ScavengeRootsInCode) {
2142 warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled");
2143 ScavengeRootsInCode = 1;
2144 }
2145 }
2146 #endif
2147
2148 // Check lower bounds of the code cache
2149 // Template Interpreter code is approximately 3X larger in debug builds.
2150 uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
2151 if (InitialCodeCacheSize < (uintx)os::vm_page_size()) {
2152 jio_fprintf(defaultStream::error_stream(),
2153 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
2154 os::vm_page_size()/K);
2155 status = false;
2156 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2157 jio_fprintf(defaultStream::error_stream(),
2158 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2159 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2160 status = false;
2161 } else if (ReservedCodeCacheSize < min_code_cache_size) {
2162 jio_fprintf(defaultStream::error_stream(),
2163 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2164 min_code_cache_size/K);
2165 status = false;
2166 } else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) {
2167 // Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported.
2168 jio_fprintf(defaultStream::error_stream(),
2169 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2170 CODE_CACHE_SIZE_LIMIT/M);
2171 status = false;
2172 } else if (NonNMethodCodeHeapSize < min_code_cache_size) {
2173 jio_fprintf(defaultStream::error_stream(),
2174 "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,
2175 min_code_cache_size/K);
2176 status = false;
2749 if (*err != '\0' || *tail == '\0') {
2750 jio_fprintf(defaultStream::error_stream(),
2751 "Bad min heap free percentage size: %s\n",
2752 option->optionString);
2753 return JNI_EINVAL;
2754 } else {
2755 if (FLAG_SET_CMDLINE(uintx, MinHeapFreeRatio, minf) != Flag::SUCCESS) {
2756 return JNI_EINVAL;
2757 }
2758 }
2759 // -Xss
2760 } else if (match_option(option, "-Xss", &tail)) {
2761 intx value = 0;
2762 jint err = parse_xss(option, tail, &value);
2763 if (err != JNI_OK) {
2764 return err;
2765 }
2766 if (FLAG_SET_CMDLINE(intx, ThreadStackSize, value) != Flag::SUCCESS) {
2767 return JNI_EINVAL;
2768 }
2769 } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
2770 julong long_CodeCacheExpansionSize = 0;
2771 ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
2772 if (errcode != arg_in_range) {
2773 jio_fprintf(defaultStream::error_stream(),
2774 "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
2775 os::vm_page_size()/K);
2776 return JNI_EINVAL;
2777 }
2778 if (FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize) != Flag::SUCCESS) {
2779 return JNI_EINVAL;
2780 }
2781 } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2782 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2783 julong long_ReservedCodeCacheSize = 0;
2784
2785 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2786 if (errcode != arg_in_range) {
2787 jio_fprintf(defaultStream::error_stream(),
2788 "Invalid maximum code cache size: %s.\n", option->optionString);
2789 return JNI_EINVAL;
2790 }
2791 if (FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize) != Flag::SUCCESS) {
2792 return JNI_EINVAL;
2793 }
2794 // -XX:NonNMethodCodeHeapSize=
2795 } else if (match_option(option, "-XX:NonNMethodCodeHeapSize=", &tail)) {
2796 julong long_NonNMethodCodeHeapSize = 0;
2797
2798 ArgsRange errcode = parse_memory_size(tail, &long_NonNMethodCodeHeapSize, 1);
2799 if (errcode != arg_in_range) {
2800 jio_fprintf(defaultStream::error_stream(),
2801 "Invalid maximum non-nmethod code heap size: %s.\n", option->optionString);
2802 return JNI_EINVAL;
2803 }
2804 if (FLAG_SET_CMDLINE(uintx, NonNMethodCodeHeapSize, (uintx)long_NonNMethodCodeHeapSize) != Flag::SUCCESS) {
2805 return JNI_EINVAL;
2806 }
2807 // -XX:ProfiledCodeHeapSize=
2808 } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
2809 julong long_ProfiledCodeHeapSize = 0;
2810
2811 ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1);
2812 if (errcode != arg_in_range) {
2813 jio_fprintf(defaultStream::error_stream(),
2814 "Invalid maximum profiled code heap size: %s.\n", option->optionString);
2815 return JNI_EINVAL;
2816 }
2817 if (FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize) != Flag::SUCCESS) {
2818 return JNI_EINVAL;
2819 }
2820 // -XX:NonProfiledCodeHeapSizee=
2821 } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) {
2822 julong long_NonProfiledCodeHeapSize = 0;
2823
2824 ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
2825 if (errcode != arg_in_range) {
2826 jio_fprintf(defaultStream::error_stream(),
2827 "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
2828 return JNI_EINVAL;
2829 }
2830 if (FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize) != Flag::SUCCESS) {
2831 return JNI_EINVAL;
2832 }
2833 // -green
2834 } else if (match_option(option, "-green")) {
2835 jio_fprintf(defaultStream::error_stream(),
2836 "Green threads support not available\n");
2837 return JNI_EINVAL;
2838 // -native
2839 } else if (match_option(option, "-native")) {
2840 // HotSpot always uses native threads, ignore silently for compatibility
2841 // -Xrs
2842 } else if (match_option(option, "-Xrs")) {
2843 // Classic/EVM option, new functionality
2844 if (FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true) != Flag::SUCCESS) {
2845 return JNI_EINVAL;
2846 }
2847 // -Xprof
2848 } else if (match_option(option, "-Xprof")) {
2849 char version[256];
2850 // Obsolete in JDK 10
|
2131 #endif
2132 }
2133
2134 #if INCLUDE_JVMCI
2135 status = status && check_jvmci_args_consistency();
2136
2137 if (EnableJVMCI) {
2138 PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true",
2139 AddProperty, UnwriteableProperty, InternalProperty);
2140
2141 if (!ScavengeRootsInCode) {
2142 warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled");
2143 ScavengeRootsInCode = 1;
2144 }
2145 }
2146 #endif
2147
2148 // Check lower bounds of the code cache
2149 // Template Interpreter code is approximately 3X larger in debug builds.
2150 uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
2151 if (ReservedCodeCacheSize < InitialCodeCacheSize) {
2152 jio_fprintf(defaultStream::error_stream(),
2153 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
2154 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
2155 status = false;
2156 } else if (ReservedCodeCacheSize < min_code_cache_size) {
2157 jio_fprintf(defaultStream::error_stream(),
2158 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
2159 min_code_cache_size/K);
2160 status = false;
2161 } else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) {
2162 // Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported.
2163 jio_fprintf(defaultStream::error_stream(),
2164 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
2165 CODE_CACHE_SIZE_LIMIT/M);
2166 status = false;
2167 } else if (NonNMethodCodeHeapSize < min_code_cache_size) {
2168 jio_fprintf(defaultStream::error_stream(),
2169 "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,
2170 min_code_cache_size/K);
2171 status = false;
2744 if (*err != '\0' || *tail == '\0') {
2745 jio_fprintf(defaultStream::error_stream(),
2746 "Bad min heap free percentage size: %s\n",
2747 option->optionString);
2748 return JNI_EINVAL;
2749 } else {
2750 if (FLAG_SET_CMDLINE(uintx, MinHeapFreeRatio, minf) != Flag::SUCCESS) {
2751 return JNI_EINVAL;
2752 }
2753 }
2754 // -Xss
2755 } else if (match_option(option, "-Xss", &tail)) {
2756 intx value = 0;
2757 jint err = parse_xss(option, tail, &value);
2758 if (err != JNI_OK) {
2759 return err;
2760 }
2761 if (FLAG_SET_CMDLINE(intx, ThreadStackSize, value) != Flag::SUCCESS) {
2762 return JNI_EINVAL;
2763 }
2764 } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
2765 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
2766 julong long_ReservedCodeCacheSize = 0;
2767
2768 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
2769 if (errcode != arg_in_range) {
2770 jio_fprintf(defaultStream::error_stream(),
2771 "Invalid maximum code cache size: %s.\n", option->optionString);
2772 return JNI_EINVAL;
2773 }
2774 if (FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize) != Flag::SUCCESS) {
2775 return JNI_EINVAL;
2776 }
2777 // -green
2778 } else if (match_option(option, "-green")) {
2779 jio_fprintf(defaultStream::error_stream(),
2780 "Green threads support not available\n");
2781 return JNI_EINVAL;
2782 // -native
2783 } else if (match_option(option, "-native")) {
2784 // HotSpot always uses native threads, ignore silently for compatibility
2785 // -Xrs
2786 } else if (match_option(option, "-Xrs")) {
2787 // Classic/EVM option, new functionality
2788 if (FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true) != Flag::SUCCESS) {
2789 return JNI_EINVAL;
2790 }
2791 // -Xprof
2792 } else if (match_option(option, "-Xprof")) {
2793 char version[256];
2794 // Obsolete in JDK 10
|