JDK-8186238 : The constant pool entry to empty string ("") should not be pre-resolved during CDS dump time
Type:Bug
Component:hotspot
Sub-Component:runtime
Affected Version:10
Priority:P2
Status:Closed
Resolution:Fixed
OS:generic
CPU:generic
Submitted:2017-08-15
Updated:2020-09-01
Resolved:2017-08-16
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The constant pool entry to empty string ("") should not be pre-resolved during CDS archiving. Empty string is not archived and eliminated from the shared string table.
Comments
I'm also good with going with the one line fix!
15-08-2017
Since this is a one-line fix, I think it's better to push the fix, instead of doing an anti-delta of JDK-8179302 which introduced the error.
The fix is of the "do less harm" type (from the resolved constants array, remove an element which didn't exist before JDK-8179302, and whose existence caused the failure). So the fix should be fairly low risk and shouldn't cause new failures to happen.
15-08-2017
Jiangli's patch seems to fix the failures. It's a bug in the AppCDS code and unrelated to the compiler. Many errors were triggered by the -esa option (enable system assertions) which happen to be used together with the -Xcomp test runs in hotspot nightly.
diff --git a/src/share/vm/oops/constantPool.cpp b/src/share/vm/oops/constantPool.cpp
--- a/src/share/vm/oops/constantPool.cpp
+++ b/src/share/vm/oops/constantPool.cpp
@@ -264,7 +264,7 @@
oop p = rr->obj_at(i);
if (p != NULL) {
int index = object_to_cp_index(i);
- if (tag_at(index).is_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