comparison src/share/vm/classfile/symbolTable.hpp @ 20493:152cf4afc11f

8056084: Refactor Hashtable to allow implementations without rehashing support Reviewed-by: gziemski, jmasa, brutisso, coleenp, tschatzl
author mgerdin
date Fri, 29 Aug 2014 13:08:01 +0200
parents 5a32d2a3cc1e
children 7848fc12602b
comparison
equal deleted inserted replaced
20492:50d3433155d9 20493:152cf4afc11f
72 bool operator == (Symbol* o) const { return _temp == o; } 72 bool operator == (Symbol* o) const { return _temp == o; }
73 // Sneaky conversion function 73 // Sneaky conversion function
74 operator Symbol*() { return _temp; } 74 operator Symbol*() { return _temp; }
75 }; 75 };
76 76
77 class SymbolTable : public Hashtable<Symbol*, mtSymbol> { 77 class SymbolTable : public RehashableHashtable<Symbol*, mtSymbol> {
78 friend class VMStructs; 78 friend class VMStructs;
79 friend class ClassFileParser; 79 friend class ClassFileParser;
80 80
81 private: 81 private:
82 // The symbol table 82 // The symbol table
108 } 108 }
109 109
110 Symbol* lookup(int index, const char* name, int len, unsigned int hash); 110 Symbol* lookup(int index, const char* name, int len, unsigned int hash);
111 111
112 SymbolTable() 112 SymbolTable()
113 : Hashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {} 113 : RehashableHashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {}
114 114
115 SymbolTable(HashtableBucket<mtSymbol>* t, int number_of_entries) 115 SymbolTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
116 : Hashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>), t, 116 : RehashableHashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>), t,
117 number_of_entries) {} 117 number_of_entries) {}
118 118
119 // Arena for permanent symbols (null class loader) that are never unloaded 119 // Arena for permanent symbols (null class loader) that are never unloaded
120 static Arena* _arena; 120 static Arena* _arena;
121 static Arena* arena() { return _arena; } // called for statistics 121 static Arena* arena() { return _arena; } // called for statistics
250 // Parallel chunked scanning 250 // Parallel chunked scanning
251 static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; } 251 static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; }
252 static int parallel_claimed_index() { return _parallel_claimed_idx; } 252 static int parallel_claimed_index() { return _parallel_claimed_idx; }
253 }; 253 };
254 254
255 class StringTable : public Hashtable<oop, mtSymbol> { 255 class StringTable : public RehashableHashtable<oop, mtSymbol> {
256 friend class VMStructs; 256 friend class VMStructs;
257 257
258 private: 258 private:
259 // The string table 259 // The string table
260 static StringTable* _the_table; 260 static StringTable* _the_table;
276 static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx); 276 static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
277 // Unlink or apply the give oop closure to the entries to the buckets 277 // Unlink or apply the give oop closure to the entries to the buckets
278 // in the range [start_idx, end_idx). 278 // in the range [start_idx, end_idx).
279 static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed); 279 static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed);
280 280
281 StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize, 281 StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize,
282 sizeof (HashtableEntry<oop, mtSymbol>)) {} 282 sizeof (HashtableEntry<oop, mtSymbol>)) {}
283 283
284 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) 284 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
285 : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t, 285 : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
286 number_of_entries) {} 286 number_of_entries) {}
287 public: 287 public:
288 // The string table 288 // The string table
289 static StringTable* the_table() { return _the_table; } 289 static StringTable* the_table() { return _the_table; }
290 290