Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp
41149 views
1
/*
2
* Copyright (c) 2012, 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_JFR_SUPPORT_JFRTRACEIDEXTENSION_HPP
26
#define SHARE_JFR_SUPPORT_JFRTRACEIDEXTENSION_HPP
27
28
#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp"
29
#include "utilities/macros.hpp"
30
31
#define DEFINE_TRACE_ID_FIELD mutable traceid _trace_id
32
33
#define DEFINE_TRACE_ID_METHODS \
34
traceid trace_id() const { return _trace_id; } \
35
traceid* const trace_id_addr() const { return &_trace_id; } \
36
void set_trace_id(traceid id) const { _trace_id = id; }
37
38
#define DEFINE_TRACE_ID_SIZE \
39
static size_t trace_id_size() { return sizeof(traceid); }
40
41
#define INIT_ID(data) JfrTraceId::assign(data)
42
#define ASSIGN_PRIMITIVE_CLASS_ID(data) JfrTraceId::assign_primitive_klass_id()
43
#define REMOVE_ID(k) JfrTraceId::remove(k);
44
#define REMOVE_METHOD_ID(method) JfrTraceId::remove(method);
45
#define RESTORE_ID(k) JfrTraceId::restore(k);
46
47
class JfrTraceFlag {
48
private:
49
mutable jshort _flags;
50
public:
51
JfrTraceFlag() : _flags(0) {}
52
bool is_set(jshort flag) const {
53
return (_flags & flag) != 0;
54
}
55
56
jshort flags() const {
57
return _flags;
58
}
59
60
void set_flags(jshort flags) const {
61
_flags = flags;
62
}
63
64
jbyte* flags_addr() const {
65
#ifdef VM_LITTLE_ENDIAN
66
return (jbyte*)&_flags;
67
#else
68
return ((jbyte*)&_flags) + 1;
69
#endif
70
}
71
72
jbyte* meta_addr() const {
73
#ifdef VM_LITTLE_ENDIAN
74
return ((jbyte*)&_flags) + 1;
75
#else
76
return (jbyte*)&_flags;
77
#endif
78
}
79
};
80
81
#define DEFINE_TRACE_FLAG mutable JfrTraceFlag _trace_flags
82
83
#define DEFINE_TRACE_FLAG_ACCESSOR \
84
bool is_trace_flag_set(jshort flag) const { \
85
return _trace_flags.is_set(flag); \
86
} \
87
jshort trace_flags() const { \
88
return _trace_flags.flags(); \
89
} \
90
void set_trace_flags(jshort flags) const { \
91
_trace_flags.set_flags(flags); \
92
} \
93
jbyte* trace_flags_addr() const { \
94
return _trace_flags.flags_addr(); \
95
} \
96
jbyte* trace_meta_addr() const { \
97
return _trace_flags.meta_addr(); \
98
}
99
100
#endif // SHARE_JFR_SUPPORT_JFRTRACEIDEXTENSION_HPP
101
102