67 // decrement upon destruction.
68 void operator=(TempNewSymbol rhs) {
69 Symbol* tmp = rhs._temp;
70 rhs._temp = _temp;
71 _temp = tmp;
72 }
73
74 // Decrement reference counter so it can go away if it's unused
75 ~TempNewSymbol() {
76 if (_temp != NULL) {
77 _temp->decrement_refcount();
78 }
79 }
80
81 // Symbol* conversion operators
82 Symbol* operator -> () const { return _temp; }
83 bool operator == (Symbol* o) const { return _temp == o; }
84 operator Symbol*() { return _temp; }
85 };
86
87 class CompactSymbolTableWriter;
88 class SerializeClosure;
89
90 class SymbolTableConfig;
91 typedef ConcurrentHashTable<Symbol*,
92 SymbolTableConfig, mtSymbol> SymbolTableHash;
93
94 class SymbolTableCreateEntry;
95
96 class SymbolTable : public CHeapObj<mtSymbol> {
97 friend class VMStructs;
98 friend class Symbol;
99 friend class ClassFileParser;
100 friend class SymbolTableConfig;
101 friend class SymbolTableCreateEntry;
102
103 private:
104 static void delete_symbol(Symbol* sym);
105 void grow(JavaThread* jt);
106 void clean_dead_entries(JavaThread* jt);
107
223 static Symbol* new_symbol(const char* name, TRAPS) {
224 return new_symbol(name, (int)strlen(name), THREAD);
225 }
226 static Symbol* new_symbol(const Symbol* sym, int begin, int end, TRAPS) {
227 assert(begin <= end && end <= sym->utf8_length(), "just checking");
228 return lookup(sym, begin, end, THREAD);
229 }
230 // Create a symbol in the arena for symbols that are not deleted
231 static Symbol* new_permanent_symbol(const char* name, TRAPS);
232
233 // Rehash the string table if it gets out of balance
234 static void rehash_table();
235 static bool needs_rehashing()
236 { return SymbolTable::the_table()->_needs_rehashing; }
237
238 // Heap dumper and CDS
239 static void symbols_do(SymbolClosure *cl);
240
241 // Sharing
242 private:
243 static void copy_shared_symbol_table(CompactSymbolTableWriter* ch_table);
244 public:
245 static void write_to_archive() NOT_CDS_RETURN;
246 static void serialize(SerializeClosure* soc) NOT_CDS_RETURN;
247 static void metaspace_pointers_do(MetaspaceClosure* it);
248
249 // Jcmd
250 static void dump(outputStream* st, bool verbose=false);
251 // Debugging
252 static void verify();
253 static void read(const char* filename, TRAPS);
254
255 // Histogram
256 static void print_histogram() PRODUCT_RETURN;
257 };
258
259 #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP
|
67 // decrement upon destruction.
68 void operator=(TempNewSymbol rhs) {
69 Symbol* tmp = rhs._temp;
70 rhs._temp = _temp;
71 _temp = tmp;
72 }
73
74 // Decrement reference counter so it can go away if it's unused
75 ~TempNewSymbol() {
76 if (_temp != NULL) {
77 _temp->decrement_refcount();
78 }
79 }
80
81 // Symbol* conversion operators
82 Symbol* operator -> () const { return _temp; }
83 bool operator == (Symbol* o) const { return _temp == o; }
84 operator Symbol*() { return _temp; }
85 };
86
87 class CompactHashtableWriter;
88 class SerializeClosure;
89
90 class SymbolTableConfig;
91 typedef ConcurrentHashTable<Symbol*,
92 SymbolTableConfig, mtSymbol> SymbolTableHash;
93
94 class SymbolTableCreateEntry;
95
96 class SymbolTable : public CHeapObj<mtSymbol> {
97 friend class VMStructs;
98 friend class Symbol;
99 friend class ClassFileParser;
100 friend class SymbolTableConfig;
101 friend class SymbolTableCreateEntry;
102
103 private:
104 static void delete_symbol(Symbol* sym);
105 void grow(JavaThread* jt);
106 void clean_dead_entries(JavaThread* jt);
107
223 static Symbol* new_symbol(const char* name, TRAPS) {
224 return new_symbol(name, (int)strlen(name), THREAD);
225 }
226 static Symbol* new_symbol(const Symbol* sym, int begin, int end, TRAPS) {
227 assert(begin <= end && end <= sym->utf8_length(), "just checking");
228 return lookup(sym, begin, end, THREAD);
229 }
230 // Create a symbol in the arena for symbols that are not deleted
231 static Symbol* new_permanent_symbol(const char* name, TRAPS);
232
233 // Rehash the string table if it gets out of balance
234 static void rehash_table();
235 static bool needs_rehashing()
236 { return SymbolTable::the_table()->_needs_rehashing; }
237
238 // Heap dumper and CDS
239 static void symbols_do(SymbolClosure *cl);
240
241 // Sharing
242 private:
243 static void copy_shared_symbol_table(CompactHashtableWriter* ch_table);
244 public:
245 static void write_to_archive() NOT_CDS_RETURN;
246 static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_RETURN;
247 static void metaspace_pointers_do(MetaspaceClosure* it);
248
249 // Jcmd
250 static void dump(outputStream* st, bool verbose=false);
251 // Debugging
252 static void verify();
253 static void read(const char* filename, TRAPS);
254
255 // Histogram
256 static void print_histogram() PRODUCT_RETURN;
257 };
258
259 #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP
|