public final class UnsafeRefArrayAccess extends Object
Offset calculation is separate from access to enable the reuse of a give compute offset.
Load/Store methods using a buffer parameter are provided to allow the prevention of final field reload after a LoadLoad barrier.
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 long |
calcElementOffset(long index) |
static <E> E |
lpElement(E[] buffer,
long offset)
A plain load (no ordering/fences) of an element from a given offset.
|
static <E> E |
lvElement(E[] buffer,
long offset)
A volatile load (load + LoadLoad barrier) of an element from a given offset.
|
static <E> void |
soElement(E[] buffer,
long offset,
E e)
An ordered store(store + StoreStore barrier) of an element to a given offset
|
static <E> void |
spElement(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 spElement(E[] buffer, long offset, E e)
buffer
- this.bufferoffset
- computed via calcElementOffset(long)
e
- an orderly kittypublic static <E> void soElement(E[] buffer, long offset, E e)
buffer
- this.bufferoffset
- computed via calcElementOffset(long)
e
- an orderly kittypublic static <E> E lpElement(E[] buffer, long offset)
buffer
- this.bufferoffset
- computed via calcElementOffset(long)
public static <E> E lvElement(E[] buffer, long offset)
buffer
- this.bufferoffset
- computed via calcElementOffset(long)
public static long calcElementOffset(long index)
index
- desirable element indexCopyright © 2013–2018. All rights reserved.