Re: JavaMemoryModel: On which JDK 1.4 VMs is "volatile access" already compliant with the proposed JDK 1.5 JMM?

From: Jeremy Manson (jmanson@cs.umd.edu)
Date: Tue Feb 10 2004 - 15:45:29 EST


>From the "better late than never" files:

> > I don't think there is a list anwhere (feel free to post one :-),
> > but when in doubt, you can run the "volatile spec compiance tests"
> > that Bill has at http://www.cs.umd.edu/~pugh/java/memoryModel/
> > Direct link:
> > http://www.cs.umd.edu/~pugh/java/memoryModel/Volatiles.tar
>
> You might want to change the AtomicLong test a bit. HotSpot 1.4.2
> passes the test with the original code but with this change
>
> --- AtomicLong.java.orig 2004-01-06 20:05:14.000000000 +0100
> +++ AtomicLong.java 2004-01-06 20:05:01.000000000 +0100
> @@ -33,6 +33,9 @@
> public class AtomicLong extends Thread {
> static int w;
> static volatile long v;
> +
> + static Object o;
> +
> static int count = 10000000;
>
> long key;
>
> I see some violations (at least on x86 and AMD64).
>

This seems to occur because the long isn't aligned to a 64-bit boundary.
We don't have a foolproof way of reproducing this, but we changed the test
so it works on 2 long volatiles, with a 32 bit int declared between them.
You can look at the new one at the address quoted above.

Worth checking into, for any VM writers out there.

                                        Jeremy
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:57 EDT