8216049: stringTable::intern creates redundant String when looking up existing one
authorshade
Sat, 16 Feb 2019 21:15:33 +0100
changeset 53785 d230a0406623
parent 53784 31e3aa9c0c71
child 53786 2a78b2963793
child 53804 f42d42c1ebdc
child 57191 de9dd71ef18c
child 57193 fab566567af9
8216049: stringTable::intern creates redundant String when looking up existing one Reviewed-by: redestad, gziemski, rehn, zgu, jiangli
src/hotspot/share/classfile/stringTable.cpp
--- a/src/hotspot/share/classfile/stringTable.cpp	Sat Feb 16 11:40:34 2019 +0900
+++ b/src/hotspot/share/classfile/stringTable.cpp	Sat Feb 16 21:15:33 2019 +0100
@@ -334,6 +334,10 @@
   if (StringTable::_alt_hash) {
     hash = hash_string(name, len, true);
   }
+  found_string = StringTable::the_table()->do_lookup(name, len, hash);
+  if (found_string != NULL) {
+    return found_string;
+  }
   return StringTable::the_table()->do_intern(string_or_null_h, name, len,
                                              hash, CHECK_NULL);
 }