[9] RFR(S): 8144212: JDK 9 b93 breaks Apache Lucene due to compact strings
Tobias Hartmann
tobias.hartmann at oracle.com
Wed Jan 6 12:01:45 UTC 2016
Hi,
please review the following patch.
https://bugs.openjdk.java.net/browse/JDK-8144212
http://cr.openjdk.java.net/~thartmann/8144212/webrev.00/
An Apache Lucene test fails with Compact Strings enabled because the result of String.getChars() is invalid. The problem is a missing membar after the _inflateString intrinsic, allowing a subsequent load from the destination array to flow above and return a wrong result (see [1]: 210 LoadUS should read the result of 196 StrInflatedCopy).
Tested with JPRT and failing Apache Lucene test.
During my investigation, I noticed that the StringUTF16.getChars() and StringUTF16.compress/inflate intrinsics use LibraryCallKit::tightly_coupled_allocation() to skip zeroing the array elements. However, the intrinsics do not take care of zeroing remaining array elements not affected by the intrinsic operation.
Currently, this is not a problem because all (String API internal) usages of the intrinsics that have a tightly coupled allocation make sure that the entire array is initialized. However, we should fix this to avoid potential bugs. I filed JDK-8146547 and will take care of it.
Thanks,
Tobias
[1] https://bugs.openjdk.java.net/secure/attachment/56238/Graph.png
More information about the hotspot-compiler-dev
mailing list