[9] RFR(S): 8144212: JDK 9 b93 breaks Apache Lucene due to compact strings

Andrew Haley aph at redhat.com
Wed Jan 6 13:34:28 UTC 2016

On 01/06/2016 01:06 PM, Tobias Hartmann wrote:

> 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?

No, I don't think so.  I was just checking: I am very aware that
HotSpot has presented those of use with relaxed memory order machines
with some interesting gotchas over the years, that's all.  I'm a bit
surprised that C2 needs this barrier, given that there is a
read-after-write dependency, but never mind.



More information about the hotspot-compiler-dev mailing list