< 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   static TableStatistics ts;
 508   SizeFunc sz;
 509   ts = _local_table->statistics_get(Thread::current(), sz, ts);
 510   return ts;
 511 }
 512 
 513 void SymbolTable::print_table_statistics(outputStream* st,
 514                                          const char* table_name) {
 515   SizeFunc sz;
 516   _local_table->statistics_to(Thread::current(), sz, st, table_name);
 517 }
 518 
 519 // Verification
 520 class VerifySymbols : StackObj {
 521 public:
 522   bool operator()(Symbol** value) {
 523     guarantee(value != NULL, "expected valid value");
 524     guarantee(*value != NULL, "value should point to a symbol");
 525     Symbol* sym = *value;
 526     guarantee(sym->equals((const char*)sym->bytes(), sym->utf8_length()),
 527               "symbol must be internally consistent");
 528     return true;
 529   };
 530 };
 531 
 532 void SymbolTable::verify() {


< prev index next >