RFR(M): 8080289: Intermediate writes in a loop not eliminated by optimizer
john.r.rose at oracle.com
Wed Jun 17 19:44:55 UTC 2015
On Jun 17, 2015, at 12:39 PM, Vitaly Davidovich <vitalyd at gmail.com> wrote:
> But happens-before is meaningful only for inter-thread communication. If we're talking about plain stores with no fences (or let's say, JMM happens-before inducing points in between them), then as long as intra-thread semantics aren't violated, I'd say anything's on the table :).
Nope, that's an oversimplified understanding. One place where the JMM will bite you is with publication of object state via final fields. Normal stores used to initialize a structure which is published via final-field semantics must be ordered to take place before the object is published. We don't (and perhaps can't) track object publication events, nor their relation to stores into newly-reachable subgraphs. Instead, we have fences that gently but firmly ensure that data (from normal stores, even to non-final fields and array elements!) is posted to memory before any store which could be a publishing store for that data.
> Will this risk uncovering broken user code? Yes, but that code is a ticking time bomb anyway (and subject to CPU reordering as well).
Indeed. We live in a world of ticking time bombs. Some of them are our problem even if we didn't cause them.
I don't mind uncovering broken user code; sooner is better. But that user will want (as a matter of QOS) a range of workarounds.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-compiler-dev