hotspot/src/share/vm/classfile/symbolTable.cpp
changeset 11480 1bf714e8adb4
parent 8885 eed0ba1d011b
child 12263 d20640f4f8fe
equal deleted inserted replaced
11441:a89f443814cd 11480:1bf714e8adb4
   202 
   202 
   203   Symbol* s = the_table()->lookup(index, name, len, hash);
   203   Symbol* s = the_table()->lookup(index, name, len, hash);
   204   return s;
   204   return s;
   205 }
   205 }
   206 
   206 
       
   207 // Look up the address of the literal in the SymbolTable for this Symbol*
       
   208 // Do not create any new symbols
       
   209 // Do not increment the reference count to keep this alive
       
   210 Symbol** SymbolTable::lookup_symbol_addr(Symbol* sym){
       
   211   unsigned int hash = hash_symbol((char*)sym->bytes(), sym->utf8_length());
       
   212   int index = the_table()->hash_to_index(hash);
       
   213 
       
   214   for (HashtableEntry<Symbol*>* e = the_table()->bucket(index); e != NULL; e = e->next()) {
       
   215     if (e->hash() == hash) {
       
   216       Symbol* literal_sym = e->literal();
       
   217       if (sym == literal_sym) {
       
   218         return e->literal_addr();
       
   219       }
       
   220     }
       
   221   }
       
   222   return NULL;
       
   223 }
       
   224 
   207 // Suggestion: Push unicode-based lookup all the way into the hashing
   225 // Suggestion: Push unicode-based lookup all the way into the hashing
   208 // and probing logic, so there is no need for convert_to_utf8 until
   226 // and probing logic, so there is no need for convert_to_utf8 until
   209 // an actual new Symbol* is created.
   227 // an actual new Symbol* is created.
   210 Symbol* SymbolTable::lookup_unicode(const jchar* name, int utf16_length, TRAPS) {
   228 Symbol* SymbolTable::lookup_unicode(const jchar* name, int utf16_length, TRAPS) {
   211   int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length);
   229   int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length);