public final class UnsafeRefArrayAccess
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static long |
REF_ARRAY_BASE |
static int |
REF_ELEMENT_SHIFT |
Constructor and Description |
---|
UnsafeRefArrayAccess() |
Modifier and Type | Method and Description |
---|---|
static <E> E[] |
allocateRefArray(int capacity)
This makes for an easier time generating the atomic queues, and removes some warnings.
|
static long |
calcCircularRefElementOffset(long index,
long mask)
Note: circular arrays are assumed a power of 2 in length and the `mask` is (length - 1).
|
static long |
calcRefElementOffset(long index) |
static <E> E |
lpRefElement(E[] buffer,
long offset)
A plain load (no ordering/fences) of an element from a given offset.
|
static <E> E |
lvRefElement(E[] buffer,
long offset)
A volatile load of an element from a given offset.
|
static <E> void |
soRefElement(E[] buffer,
long offset,
E e)
An ordered store of an element to a given offset
|
static <E> void |
spRefElement(E[] buffer,
long offset,
E e)
A plain store (no ordering/fences) of an element to a given offset
|
public static final long REF_ARRAY_BASE
public static final int REF_ELEMENT_SHIFT
public static <E> void spRefElement(E[] buffer, long offset, E e)
buffer
- this.bufferoffset
- computed via calcRefElementOffset(long)
e
- an orderly kittypublic static <E> void soRefElement(E[] buffer, long offset, E e)
buffer
- this.bufferoffset
- computed via calcCircularRefElementOffset(long, long)
e
- an orderly kittypublic static <E> E lpRefElement(E[] buffer, long offset)
buffer
- this.bufferoffset
- computed via calcRefElementOffset(long)
public static <E> E lvRefElement(E[] buffer, long offset)
buffer
- this.bufferoffset
- computed via calcRefElementOffset(long)
public static long calcRefElementOffset(long index)
index
- desirable element indexpublic static long calcCircularRefElementOffset(long index, long mask)
index
- desirable element indexmask
- (length - 1)public static <E> E[] allocateRefArray(int capacity)