/dalvik/tests/067-preemptive-unpark/src/ |
Main.java | 1 import sun.misc.Unsafe; 6 private static Unsafe UNSAFE; 16 UNSAFE.unpark(test); 40 * Set up {@link #UNSAFE}. 44 * Subvert the access check to get the unique Unsafe instance. 49 Field field = Unsafe.class.getDeclaredField("THE_ONE"); 52 UNSAFE = (Unsafe) field.get(null); 95 UNSAFE.park(false, 500 * 1000000); // 500 mse [all...] |
/libcore/luni/src/main/native/ |
sun_misc_Unsafe.cpp | 17 #define LOG_TAG "Unsafe" 27 NATIVE_METHOD(Unsafe, allocateInstance, "(Ljava/lang/Class;)Ljava/lang/Object;"), 30 jniRegisterNativeMethods(env, "sun/misc/Unsafe", gMethods, NELEM(gMethods));
|
/libcore/luni/src/test/java/sun/misc/ |
UnsafeTest.java | 29 Unsafe.getUnsafe(); 42 Unsafe.getUnsafe(); 59 private static Unsafe getUnsafe() throws Exception { 60 Class<?> unsafeClass = Class.forName("sun.misc.Unsafe"); 63 return (Unsafe) f.get(null);
|
/libcore/luni/src/main/java/sun/misc/ |
Unsafe.java | 29 public final class Unsafe { 31 private static final Unsafe THE_ONE = new Unsafe(); 33 private static final Unsafe theUnsafe = THE_ONE; 38 private Unsafe() {} 44 public static Unsafe getUnsafe() { 47 * Unsafe instance. 50 if ((calling != null) && (calling != Unsafe.class.getClassLoader())) { 51 throw new SecurityException("Unsafe access denied");
|
/libcore/luni/src/main/java/java/util/concurrent/atomic/ |
AtomicBoolean.java | 8 import sun.misc.Unsafe; 23 // setup to use Unsafe.compareAndSwapInt for updates 24 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicBoolean 29 valueOffset = unsafe.objectFieldOffset 72 return unsafe.compareAndSwapInt(this, valueOffset, e, u); 90 return unsafe.compareAndSwapInt(this, valueOffset, e, u); 110 unsafe.putOrderedInt(this, valueOffset, v);
|
AtomicReference.java | 8 import sun.misc.Unsafe; 21 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicReference 26 valueOffset = unsafe.objectFieldOffset 73 unsafe.putOrderedObject(this, valueOffset, newValue); 85 return unsafe.compareAndSwapObject(this, valueOffset, expect, update); 101 return unsafe.compareAndSwapObject(this, valueOffset, expect, update);
|
AtomicInteger.java | 8 import sun.misc.Unsafe; 26 // setup to use Unsafe.compareAndSwapInt for updates 27 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicInteger 32 valueOffset = unsafe.objectFieldOffset 79 unsafe.putOrderedInt(this, valueOffset, newValue); 106 return unsafe.compareAndSwapInt(this, valueOffset, expect, update); 122 return unsafe.compareAndSwapInt(this, valueOffset, expect, update);
|
AtomicLong.java | 8 import sun.misc.Unsafe; 26 // setup to use Unsafe.compareAndSwapLong for updates 27 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicLong 32 * compareAndSwap for longs. While the Unsafe.compareAndSwapLong 46 valueOffset = unsafe.objectFieldOffset 93 unsafe.putOrderedLong(this, valueOffset, newValue); 120 return unsafe.compareAndSwapLong(this, valueOffset, expect, update); 136 return unsafe.compareAndSwapLong(this, valueOffset, expect, update) [all...] |
AtomicIntegerArray.java | 8 import sun.misc.Unsafe; 21 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicIntegerArray 22 private static final int base = unsafe.arrayBaseOffset(int[].class); 27 int scale = unsafe.arrayIndexScale(int[].class); 86 return unsafe.getIntVolatile(array, offset); 96 unsafe.putIntVolatile(array, checkedByteOffset(i), newValue); 107 unsafe.putOrderedInt(array, checkedByteOffset(i), newValue); 142 return unsafe.compareAndSwapInt(array, offset, expect, update) [all...] |
AtomicLongArray.java | 8 import sun.misc.Unsafe; 20 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicLongArray 21 private static final int base = unsafe.arrayBaseOffset(long[].class); 26 int scale = unsafe.arrayIndexScale(long[].class); 85 return unsafe.getLongVolatile(array, offset); 95 unsafe.putLongVolatile(array, checkedByteOffset(i), newValue); 106 unsafe.putOrderedLong(array, checkedByteOffset(i), newValue); 142 return unsafe.compareAndSwapLong(array, offset, expect, update) [all...] |
AtomicMarkableReference.java | 162 // Unsafe mechanics 164 private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); 166 objectFieldOffset(UNSAFE, "pair", AtomicMarkableReference.class); 169 return UNSAFE.compareAndSwapObject(this, pairOffset, cmp, val); 172 static long objectFieldOffset(sun.misc.Unsafe UNSAFE, 175 return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
|
AtomicStampedReference.java | 163 // Unsafe mechanics 165 private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); 167 objectFieldOffset(UNSAFE, "pair", AtomicStampedReference.class); 170 return UNSAFE.compareAndSwapObject(this, pairOffset, cmp, val); 173 static long objectFieldOffset(sun.misc.Unsafe UNSAFE, 176 return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
|
AtomicLongFieldUpdater.java | 10 import sun.misc.Unsafe; 238 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicLongFieldUpdater.CASUpdater 270 offset = unsafe.objectFieldOffset(field); 282 return unsafe.compareAndSwapLong(obj, offset, expect, update); 287 return unsafe.compareAndSwapLong(obj, offset, expect, update); 292 unsafe.putLongVolatile(obj, offset, newValue); 297 unsafe.putOrderedLong(obj, offset, newValue); 302 return unsafe.getLongVolatile(obj, offset) 323 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicLongFieldUpdater.LockedUpdater [all...] |
AtomicIntegerFieldUpdater.java | 10 import sun.misc.Unsafe; 239 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicIntegerFieldUpdater.AtomicIntegerFieldUpdaterImpl 272 offset = unsafe.objectFieldOffset(field); 284 return unsafe.compareAndSwapInt(obj, offset, expect, update); 289 return unsafe.compareAndSwapInt(obj, offset, expect, update); 294 unsafe.putIntVolatile(obj, offset, newValue); 299 unsafe.putOrderedInt(obj, offset, newValue); 304 return unsafe.getIntVolatile(obj, offset) [all...] |
AtomicReferenceArray.java | 11 import sun.misc.Unsafe; 25 private static final Unsafe unsafe; field in class:AtomicReferenceArray 34 unsafe = Unsafe.getUnsafe(); 35 arrayFieldOffset = unsafe.objectFieldOffset 37 base = unsafe.arrayBaseOffset(Object[].class); 38 scale = unsafe.arrayIndexScale(Object[].class); 100 return (E) unsafe.getObjectVolatile(array, offset); 110 unsafe.putObjectVolatile(array, checkedByteOffset(i), newValue) [all...] |
AtomicReferenceFieldUpdater.java | 9 import sun.misc.Unsafe; 154 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:AtomicReferenceFieldUpdater.AtomicReferenceFieldUpdaterImpl 206 offset = unsafe.objectFieldOffset(field); 229 return unsafe.compareAndSwapObject(obj, offset, expect, update); 238 return unsafe.compareAndSwapObject(obj, offset, expect, update); 246 unsafe.putObjectVolatile(obj, offset, newValue); 254 unsafe.putOrderedObject(obj, offset, newValue); 260 return (V)unsafe.getObjectVolatile(obj, offset) [all...] |
/libcore/luni/src/main/java/java/util/concurrent/locks/ |
LockSupport.java | 8 import sun.misc.Unsafe; 97 private static final Unsafe unsafe = Unsafe.getUnsafe(); field in class:LockSupport 102 parkBlockerOffset = unsafe.objectFieldOffset 109 unsafe.putObject(t, parkBlockerOffset, arg); 125 unsafe.unpark(thread); 159 unsafe.park(false, 0L); 199 unsafe.park(false, nanos); 240 unsafe.park(true, deadline) [all...] |
/libcore/luni/src/test/java/tests/api/org/apache/harmony/kernel/dalvik/ |
ThreadsTest.java | 24 import sun.misc.Unsafe; 27 * Tests for the <code>park()</code> functionality of {@link Unsafe}. 30 private static Unsafe UNSAFE = null; 33 * Set up {@link #UNSAFE}. This subverts the access check to 34 * get the unique Unsafe instance. We can do this because 39 Field field = Unsafe.class.getDeclaredField("THE_ONE"); 42 UNSAFE = (Unsafe) field.get(null); 86 UNSAFE.unpark(parkerThread) [all...] |
/libcore/luni/src/main/java/java/util/concurrent/ |
SynchronousQueue.java | 216 UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val); 229 UNSAFE.compareAndSwapObject(this, matchOffset, null, s)) { 244 UNSAFE.compareAndSwapObject(this, matchOffset, null, this); 251 // Unsafe mechanics 252 private static final sun.misc.Unsafe UNSAFE; 258 UNSAFE = sun.misc.Unsafe.getUnsafe(); 260 matchOffset = UNSAFE.objectFieldOffset 262 nextOffset = UNSAFE.objectFieldOffse [all...] |
ConcurrentLinkedQueue.java | 137 * for a volatile write to item by using Unsafe.putObject instead 158 UNSAFE.putObject(this, itemOffset, item); 162 return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val); 166 UNSAFE.putOrderedObject(this, nextOffset, val); 170 return UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val); 173 // Unsafe mechanics 175 private static final sun.misc.Unsafe UNSAFE; 181 UNSAFE = sun.misc.Unsafe.getUnsafe() [all...] |
ConcurrentSkipListSet.java | 446 UNSAFE.putObjectVolatile(this, mapOffset, map); 449 private static final sun.misc.Unsafe UNSAFE; 453 UNSAFE = sun.misc.Unsafe.getUnsafe(); 455 mapOffset = UNSAFE.objectFieldOffset
|
FutureTask.java | 44 * AtomicXFieldUpdaters and instead directly use Unsafe intrinsics. 140 if (!UNSAFE.compareAndSwapInt(this, stateOffset, NEW, INTERRUPTING)) 145 UNSAFE.putOrderedInt(this, stateOffset, INTERRUPTED); // final state 147 else if (!UNSAFE.compareAndSwapInt(this, stateOffset, NEW, CANCELLED)) 198 if (UNSAFE.compareAndSwapInt(this, stateOffset, NEW, COMPLETING)) { 200 UNSAFE.putOrderedInt(this, stateOffset, NORMAL); // final state 216 if (UNSAFE.compareAndSwapInt(this, stateOffset, NEW, COMPLETING)) { 218 UNSAFE.putOrderedInt(this, stateOffset, EXCEPTIONAL); // final state 225 !UNSAFE.compareAndSwapObject(this, runnerOffset, 267 !UNSAFE.compareAndSwapObject(this, runnerOffset [all...] |
LinkedTransferQueue.java | 416 * them after use. Relies heavily on Unsafe mechanics to minimize 428 return UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val); 433 return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val); 441 UNSAFE.putObject(this, itemOffset, item); // relaxed write 450 UNSAFE.putObject(this, nextOffset, this); 463 UNSAFE.putObject(this, itemOffset, this); 464 UNSAFE.putObject(this, waiterOffset, null); 509 // Unsafe mechanics 510 private static final sun.misc.Unsafe UNSAFE; [all...] |
Phaser.java | 364 if (UNSAFE.compareAndSwapLong(this, stateOffset, s, s-=adjust)) { 377 UNSAFE.compareAndSwapLong(this, stateOffset, s, n); 382 UNSAFE.compareAndSwapLong(this, stateOffset, 418 else if (UNSAFE.compareAndSwapLong(this, stateOffset, 425 if (UNSAFE.compareAndSwapLong(this, stateOffset, s, next)) 437 while (!UNSAFE.compareAndSwapLong 469 !UNSAFE.compareAndSwapLong 659 if (UNSAFE.compareAndSwapLong(this, stateOffset, s, 675 if (!UNSAFE.compareAndSwapLong(this, stateOffset, s, n)) [all...] |
ConcurrentLinkedDeque.java | 278 UNSAFE.putObject(this, itemOffset, item); 282 return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val); 286 UNSAFE.putOrderedObject(this, nextOffset, val); 290 return UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val); 294 UNSAFE.putOrderedObject(this, prevOffset, val); 298 return UNSAFE.compareAndSwapObject(this, prevOffset, cmp, val); 301 // Unsafe mechanics 303 private static final sun.misc.Unsafe UNSAFE; 310 UNSAFE = sun.misc.Unsafe.getUnsafe() [all...] |