Java memory model question
David Lloyd
david.lloyd at redhat.com
Fri Mar 6 14:50:40 UTC 2020
On Fri, Mar 6, 2020 at 7:53 AM Andrew Haley <aph at redhat.com> wrote:
>
> On 3/6/20 10:27 AM, Luke Hutchison wrote:
> > On Fri, Mar 6, 2020 at 12:46 AM Brian Goetz <brian.goetz at oracle.com> wrote:
> >
> >> No, but this is a common myth. Method boundaries are not part of the
> >> JMM, and the JIT regularly makes optimizations that have the effect of
> >> reordering operations across method boundaries.
> >
> > Thanks. That's pretty interesting, but I can't think of an optimization
> > that would have that effect. Can you give an example?
>
> Inside an optimizer in intermediate form, unrelated operations are
> often unordered: that is to say, they may be emitted in any order.
This is a really nice (if a little old) primer by Alexey Shipilev
which talks about program order which might be helpful:
https://shipilev.net/blog/2014/jmm-pragmatics/
--
- DML
More information about the jdk-dev
mailing list