Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/compiler/compilerOracle.hpp
40930 views
1
/*
2
* Copyright (c) 1998, 2021, 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_COMPILER_COMPILERORACLE_HPP
26
#define SHARE_COMPILER_COMPILERORACLE_HPP
27
28
#include "memory/allocation.hpp"
29
#include "oops/oopsHierarchy.hpp"
30
31
class methodHandle;
32
33
34
// CompilerOracle is an interface for turning on and off compilation
35
// for some methods
36
37
// OPTION_TYPES: type, name
38
#define OPTION_TYPES(type) \
39
type(Intx, "intx") \
40
type(Uintx, "uintx") \
41
type(Bool, "bool") \
42
type(Ccstr, "ccstr") \
43
type(Ccstrlist, "ccstrlist") \
44
type(Double, "double")
45
46
// COMPILECOMMAND_OPTIONS: option, name, variant, type
47
#define COMPILECOMMAND_OPTIONS(option) \
48
option(Help, "help", Unknown) \
49
option(Quiet, "quiet", Unknown) \
50
option(Log, "log", Bool) \
51
option(Print, "print", Bool) \
52
option(Inline, "inline", Bool) \
53
option(DontInline, "dontinline", Bool) \
54
option(Blackhole, "blackhole", Bool) \
55
option(CompileOnly, "compileonly", Bool)\
56
option(Exclude, "exclude", Bool) \
57
option(Break, "break", Bool) \
58
option(BreakAtExecute, "BreakAtExecute", Bool) \
59
option(BreakAtCompile, "BreakAtCompile", Bool) \
60
option(PrintAssembly, "PrintAssembly", Bool) \
61
option(PrintInlining, "PrintInlining", Bool) \
62
option(PrintIntrinsics, "PrintIntrinsics", Bool) \
63
option(PrintNMethods, "PrintNMethods", Bool) \
64
option(PrintOptoAssembly, "PrintOptoAssembly", Bool) \
65
option(PrintDebugInfo, "PrintDebugInfo", Bool) \
66
option(PrintRelocations, "PrintRelocations", Bool) \
67
option(PrintDependencies, "PrintDependencies", Bool) \
68
option(BackgroundCompilation, "BackgroundCompilation", Bool) \
69
option(RepeatCompilation, "RepeatCompilation", Intx) \
70
option(ReplayInline, "ReplayInline", Bool) \
71
option(DumpReplay, "DumpReplay", Bool) \
72
option(DumpInline, "DumpInline", Bool) \
73
option(CompileThresholdScaling, "CompileThresholdScaling", Double) \
74
option(ControlIntrinsic, "ControlIntrinsic", Ccstrlist) \
75
option(DisableIntrinsic, "DisableIntrinsic", Ccstrlist) \
76
option(NoRTMLockEliding, "NoRTMLockEliding", Bool) \
77
option(UseRTMLockEliding, "UseRTMLockEliding", Bool) \
78
option(BlockLayoutByFrequency, "BlockLayoutByFrequency", Bool) \
79
option(TraceOptoPipelining, "TraceOptoPipelining", Bool) \
80
option(TraceOptoOutput, "TraceOptoOutput", Bool) \
81
option(TraceSpilling, "TraceSpilling", Bool) \
82
option(PrintIdeal, "PrintIdeal", Bool) \
83
option(IGVPrintLevel, "IGVPrintLevel", Intx) \
84
option(Vectorize, "Vectorize", Bool) \
85
option(VectorizeDebug, "VectorizeDebug", Uintx) \
86
option(CloneMapDebug, "CloneMapDebug", Bool) \
87
option(IncrementalInlineForceCleanup, "IncrementalInlineForceCleanup", Bool) \
88
option(MaxNodeLimit, "MaxNodeLimit", Intx) \
89
NOT_PRODUCT(option(TestOptionInt, "TestOptionInt", Intx)) \
90
NOT_PRODUCT(option(TestOptionUint, "TestOptionUint", Uintx)) \
91
NOT_PRODUCT(option(TestOptionBool, "TestOptionBool", Bool)) \
92
NOT_PRODUCT(option(TestOptionBool2, "TestOptionBool2", Bool)) \
93
NOT_PRODUCT(option(TestOptionStr, "TestOptionStr", Ccstr)) \
94
NOT_PRODUCT(option(TestOptionList, "TestOptionList", Ccstrlist)) \
95
NOT_PRODUCT(option(TestOptionDouble, "TestOptionDouble", Double)) \
96
option(Option, "option", Unknown) \
97
option(Unknown, "unknown", Unknown)
98
99
enum class CompileCommand {
100
#define enum_of_options(option, name, ctype) option,
101
COMPILECOMMAND_OPTIONS(enum_of_options)
102
#undef enum_of_options
103
Count
104
};
105
106
enum class OptionType {
107
#define enum_of_types(type, name) type,
108
OPTION_TYPES(enum_of_types)
109
#undef enum_of_types
110
Unknown
111
};
112
113
class CompilerOracle : AllStatic {
114
private:
115
static bool _quiet;
116
static void print_parse_error(char* error_msg, char* original_line);
117
static void print_command(enum CompileCommand option, const char* name, enum OptionType type);
118
119
public:
120
// True if the command file has been specified or is implicit
121
static bool has_command_file();
122
123
// Reads from file and adds to lists
124
static void parse_from_file();
125
126
// Tells whether we to exclude compilation of method
127
static bool should_exclude(const methodHandle& method);
128
static bool be_quiet() { return _quiet; }
129
130
// Tells whether we want to inline this method
131
static bool should_inline(const methodHandle& method);
132
133
// Tells whether we want to disallow inlining of this method
134
static bool should_not_inline(const methodHandle& method);
135
136
// Tells whether we should print the assembly for this method
137
static bool should_print(const methodHandle& method);
138
139
// Tells whether we should log the compilation data for this method
140
static bool should_log(const methodHandle& method);
141
142
// Tells whether to break when compiling method
143
static bool should_break_at(const methodHandle& method);
144
145
// Tells whether there are any methods to print for print_method_statistics()
146
static bool should_print_methods();
147
148
// Tags the method as blackhole candidate, if possible.
149
static void tag_blackhole_if_possible(const methodHandle& method);
150
151
// A wrapper for checking bool options
152
static bool has_option(const methodHandle& method, enum CompileCommand option);
153
154
// Check if method has option and value set. If yes, overwrite value and return true,
155
// otherwise leave value unchanged and return false.
156
template<typename T>
157
static bool has_option_value(const methodHandle& method, enum CompileCommand option, T& value);
158
159
// This check is currently only needed by whitebox API
160
template<typename T>
161
static bool option_matches_type(enum CompileCommand option, T& value);
162
163
// Reads from string instead of file
164
static void parse_from_string(const char* option_string, void (*parser)(char*));
165
static void parse_from_line(char* line);
166
static void parse_compile_only(char* line);
167
168
// Fast check if there is any option set that compile control needs to know about
169
static bool has_any_command_set();
170
171
// convert a string to a proper compilecommand option - used from whitebox.
172
// returns CompileCommand::Unknown on names not matching an option.
173
static enum CompileCommand string_to_option(const char* name);
174
175
// convert a string to a proper compilecommand option
176
// returns CompileCommand::Unknown if name is not an option.
177
static enum CompileCommand parse_option_name(const char* name);
178
179
// convert a string to a proper option type
180
// returns OptionType::Unknown on strings not matching an option type.
181
static enum OptionType parse_option_type(const char* type_str);
182
};
183
184
#endif // SHARE_COMPILER_COMPILERORACLE_HPP
185
186