79 // The symbol table |
79 // The symbol table |
80 static SymbolTable* _the_table; |
80 static SymbolTable* _the_table; |
81 |
81 |
82 // Set if one bucket is out of balance due to hash algorithm deficiency |
82 // Set if one bucket is out of balance due to hash algorithm deficiency |
83 static bool _needs_rehashing; |
83 static bool _needs_rehashing; |
84 static jint _seed; |
|
85 |
84 |
86 // For statistics |
85 // For statistics |
87 static int symbols_removed; |
86 static int symbols_removed; |
88 static int symbols_counted; |
87 static int symbols_counted; |
89 |
88 |
122 // Arena for permanent symbols (null class loader) that are never unloaded |
121 // Arena for permanent symbols (null class loader) that are never unloaded |
123 static Arena* _arena; |
122 static Arena* _arena; |
124 static Arena* arena() { return _arena; } // called for statistics |
123 static Arena* arena() { return _arena; } // called for statistics |
125 |
124 |
126 static void initialize_symbols(int arena_alloc_size = 0); |
125 static void initialize_symbols(int arena_alloc_size = 0); |
127 |
|
128 static bool use_alternate_hashcode() { return _seed != 0; } |
|
129 static jint seed() { return _seed; } |
|
130 |
|
131 unsigned int new_hash(Symbol* sym); |
|
132 public: |
126 public: |
133 enum { |
127 enum { |
134 symbol_alloc_batch_size = 8, |
128 symbol_alloc_batch_size = 8, |
135 // Pick initial size based on java -version size measurements |
129 // Pick initial size based on java -version size measurements |
136 symbol_alloc_arena_size = 360*K |
130 symbol_alloc_arena_size = 360*K |
245 // The string table |
239 // The string table |
246 static StringTable* _the_table; |
240 static StringTable* _the_table; |
247 |
241 |
248 // Set if one bucket is out of balance due to hash algorithm deficiency |
242 // Set if one bucket is out of balance due to hash algorithm deficiency |
249 static bool _needs_rehashing; |
243 static bool _needs_rehashing; |
250 static jint _seed; |
|
251 |
244 |
252 static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); |
245 static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); |
253 oop basic_add(int index, Handle string_or_null, jchar* name, int len, |
246 oop basic_add(int index, Handle string_or_null, jchar* name, int len, |
254 unsigned int hashValue, TRAPS); |
247 unsigned int hashValue, TRAPS); |
255 |
248 |
259 sizeof (HashtableEntry<oop, mtSymbol>)) {} |
252 sizeof (HashtableEntry<oop, mtSymbol>)) {} |
260 |
253 |
261 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) |
254 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) |
262 : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t, |
255 : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t, |
263 number_of_entries) {} |
256 number_of_entries) {} |
264 |
|
265 static bool use_alternate_hashcode() { return _seed != 0; } |
|
266 static jint seed() { return _seed; } |
|
267 |
|
268 unsigned int new_hash(oop s); |
|
269 public: |
257 public: |
270 // The string table |
258 // The string table |
271 static StringTable* the_table() { return _the_table; } |
259 static StringTable* the_table() { return _the_table; } |
272 |
260 |
273 static void create_table() { |
261 static void create_table() { |