8079840: G1StringDedupTable::deduplicate() reset String hash value unnecessarily

Only set hash value if String's hash value was 0.

Reviewed-by: pliden, brutisso
This commit is contained in:
Jiangli Zhou 2015-05-11 15:06:02 -04:00
parent 961389c6ef
commit cb51ce598c

View File

@ -310,11 +310,11 @@ void G1StringDedupTable::deduplicate(oop java_string, G1StringDedupStat& stat) {
// Compute hash
hash = hash_code(value);
stat.inc_hashed();
}
if (use_java_hash() && hash != 0) {
// Store hash code in cache
java_lang_String::set_hash(java_string, hash);
if (use_java_hash() && hash != 0) {
// Store hash code in cache
java_lang_String::set_hash(java_string, hash);
}
}
typeArrayOop existing_value = lookup_or_add(value, hash);