src/share/vm/classfile/symbolTable.cpp

changeset 3427
94ec88ca68e2
parent 2700
352622fd140a
child 3682
fc9d8850ab8b
     1.1 --- a/src/share/vm/classfile/symbolTable.cpp	Mon Jan 09 10:27:24 2012 +0100
     1.2 +++ b/src/share/vm/classfile/symbolTable.cpp	Wed Jan 11 17:34:02 2012 -0500
     1.3 @@ -204,6 +204,24 @@
     1.4    return s;
     1.5  }
     1.6  
     1.7 +// Look up the address of the literal in the SymbolTable for this Symbol*
     1.8 +// Do not create any new symbols
     1.9 +// Do not increment the reference count to keep this alive
    1.10 +Symbol** SymbolTable::lookup_symbol_addr(Symbol* sym){
    1.11 +  unsigned int hash = hash_symbol((char*)sym->bytes(), sym->utf8_length());
    1.12 +  int index = the_table()->hash_to_index(hash);
    1.13 +
    1.14 +  for (HashtableEntry<Symbol*>* e = the_table()->bucket(index); e != NULL; e = e->next()) {
    1.15 +    if (e->hash() == hash) {
    1.16 +      Symbol* literal_sym = e->literal();
    1.17 +      if (sym == literal_sym) {
    1.18 +        return e->literal_addr();
    1.19 +      }
    1.20 +    }
    1.21 +  }
    1.22 +  return NULL;
    1.23 +}
    1.24 +
    1.25  // Suggestion: Push unicode-based lookup all the way into the hashing
    1.26  // and probing logic, so there is no need for convert_to_utf8 until
    1.27  // an actual new Symbol* is created.

mercurial