8186238: The constant pool entry to empty string ("") should not be pre-resolved during CDS dump time.
authorjiangli
Tue, 15 Aug 2017 18:13:20 -0400
changeset 46816 f64eb2bfb250
parent 46810 7dad333205cd
child 46817 a27c007d05bb
8186238: The constant pool entry to empty string ("") should not be pre-resolved during CDS dump time. Summary: Skip constant pool entry to empty string during pre-resolving at CDS dump time. Reviewed-by: iklam, dcubed
hotspot/src/share/vm/oops/constantPool.cpp
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Mon Aug 14 14:32:17 2017 -0400
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Tue Aug 15 18:13:20 2017 -0400
@@ -264,7 +264,9 @@
       oop p = rr->obj_at(i);
       if (p != NULL) {
         int index = object_to_cp_index(i);
-        if (tag_at(index).is_string()) {
+        // Skip the entry if the string hash code is 0 since the string
+        // is not included in the shared string_table, see StringTable::copy_shared_string.
+        if (tag_at(index).is_string() && java_lang_String::hash_code(p) != 0) {
           oop op = StringTable::create_archived_string(p, THREAD);
           // If the String object is not archived (possibly too large),
           // NULL is returned. Also set it in the array, so we won't