author | mgronlun |
Sat, 24 Aug 2019 14:30:27 +0200 | |
branch | JEP-349-branch |
changeset 57870 | 00860d9caf4d |
parent 57360 | 5d043a159d5c |
child 57983 | a57907813a83 |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
57360 | 2 |
* Copyright (c) 2017, 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" |
|
26 |
#include "jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp" |
|
27 |
#include "oops/instanceKlass.hpp" |
|
28 |
#include "oops/oop.inline.hpp" |
|
29 |
#include "oops/symbol.hpp" |
|
30 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
31 |
JfrSymbolId::JfrSymbolId() : |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
32 |
_sym_table(new SymbolTable(this)), |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
33 |
_cstring_table(new CStringTable(this)), |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
34 |
_sym_list(NULL), |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
35 |
_cstring_list(NULL), |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
36 |
_symbol_id_counter(0), |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
37 |
_class_unload(false) { |
50113 | 38 |
assert(_sym_table != NULL, "invariant"); |
39 |
assert(_cstring_table != NULL, "invariant"); |
|
40 |
} |
|
41 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
42 |
JfrSymbolId::~JfrSymbolId() { |
50113 | 43 |
clear(); |
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
44 |
delete _sym_table; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
45 |
delete _cstring_table; |
50113 | 46 |
} |
47 |
||
48 |
void JfrSymbolId::clear() { |
|
49 |
assert(_sym_table != NULL, "invariant"); |
|
50 |
if (_sym_table->has_entries()) { |
|
51 |
_sym_table->clear_entries(); |
|
52 |
} |
|
53 |
assert(!_sym_table->has_entries(), "invariant"); |
|
54 |
||
55 |
assert(_cstring_table != NULL, "invariant"); |
|
56 |
if (_cstring_table->has_entries()) { |
|
57 |
_cstring_table->clear_entries(); |
|
58 |
} |
|
59 |
assert(!_cstring_table->has_entries(), "invariant"); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
60 |
|
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
61 |
_sym_list = NULL; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
62 |
_cstring_list = NULL; |
50113 | 63 |
_symbol_id_counter = 0; |
64 |
} |
|
65 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
66 |
void JfrSymbolId::set_class_unload(bool class_unload) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
67 |
_class_unload = class_unload; |
50113 | 68 |
} |
69 |
||
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
70 |
traceid JfrSymbolId::mark_unsafe_anonymous_klass_name(const Klass* k) { |
50113 | 71 |
assert(k != NULL, "invariant"); |
72 |
assert(k->is_instance_klass(), "invariant"); |
|
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
73 |
assert(is_unsafe_anonymous_klass(k), "invariant"); |
50113 | 74 |
|
75 |
uintptr_t anonymous_symbol_hash_code = 0; |
|
76 |
const char* const anonymous_symbol = |
|
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
77 |
create_unsafe_anonymous_klass_symbol((const InstanceKlass*)k, anonymous_symbol_hash_code); |
50113 | 78 |
|
79 |
if (anonymous_symbol == NULL) { |
|
80 |
return 0; |
|
81 |
} |
|
82 |
||
83 |
assert(anonymous_symbol_hash_code != 0, "invariant"); |
|
84 |
traceid symbol_id = mark(anonymous_symbol, anonymous_symbol_hash_code); |
|
85 |
assert(mark(anonymous_symbol, anonymous_symbol_hash_code) == symbol_id, "invariant"); |
|
86 |
return symbol_id; |
|
87 |
} |
|
88 |
||
89 |
const JfrSymbolId::SymbolEntry* JfrSymbolId::map_symbol(const Symbol* symbol) const { |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
90 |
return _sym_table->lookup_only(symbol, (uintptr_t)symbol->identity_hash()); |
50113 | 91 |
} |
92 |
||
93 |
const JfrSymbolId::SymbolEntry* JfrSymbolId::map_symbol(uintptr_t hash) const { |
|
94 |
return _sym_table->lookup_only(NULL, hash); |
|
95 |
} |
|
96 |
||
97 |
const JfrSymbolId::CStringEntry* JfrSymbolId::map_cstring(uintptr_t hash) const { |
|
98 |
return _cstring_table->lookup_only(NULL, hash); |
|
99 |
} |
|
100 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
101 |
void JfrSymbolId::assign_id(const SymbolEntry* entry) { |
50113 | 102 |
assert(entry != NULL, "invariant"); |
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
103 |
const_cast<Symbol*>(entry->literal())->increment_refcount(); |
50113 | 104 |
assert(entry->id() == 0, "invariant"); |
105 |
entry->set_id(++_symbol_id_counter); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
106 |
entry->set_list_next(_sym_list); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
107 |
_sym_list = entry; |
50113 | 108 |
} |
109 |
||
110 |
bool JfrSymbolId::equals(const Symbol* query, uintptr_t hash, const SymbolEntry* entry) { |
|
111 |
// query might be NULL |
|
112 |
assert(entry != NULL, "invariant"); |
|
113 |
assert(entry->hash() == hash, "invariant"); |
|
114 |
return true; |
|
115 |
} |
|
116 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
117 |
void JfrSymbolId::unlink(const SymbolEntry* entry) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
118 |
assert(entry != NULL, "invariant"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
119 |
const_cast<Symbol*>(entry->literal())->decrement_refcount(); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
120 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
121 |
|
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
122 |
void JfrSymbolId::assign_id(const CStringEntry* entry) { |
50113 | 123 |
assert(entry != NULL, "invariant"); |
124 |
assert(entry->id() == 0, "invariant"); |
|
125 |
entry->set_id(++_symbol_id_counter); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
126 |
entry->set_list_next(_cstring_list); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
127 |
_cstring_list = entry; |
50113 | 128 |
} |
129 |
||
130 |
bool JfrSymbolId::equals(const char* query, uintptr_t hash, const CStringEntry* entry) { |
|
131 |
// query might be NULL |
|
132 |
assert(entry != NULL, "invariant"); |
|
133 |
assert(entry->hash() == hash, "invariant"); |
|
134 |
return true; |
|
135 |
} |
|
136 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
137 |
void JfrSymbolId::unlink(const CStringEntry* entry) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
138 |
assert(entry != NULL, "invariant"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
139 |
if (entry->id() != 1) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
140 |
FREE_C_HEAP_ARRAY(char, entry->literal()); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
141 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
142 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
143 |
|
50113 | 144 |
traceid JfrSymbolId::mark(const Klass* k) { |
145 |
assert(k != NULL, "invariant"); |
|
146 |
traceid symbol_id = 0; |
|
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
147 |
if (is_unsafe_anonymous_klass(k)) { |
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
148 |
symbol_id = mark_unsafe_anonymous_klass_name(k); |
50113 | 149 |
} |
150 |
if (0 == symbol_id) { |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
151 |
Symbol* const sym = k->name(); |
50113 | 152 |
if (sym != NULL) { |
153 |
symbol_id = mark(sym); |
|
154 |
} |
|
155 |
} |
|
156 |
assert(symbol_id > 0, "a symbol handler must mark the symbol for writing"); |
|
157 |
return symbol_id; |
|
158 |
} |
|
159 |
||
160 |
traceid JfrSymbolId::mark(const Symbol* symbol) { |
|
161 |
assert(symbol != NULL, "invariant"); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
162 |
return mark(symbol, (uintptr_t)symbol->identity_hash()); |
50113 | 163 |
} |
164 |
||
165 |
traceid JfrSymbolId::mark(const Symbol* data, uintptr_t hash) { |
|
166 |
assert(data != NULL, "invariant"); |
|
167 |
assert(_sym_table != NULL, "invariant"); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
168 |
const SymbolEntry& entry = _sym_table->lookup_put(data, hash); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
169 |
if (_class_unload) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
170 |
entry.set_unloading(); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
171 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
172 |
return entry.id(); |
50113 | 173 |
} |
174 |
||
175 |
traceid JfrSymbolId::mark(const char* str, uintptr_t hash) { |
|
176 |
assert(str != NULL, "invariant"); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
177 |
const CStringEntry& entry = _cstring_table->lookup_put(str, hash); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
178 |
if (_class_unload) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
179 |
entry.set_unloading(); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
180 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
181 |
return entry.id(); |
50113 | 182 |
} |
183 |
||
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
184 |
bool JfrSymbolId::is_unsafe_anonymous_klass(const Klass* k) { |
50113 | 185 |
assert(k != NULL, "invariant"); |
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
186 |
return k->is_instance_klass() && ((const InstanceKlass*)k)->is_unsafe_anonymous(); |
50113 | 187 |
} |
188 |
||
189 |
/* |
|
190 |
* jsr292 anonymous classes symbol is the external name + |
|
191 |
* the identity_hashcode slash appended: |
|
192 |
* java.lang.invoke.LambdaForm$BMH/22626602 |
|
193 |
* |
|
194 |
* caller needs ResourceMark |
|
195 |
*/ |
|
196 |
||
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
197 |
uintptr_t JfrSymbolId::unsafe_anonymous_klass_name_hash_code(const InstanceKlass* ik) { |
50113 | 198 |
assert(ik != NULL, "invariant"); |
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
199 |
assert(ik->is_unsafe_anonymous(), "invariant"); |
53176
6af596144294
8215773: applications/kitchensink/Kitchensink.java crash with "assert(ZAddress::is_marked(addr)) failed: Should be marked"
eosterlund
parents:
51444
diff
changeset
|
200 |
const oop mirror = ik->java_mirror_no_keepalive(); |
50113 | 201 |
assert(mirror != NULL, "invariant"); |
202 |
return (uintptr_t)mirror->identity_hash(); |
|
203 |
} |
|
204 |
||
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
205 |
const char* JfrSymbolId::create_unsafe_anonymous_klass_symbol(const InstanceKlass* ik, uintptr_t& hashcode) { |
50113 | 206 |
assert(ik != NULL, "invariant"); |
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
207 |
assert(ik->is_unsafe_anonymous(), "invariant"); |
50113 | 208 |
assert(0 == hashcode, "invariant"); |
209 |
char* anonymous_symbol = NULL; |
|
53176
6af596144294
8215773: applications/kitchensink/Kitchensink.java crash with "assert(ZAddress::is_marked(addr)) failed: Should be marked"
eosterlund
parents:
51444
diff
changeset
|
210 |
const oop mirror = ik->java_mirror_no_keepalive(); |
50113 | 211 |
assert(mirror != NULL, "invariant"); |
212 |
char hash_buf[40]; |
|
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
213 |
hashcode = unsafe_anonymous_klass_name_hash_code(ik); |
50113 | 214 |
sprintf(hash_buf, "/" UINTX_FORMAT, hashcode); |
215 |
const size_t hash_len = strlen(hash_buf); |
|
216 |
const size_t result_len = ik->name()->utf8_length(); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
217 |
anonymous_symbol = NEW_C_HEAP_ARRAY(char, result_len + hash_len + 1, mtTracing); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
218 |
assert(anonymous_symbol != NULL, "invariant"); |
50113 | 219 |
ik->name()->as_klass_external_name(anonymous_symbol, (int)result_len + 1); |
220 |
assert(strlen(anonymous_symbol) == result_len, "invariant"); |
|
221 |
strcpy(anonymous_symbol + result_len, hash_buf); |
|
222 |
assert(strlen(anonymous_symbol) == result_len + hash_len, "invariant"); |
|
223 |
return anonymous_symbol; |
|
224 |
} |
|
225 |
||
226 |
uintptr_t JfrSymbolId::regular_klass_name_hash_code(const Klass* k) { |
|
227 |
assert(k != NULL, "invariant"); |
|
228 |
const Symbol* const sym = k->name(); |
|
229 |
assert(sym != NULL, "invariant"); |
|
230 |
return (uintptr_t)const_cast<Symbol*>(sym)->identity_hash(); |
|
231 |
} |
|
232 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
233 |
static void preload_bootstrap_loader_name(JfrSymbolId* symbol_id) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
234 |
assert(symbol_id != NULL, "invariant"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
235 |
assert(!symbol_id->has_entries(), "invariant"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
236 |
symbol_id->mark((const char*)&BOOTSTRAP_LOADER_NAME, 0); // pre-load "bootstrap" into id 1 |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
237 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
238 |
|
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
239 |
JfrArtifactSet::JfrArtifactSet(bool class_unload) : _symbol_id(new JfrSymbolId()), |
57360 | 240 |
_klass_list(NULL), |
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
241 |
_total_count(0) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
242 |
preload_bootstrap_loader_name(_symbol_id); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
243 |
initialize(class_unload); |
50113 | 244 |
assert(_klass_list != NULL, "invariant"); |
245 |
} |
|
246 |
||
247 |
static const size_t initial_class_list_size = 200; |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
248 |
|
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
249 |
void JfrArtifactSet::initialize(bool class_unload) { |
50113 | 250 |
assert(_symbol_id != NULL, "invariant"); |
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
251 |
_symbol_id->set_class_unload(class_unload); |
57360 | 252 |
_total_count = 0; |
50113 | 253 |
// resource allocation |
254 |
_klass_list = new GrowableArray<const Klass*>(initial_class_list_size, false, mtTracing); |
|
255 |
} |
|
256 |
||
257 |
JfrArtifactSet::~JfrArtifactSet() { |
|
258 |
clear(); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
259 |
delete _symbol_id; |
50113 | 260 |
} |
261 |
||
262 |
void JfrArtifactSet::clear() { |
|
263 |
_symbol_id->clear(); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
264 |
preload_bootstrap_loader_name(_symbol_id); |
50113 | 265 |
// _klass_list will be cleared by a ResourceMark |
266 |
} |
|
267 |
||
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
268 |
traceid JfrArtifactSet::mark_unsafe_anonymous_klass_name(const Klass* klass) { |
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
51334
diff
changeset
|
269 |
return _symbol_id->mark_unsafe_anonymous_klass_name(klass); |
50113 | 270 |
} |
271 |
||
272 |
traceid JfrArtifactSet::mark(const Symbol* sym, uintptr_t hash) { |
|
273 |
return _symbol_id->mark(sym, hash); |
|
274 |
} |
|
275 |
||
276 |
traceid JfrArtifactSet::mark(const Klass* klass) { |
|
277 |
return _symbol_id->mark(klass); |
|
278 |
} |
|
279 |
||
280 |
traceid JfrArtifactSet::mark(const Symbol* symbol) { |
|
281 |
return _symbol_id->mark(symbol); |
|
282 |
} |
|
283 |
||
284 |
traceid JfrArtifactSet::mark(const char* const str, uintptr_t hash) { |
|
285 |
return _symbol_id->mark(str, hash); |
|
286 |
} |
|
287 |
||
288 |
const JfrSymbolId::SymbolEntry* JfrArtifactSet::map_symbol(const Symbol* symbol) const { |
|
289 |
return _symbol_id->map_symbol(symbol); |
|
290 |
} |
|
291 |
||
292 |
const JfrSymbolId::SymbolEntry* JfrArtifactSet::map_symbol(uintptr_t hash) const { |
|
293 |
return _symbol_id->map_symbol(hash); |
|
294 |
} |
|
295 |
||
296 |
const JfrSymbolId::CStringEntry* JfrArtifactSet::map_cstring(uintptr_t hash) const { |
|
297 |
return _symbol_id->map_cstring(hash); |
|
298 |
} |
|
299 |
||
300 |
bool JfrArtifactSet::has_klass_entries() const { |
|
301 |
return _klass_list->is_nonempty(); |
|
302 |
} |
|
303 |
||
304 |
int JfrArtifactSet::entries() const { |
|
305 |
return _klass_list->length(); |
|
306 |
} |
|
307 |
||
308 |
void JfrArtifactSet::register_klass(const Klass* k) { |
|
309 |
assert(k != NULL, "invariant"); |
|
310 |
assert(_klass_list != NULL, "invariant"); |
|
311 |
assert(_klass_list->find(k) == -1, "invariant"); |
|
312 |
_klass_list->append(k); |
|
313 |
} |
|
57360 | 314 |
|
315 |
size_t JfrArtifactSet::total_count() const { |
|
316 |
return _total_count; |
|
317 |
} |