RFR(S): 8144212: JDK 9 b93 breaks Apache Lucene due to compact strings
tobias.hartmann at oracle.com
Wed Jan 6 12:01:45 UTC 2016
please review the following patch.
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 : 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.
More information about the hotspot-compiler-dev