Lines Matching refs:unsafe

65     Unsafe unsafe = getUnsafe();  in main()  local
67 testArrayBaseOffset(unsafe); in main()
68 testArrayIndexScale(unsafe); in main()
69 testGetAndPutAndCAS(unsafe); in main()
70 testGetAndPutVolatile(unsafe); in main()
71 testCopyMemoryPrimitiveArrays(unsafe); in main()
74 private static void testArrayBaseOffset(Unsafe unsafe) { in testArrayBaseOffset() argument
75 check(unsafe.arrayBaseOffset(boolean[].class), vmArrayBaseOffset(boolean[].class), in testArrayBaseOffset()
77 check(unsafe.arrayBaseOffset(byte[].class), vmArrayBaseOffset(byte[].class), in testArrayBaseOffset()
79 check(unsafe.arrayBaseOffset(char[].class), vmArrayBaseOffset(char[].class), in testArrayBaseOffset()
81 check(unsafe.arrayBaseOffset(double[].class), vmArrayBaseOffset(double[].class), in testArrayBaseOffset()
83 check(unsafe.arrayBaseOffset(float[].class), vmArrayBaseOffset(float[].class), in testArrayBaseOffset()
85 check(unsafe.arrayBaseOffset(int[].class), vmArrayBaseOffset(int[].class), in testArrayBaseOffset()
87 check(unsafe.arrayBaseOffset(long[].class), vmArrayBaseOffset(long[].class), in testArrayBaseOffset()
89 check(unsafe.arrayBaseOffset(Object[].class), vmArrayBaseOffset(Object[].class), in testArrayBaseOffset()
93 private static void testArrayIndexScale(Unsafe unsafe) { in testArrayIndexScale() argument
94 check(unsafe.arrayIndexScale(boolean[].class), vmArrayIndexScale(boolean[].class), in testArrayIndexScale()
96 check(unsafe.arrayIndexScale(byte[].class), vmArrayIndexScale(byte[].class), in testArrayIndexScale()
98 check(unsafe.arrayIndexScale(char[].class), vmArrayIndexScale(char[].class), in testArrayIndexScale()
100 check(unsafe.arrayIndexScale(double[].class), vmArrayIndexScale(double[].class), in testArrayIndexScale()
102 check(unsafe.arrayIndexScale(float[].class), vmArrayIndexScale(float[].class), in testArrayIndexScale()
104 check(unsafe.arrayIndexScale(int[].class), vmArrayIndexScale(int[].class), in testArrayIndexScale()
106 check(unsafe.arrayIndexScale(long[].class), vmArrayIndexScale(long[].class), in testArrayIndexScale()
108 check(unsafe.arrayIndexScale(Object[].class), vmArrayIndexScale(Object[].class), in testArrayIndexScale()
112 private static void testGetAndPutAndCAS(Unsafe unsafe) throws NoSuchFieldException { in testGetAndPutAndCAS() argument
117 long intOffset = unsafe.objectFieldOffset(intField); in testGetAndPutAndCAS()
118 check(unsafe.getInt(t, intOffset), 0, "Unsafe.getInt(Object, long) - initial"); in testGetAndPutAndCAS()
119 unsafe.putInt(t, intOffset, intValue); in testGetAndPutAndCAS()
121 check(unsafe.getInt(t, intOffset), intValue, "Unsafe.getInt(Object, long)"); in testGetAndPutAndCAS()
125 long longOffset = unsafe.objectFieldOffset(longField); in testGetAndPutAndCAS()
126 check(unsafe.getLong(t, longOffset), 0, "Unsafe.getLong(Object, long) - initial"); in testGetAndPutAndCAS()
127 unsafe.putLong(t, longOffset, longValue); in testGetAndPutAndCAS()
129 check(unsafe.getLong(t, longOffset), longValue, "Unsafe.getLong(Object, long)"); in testGetAndPutAndCAS()
133 long objectOffset = unsafe.objectFieldOffset(objectField); in testGetAndPutAndCAS()
134 check(unsafe.getObject(t, objectOffset), null, "Unsafe.getObject(Object, long) - initial"); in testGetAndPutAndCAS()
135 unsafe.putObject(t, objectOffset, objectValue); in testGetAndPutAndCAS()
137 check(unsafe.getObject(t, objectOffset), objectValue, "Unsafe.getObject(Object, long)"); in testGetAndPutAndCAS()
139 if (unsafe.compareAndSwapInt(t, intOffset, 0, 1)) { in testGetAndPutAndCAS()
142 if (!unsafe.compareAndSwapInt(t, intOffset, intValue, 0)) { in testGetAndPutAndCAS()
146 if (!unsafe.compareAndSwapInt(t, intOffset, 0, 1)) { in testGetAndPutAndCAS()
151 if (!unsafe.compareAndSwapInt(t, intOffset, 1, 1)) { in testGetAndPutAndCAS()
155 if (unsafe.compareAndSwapLong(t, longOffset, 0, 1)) { in testGetAndPutAndCAS()
158 if (!unsafe.compareAndSwapLong(t, longOffset, longValue, 0)) { in testGetAndPutAndCAS()
162 if (!unsafe.compareAndSwapLong(t, longOffset, 0, 1)) { in testGetAndPutAndCAS()
167 if (!unsafe.compareAndSwapLong(t, longOffset, 1, 1)) { in testGetAndPutAndCAS()
176 if (unsafe.compareAndSwapObject(t, objectOffset, new Object(), new Object())) { in testGetAndPutAndCAS()
181 if (!unsafe.compareAndSwapObject(t, objectOffset, objectValue, objectValue2)) { in testGetAndPutAndCAS()
186 if (!unsafe.compareAndSwapObject(t, objectOffset, objectValue2, objectValue3)) { in testGetAndPutAndCAS()
192 if (!unsafe.compareAndSwapObject(t, objectOffset, objectValue3, objectValue3)) { in testGetAndPutAndCAS()
198 if (!unsafe.compareAndSwapObject(t, objectOffset, objectValue3, t)) { in testGetAndPutAndCAS()
204 if (!unsafe.compareAndSwapObject(t, objectOffset, t, t)) { in testGetAndPutAndCAS()
209 if (!unsafe.compareAndSwapObject(t, objectOffset, t, new Object())) { in testGetAndPutAndCAS()
215 private static void testGetAndPutVolatile(Unsafe unsafe) throws NoSuchFieldException { in testGetAndPutVolatile() argument
220 long volatileIntOffset = unsafe.objectFieldOffset(volatileIntField); in testGetAndPutVolatile()
221 check(unsafe.getIntVolatile(tv, volatileIntOffset), in testGetAndPutVolatile()
224 unsafe.putIntVolatile(tv, volatileIntOffset, intValue); in testGetAndPutVolatile()
226 check(unsafe.getIntVolatile(tv, volatileIntOffset), in testGetAndPutVolatile()
232 long volatileLongOffset = unsafe.objectFieldOffset(volatileLongField); in testGetAndPutVolatile()
233 check(unsafe.getLongVolatile(tv, volatileLongOffset), in testGetAndPutVolatile()
236 unsafe.putLongVolatile(tv, volatileLongOffset, longValue); in testGetAndPutVolatile()
238 check(unsafe.getLongVolatile(tv, volatileLongOffset), in testGetAndPutVolatile()
244 long volatileObjectOffset = unsafe.objectFieldOffset(volatileObjectField); in testGetAndPutVolatile()
245 check(unsafe.getObjectVolatile(tv, volatileObjectOffset), in testGetAndPutVolatile()
248 unsafe.putObjectVolatile(tv, volatileObjectOffset, objectValue); in testGetAndPutVolatile()
250 check(unsafe.getObjectVolatile(tv, volatileObjectOffset), in testGetAndPutVolatile()
256 private static void testCopyMemoryPrimitiveArrays(Unsafe unsafe) { in testCopyMemoryPrimitiveArrays() argument
266 unsafe.copyMemoryFromPrimitiveArray(inputFloats, 0, memory, size); in testCopyMemoryPrimitiveArrays()
267 unsafe.copyMemoryToPrimitiveArray(memory, outputFloats, 0, size); in testCopyMemoryPrimitiveArrays()
278 unsafe.copyMemoryFromPrimitiveArray(inputDoubles, 0, memory, size); in testCopyMemoryPrimitiveArrays()
279 unsafe.copyMemoryToPrimitiveArray(memory, outputDoubles, 0, size); in testCopyMemoryPrimitiveArrays()