< prev index next >

src/share/vm/classfile/symbolTable.cpp

Print this page




 704 
 705   HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
 706   add_entry(index, entry);
 707   return string();
 708 }
 709 
 710 
 711 oop StringTable::lookup(Symbol* symbol) {
 712   ResourceMark rm;
 713   int length;
 714   jchar* chars = symbol->as_unicode(length);
 715   return lookup(chars, length);
 716 }
 717 
 718 // Tell the GC that this string was looked up in the StringTable.
 719 static void ensure_string_alive(oop string) {
 720   // A lookup in the StringTable could return an object that was previously
 721   // considered dead. The SATB part of G1 needs to get notified about this
 722   // potential resurrection, otherwise the marking might not find the object.
 723 #if INCLUDE_ALL_GCS
 724   if (UseG1GC && string != NULL) {
 725     G1SATBCardTableModRefBS::enqueue(string);
 726   }
 727 #endif
 728 }
 729 
 730 oop StringTable::lookup(jchar* name, int len) {
 731   unsigned int hash = hash_string(name, len);
 732   int index = the_table()->hash_to_index(hash);
 733   oop string = the_table()->lookup(index, name, len, hash);
 734 
 735   ensure_string_alive(string);
 736 
 737   return string;
 738 }
 739 
 740 
 741 oop StringTable::intern(Handle string_or_null, jchar* name,
 742                         int len, TRAPS) {
 743   unsigned int hashValue = hash_string(name, len);
 744   int index = the_table()->hash_to_index(hashValue);




 704 
 705   HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
 706   add_entry(index, entry);
 707   return string();
 708 }
 709 
 710 
 711 oop StringTable::lookup(Symbol* symbol) {
 712   ResourceMark rm;
 713   int length;
 714   jchar* chars = symbol->as_unicode(length);
 715   return lookup(chars, length);
 716 }
 717 
 718 // Tell the GC that this string was looked up in the StringTable.
 719 static void ensure_string_alive(oop string) {
 720   // A lookup in the StringTable could return an object that was previously
 721   // considered dead. The SATB part of G1 needs to get notified about this
 722   // potential resurrection, otherwise the marking might not find the object.
 723 #if INCLUDE_ALL_GCS
 724   if ((UseG1GC || (UseShenandoahGC && ShenandoahSATBBarrier)) && string != NULL) {
 725     G1SATBCardTableModRefBS::enqueue(string);
 726   }
 727 #endif
 728 }
 729 
 730 oop StringTable::lookup(jchar* name, int len) {
 731   unsigned int hash = hash_string(name, len);
 732   int index = the_table()->hash_to_index(hash);
 733   oop string = the_table()->lookup(index, name, len, hash);
 734 
 735   ensure_string_alive(string);
 736 
 737   return string;
 738 }
 739 
 740 
 741 oop StringTable::intern(Handle string_or_null, jchar* name,
 742                         int len, TRAPS) {
 743   unsigned int hashValue = hash_string(name, len);
 744   int index = the_table()->hash_to_index(hashValue);


< prev index next >