changeset 8374:43fee4497230

8079840: G1StringDedupTable::deduplicate() reset String hash value unnecessarily. Summary: Only set hash value if String's hash value was 0. Reviewed-by: pliden, brutisso
author jiangli
date Mon, 11 May 2015 15:06:02 -0400
parents 9e7e29a28a10
children 09d7c0b170a9
files src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	Sat May 09 07:32:49 2015 -0400
+++ b/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);