comparison src/share/vm/classfile/symbolTable.hpp @ 14422:2b8e28fdf503

Merge
author kvn
date Tue, 05 Nov 2013 17:38:04 -0800
parents c90e76575b03
children 893ce66f7473
comparison
equal deleted inserted replaced
14421:3068270ba476 14422:2b8e28fdf503
105 int* cp_indices, unsigned int* hashValues, 105 int* cp_indices, unsigned int* hashValues,
106 TRAPS) { 106 TRAPS) {
107 add(loader_data, cp, names_count, name, lengths, cp_indices, hashValues, THREAD); 107 add(loader_data, cp, names_count, name, lengths, cp_indices, hashValues, THREAD);
108 } 108 }
109 109
110 // Table size
111 enum {
112 symbol_table_size = 20011
113 };
114
115 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);
116 111
117 SymbolTable() 112 SymbolTable()
118 : Hashtable<Symbol*, mtSymbol>(symbol_table_size, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {} 113 : Hashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {}
119 114
120 SymbolTable(HashtableBucket<mtSymbol>* t, int number_of_entries) 115 SymbolTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
121 : Hashtable<Symbol*, mtSymbol>(symbol_table_size, sizeof (HashtableEntry<Symbol*, mtSymbol>), t, 116 : Hashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>), t,
122 number_of_entries) {} 117 number_of_entries) {}
123 118
124 // Arena for permanent symbols (null class loader) that are never unloaded 119 // Arena for permanent symbols (null class loader) that are never unloaded
125 static Arena* _arena; 120 static Arena* _arena;
126 static Arena* arena() { return _arena; } // called for statistics 121 static Arena* arena() { return _arena; } // called for statistics
134 }; 129 };
135 130
136 // The symbol table 131 // The symbol table
137 static SymbolTable* the_table() { return _the_table; } 132 static SymbolTable* the_table() { return _the_table; }
138 133
134 // Size of one bucket in the string table. Used when checking for rollover.
135 static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
136
139 static void create_table() { 137 static void create_table() {
140 assert(_the_table == NULL, "One symbol table allowed."); 138 assert(_the_table == NULL, "One symbol table allowed.");
141 _the_table = new SymbolTable(); 139 _the_table = new SymbolTable();
142 initialize_symbols(symbol_alloc_arena_size); 140 initialize_symbols(symbol_alloc_arena_size);
143 } 141 }
144 142
145 static void create_table(HashtableBucket<mtSymbol>* t, int length, 143 static void create_table(HashtableBucket<mtSymbol>* t, int length,
146 int number_of_entries) { 144 int number_of_entries) {
147 assert(_the_table == NULL, "One symbol table allowed."); 145 assert(_the_table == NULL, "One symbol table allowed.");
148 assert(length == symbol_table_size * sizeof(HashtableBucket<mtSymbol>), 146
149 "bad shared symbol size."); 147 // If CDS archive used a different symbol table size, use that size instead
148 // which is better than giving an error.
149 SymbolTableSize = length/bucket_size();
150
150 _the_table = new SymbolTable(t, number_of_entries); 151 _the_table = new SymbolTable(t, number_of_entries);
151 // if CDS give symbol table a default arena size since most symbols 152 // if CDS give symbol table a default arena size since most symbols
152 // are already allocated in the shared misc section. 153 // are already allocated in the shared misc section.
153 initialize_symbols(); 154 initialize_symbols();
154 } 155 }
309 310
310 // Debugging 311 // Debugging
311 static void verify(); 312 static void verify();
312 static void dump(outputStream* st); 313 static void dump(outputStream* st);
313 314
315 enum VerifyMesgModes {
316 _verify_quietly = 0,
317 _verify_with_mesgs = 1
318 };
319
320 enum VerifyRetTypes {
321 _verify_pass = 0,
322 _verify_fail_continue = 1,
323 _verify_fail_done = 2
324 };
325
326 static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
327 HashtableEntry<oop, mtSymbol>* e_ptr1,
328 int bkt2, int e_cnt2,
329 HashtableEntry<oop, mtSymbol>* e_ptr2);
330 static VerifyRetTypes verify_entry(int bkt, int e_cnt,
331 HashtableEntry<oop, mtSymbol>* e_ptr,
332 VerifyMesgModes mesg_mode);
333 static int verify_and_compare_entries();
334
314 // Sharing 335 // Sharing
315 static void copy_buckets(char** top, char*end) { 336 static void copy_buckets(char** top, char*end) {
316 the_table()->Hashtable<oop, mtSymbol>::copy_buckets(top, end); 337 the_table()->Hashtable<oop, mtSymbol>::copy_buckets(top, end);
317 } 338 }
318 static void copy_table(char** top, char*end) { 339 static void copy_table(char** top, char*end) {