gcj internals documentation
Boehm, Hans
hans.boehm@hp.com
Wed Oct 11 18:54:00 GMT 2006
> From: Paul Biggar
> On 04 Oct 2006 09:14:38 -0600, Tom Tromey <tromey@redhat.com> wrote:
> >
> > The compiler turns 'synchronized' into calls to
> _Jv_MonitorEnter and
> > _Jv_MonitorExit. It also does the obvious transformation
> here for the
> > monitor-related bytecode instructions.
>> It looks like synchronization removal can simply be done by
> removing these function calls in cases where the object
> doesnt escape. Does this sound right?
>>> > Paul> Is the synchronization model accurate to Java1.4?
> Will it change
> > Paul> when the ecj compiler is put in, and we model Java 1.5?
> >
> > The spec for synchronization hasn't really changed over the years.
> > (The memory model has a bit, I suppose.) We're ok up to 1.4.
>In 1.5, synchronization operations on objects that do not escape the
thread can be removed. Locks have memory visibility implications only
when a lock is released by one thread and then acquired by another. I
believe that was not technically true in 1.4 and earlier, so this
transformation technically isn't valid there. However, the pre-1.5
memory model had enough problems that I don't think anyone really cares
about it.
Hans
More information about the Java
mailing list