author | mgronlun |
Sun, 15 Sep 2019 20:23:40 +0200 | |
branch | JEP-349-branch |
changeset 58159 | 892527a70da9 |
parent 58157 | 9dca61a7df19 |
child 58392 | be0dc16e920d |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52334
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
50113 | 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 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52334
diff
changeset
|
25 |
#ifndef SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEID_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52334
diff
changeset
|
26 |
#define SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEID_INLINE_HPP |
50113 | 27 |
|
28 |
#include "classfile/classLoaderData.hpp" |
|
29 |
#include "classfile/moduleEntry.hpp" |
|
30 |
#include "classfile/packageEntry.hpp" |
|
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
31 |
#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp" |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
32 |
#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp" |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
33 |
#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp" |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
34 |
#include "jfr/support/jfrKlassExtension.hpp" |
50113 | 35 |
#include "oops/arrayKlass.hpp" |
36 |
#include "oops/klass.hpp" |
|
37 |
#include "oops/instanceKlass.hpp" |
|
38 |
#include "oops/method.hpp" |
|
50122
d2bcbcf0d3d9
8203278: AArch64/PPC64 build failures after JDK-8199712 (Flight Recorder)
shade
parents:
50113
diff
changeset
|
39 |
#include "runtime/thread.inline.hpp" |
50113 | 40 |
#include "utilities/debug.hpp" |
41 |
||
42 |
template <typename T> |
|
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
43 |
inline traceid set_used_and_get(const T* type) { |
50113 | 44 |
assert(type != NULL, "invariant"); |
45 |
SET_USED_THIS_EPOCH(type); |
|
46 |
assert(USED_THIS_EPOCH(type), "invariant"); |
|
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
47 |
return TRACE_ID(type); |
50113 | 48 |
} |
49 |
||
50 |
inline traceid JfrTraceId::get(const Klass* klass) { |
|
51 |
assert(klass != NULL, "invariant"); |
|
52 |
return TRACE_ID(klass); |
|
53 |
} |
|
54 |
||
55 |
inline traceid JfrTraceId::get(const Thread* t) { |
|
56 |
assert(t != NULL, "invariant"); |
|
57 |
return TRACE_ID_RAW(t->jfr_thread_local()); |
|
58 |
} |
|
59 |
||
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
60 |
inline traceid JfrTraceId::use(const Klass* klass) { |
50113 | 61 |
assert(klass != NULL, "invariant"); |
57874 | 62 |
if (SHOULD_TAG(klass)) { |
57983
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
63 |
JfrTraceIdEpoch::set_changed_tag_state(); |
57874 | 64 |
return set_used_and_get(klass); |
57873 | 65 |
} |
57874 | 66 |
assert(USED_THIS_EPOCH(klass), "invariant"); |
67 |
return TRACE_ID(klass); |
|
50113 | 68 |
} |
69 |
||
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
70 |
inline traceid JfrTraceId::use(const Method* method) { |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
71 |
assert(method != NULL, "invariant"); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
72 |
return use(method->method_holder(), method); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
73 |
} |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
74 |
|
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
75 |
inline traceid JfrTraceId::use(const Klass* klass, const Method* method) { |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
76 |
assert(klass != NULL, "invariant"); |
50113 | 77 |
assert(method != NULL, "invariant"); |
57983
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
78 |
bool changed_tag_state = false; |
57874 | 79 |
if (SHOULD_TAG_KLASS_METHOD(klass)) { |
80 |
SET_METHOD_AND_CLASS_USED_THIS_EPOCH(klass); |
|
57983
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
81 |
changed_tag_state = true; |
57874 | 82 |
} |
50113 | 83 |
assert(METHOD_AND_CLASS_USED_THIS_EPOCH(klass), "invariant"); |
57983
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
84 |
if (METHOD_FLAG_NOT_USED_THIS_EPOCH(method)) { |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
85 |
SET_METHOD_FLAG_USED_THIS_EPOCH(method); |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
86 |
changed_tag_state = true; |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
87 |
} |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
88 |
assert(METHOD_FLAG_USED_THIS_EPOCH(method), "invariant"); |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
89 |
if (changed_tag_state) { |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
90 |
JfrTraceIdEpoch::set_changed_tag_state(); |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57902
diff
changeset
|
91 |
} |
50113 | 92 |
return (METHOD_ID(klass, method)); |
93 |
} |
|
94 |
||
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
95 |
inline traceid JfrTraceId::use(const ModuleEntry* module) { |
50113 | 96 |
assert(module != NULL, "invariant"); |
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
97 |
return set_used_and_get(module); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
98 |
} |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
99 |
|
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
100 |
inline traceid JfrTraceId::use(const PackageEntry* package) { |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
101 |
assert(package != NULL, "invariant"); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
102 |
return set_used_and_get(package); |
50113 | 103 |
} |
104 |
||
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
105 |
inline traceid JfrTraceId::use(const ClassLoaderData* cld) { |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
106 |
assert(cld != NULL, "invariant"); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
107 |
return cld->is_unsafe_anonymous() ? 0 : set_used_and_get(cld); |
50113 | 108 |
} |
109 |
||
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
110 |
inline void JfrTraceId::set_leakp(const Method* method) { |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
111 |
assert(method != NULL, "invariant"); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
112 |
const Klass* const klass = method->method_holder(); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
113 |
assert(klass != NULL, "invariant"); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
114 |
assert(METHOD_AND_CLASS_USED_THIS_EPOCH(klass), "invariant"); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
115 |
assert(METHOD_FLAG_USED_THIS_EPOCH(method), "invariant"); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
116 |
SET_LEAKP(klass); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
117 |
SET_METHOD_LEAKP(method); |
50113 | 118 |
} |
119 |
||
120 |
inline bool JfrTraceId::in_visible_set(const Klass* klass) { |
|
121 |
assert(klass != NULL, "invariant"); |
|
122 |
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_vm, "invariant"); |
|
123 |
return (IS_JDK_JFR_EVENT_SUBKLASS(klass) && !klass->is_abstract()) || IS_EVENT_HOST_KLASS(klass); |
|
124 |
} |
|
125 |
||
126 |
inline bool JfrTraceId::is_jdk_jfr_event(const Klass* k) { |
|
127 |
assert(k != NULL, "invariant"); |
|
128 |
return IS_JDK_JFR_EVENT_KLASS(k); |
|
129 |
} |
|
130 |
||
131 |
inline void JfrTraceId::tag_as_jdk_jfr_event(const Klass* klass) { |
|
132 |
assert(klass != NULL, "invariant"); |
|
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
133 |
SET_JDK_JFR_EVENT_KLASS(klass); |
50113 | 134 |
assert(IS_JDK_JFR_EVENT_KLASS(klass), "invariant"); |
135 |
} |
|
136 |
||
137 |
inline bool JfrTraceId::is_jdk_jfr_event_sub(const Klass* k) { |
|
138 |
assert(k != NULL, "invariant"); |
|
139 |
return IS_JDK_JFR_EVENT_SUBKLASS(k); |
|
140 |
} |
|
141 |
||
142 |
inline void JfrTraceId::tag_as_jdk_jfr_event_sub(const Klass* k) { |
|
143 |
assert(k != NULL, "invariant"); |
|
52334
a181612f0715
8203629: Produce events in the JDK without a dependency on jdk.jfr
egahlin
parents:
51444
diff
changeset
|
144 |
if (IS_NOT_AN_EVENT_SUB_KLASS(k)) { |
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
145 |
SET_JDK_JFR_EVENT_SUBKLASS(k); |
50113 | 146 |
} |
147 |
assert(IS_JDK_JFR_EVENT_SUBKLASS(k), "invariant"); |
|
148 |
} |
|
149 |
||
150 |
inline bool JfrTraceId::in_jdk_jfr_event_hierarchy(const Klass* klass) { |
|
151 |
assert(klass != NULL, "invariant"); |
|
152 |
if (is_jdk_jfr_event(klass)) { |
|
153 |
return true; |
|
154 |
} |
|
155 |
const Klass* const super = klass->super(); |
|
156 |
return super != NULL ? IS_EVENT_KLASS(super) : false; |
|
157 |
} |
|
158 |
||
159 |
inline bool JfrTraceId::is_event_host(const Klass* k) { |
|
160 |
assert(k != NULL, "invariant"); |
|
161 |
return IS_EVENT_HOST_KLASS(k); |
|
162 |
} |
|
163 |
||
164 |
inline void JfrTraceId::tag_as_event_host(const Klass* k) { |
|
165 |
assert(k != NULL, "invariant"); |
|
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
53244
diff
changeset
|
166 |
SET_EVENT_HOST_KLASS(k); |
50113 | 167 |
assert(IS_EVENT_HOST_KLASS(k), "invariant"); |
168 |
} |
|
169 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52334
diff
changeset
|
170 |
#endif // SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEID_INLINE_HPP |