RFR(S): 8144212: JDK 9 b93 breaks Apache Lucene due to compact strings
tobias.hartmann at oracle.com
Wed Jan 6 13:06:16 UTC 2016
On 06.01.2016 13:07, Andrew Haley wrote:
> On 06/01/16 12:01, Tobias Hartmann wrote:
>> 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
>> Tested with JPRT and failing Apache Lucene test.
> Is a MemBarCPUOrder sufficient for machines with relaxed memory
The problem here is that C2 reorders memory instructions and moves an array load before an array store. The MemBarCPUOrder is now used (compiler internally) to prevent this. We do the same for normal array copys in PhaseMacroExpand::expand_arraycopy_node(). No actual code is emitted. See also the comment in memnode.hpp:
// Ordering within the same CPU. Used to order unsafe memory references
// inside the compiler when we lack alias info. Not needed "outside" the
// compiler because the CPU does all the ordering for us.
"CPU does all the ordering for us" means that even with a relaxed memory ordering, loads are never moved before dependent stores.
Or did I misunderstand your question?
More information about the hotspot-compiler-dev