[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Synchronisation and Optimisation
>
> > Would it correct the problem if we made CSE kill all information about
> > fields (and arrays and globals) when it encounters a monitorexit
> > statement? That is,
> > NaiveSideEffectTester: unitCanWriteTo( Unit u, Value v )
> > would return true if u was a monitorexit, and v was visible to other
> > threads?
>
> Intuitive solution (which may not be formally correct): All information
> about the fields needs to be killed on monitorenter _and_
> monitorexit. I am
> not that familiar with the Soot code yet - so can't comment on
> the proposed
> code change. I would appreciate if someone else can have a look at it.
>
Further note:
The fix proposed will still leave CSE/PRE generating code that will voilate
the memory model as specified in JLS chapter 12.1. This is analogous to the
bug reported in Sun JVMs:
http://developer.java.sun.com/developer/bugParade/bugs/4242244.html.
Bill Pugh argued that the Java memory model should be fixed, and not the
compilers. As all current JVMs display this bug, I would argue we can safely
allow the CSE/PRE to generate bytecode that violates this particular section
of JLS.
Regards,
Stephen