8079840: G1StringDedupTable::deduplicate() reset String hash value unnecessarily.
Summary: Only set hash value if String's hash value was 0.
Reviewed-by: pliden, brutisso
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp Sat May 09 07:32:49 2015 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp Mon May 11 15:06:02 2015 -0400
@@ -310,11 +310,11 @@
// 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);