< prev index next >

src/hotspot/share/classfile/symbolTable.cpp

Print this page




 486   int len = (int)strlen(name);
 487   Symbol* sym = SymbolTable::lookup_only(name, len, hash);
 488   if (sym == NULL) {
 489     sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, false, CHECK_NULL);
 490   }
 491   if (!sym->is_permanent()) {
 492     sym->make_permanent();
 493     log_trace_symboltable_helper(sym, "Asked for a permanent symbol, but got a regular one");
 494   }
 495   return sym;
 496 }
 497 
 498 struct SizeFunc : StackObj {
 499   size_t operator()(Symbol** value) {
 500     assert(value != NULL, "expected valid value");
 501     assert(*value != NULL, "value should point to a symbol");
 502     return (*value)->size() * HeapWordSize;
 503   };
 504 };
 505 





 506 void SymbolTable::print_table_statistics(outputStream* st,
 507                                          const char* table_name) {
 508   SizeFunc sz;
 509   _local_table->statistics_to(Thread::current(), sz, st, table_name);
 510 }
 511 
 512 // Verification
 513 class VerifySymbols : StackObj {
 514 public:
 515   bool operator()(Symbol** value) {
 516     guarantee(value != NULL, "expected valid value");
 517     guarantee(*value != NULL, "value should point to a symbol");
 518     Symbol* sym = *value;
 519     guarantee(sym->equals((const char*)sym->bytes(), sym->utf8_length()),
 520               "symbol must be internally consistent");
 521     return true;
 522   };
 523 };
 524 
 525 void SymbolTable::verify() {




 486   int len = (int)strlen(name);
 487   Symbol* sym = SymbolTable::lookup_only(name, len, hash);
 488   if (sym == NULL) {
 489     sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, false, CHECK_NULL);
 490   }
 491   if (!sym->is_permanent()) {
 492     sym->make_permanent();
 493     log_trace_symboltable_helper(sym, "Asked for a permanent symbol, but got a regular one");
 494   }
 495   return sym;
 496 }
 497 
 498 struct SizeFunc : StackObj {
 499   size_t operator()(Symbol** value) {
 500     assert(value != NULL, "expected valid value");
 501     assert(*value != NULL, "value should point to a symbol");
 502     return (*value)->size() * HeapWordSize;
 503   };
 504 };
 505 
 506 TableStatistics SymbolTable::get_table_statistics() {
 507   SizeFunc sz;
 508   return _local_table->statistics_calculate(Thread::current(), sz);
 509 }
 510 
 511 void SymbolTable::print_table_statistics(outputStream* st,
 512                                          const char* table_name) {
 513   SizeFunc sz;
 514   _local_table->statistics_to(Thread::current(), sz, st, table_name);
 515 }
 516 
 517 // Verification
 518 class VerifySymbols : StackObj {
 519 public:
 520   bool operator()(Symbol** value) {
 521     guarantee(value != NULL, "expected valid value");
 522     guarantee(*value != NULL, "value should point to a symbol");
 523     Symbol* sym = *value;
 524     guarantee(sym->equals((const char*)sym->bytes(), sym->utf8_length()),
 525               "symbol must be internally consistent");
 526     return true;
 527   };
 528 };
 529 
 530 void SymbolTable::verify() {


< prev index next >