1/*
2 * Copyright (c) 2000, 2019, 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
28class fileStream;
29
30//
31// Defines all global flags used by the JVMCI compiler. Only flags that need
32// to be accessible to the JVMCI C++ code should be defined here.
33//
34#define JVMCI_FLAGS(develop, \
35 develop_pd, \
36 product, \
37 product_pd, \
38 diagnostic, \
39 diagnostic_pd, \
40 experimental, \
41 notproduct, \
42 range, \
43 constraint, \
44 writeable) \
45 \
46 experimental(bool, EnableJVMCI, false, \
47 "Enable JVMCI") \
48 \
49 experimental(bool, UseJVMCICompiler, false, \
50 "Use JVMCI as the default compiler") \
51 \
52 experimental(bool, JVMCIPrintProperties, false, \
53 "Prints properties used by the JVMCI compiler and exits") \
54 \
55 experimental(bool, BootstrapJVMCI, false, \
56 "Bootstrap JVMCI before running Java main method. This " \
57 "initializes the compile queue with a small set of methods " \
58 "and processes the queue until it is empty. Combining this with " \
59 "-XX:-TieredCompilation makes JVMCI compile more of itself.") \
60 \
61 experimental(bool, EagerJVMCI, false, \
62 "Force eager JVMCI initialization") \
63 \
64 experimental(bool, PrintBootstrap, true, \
65 "Print JVMCI bootstrap progress and summary") \
66 \
67 experimental(intx, JVMCIThreads, 1, \
68 "Force number of JVMCI compiler threads to use. Ignored if " \
69 "UseJVMCICompiler is false.") \
70 range(1, max_jint) \
71 \
72 experimental(intx, JVMCIHostThreads, 1, \
73 "Force number of C1 compiler threads. Ignored if " \
74 "UseJVMCICompiler is false.") \
75 range(1, max_jint) \
76 \
77 NOT_COMPILER2(product(intx, MaxVectorSize, 64, \
78 "Max vector size in bytes, " \
79 "actual size could be less depending on elements type")) \
80 \
81 NOT_COMPILER2(product(bool, ReduceInitialCardMarks, true, \
82 "Defer write barriers of young objects")) \
83 \
84 experimental(intx, JVMCITraceLevel, 0, \
85 "Trace level for JVMCI: " \
86 "1 means emit a message for each CompilerToVM call," \
87 "levels greater than 1 provide progressively greater detail") \
88 \
89 experimental(intx, JVMCICounterSize, 0, \
90 "Reserved size for benchmark counters") \
91 range(0, max_jint) \
92 \
93 experimental(bool, JVMCICountersExcludeCompiler, true, \
94 "Exclude JVMCI compiler threads from benchmark counters") \
95 \
96 develop(bool, JVMCIUseFastLocking, true, \
97 "Use fast inlined locking code") \
98 \
99 experimental(intx, JVMCINMethodSizeLimit, (80*K)*wordSize, \
100 "Maximum size of a compiled method.") \
101 \
102 experimental(intx, MethodProfileWidth, 0, \
103 "Number of methods to record in call profile") \
104 \
105 experimental(ccstr, JVMCILibPath, NULL, \
106 "LD path for loading the JVMCI shared library") \
107 \
108 experimental(ccstr, JVMCILibDumpJNIConfig, NULL, \
109 "Dumps to the given file a description of the classes, fields " \
110 "and methods the JVMCI shared library must provide") \
111 \
112 experimental(bool, UseJVMCINativeLibrary, false, \
113 "Execute JVMCI Java code from a shared library " \
114 "instead of loading it from class files and executing it " \
115 "on the HotSpot heap") \
116 \
117 NOT_COMPILER2(diagnostic(bool, UseMultiplyToLenIntrinsic, false, \
118 "Enables intrinsification of BigInteger.multiplyToLen()")) \
119 \
120 NOT_COMPILER2(diagnostic(bool, UseSquareToLenIntrinsic, false, \
121 "Enables intrinsification of BigInteger.squareToLen()")) \
122 \
123 NOT_COMPILER2(diagnostic(bool, UseMulAddIntrinsic, false, \
124 "Enables intrinsification of BigInteger.mulAdd()")) \
125 \
126 NOT_COMPILER2(diagnostic(bool, UseMontgomeryMultiplyIntrinsic, false, \
127 "Enables intrinsification of BigInteger.montgomeryMultiply()")) \
128 \
129 NOT_COMPILER2(diagnostic(bool, UseMontgomerySquareIntrinsic, false, \
130 "Enables intrinsification of BigInteger.montgomerySquare()"))
131
132// The base name for the shared library containing the JVMCI based compiler
133#define JVMCI_SHARED_LIBRARY_NAME "jvmcicompiler"
134
135class JVMCIGlobals {
136 private:
137 static fileStream* _jni_config_file;
138 public:
139
140 // Returns true if jvmci flags are consistent. If not consistent,
141 // an error message describing the inconsistency is printed before
142 // returning false.
143 static bool check_jvmci_flags_are_consistent();
144
145 // Check and exit VM with error if selected GC is not supported by JVMCI.
146 static void check_jvmci_supported_gc();
147
148 static fileStream* get_jni_config_file() { return _jni_config_file; }
149};
150#endif // SHARE_JVMCI_JVMCI_GLOBALS_HPP
151