Lines Matching refs:unsafe
51 Unsafe unsafe = getUnsafe(); in main() local
53 testArrayBaseOffset(unsafe); in main()
54 testArrayIndexScale(unsafe); in main()
55 testGetAndPutAndCAS(unsafe); in main()
56 testGetAndPutVolatile(unsafe); in main()
59 private static void testArrayBaseOffset(Unsafe unsafe) { in testArrayBaseOffset() argument
60 check(unsafe.arrayBaseOffset(boolean[].class), vmArrayBaseOffset(boolean[].class), in testArrayBaseOffset()
62 check(unsafe.arrayBaseOffset(byte[].class), vmArrayBaseOffset(byte[].class), in testArrayBaseOffset()
64 check(unsafe.arrayBaseOffset(char[].class), vmArrayBaseOffset(char[].class), in testArrayBaseOffset()
66 check(unsafe.arrayBaseOffset(double[].class), vmArrayBaseOffset(double[].class), in testArrayBaseOffset()
68 check(unsafe.arrayBaseOffset(float[].class), vmArrayBaseOffset(float[].class), in testArrayBaseOffset()
70 check(unsafe.arrayBaseOffset(int[].class), vmArrayBaseOffset(int[].class), in testArrayBaseOffset()
72 check(unsafe.arrayBaseOffset(long[].class), vmArrayBaseOffset(long[].class), in testArrayBaseOffset()
74 check(unsafe.arrayBaseOffset(Object[].class), vmArrayBaseOffset(Object[].class), in testArrayBaseOffset()
78 private static void testArrayIndexScale(Unsafe unsafe) { in testArrayIndexScale() argument
79 check(unsafe.arrayIndexScale(boolean[].class), vmArrayIndexScale(boolean[].class), in testArrayIndexScale()
81 check(unsafe.arrayIndexScale(byte[].class), vmArrayIndexScale(byte[].class), in testArrayIndexScale()
83 check(unsafe.arrayIndexScale(char[].class), vmArrayIndexScale(char[].class), in testArrayIndexScale()
85 check(unsafe.arrayIndexScale(double[].class), vmArrayIndexScale(double[].class), in testArrayIndexScale()
87 check(unsafe.arrayIndexScale(float[].class), vmArrayIndexScale(float[].class), in testArrayIndexScale()
89 check(unsafe.arrayIndexScale(int[].class), vmArrayIndexScale(int[].class), in testArrayIndexScale()
91 check(unsafe.arrayIndexScale(long[].class), vmArrayIndexScale(long[].class), in testArrayIndexScale()
93 check(unsafe.arrayIndexScale(Object[].class), vmArrayIndexScale(Object[].class), in testArrayIndexScale()
97 private static void testGetAndPutAndCAS(Unsafe unsafe) throws NoSuchFieldException { in testGetAndPutAndCAS() argument
102 long intOffset = unsafe.objectFieldOffset(intField); in testGetAndPutAndCAS()
103 check(unsafe.getInt(t, intOffset), 0, "Unsafe.getInt(Object, long) - initial"); in testGetAndPutAndCAS()
104 unsafe.putInt(t, intOffset, intValue); in testGetAndPutAndCAS()
106 check(unsafe.getInt(t, intOffset), intValue, "Unsafe.getInt(Object, long)"); in testGetAndPutAndCAS()
110 long longOffset = unsafe.objectFieldOffset(longField); in testGetAndPutAndCAS()
111 check(unsafe.getLong(t, longOffset), 0, "Unsafe.getLong(Object, long) - initial"); in testGetAndPutAndCAS()
112 unsafe.putLong(t, longOffset, longValue); in testGetAndPutAndCAS()
114 check(unsafe.getLong(t, longOffset), longValue, "Unsafe.getLong(Object, long)"); in testGetAndPutAndCAS()
118 long objectOffset = unsafe.objectFieldOffset(objectField); in testGetAndPutAndCAS()
119 check(unsafe.getObject(t, objectOffset), null, "Unsafe.getObject(Object, long) - initial"); in testGetAndPutAndCAS()
120 unsafe.putObject(t, objectOffset, objectValue); in testGetAndPutAndCAS()
122 check(unsafe.getObject(t, objectOffset), objectValue, "Unsafe.getObject(Object, long)"); in testGetAndPutAndCAS()
124 if (unsafe.compareAndSwapInt(t, intOffset, 0, 1)) { in testGetAndPutAndCAS()
127 if (!unsafe.compareAndSwapInt(t, intOffset, intValue, 0)) { in testGetAndPutAndCAS()
131 if (!unsafe.compareAndSwapInt(t, intOffset, 0, 1)) { in testGetAndPutAndCAS()
136 if (!unsafe.compareAndSwapInt(t, intOffset, 1, 1)) { in testGetAndPutAndCAS()
140 if (unsafe.compareAndSwapLong(t, longOffset, 0, 1)) { in testGetAndPutAndCAS()
143 if (!unsafe.compareAndSwapLong(t, longOffset, longValue, 0)) { in testGetAndPutAndCAS()
147 if (!unsafe.compareAndSwapLong(t, longOffset, 0, 1)) { in testGetAndPutAndCAS()
152 if (!unsafe.compareAndSwapLong(t, longOffset, 1, 1)) { in testGetAndPutAndCAS()
161 if (unsafe.compareAndSwapObject(t, objectOffset, new Object(), new Object())) { in testGetAndPutAndCAS()
166 if (!unsafe.compareAndSwapObject(t, objectOffset, objectValue, objectValue2)) { in testGetAndPutAndCAS()
171 if (!unsafe.compareAndSwapObject(t, objectOffset, objectValue2, objectValue3)) { in testGetAndPutAndCAS()
177 if (!unsafe.compareAndSwapObject(t, objectOffset, objectValue3, objectValue3)) { in testGetAndPutAndCAS()
183 if (!unsafe.compareAndSwapObject(t, objectOffset, objectValue3, t)) { in testGetAndPutAndCAS()
189 if (!unsafe.compareAndSwapObject(t, objectOffset, t, t)) { in testGetAndPutAndCAS()
194 if (!unsafe.compareAndSwapObject(t, objectOffset, t, new Object())) { in testGetAndPutAndCAS()
200 private static void testGetAndPutVolatile(Unsafe unsafe) throws NoSuchFieldException { in testGetAndPutVolatile() argument
205 long volatileIntOffset = unsafe.objectFieldOffset(volatileIntField); in testGetAndPutVolatile()
206 check(unsafe.getIntVolatile(tv, volatileIntOffset), in testGetAndPutVolatile()
209 unsafe.putIntVolatile(tv, volatileIntOffset, intValue); in testGetAndPutVolatile()
211 check(unsafe.getIntVolatile(tv, volatileIntOffset), in testGetAndPutVolatile()
217 long volatileLongOffset = unsafe.objectFieldOffset(volatileLongField); in testGetAndPutVolatile()
218 check(unsafe.getLongVolatile(tv, volatileLongOffset), in testGetAndPutVolatile()
221 unsafe.putLongVolatile(tv, volatileLongOffset, longValue); in testGetAndPutVolatile()
223 check(unsafe.getLongVolatile(tv, volatileLongOffset), in testGetAndPutVolatile()
229 long volatileObjectOffset = unsafe.objectFieldOffset(volatileObjectField); in testGetAndPutVolatile()
230 check(unsafe.getObjectVolatile(tv, volatileObjectOffset), in testGetAndPutVolatile()
233 unsafe.putObjectVolatile(tv, volatileObjectOffset, objectValue); in testGetAndPutVolatile()
235 check(unsafe.getObjectVolatile(tv, volatileObjectOffset), in testGetAndPutVolatile()