Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/compiler/compilerEvent.hpp
40930 views
1
/*
2
* Copyright (c) 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_COMPILER_COMPILEREVENT_HPP
25
#define SHARE_COMPILER_COMPILEREVENT_HPP
26
27
#include "jni.h"
28
#include "compiler/compilerDefinitions.hpp"
29
#include "memory/allocation.hpp"
30
#include "utilities/macros.hpp"
31
#include "utilities/ticks.hpp"
32
33
#if INCLUDE_JFR
34
#include "jfr/utilities/jfrTime.hpp"
35
#endif
36
37
class ciMethod;
38
template <typename>
39
class GrowableArray;
40
class Method;
41
class EventCompilation;
42
class EventCompilationFailure;
43
class EventCompilerInlining;
44
class EventCompilerPhase;
45
struct JfrStructCalleeMethod;
46
47
class CompilerEvent : AllStatic {
48
public:
49
static jlong ticksNow() {
50
// Using Ticks for consistent usage outside JFR folder.
51
JFR_ONLY(return JfrTime::is_ft_enabled() ? Ticks::now().ft_value() : Ticks::now().value();) NOT_JFR_RETURN_(0L);
52
}
53
54
class CompilationEvent : AllStatic {
55
public:
56
static void post(EventCompilation& event, int compile_id, CompilerType type, Method* method, int compile_level, bool success, bool is_osr, int code_size, int inlined_bytecodes) NOT_JFR_RETURN();
57
};
58
59
class CompilationFailureEvent : AllStatic {
60
public:
61
static void post(EventCompilationFailure& event, int compile_id, const char* reason) NOT_JFR_RETURN();
62
};
63
64
class PhaseEvent : AllStatic {
65
friend class CompilerPhaseTypeConstant;
66
public:
67
68
// Gets a unique identifier for `phase_name`, computing and registering it first if necessary.
69
// If `may_exist` is true, then current registrations are searched first. If false, then
70
// there must not be an existing registration for `phase_name`.
71
// If `use_strdup` is true, then `phase_name` is strdup'ed before registration.
72
// If `sync` is true, then access to the registration table is synchronized.
73
static int get_phase_id(const char* phase_name, bool may_exist, bool use_strdup, bool sync) NOT_JFR_RETURN_(-1);
74
75
static void post(EventCompilerPhase& event, const Ticks& start_time, int phase, int compile_id, int level) NOT_JFR_RETURN();
76
static void post(EventCompilerPhase& event, jlong start_time, int phase, int compile_id, int level) {
77
JFR_ONLY(post(event, Ticks(start_time), phase, compile_id, level);)
78
}
79
};
80
81
class InlineEvent : AllStatic {
82
static void post(EventCompilerInlining& event, int compile_id, Method* caller, const JfrStructCalleeMethod& callee, bool success, const char* msg, int bci) NOT_JFR_RETURN();
83
public:
84
static void post(EventCompilerInlining& event, int compile_id, Method* caller, Method* callee, bool success, const char* msg, int bci) NOT_JFR_RETURN();
85
static void post(EventCompilerInlining& event, int compile_id, Method* caller, ciMethod* callee, bool success, const char* msg, int bci) NOT_JFR_RETURN();
86
};
87
};
88
#endif // SHARE_COMPILER_COMPILEREVENT_HPP
89
90