470 } while(true);
471
472 update_needs_rehash(rehash_warning);
473
474 if (clean_hint) {
475 mark_has_items_to_clean();
476 check_concurrent_work();
477 }
478
479 assert((sym == NULL) || sym->refcount() != 0, "found dead symbol");
480 return sym;
481 }
482
483 Symbol* SymbolTable::new_permanent_symbol(const char* name, TRAPS) {
484 unsigned int hash = 0;
485 int len = (int)strlen(name);
486 Symbol* sym = SymbolTable::lookup_only(name, len, hash);
487 if (sym == NULL) {
488 sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, false, CHECK_NULL);
489 }
490 if (sym->refcount() != PERM_REFCOUNT) {
491 sym->increment_refcount();
492 log_trace_symboltable_helper(sym, "Asked for a permanent symbol, but got a regular one");
493 }
494 return sym;
495 }
496
497 struct SizeFunc : StackObj {
498 size_t operator()(Symbol** value) {
499 assert(value != NULL, "expected valid value");
500 assert(*value != NULL, "value should point to a symbol");
501 return (*value)->size() * HeapWordSize;
502 };
503 };
504
505 void SymbolTable::print_table_statistics(outputStream* st,
506 const char* table_name) {
507 SizeFunc sz;
508 _local_table->statistics_to(Thread::current(), sz, st, table_name);
509 }
510
511 // Verification
|
470 } while(true);
471
472 update_needs_rehash(rehash_warning);
473
474 if (clean_hint) {
475 mark_has_items_to_clean();
476 check_concurrent_work();
477 }
478
479 assert((sym == NULL) || sym->refcount() != 0, "found dead symbol");
480 return sym;
481 }
482
483 Symbol* SymbolTable::new_permanent_symbol(const char* name, TRAPS) {
484 unsigned int hash = 0;
485 int len = (int)strlen(name);
486 Symbol* sym = SymbolTable::lookup_only(name, len, hash);
487 if (sym == NULL) {
488 sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, false, CHECK_NULL);
489 }
490 if (!sym->is_permanent()) {
491 sym->make_permanent();
492 log_trace_symboltable_helper(sym, "Asked for a permanent symbol, but got a regular one");
493 }
494 return sym;
495 }
496
497 struct SizeFunc : StackObj {
498 size_t operator()(Symbol** value) {
499 assert(value != NULL, "expected valid value");
500 assert(*value != NULL, "value should point to a symbol");
501 return (*value)->size() * HeapWordSize;
502 };
503 };
504
505 void SymbolTable::print_table_statistics(outputStream* st,
506 const char* table_name) {
507 SizeFunc sz;
508 _local_table->statistics_to(Thread::current(), sz, st, table_name);
509 }
510
511 // Verification
|