Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/jvmci/jvmciCompiler.hpp
40949 views
1
/*
2
* Copyright (c) 2011, 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
#ifndef SHARE_JVMCI_JVMCICOMPILER_HPP
25
#define SHARE_JVMCI_JVMCICOMPILER_HPP
26
27
#include "compiler/abstractCompiler.hpp"
28
#include "compiler/compiler_globals.hpp"
29
#include "runtime/atomic.hpp"
30
31
class JVMCICompiler : public AbstractCompiler {
32
private:
33
bool _bootstrapping;
34
35
/**
36
* True if we have seen a bootstrap compilation request.
37
*/
38
volatile bool _bootstrap_compilation_request_handled;
39
40
/**
41
* Number of methods successfully compiled by a call to
42
* JVMCICompiler::compile_method().
43
*/
44
volatile int _methods_compiled;
45
46
// Incremented periodically by JVMCI compiler threads
47
// to indicate JVMCI compilation activity.
48
volatile int _global_compilation_ticks;
49
50
static JVMCICompiler* _instance;
51
52
// Code installation timer for CompileBroker compilations
53
static elapsedTimer _codeInstallTimer;
54
55
// Code installation timer for non-CompileBroker compilations
56
static elapsedTimer _hostedCodeInstallTimer;
57
58
/**
59
* Exits the VM due to an unexpected exception.
60
*/
61
static void exit_on_pending_exception(oop exception, const char* message);
62
63
public:
64
JVMCICompiler();
65
66
static JVMCICompiler* instance(bool require_non_null, TRAPS);
67
68
virtual const char* name() { return UseJVMCINativeLibrary ? "JVMCI-native" : "JVMCI"; }
69
70
bool is_jvmci() { return true; }
71
bool is_c1 () { return false; }
72
bool is_c2 () { return false; }
73
74
bool needs_stubs () { return false; }
75
76
// Initialization
77
virtual void initialize();
78
79
/**
80
* Initialize the compile queue with the methods in java.lang.Object and
81
* then wait until the queue is empty.
82
*/
83
void bootstrap(TRAPS);
84
85
// Should force compilation of method at CompLevel_simple?
86
bool force_comp_at_level_simple(const methodHandle& method);
87
88
bool is_bootstrapping() const { return _bootstrapping; }
89
90
void set_bootstrap_compilation_request_handled() {
91
_instance->_bootstrap_compilation_request_handled = true;
92
}
93
94
// Compilation entry point for methods
95
virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive);
96
97
// Print compilation timers and statistics
98
virtual void print_timers();
99
100
// Gets the number of methods that have been successfully compiled by
101
// a call to JVMCICompiler::compile_method().
102
int methods_compiled() { return _methods_compiled; }
103
void inc_methods_compiled();
104
105
// Gets a value indicating JVMCI compilation activity on any thread.
106
// If successive calls to this method return a different value, then
107
// some degree of JVMCI compilation occurred between the calls.
108
int global_compilation_ticks() const { return _global_compilation_ticks; }
109
void inc_global_compilation_ticks();
110
111
// Print timers related to non-CompileBroker compilations
112
static void print_hosted_timers();
113
114
static elapsedTimer* codeInstallTimer(bool hosted) {
115
if (!hosted) {
116
return &_codeInstallTimer;
117
} else {
118
return &_hostedCodeInstallTimer;
119
}
120
}
121
};
122
123
#endif // SHARE_JVMCI_JVMCICOMPILER_HPP
124
125