@Override public void putLongLittleEndian(byte[] array, int offset, long value) { theUnsafe.putLong(array, (long) offset + BYTE_ARRAY_BASE_OFFSET, value); } },
/** Performs a CAS operation on the {@link #waiters} field. */ @Override boolean casWaiters(AbstractFuture<?> future, Waiter expect, Waiter update) { return UNSAFE.compareAndSwapObject(future, WAITERS_OFFSET, expect, update); }
@Override void putNext(Waiter waiter, Waiter newValue) { UNSAFE.putObject(waiter, WAITER_NEXT_OFFSET, newValue); }
@Override public long getLongLittleEndian(byte[] array, int offset) { return theUnsafe.getLong(array, (long) offset + BYTE_ARRAY_BASE_OFFSET); }
static int getInt(Object object, long fieldOffset) { return UNSAFE.getInt(object, fieldOffset); }
static void putInt(byte[] data, int index, int value) { UNSAFE.putInt(data, BYTE_ARRAY_BASE_OFFSET + index, value); }
/** CASes the base field. */ final boolean casBase(long cmp, long val) { return UNSAFE.compareAndSwapLong(this, baseOffset, cmp, val); }
static void putShort(byte[] data, int index, short value) { UNSAFE.putShort(data, BYTE_ARRAY_BASE_OFFSET + index, value); }
static short getShort(long address) { return UNSAFE.getShort(address); }
static long objectFieldOffset(Field field) { return UNSAFE.objectFieldOffset(field); }
/** CASes the busy field from 0 to 1 to acquire lock. */ final boolean casBusy() { return UNSAFE.compareAndSwapInt(this, busyOffset, 0, 1); }
static int getInt(long address) { return UNSAFE.getInt(address); }
@Override public void putLongLittleEndian(byte[] array, int offset, long value) { // Reverse the order of the bytes before storing, since we're on big-endian hardware. long littleEndianValue = Long.reverseBytes(value); theUnsafe.putLong(array, (long) offset + BYTE_ARRAY_BASE_OFFSET, littleEndianValue); } };
/** CASes the base field. */ final boolean casBase(long cmp, long val) { return UNSAFE.compareAndSwapLong(this, baseOffset, cmp, val); }
@Override void putThread(Waiter waiter, Thread newValue) { UNSAFE.putObject(waiter, WAITER_THREAD_OFFSET, newValue); }
/** Performs a CAS operation on the {@link #listeners} field. */ @Override boolean casListeners(AbstractFuture<?> future, Listener expect, Listener update) { return UNSAFE.compareAndSwapObject(future, LISTENERS_OFFSET, expect, update); }
/** CASes the busy field from 0 to 1 to acquire lock. */ final boolean casBusy() { return UNSAFE.compareAndSwapInt(this, busyOffset, 0, 1); }
final boolean cas(long cmp, long val) { return UNSAFE.compareAndSwapLong(this, valueOffset, cmp, val); }
/** Performs a CAS operation on the {@link #value} field. */ @Override boolean casValue(AbstractFuture<?> future, Object expect, Object update) { return UNSAFE.compareAndSwapObject(future, VALUE_OFFSET, expect, update); } }
final boolean cas(long cmp, long val) { return UNSAFE.compareAndSwapLong(this, valueOffset, cmp, val); }