--- old/src/share/vm/classfile/symbolTable.cpp 2014-04-25 14:05:09.000000000 -0500 +++ new/src/share/vm/classfile/symbolTable.cpp 2014-04-25 14:05:09.000000000 -0500 @@ -209,10 +209,10 @@ } // Pick hashing algorithm. -unsigned int SymbolTable::hash_symbol(const char* s, int len) { +unsigned int SymbolTable::hash_symbol(const char* name, int len) { return use_alternate_hashcode() ? - AltHashing::murmur3_32(seed(), (const jbyte*)s, len) : - java_lang_String::hash_code(s, len); + AltHashing::murmur3_32(seed(), (const jbyte*)name, len) : + java_lang_String::hash_code(name, len); } @@ -223,7 +223,7 @@ // entries in the symbol table during normal execution (only during // safepoints). -Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) { +Symbol* SymbolTable::lookup_and_add(const char* name, int len, TRAPS) { unsigned int hashValue = hash_symbol(name, len); int index = the_table()->hash_to_index(hashValue); @@ -239,7 +239,7 @@ return the_table()->basic_add(index, (u1*)name, len, hashValue, true, CHECK_NULL); } -Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) { +Symbol* SymbolTable::lookup_and_add(const Symbol* sym, int begin, int end, TRAPS) { char* buffer; int index, len; unsigned int hashValue; @@ -278,7 +278,7 @@ return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, CHECK_NULL); } -Symbol* SymbolTable::lookup_only(const char* name, int len, +Symbol* SymbolTable::lookup_and_hash(const char* name, int len, unsigned int& hash) { hash = hash_symbol(name, len); int index = the_table()->hash_to_index(hash); @@ -308,34 +308,34 @@ // Suggestion: Push unicode-based lookup all the way into the hashing // and probing logic, so there is no need for convert_to_utf8 until // an actual new Symbol* is created. -Symbol* SymbolTable::lookup_unicode(const jchar* name, int utf16_length, TRAPS) { +Symbol* SymbolTable::lookup_and_add_unicode(const jchar* name, int utf16_length, TRAPS) { int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length); char stack_buf[128]; if (utf8_length < (int) sizeof(stack_buf)) { char* chars = stack_buf; UNICODE::convert_to_utf8(name, utf16_length, chars); - return lookup(chars, utf8_length, THREAD); + return lookup_and_add(chars, utf8_length, THREAD); } else { ResourceMark rm(THREAD); - char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);; + char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1); UNICODE::convert_to_utf8(name, utf16_length, chars); - return lookup(chars, utf8_length, THREAD); + return lookup_and_add(chars, utf8_length, THREAD); } } -Symbol* SymbolTable::lookup_only_unicode(const jchar* name, int utf16_length, +Symbol* SymbolTable::lookup_and_hash_unicode(const jchar* name, int utf16_length, unsigned int& hash) { int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length); char stack_buf[128]; if (utf8_length < (int) sizeof(stack_buf)) { char* chars = stack_buf; UNICODE::convert_to_utf8(name, utf16_length, chars); - return lookup_only(chars, utf8_length, hash); + return lookup_and_hash(chars, utf8_length, hash); } else { ResourceMark rm; - char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);; + char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1); UNICODE::convert_to_utf8(name, utf16_length, chars); - return lookup_only(chars, utf8_length, hash); + return lookup_and_hash(chars, utf8_length, hash); } } @@ -362,7 +362,7 @@ Symbol* SymbolTable::new_permanent_symbol(const char* name, TRAPS) { unsigned int hash; - Symbol* result = SymbolTable::lookup_only((char*)name, (int)strlen(name), hash); + Symbol* result = SymbolTable::lookup_and_hash((char*)name, (int)strlen(name), hash); if (result != NULL) { return result; } @@ -425,7 +425,6 @@ const char** names, int* lengths, int* cp_indices, unsigned int* hashValues, TRAPS) { - // Check symbol names are not too long. If any are too long, don't add any. for (int i = 0; i< names_count; i++) { if (lengths[i] > Symbol::max_length()) { @@ -469,7 +468,6 @@ return true; } - void SymbolTable::verify() { for (int i = 0; i < the_table()->table_size(); ++i) { HashtableEntry* p = the_table()->bucket(i); @@ -488,7 +486,6 @@ the_table()->dump_table(st, "SymbolTable"); } - //--------------------------------------------------------------------------- // Non-product code