< prev index next >

src/hotspot/share/classfile/symbolTable.cpp

Print this page
rev 52316 : 8185525: Add JFR event for DictionarySizes
Summary: Added TableStatistics event
Reviewed-by: egahlin, coleenp


 435       Symbol* sym = table->basic_add(index, (u1*)names[i], lengths[i], hashValues[i], c_heap, CHECK);
 436       cp->symbol_at_put(cp_indices[i], sym);
 437     }
 438   }
 439 }
 440 
 441 Symbol* SymbolTable::new_permanent_symbol(const char* name, TRAPS) {
 442   unsigned int hash;
 443   Symbol* result = SymbolTable::lookup_only((char*)name, (int)strlen(name), hash);
 444   if (result != NULL) {
 445     return result;
 446   }
 447   // Grab SymbolTable_lock first.
 448   MutexLocker ml(SymbolTable_lock, THREAD);
 449 
 450   SymbolTable* table = the_table();
 451   int index = table->hash_to_index(hash);
 452   return table->basic_add(index, (u1*)name, (int)strlen(name), hash, false, THREAD);
 453 }
 454 




 455 Symbol* SymbolTable::basic_add(int index_arg, u1 *name, int len,
 456                                unsigned int hashValue_arg, bool c_heap, TRAPS) {
 457   assert(!Universe::heap()->is_in_reserved(name),
 458          "proposed name of symbol must be stable");
 459 
 460   // Don't allow symbols to be created which cannot fit in a Symbol*.
 461   if (len > Symbol::max_length()) {
 462     THROW_MSG_0(vmSymbols::java_lang_InternalError(),
 463                 "name is too long to represent");
 464   }
 465 
 466   // Cannot hit a safepoint in this function because the "this" pointer can move.
 467   NoSafepointVerifier nsv;
 468 
 469   // Check if the symbol table has been rehashed, if so, need to recalculate
 470   // the hash value and index.
 471   unsigned int hashValue;
 472   int index;
 473   if (use_alternate_hashcode()) {
 474     hashValue = hash_symbol((const char*)name, len);




 435       Symbol* sym = table->basic_add(index, (u1*)names[i], lengths[i], hashValues[i], c_heap, CHECK);
 436       cp->symbol_at_put(cp_indices[i], sym);
 437     }
 438   }
 439 }
 440 
 441 Symbol* SymbolTable::new_permanent_symbol(const char* name, TRAPS) {
 442   unsigned int hash;
 443   Symbol* result = SymbolTable::lookup_only((char*)name, (int)strlen(name), hash);
 444   if (result != NULL) {
 445     return result;
 446   }
 447   // Grab SymbolTable_lock first.
 448   MutexLocker ml(SymbolTable_lock, THREAD);
 449 
 450   SymbolTable* table = the_table();
 451   int index = table->hash_to_index(hash);
 452   return table->basic_add(index, (u1*)name, (int)strlen(name), hash, false, THREAD);
 453 }
 454 
 455 TableStatistics SymbolTable::get_table_statistics() {
 456   return the_table()->statistics_calculate();
 457 }
 458 
 459 Symbol* SymbolTable::basic_add(int index_arg, u1 *name, int len,
 460                                unsigned int hashValue_arg, bool c_heap, TRAPS) {
 461   assert(!Universe::heap()->is_in_reserved(name),
 462          "proposed name of symbol must be stable");
 463 
 464   // Don't allow symbols to be created which cannot fit in a Symbol*.
 465   if (len > Symbol::max_length()) {
 466     THROW_MSG_0(vmSymbols::java_lang_InternalError(),
 467                 "name is too long to represent");
 468   }
 469 
 470   // Cannot hit a safepoint in this function because the "this" pointer can move.
 471   NoSafepointVerifier nsv;
 472 
 473   // Check if the symbol table has been rehashed, if so, need to recalculate
 474   // the hash value and index.
 475   unsigned int hashValue;
 476   int index;
 477   if (use_alternate_hashcode()) {
 478     hashValue = hash_symbol((const char*)name, len);


< prev index next >