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

From: Juergen Kreileder (jk@blackdown.de)
Date: Tue Jan 06 2004 - 14:16:42 EST


Doug Lea <dl@cs.oswego.edu> writes:

>> Just wondering. If I were wanting to avoid using the "thread-local
>> hack" for the double-checked locking idiom on JDK 1.4 (just for
>> those platforms where JDK 1.4 volatile is 1.5 proposed-JMM
>> compliant), how would I go about determining the list of JDK 1.4
>> implementations that support the proposed JMM semantics for
>> volatile.
>
> 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).

        Juergen

-- 
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux/java2-status/
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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