Mercurial > hg > truffle
diff graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java @ 7282:390448a6b535
converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
the HP_series and FloatingReads tests have been disabled temporarily
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 20 Dec 2012 14:59:57 +0100 |
parents | 519d27db8eb9 |
children | 5e3d1a68664e |
line wrap: on
line diff
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java Thu Dec 20 13:14:56 2012 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java Thu Dec 20 14:59:57 2012 +0100 @@ -24,9 +24,11 @@ import org.junit.*; +import com.oracle.graal.jtt.*; + import sun.misc.*; -public class Unsafe_compareAndSwap { +public class Unsafe_compareAndSwap extends JTTTest { static final Unsafe unsafe = UnsafeAccess01.getUnsafe(); static final long valueOffset; static { @@ -35,19 +37,26 @@ } catch (Exception ex) { throw new Error(ex); } } - public static void test(Unsafe_compareAndSwap u, Object o, String expected, String newValue) { + public static String test(Unsafe_compareAndSwap u, Object o, String expected, String newValue) { // First arg is not an array - can use a field write barrier unsafe.compareAndSwapObject(u, valueOffset, expected, newValue); // Not known if first arg is an array - different write barrier may be used unsafe.compareAndSwapObject(o, valueOffset, expected, newValue); + + return instance.value; } - private String value = "a"; + private String value; + + private static final Unsafe_compareAndSwap instance = new Unsafe_compareAndSwap(); + + @Override + protected void before() { + instance.value = "a"; + } @Test public void run0() throws Throwable { - Unsafe_compareAndSwap u = new Unsafe_compareAndSwap(); - test(u, u, "a", "b"); - Assert.assertEquals(u.value, "b"); + runTest("test", instance, instance, "a", "b"); } }