equal
deleted
inserted
replaced
23 */ |
23 */ |
24 |
24 |
25 /** |
25 /** |
26 * @test |
26 * @test |
27 * @bug 8167298 |
27 * @bug 8167298 |
28 * @summary Unsafe.compareAndExchangeObject should keep track of returned type after matching |
28 * @summary Unsafe.compareAndExchangeReference should keep track of returned type after matching |
29 * @modules java.base/jdk.internal.misc |
29 * @modules java.base/jdk.internal.misc |
30 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-UseCompressedOops TestCAEAntiDep |
30 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-UseCompressedOops TestCAEAntiDep |
31 * |
31 * |
32 */ |
32 */ |
33 |
33 |
52 throw new RuntimeException(e); |
52 throw new RuntimeException(e); |
53 } |
53 } |
54 } |
54 } |
55 |
55 |
56 static int m(TestCAEAntiDep test, Object expected, Object x) { |
56 static int m(TestCAEAntiDep test, Object expected, Object x) { |
57 C old = (C)UNSAFE.compareAndExchangeObject(test, O_OFFSET, expected, x); |
57 C old = (C)UNSAFE.compareAndExchangeReference(test, O_OFFSET, expected, x); |
58 int res = old.f1; |
58 int res = old.f1; |
59 old.f1 = 0x42; |
59 old.f1 = 0x42; |
60 return res; |
60 return res; |
61 } |
61 } |
62 |
62 |