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 develop(bool, JVMCIUseFastLocking, true, \ 107 "Use fast inlined locking code") \ 108 \ 109 product(intx, JVMCINMethodSizeLimit, (80*K)*wordSize, EXPERIMENTAL, \ 110 "Maximum size of a compiled method.") \ 111 range(0, max_jint) \ 112 \ 113 product(ccstr, JVMCILibPath, NULL, EXPERIMENTAL, \ 114 "LD path for loading the JVMCI shared library") \ 115 \ 116 product(ccstr, JVMCILibDumpJNIConfig, NULL, EXPERIMENTAL, \ 117 "Dumps to the given file a description of the classes, fields " \ 118 "and methods the JVMCI shared library must provide") \ 119 \ 120 product(bool, UseJVMCINativeLibrary, false, EXPERIMENTAL, \ 121 "Execute JVMCI Java code from a shared library " \ 122 "instead of loading it from class files and executing it " \ 123 "on the HotSpot heap. Defaults to true if EnableJVMCIProduct is " \ 124 "true and a JVMCI native library is available.") \ 125 \ 126 NOT_COMPILER2(product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC, \ 127 "Enables intrinsification of BigInteger.multiplyToLen()")) \ 128 \ 129 NOT_COMPILER2(product(bool, UseSquareToLenIntrinsic, false, DIAGNOSTIC, \ 130 "Enables intrinsification of BigInteger.squareToLen()")) \ 131 \ 132 NOT_COMPILER2(product(bool, UseMulAddIntrinsic, false, DIAGNOSTIC, \ 133 "Enables intrinsification of BigInteger.mulAdd()")) \ 134 \ 135 NOT_COMPILER2(product(bool, UseMontgomeryMultiplyIntrinsic, false, DIAGNOSTIC, \ 136 "Enables intrinsification of BigInteger.montgomeryMultiply()")) \ 137 \ 138 NOT_COMPILER2(product(bool, UseMontgomerySquareIntrinsic, false, DIAGNOSTIC, \ 139 "Enables intrinsification of BigInteger.montgomerySquare()")) 140 141 // end of JVMCI_FLAGS 142 143 DECLARE_FLAGS(JVMCI_FLAGS) 144 145 // The base name for the shared library containing the JVMCI based compiler 146 #define JVMCI_SHARED_LIBRARY_NAME "jvmcicompiler" 147 148 class JVMCIGlobals { 149 private: 150 static fileStream* _jni_config_file; 151 public: 152 153 // Returns true if jvmci flags are consistent. If not consistent, 154 // an error message describing the inconsistency is printed before 155 // returning false. 156 static bool check_jvmci_flags_are_consistent(); 157 158 // Convert JVMCI experimental flags to product 159 static bool enable_jvmci_product_mode(JVMFlagOrigin); 160 161 // Returns true iff the GC fully supports JVMCI. 162 static bool gc_supports_jvmci(); 163 164 // Check and turn off EnableJVMCI if selected GC does not support JVMCI. 165 static void check_jvmci_supported_gc(); 166 167 static fileStream* get_jni_config_file() { return _jni_config_file; } 168 }; 169 #endif // SHARE_JVMCI_JVMCI_GLOBALS_HPP