author | coleenp |
Thu, 25 Apr 2019 10:56:31 -0400 | |
changeset 54623 | 1126f0607c70 |
parent 52212 | e6973df15152 |
child 57360 | 5d043a159d5c |
child 58003 | a645b2f7bece |
child 58678 | 9cf78a70fa4f |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
52212
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 |
||
25 |
#include "precompiled.hpp" |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
26 |
#include "jfr/metadata/jfrSerializer.hpp" |
50113 | 27 |
#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" |
28 |
#include "jfr/recorder/checkpoint/types/jfrType.hpp" |
|
29 |
#include "jfr/recorder/checkpoint/types/jfrTypeManager.hpp" |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
30 |
#include "jfr/utilities/jfrDoublyLinkedList.hpp" |
50113 | 31 |
#include "jfr/utilities/jfrIterator.hpp" |
32 |
#include "runtime/safepoint.hpp" |
|
33 |
#include "runtime/thread.inline.hpp" |
|
34 |
#include "utilities/exceptions.hpp" |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
35 |
#include "runtime/semaphore.hpp" |
50113 | 36 |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
37 |
class JfrSerializerRegistration : public JfrCHeapObj { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
38 |
private: |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
39 |
JfrSerializerRegistration* _next; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
40 |
JfrSerializerRegistration* _prev; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
41 |
JfrSerializer* _serializer; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
42 |
mutable JfrCheckpointBlobHandle _cache; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
43 |
JfrTypeId _id; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
44 |
bool _permit_cache; |
50113 | 45 |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
46 |
public: |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
47 |
JfrSerializerRegistration(JfrTypeId id, bool permit_cache, JfrSerializer* serializer) : |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
48 |
_next(NULL), _prev(NULL), _serializer(serializer), _cache(), _id(id), _permit_cache(permit_cache) {} |
50113 | 49 |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
50 |
~JfrSerializerRegistration() { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
51 |
delete _serializer; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
52 |
} |
50113 | 53 |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
54 |
JfrSerializerRegistration* next() const { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
55 |
return _next; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
56 |
} |
50113 | 57 |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
58 |
void set_next(JfrSerializerRegistration* next) { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
59 |
_next = next; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
60 |
} |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
61 |
|
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
62 |
JfrSerializerRegistration* prev() const { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
63 |
return _prev; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
64 |
} |
50113 | 65 |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
66 |
void set_prev(JfrSerializerRegistration* prev) { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
67 |
_prev = prev; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
68 |
} |
50113 | 69 |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
70 |
JfrTypeId id() const { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
71 |
return _id; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
72 |
} |
50113 | 73 |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
74 |
void invoke(JfrCheckpointWriter& writer) const; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
75 |
}; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
76 |
|
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
77 |
void JfrSerializerRegistration::invoke(JfrCheckpointWriter& writer) const { |
50113 | 78 |
if (_cache.valid()) { |
79 |
writer.increment(); |
|
80 |
_cache->write(writer); |
|
81 |
return; |
|
82 |
} |
|
83 |
const JfrCheckpointContext ctx = writer.context(); |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
84 |
// serialize the type id before invoking callback |
50113 | 85 |
writer.write_type(_id); |
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
86 |
const intptr_t start = writer.current_offset(); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
87 |
// invoke the serializer routine |
50113 | 88 |
_serializer->serialize(writer); |
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
89 |
if (start == writer.current_offset() ) { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
90 |
// the serializer implementation did nothing, rewind to restore |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
91 |
writer.set_context(ctx); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
92 |
return; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
93 |
} |
50113 | 94 |
if (_permit_cache) { |
95 |
_cache = writer.copy(&ctx); |
|
96 |
} |
|
97 |
} |
|
98 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
99 |
class SerializerRegistrationGuard : public StackObj { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
100 |
private: |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
101 |
static Semaphore _mutex_semaphore; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
102 |
public: |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
103 |
SerializerRegistrationGuard() { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
104 |
_mutex_semaphore.wait(); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
105 |
} |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
106 |
~SerializerRegistrationGuard() { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
107 |
_mutex_semaphore.signal(); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
108 |
} |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
109 |
}; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
110 |
|
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
111 |
Semaphore SerializerRegistrationGuard::_mutex_semaphore(1); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
112 |
|
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
113 |
typedef JfrDoublyLinkedList<JfrSerializerRegistration> List; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
114 |
typedef StopOnNullIterator<const List> Iterator; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
115 |
static List types; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
116 |
static List safepoint_types; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
117 |
|
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
118 |
void JfrTypeManager::clear() { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
119 |
SerializerRegistrationGuard guard; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
120 |
Iterator iter(types); |
50113 | 121 |
JfrSerializerRegistration* registration; |
122 |
while (iter.has_next()) { |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
123 |
registration = types.remove(iter.next()); |
50113 | 124 |
assert(registration != NULL, "invariant"); |
125 |
delete registration; |
|
126 |
} |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
127 |
Iterator sp_type_iter(safepoint_types); |
50113 | 128 |
while (sp_type_iter.has_next()) { |
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
129 |
registration = safepoint_types.remove(sp_type_iter.next()); |
50113 | 130 |
assert(registration != NULL, "invariant"); |
131 |
delete registration; |
|
132 |
} |
|
133 |
} |
|
134 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
135 |
void JfrTypeManager::write_types(JfrCheckpointWriter& writer) { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
136 |
const Iterator iter(types); |
50113 | 137 |
while (iter.has_next()) { |
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
138 |
iter.next()->invoke(writer); |
50113 | 139 |
} |
140 |
} |
|
141 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
142 |
void JfrTypeManager::write_safepoint_types(JfrCheckpointWriter& writer) { |
50113 | 143 |
assert(SafepointSynchronize::is_at_safepoint(), "invariant"); |
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
144 |
const Iterator iter(safepoint_types); |
50113 | 145 |
while (iter.has_next()) { |
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
146 |
iter.next()->invoke(writer); |
50113 | 147 |
} |
148 |
} |
|
149 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
150 |
void JfrTypeManager::write_type_set() { |
50113 | 151 |
// can safepoint here because of Module_lock |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
52212
diff
changeset
|
152 |
MutexLocker cld_lock(SafepointSynchronize::is_at_safepoint() ? NULL : ClassLoaderDataGraph_lock); |
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
52212
diff
changeset
|
153 |
MutexLocker lock(SafepointSynchronize::is_at_safepoint() ? NULL : Module_lock); |
51608 | 154 |
|
50113 | 155 |
JfrCheckpointWriter writer(true, true, Thread::current()); |
156 |
TypeSet set; |
|
157 |
set.serialize(writer); |
|
158 |
} |
|
159 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
160 |
void JfrTypeManager::write_type_set_for_unloaded_classes() { |
52212
e6973df15152
8212663: Remove conservative at_safepoint assert when JFR writes type sets during class unloading
eosterlund
parents:
51608
diff
changeset
|
161 |
assert_locked_or_safepoint(ClassLoaderDataGraph_lock); |
50113 | 162 |
JfrCheckpointWriter writer(false, true, Thread::current()); |
163 |
ClassUnloadTypeSet class_unload_set; |
|
164 |
class_unload_set.serialize(writer); |
|
165 |
} |
|
166 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
167 |
void JfrTypeManager::create_thread_checkpoint(JavaThread* jt) { |
50113 | 168 |
assert(jt != NULL, "invariant"); |
169 |
JfrThreadConstant type_thread(jt); |
|
170 |
JfrCheckpointWriter writer(false, true, jt); |
|
171 |
writer.write_type(TYPE_THREAD); |
|
172 |
type_thread.serialize(writer); |
|
173 |
// create and install a checkpoint blob |
|
174 |
jt->jfr_thread_local()->set_thread_checkpoint(writer.checkpoint_blob()); |
|
175 |
assert(jt->jfr_thread_local()->has_thread_checkpoint(), "invariant"); |
|
176 |
} |
|
177 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
178 |
void JfrTypeManager::write_thread_checkpoint(JavaThread* jt) { |
50113 | 179 |
assert(jt != NULL, "JavaThread is NULL!"); |
180 |
ResourceMark rm(jt); |
|
181 |
if (jt->jfr_thread_local()->has_thread_checkpoint()) { |
|
182 |
JfrCheckpointWriter writer(false, false, jt); |
|
183 |
jt->jfr_thread_local()->thread_checkpoint()->write(writer); |
|
184 |
} else { |
|
185 |
JfrThreadConstant type_thread(jt); |
|
186 |
JfrCheckpointWriter writer(false, true, jt); |
|
187 |
writer.write_type(TYPE_THREAD); |
|
188 |
type_thread.serialize(writer); |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
#ifdef ASSERT |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
193 |
static void assert_not_registered_twice(JfrTypeId id, List& list) { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
194 |
const Iterator iter(list); |
50113 | 195 |
while (iter.has_next()) { |
196 |
assert(iter.next()->id() != id, "invariant"); |
|
197 |
} |
|
198 |
} |
|
199 |
#endif |
|
200 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
201 |
static bool register_type(JfrTypeId id, bool require_safepoint, bool permit_cache, JfrSerializer* serializer) { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
202 |
assert(serializer != NULL, "invariant"); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
203 |
JfrSerializerRegistration* const registration = new JfrSerializerRegistration(id, permit_cache, serializer); |
50113 | 204 |
if (registration == NULL) { |
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
205 |
delete serializer; |
50113 | 206 |
return false; |
207 |
} |
|
208 |
if (require_safepoint) { |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
209 |
assert(!safepoint_types.in_list(registration), "invariant"); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
210 |
DEBUG_ONLY(assert_not_registered_twice(id, safepoint_types);) |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
211 |
safepoint_types.prepend(registration); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
212 |
} else { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
213 |
assert(!types.in_list(registration), "invariant"); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
214 |
DEBUG_ONLY(assert_not_registered_twice(id, types);) |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
215 |
types.prepend(registration); |
50113 | 216 |
} |
217 |
return true; |
|
218 |
} |
|
219 |
||
220 |
bool JfrTypeManager::initialize() { |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
221 |
SerializerRegistrationGuard guard; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
222 |
|
50113 | 223 |
// register non-safepointing type serialization |
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
224 |
register_type(TYPE_FLAGVALUEORIGIN, false, true, new FlagValueOriginConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
225 |
register_type(TYPE_INFLATECAUSE, false, true, new MonitorInflateCauseConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
226 |
register_type(TYPE_GCCAUSE, false, true, new GCCauseConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
227 |
register_type(TYPE_GCNAME, false, true, new GCNameConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
228 |
register_type(TYPE_GCWHEN, false, true, new GCWhenConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
229 |
register_type(TYPE_G1HEAPREGIONTYPE, false, true, new G1HeapRegionTypeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
230 |
register_type(TYPE_GCTHRESHOLDUPDATER, false, true, new GCThresholdUpdaterConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
231 |
register_type(TYPE_METADATATYPE, false, true, new MetadataTypeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
232 |
register_type(TYPE_METASPACEOBJECTTYPE, false, true, new MetaspaceObjectTypeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
233 |
register_type(TYPE_G1YCTYPE, false, true, new G1YCTypeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
234 |
register_type(TYPE_REFERENCETYPE, false, true, new ReferenceTypeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
235 |
register_type(TYPE_NARROWOOPMODE, false, true, new NarrowOopModeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
236 |
register_type(TYPE_COMPILERPHASETYPE, false, true, new CompilerPhaseTypeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
237 |
register_type(TYPE_CODEBLOBTYPE, false, true, new CodeBlobTypeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
238 |
register_type(TYPE_VMOPERATIONTYPE, false, true, new VMOperationTypeConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
239 |
register_type(TYPE_THREADSTATE, false, true, new ThreadStateConstant()); |
50113 | 240 |
|
241 |
// register safepointing type serialization |
|
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
242 |
register_type(TYPE_THREADGROUP, true, false, new JfrThreadGroupConstant()); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
243 |
register_type(TYPE_THREAD, true, false, new JfrThreadConstantSet()); |
50113 | 244 |
return true; |
245 |
} |
|
246 |
||
50703
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
247 |
// implementation for the static registration function exposed in the JfrSerializer api |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
248 |
bool JfrSerializer::register_serializer(JfrTypeId id, bool require_safepoint, bool permit_cache, JfrSerializer* serializer) { |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
249 |
SerializerRegistrationGuard guard; |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
250 |
return register_type(id, require_safepoint, permit_cache, serializer); |
0486d7749b8d
8205053: Decouple type registration from framework lifecycle
egahlin
parents:
50525
diff
changeset
|
251 |
} |