< prev index next >

src/share/vm/classfile/stringTable.cpp

Print this page
rev 12679 : 8176593: Throwable::getStackTrace performance regression
Reviewed-by: jiangli, iklam

*** 115,129 **** vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "unable to create Unicode string for verification"); return 0; } } ! oop StringTable::lookup_shared(jchar* name, int len) { ! // java_lang_String::hash_code() was used to compute hash values in the shared table. Don't ! // use the hash value from StringTable::hash_string() as it might use alternate hashcode. ! return _shared_table.lookup((const char*)name, ! java_lang_String::hash_code(name, len), len); } oop StringTable::lookup_in_main_table(int index, jchar* name, int len, unsigned int hash) { int count = 0; --- 115,128 ---- vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "unable to create Unicode string for verification"); return 0; } } ! oop StringTable::lookup_shared(jchar* name, int len, unsigned int hash) { ! assert(hash == java_lang_String::hash_code(name, len), ! "hash must be computed using java_lang_String::hash_code"); ! return _shared_table.lookup((const char*)name, hash, len); } oop StringTable::lookup_in_main_table(int index, jchar* name, int len, unsigned int hash) { int count = 0;
*** 197,228 **** } #endif } oop StringTable::lookup(jchar* name, int len) { ! oop string = lookup_shared(name, len); if (string != NULL) { return string; } ! ! unsigned int hash = hash_string(name, len); int index = the_table()->hash_to_index(hash); string = the_table()->lookup_in_main_table(index, name, len, hash); ensure_string_alive(string); return string; } oop StringTable::intern(Handle string_or_null, jchar* name, int len, TRAPS) { ! oop found_string = lookup_shared(name, len); if (found_string != NULL) { return found_string; } ! ! unsigned int hashValue = hash_string(name, len); int index = the_table()->hash_to_index(hashValue); found_string = the_table()->lookup_in_main_table(index, name, len, hashValue); // Found if (found_string != NULL) { --- 196,231 ---- } #endif } oop StringTable::lookup(jchar* name, int len) { ! unsigned int hash = java_lang_String::hash_code(name, len); ! oop string = lookup_shared(name, len, hash); if (string != NULL) { return string; } ! if (use_alternate_hashcode()) { ! hash = hash_string(name, len); ! } int index = the_table()->hash_to_index(hash); string = the_table()->lookup_in_main_table(index, name, len, hash); ensure_string_alive(string); return string; } oop StringTable::intern(Handle string_or_null, jchar* name, int len, TRAPS) { ! unsigned int hashValue = java_lang_String::hash_code(name, len); ! oop found_string = lookup_shared(name, len, hashValue); if (found_string != NULL) { return found_string; } ! if (use_alternate_hashcode()) { ! hashValue = hash_string(name, len); ! } int index = the_table()->hash_to_index(hashValue); found_string = the_table()->lookup_in_main_table(index, name, len, hashValue); // Found if (found_string != NULL) {
< prev index next >