26 #include "jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp" |
26 #include "jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp" |
27 #include "oops/instanceKlass.hpp" |
27 #include "oops/instanceKlass.hpp" |
28 #include "oops/oop.inline.hpp" |
28 #include "oops/oop.inline.hpp" |
29 #include "oops/symbol.hpp" |
29 #include "oops/symbol.hpp" |
30 |
30 |
31 JfrSymbolId::JfrSymbolId() : _symbol_id_counter(0), _sym_table(new SymbolTable(this)), _cstring_table(new CStringTable(this)) { |
31 JfrSymbolId::JfrSymbolId() : _symbol_id_counter(0), _sym_table(new SymbolTable(this)), |
|
32 _cstring_table(new CStringTable(this)), _pkg_table(new CStringTable(this)) { |
32 assert(_sym_table != NULL, "invariant"); |
33 assert(_sym_table != NULL, "invariant"); |
33 assert(_cstring_table != NULL, "invariant"); |
34 assert(_cstring_table != NULL, "invariant"); |
|
35 assert(_pkg_table != NULL, "invariant"); |
34 initialize(); |
36 initialize(); |
35 } |
37 } |
36 |
38 |
37 void JfrSymbolId::initialize() { |
39 void JfrSymbolId::initialize() { |
38 clear(); |
40 clear(); |
50 if (_cstring_table->has_entries()) { |
52 if (_cstring_table->has_entries()) { |
51 _cstring_table->clear_entries(); |
53 _cstring_table->clear_entries(); |
52 } |
54 } |
53 assert(!_cstring_table->has_entries(), "invariant"); |
55 assert(!_cstring_table->has_entries(), "invariant"); |
54 _symbol_id_counter = 0; |
56 _symbol_id_counter = 0; |
|
57 assert(_pkg_table != NULL, "invariant"); |
|
58 if (_pkg_table->has_entries()) { |
|
59 _pkg_table->clear_entries(); |
|
60 } |
|
61 assert(!_pkg_table->has_entries(), "invariant"); |
55 } |
62 } |
56 |
63 |
57 JfrSymbolId::~JfrSymbolId() { |
64 JfrSymbolId::~JfrSymbolId() { |
58 delete _sym_table; |
65 delete _sym_table; |
59 delete _cstring_table; |
66 delete _cstring_table; |
144 } |
151 } |
145 |
152 |
146 traceid JfrSymbolId::mark(const char* str, uintptr_t hash) { |
153 traceid JfrSymbolId::mark(const char* str, uintptr_t hash) { |
147 assert(str != NULL, "invariant"); |
154 assert(str != NULL, "invariant"); |
148 return _cstring_table->id(str, hash); |
155 return _cstring_table->id(str, hash); |
|
156 } |
|
157 |
|
158 traceid JfrSymbolId::markPackage(const char* name, uintptr_t hash) { |
|
159 assert(name != NULL, "invariant"); |
|
160 assert(_pkg_table != NULL, "invariant"); |
|
161 return _pkg_table->id(name, hash); |
149 } |
162 } |
150 |
163 |
151 bool JfrSymbolId::is_anonymous_klass(const Klass* k) { |
164 bool JfrSymbolId::is_anonymous_klass(const Klass* k) { |
152 assert(k != NULL, "invariant"); |
165 assert(k != NULL, "invariant"); |
153 return k->oop_is_instance() && ((const InstanceKlass*)k)->is_anonymous(); |
166 return k->oop_is_instance() && ((const InstanceKlass*)k)->is_anonymous(); |
241 |
254 |
242 traceid JfrArtifactSet::mark(const char* const str, uintptr_t hash) { |
255 traceid JfrArtifactSet::mark(const char* const str, uintptr_t hash) { |
243 return _symbol_id->mark(str, hash); |
256 return _symbol_id->mark(str, hash); |
244 } |
257 } |
245 |
258 |
|
259 traceid JfrArtifactSet::markPackage(const char* const name, uintptr_t hash) { |
|
260 return _symbol_id->markPackage(name, hash); |
|
261 } |
|
262 |
246 const JfrSymbolId::SymbolEntry* JfrArtifactSet::map_symbol(const Symbol* symbol) const { |
263 const JfrSymbolId::SymbolEntry* JfrArtifactSet::map_symbol(const Symbol* symbol) const { |
247 return _symbol_id->map_symbol(symbol); |
264 return _symbol_id->map_symbol(symbol); |
248 } |
265 } |
249 |
266 |
250 const JfrSymbolId::SymbolEntry* JfrArtifactSet::map_symbol(uintptr_t hash) const { |
267 const JfrSymbolId::SymbolEntry* JfrArtifactSet::map_symbol(uintptr_t hash) const { |