8079840: G1StringDedupTable::deduplicate() reset String hash value unnecessarily.
authorjiangli
Mon, 11 May 2015 15:06:02 -0400
changeset 30619 f02421441c2e
parent 30618 2f98610229a5
child 30620 0e42f4f73460
8079840: G1StringDedupTable::deduplicate() reset String hash value unnecessarily. Summary: Only set hash value if String's hash value was 0. Reviewed-by: pliden, brutisso
hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
--- 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);