< prev index next >

src/share/vm/classfile/symbolTable.cpp

Print this page




 227     }
 228     _lookup_shared_first = false;
 229     return lookup_dynamic(index, name, len, hash);
 230   } else {
 231     sym = lookup_dynamic(index, name, len, hash);
 232     if (sym != NULL) {
 233       return sym;
 234     }
 235     sym = lookup_shared(name, len, hash);
 236     if (sym != NULL) {
 237       _lookup_shared_first = true;
 238     }
 239     return sym;
 240   }
 241 }
 242 
 243 // Pick hashing algorithm.
 244 unsigned int SymbolTable::hash_symbol(const char* s, int len) {
 245   return use_alternate_hashcode() ?
 246            AltHashing::murmur3_32(seed(), (const jbyte*)s, len) :
 247            java_lang_String::hash_code(s, len);
 248 }
 249 
 250 
 251 // We take care not to be blocking while holding the
 252 // SymbolTable_lock. Otherwise, the system might deadlock, since the
 253 // symboltable is used during compilation (VM_thread) The lock free
 254 // synchronization is simplified by the fact that we do not delete
 255 // entries in the symbol table during normal execution (only during
 256 // safepoints).
 257 
 258 Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) {
 259   unsigned int hashValue = hash_symbol(name, len);
 260   int index = the_table()->hash_to_index(hashValue);
 261 
 262   Symbol* s = the_table()->lookup(index, name, len, hashValue);
 263 
 264   // Found
 265   if (s != NULL) return s;
 266 
 267   // Grab SymbolTable_lock first.




 227     }
 228     _lookup_shared_first = false;
 229     return lookup_dynamic(index, name, len, hash);
 230   } else {
 231     sym = lookup_dynamic(index, name, len, hash);
 232     if (sym != NULL) {
 233       return sym;
 234     }
 235     sym = lookup_shared(name, len, hash);
 236     if (sym != NULL) {
 237       _lookup_shared_first = true;
 238     }
 239     return sym;
 240   }
 241 }
 242 
 243 // Pick hashing algorithm.
 244 unsigned int SymbolTable::hash_symbol(const char* s, int len) {
 245   return use_alternate_hashcode() ?
 246            AltHashing::murmur3_32(seed(), (const jbyte*)s, len) :
 247            java_lang_String::hash_code((const jbyte*)s, len);
 248 }
 249 
 250 
 251 // We take care not to be blocking while holding the
 252 // SymbolTable_lock. Otherwise, the system might deadlock, since the
 253 // symboltable is used during compilation (VM_thread) The lock free
 254 // synchronization is simplified by the fact that we do not delete
 255 // entries in the symbol table during normal execution (only during
 256 // safepoints).
 257 
 258 Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) {
 259   unsigned int hashValue = hash_symbol(name, len);
 260   int index = the_table()->hash_to_index(hashValue);
 261 
 262   Symbol* s = the_table()->lookup(index, name, len, hashValue);
 263 
 264   // Found
 265   if (s != NULL) return s;
 266 
 267   // Grab SymbolTable_lock first.


< prev index next >