< prev index next >

src/hotspot/share/classfile/symbolTable.cpp

Print this page


 496     sym = allocate_symbol(name, len, heap);
 497     if (_local_table->insert(THREAD, lookup, sym, &rehash_warning, &clean_hint)) {
 498       break;
 499     }
 500     // In case another thread did a concurrent add, return value already in the table.
 501     // This could fail if the symbol got deleted concurrently, so loop back until success.
 502     if (_local_table->get(THREAD, lookup, stg, &rehash_warning)) {
 503       sym = stg.get_res_sym();
 504       break;
 505     }
 506   } while(true);
 507 
 508   update_needs_rehash(rehash_warning);
 509 
 510   if (clean_hint) {
 511     mark_has_items_to_clean();
 512     check_concurrent_work();
 513   }
 514 
 515   assert((sym == NULL) || sym->refcount() != 0, "found dead symbol");
 516 #if INCLUDE_CDS
 517   if (DumpSharedSpaces) {
 518     if (sym != NULL) {
 519       MetaspaceShared::add_symbol(sym);
 520     }
 521   }
 522 #endif
 523   return sym;
 524 }
 525 
 526 Symbol* SymbolTable::new_permanent_symbol(const char* name) {
 527   unsigned int hash = 0;
 528   int len = (int)strlen(name);
 529   Symbol* sym = SymbolTable::lookup_only(name, len, hash);
 530   if (sym == NULL) {
 531     sym = do_add_if_needed(name, len, hash, false);
 532   }
 533   if (!sym->is_permanent()) {
 534     sym->make_permanent();
 535     log_trace_symboltable_helper(sym, "Asked for a permanent symbol, but got a regular one");
 536   }
 537   return sym;
 538 }
 539 
 540 struct SizeFunc : StackObj {
 541   size_t operator()(Symbol** value) {
 542     assert(value != NULL, "expected valid value");




 496     sym = allocate_symbol(name, len, heap);
 497     if (_local_table->insert(THREAD, lookup, sym, &rehash_warning, &clean_hint)) {
 498       break;
 499     }
 500     // In case another thread did a concurrent add, return value already in the table.
 501     // This could fail if the symbol got deleted concurrently, so loop back until success.
 502     if (_local_table->get(THREAD, lookup, stg, &rehash_warning)) {
 503       sym = stg.get_res_sym();
 504       break;
 505     }
 506   } while(true);
 507 
 508   update_needs_rehash(rehash_warning);
 509 
 510   if (clean_hint) {
 511     mark_has_items_to_clean();
 512     check_concurrent_work();
 513   }
 514 
 515   assert((sym == NULL) || sym->refcount() != 0, "found dead symbol");







 516   return sym;
 517 }
 518 
 519 Symbol* SymbolTable::new_permanent_symbol(const char* name) {
 520   unsigned int hash = 0;
 521   int len = (int)strlen(name);
 522   Symbol* sym = SymbolTable::lookup_only(name, len, hash);
 523   if (sym == NULL) {
 524     sym = do_add_if_needed(name, len, hash, false);
 525   }
 526   if (!sym->is_permanent()) {
 527     sym->make_permanent();
 528     log_trace_symboltable_helper(sym, "Asked for a permanent symbol, but got a regular one");
 529   }
 530   return sym;
 531 }
 532 
 533 struct SizeFunc : StackObj {
 534   size_t operator()(Symbol** value) {
 535     assert(value != NULL, "expected valid value");


< prev index next >