1 /* 2 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_JVMCI_JVMCI_GLOBALS_HPP 26 #define SHARE_JVMCI_JVMCI_GLOBALS_HPP 27 28 #include "runtime/globals_shared.hpp" 29 #include "utilities/vmEnums.hpp" 30 31 class fileStream; 32 33 // 34 // Declare all global flags used by the JVMCI compiler. Only flags that need 35 // to be accessible to the JVMCI C++ code should be defined here. 36 // 37 #define JVMCI_FLAGS(develop, \ 38 develop_pd, \ 39 product, \ 40 product_pd, \ 41 notproduct, \ 42 range, \ 43 constraint) \ 44 \ 45 product(bool, EnableJVMCI, false, EXPERIMENTAL, \ 46 "Enable JVMCI") \ 47 \ 48 product(bool, EnableJVMCIProduct, false, EXPERIMENTAL, \ 49 "Allow JVMCI to be used in product mode. This alters a subset of "\ 50 "JVMCI flags to be non-experimental, defaults UseJVMCICompiler " \ 51 "and EnableJVMCI to true and defaults UseJVMCINativeLibrary " \ 52 "to true if a JVMCI native library is available.") \ 53 \ 54 product(bool, UseJVMCICompiler, false, EXPERIMENTAL, \ 55 "Use JVMCI as the default compiler. Defaults to true if " \ 56 "EnableJVMCIProduct is true.") \ 57 \ 58 product(bool, JVMCIPrintProperties, false, EXPERIMENTAL, \ 59 "Prints properties used by the JVMCI compiler and exits") \ 60 \ 61 product(bool, BootstrapJVMCI, false, EXPERIMENTAL, \ 62 "Bootstrap JVMCI before running Java main method. This " \ 63 "initializes the compile queue with a small set of methods " \ 64 "and processes the queue until it is empty. Combining this with " \ 65 "-XX:-TieredCompilation makes JVMCI compile more of itself.") \ 66 \ 67 product(bool, EagerJVMCI, false, EXPERIMENTAL, \ 68 "Force eager JVMCI initialization") \ 69 \ 70 product(bool, PrintBootstrap, true, EXPERIMENTAL, \ 71 "Print JVMCI bootstrap progress and summary") \ 72 \ 73 product(intx, JVMCIThreads, 1, EXPERIMENTAL, \ 74 "Force number of JVMCI compiler threads to use. Ignored if " \ 75 "UseJVMCICompiler is false.") \ 76 range(1, max_jint) \ 77 \ 78 product(intx, JVMCIHostThreads, 1, EXPERIMENTAL, \ 79 "Force number of C1 compiler threads. Ignored if " \ 80 "UseJVMCICompiler is false.") \ 81 range(1, max_jint) \ 82 \ 83 NOT_COMPILER2(product(intx, MaxVectorSize, 64, \ 84 "Max vector size in bytes, " \ 85 "actual size could be less depending on elements type") \ 86 range(0, max_jint)) \ 87 \ 88 NOT_COMPILER2(product(bool, ReduceInitialCardMarks, true, \ 89 "Defer write barriers of young objects")) \ 90 \ 91 product(intx, JVMCIEventLogLevel, 1, EXPERIMENTAL, \ 92 "Event log level for JVMCI") \ 93 range(0, 4) \ 94 \ 95 product(intx, JVMCITraceLevel, 0, EXPERIMENTAL, \ 96 "Trace level for JVMCI") \ 97 range(0, 4) \ 98 \ 99 product(intx, JVMCICounterSize, 0, EXPERIMENTAL, \ 100 "Reserved size for benchmark counters") \ 101 range(0, 1000000) \ 102 \ 103 product(bool, JVMCICountersExcludeCompiler, true, EXPERIMENTAL, \ 104 "Exclude JVMCI compiler threads from benchmark counters") \ 105 \ 106 product(intx, JVMCINMethodSizeLimit, (80*K)*wordSize, EXPERIMENTAL, \ 107 "Maximum size of a compiled method.") \ 108 range(0, max_jint) \ 109 \ 110 product(ccstr, JVMCILibPath, NULL, EXPERIMENTAL, \ 111 "LD path for loading the JVMCI shared library") \ 112 \ 113 product(ccstr, JVMCILibDumpJNIConfig, NULL, EXPERIMENTAL, \ 114 "Dumps to the given file a description of the classes, fields " \ 115 "and methods the JVMCI shared library must provide") \ 116 \ 117 product(bool, UseJVMCINativeLibrary, false, EXPERIMENTAL, \ 118 "Execute JVMCI Java code from a shared library " \ 119 "instead of loading it from class files and executing it " \ 120 "on the HotSpot heap. Defaults to true if EnableJVMCIProduct is " \ 121 "true and a JVMCI native library is available.") \ 122 \ 123 NOT_COMPILER2(product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC, \ 124 "Enables intrinsification of BigInteger.multiplyToLen()")) \ 125 \ 126 NOT_COMPILER2(product(bool, UseSquareToLenIntrinsic, false, DIAGNOSTIC, \ 127 "Enables intrinsification of BigInteger.squareToLen()")) \ 128 \ 129 NOT_COMPILER2(product(bool, UseMulAddIntrinsic, false, DIAGNOSTIC, \ 130 "Enables intrinsification of BigInteger.mulAdd()")) \ 131 \ 132 NOT_COMPILER2(product(bool, UseMontgomeryMultiplyIntrinsic, false, DIAGNOSTIC, \ 133 "Enables intrinsification of BigInteger.montgomeryMultiply()")) \ 134 \ 135 NOT_COMPILER2(product(bool, UseMontgomerySquareIntrinsic, false, DIAGNOSTIC, \ 136 "Enables intrinsification of BigInteger.montgomerySquare()")) 137 138 // end of JVMCI_FLAGS 139 140 DECLARE_FLAGS(JVMCI_FLAGS) 141 142 // The base name for the shared library containing the JVMCI based compiler 143 #define JVMCI_SHARED_LIBRARY_NAME "jvmcicompiler" 144 145 class JVMCIGlobals { 146 private: 147 static fileStream* _jni_config_file; 148 public: 149 150 // Returns true if jvmci flags are consistent. If not consistent, 151 // an error message describing the inconsistency is printed before 152 // returning false. 153 static bool check_jvmci_flags_are_consistent(); 154 155 // Convert JVMCI experimental flags to product 156 static bool enable_jvmci_product_mode(JVMFlagOrigin); 157 158 // Returns true iff the GC fully supports JVMCI. 159 static bool gc_supports_jvmci(); 160 161 // Check and turn off EnableJVMCI if selected GC does not support JVMCI. 162 static void check_jvmci_supported_gc(); 163 164 static fileStream* get_jni_config_file() { return _jni_config_file; } 165 }; 166 #endif // SHARE_JVMCI_JVMCI_GLOBALS_HPP