Package one.microstream.memory.sun
Class JdkInternals
- java.lang.Object
-
- one.microstream.memory.sun.JdkInternals
-
public final class JdkInternals extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
JdkInternals.Warning
-
Constructor Summary
Constructors Constructor Description JdkInternals()
-
Method Summary
Modifier and Type Method Description static long
alignAddress(long address)
static long
allocateMemory(long bytes)
static byte[]
asByteArray(long value)
static byte[]
asByteArray(long[] longArray)
static long
byteSizeArray_boolean(long elementCount)
static long
byteSizeArray_byte(long elementCount)
static long
byteSizeArray_char(long elementCount)
static long
byteSizeArray_double(long elementCount)
static long
byteSizeArray_float(long elementCount)
static long
byteSizeArray_int(long elementCount)
static long
byteSizeArray_long(long elementCount)
static long
byteSizeArray_short(long elementCount)
static long
byteSizeArrayObject(long elementCount)
static int
byteSizeFieldValue(Class<?> type)
static int
byteSizeInstance(Class<?> type)
static int
byteSizeObjectHeader()
static int
byteSizeReference()
static boolean
compareAndSwap_int(Object subject, long offset, int expected, int replacement)
static boolean
compareAndSwap_long(Object subject, long offset, long expected, long replacement)
static boolean
compareAndSwapObject(Object subject, long offset, Object expected, Object replacement)
static void
copyArrayToAddress(boolean[] array, long targetAddress)
static void
copyArrayToAddress(byte[] array, long targetAddress)
static void
copyArrayToAddress(char[] array, long targetAddress)
static void
copyArrayToAddress(double[] array, long targetAddress)
static void
copyArrayToAddress(float[] array, long targetAddress)
static void
copyArrayToAddress(int[] array, long targetAddress)
static void
copyArrayToAddress(long[] array, long targetAddress)
static void
copyArrayToAddress(short[] array, long targetAddress)
static void
copyRange(long sourceAddress, long targetAddress, long length)
static void
copyRange(Object source, long sourceOffset, Object target, long targetOffset, long length)
static void
copyRangeToArray(long sourceAddress, boolean[] target)
static void
copyRangeToArray(long sourceAddress, byte[] target)
static void
copyRangeToArray(long sourceAddress, char[] target)
static void
copyRangeToArray(long sourceAddress, double[] target)
static void
copyRangeToArray(long sourceAddress, float[] target)
static void
copyRangeToArray(long sourceAddress, int[] target)
static void
copyRangeToArray(long sourceAddress, long[] target)
static void
copyRangeToArray(long sourceAddress, short[] target)
static boolean
deallocateDirectBuffer(ByteBuffer directBuffer)
static DirectBufferDeallocator
DirectBufferDeallocator()
static void
ensureClassInitialized(Class<?> c)
static void
ensureClassInitialized(Class<?>... classes)
static void
fillMemory(long address, long length, byte value)
static void
freeMemory(long address)
static boolean
get_boolean(long address)
static boolean
get_boolean(Object instance, long offset)
static byte
get_byte(long address)
static byte
get_byte(Object instance, long offset)
static char
get_char(long address)
static char
get_char(Object instance, long offset)
static double
get_double(long address)
static double
get_double(Object instance, long offset)
static float
get_float(long address)
static float
get_float(Object instance, long offset)
static int
get_int(long address)
static int
get_int(Object instance, long offset)
static long
get_long(long address)
static long
get_long(Object instance, long offset)
static short
get_short(long address)
static short
get_short(Object instance, long offset)
static DirectBufferAddressGetter
getDirectBufferAddressGetter()
static DirectBufferDeallocator
getDirectBufferDeallocator()
static long
getDirectByteBufferAddress(ByteBuffer directBuffer)
static sun.misc.Unsafe
getMemoryAccess()
static Object
getObject(Object instance, long offset)
static Object
getStaticFieldBase(Field field)
static long[]
getStaticFieldOffsets(Field[] fields)
static void
guaranteeUsability()
Guarantees the full usability of this class by validating if all functionality is usable.static List<JdkInternals.Warning>
initializationWarnings()
static <T> T
instantiateBlank(Class<T> c)
static DefaultInstantiator
InstantiatorBlank()
static boolean
internalDeallocateDirectBuffer(ByteBuffer directBuffer)
static long
internalGetDirectByteBufferAddress(ByteBuffer directBuffer)
static long
objectFieldOffset(Field field)
Return the field value's arithmetic memory offset relative to the object base offset.static long[]
objectFieldOffsets(Field... fields)
Array alias vor #objectFieldOffset(Field).static int
pageSize()
static void
printInitializationWarnings(PrintStream printStream)
static long
reallocateMemory(long address, long bytes)
static void
set_boolean(long address, boolean value)
static void
set_boolean(Object instance, long offset, boolean value)
static void
set_booleanInBytes(byte[] bytes, int index, boolean value)
static void
set_byte(long address, byte value)
static void
set_byte(Object instance, long offset, byte value)
static void
set_byteInBytes(byte[] bytes, int index, byte value)
static void
set_char(long address, char value)
static void
set_char(Object instance, long offset, char value)
static void
set_charInBytes(byte[] bytes, int index, char value)
static void
set_double(long address, double value)
static void
set_double(Object instance, long offset, double value)
static void
set_doubleInBytes(byte[] bytes, int index, double value)
static void
set_float(long address, float value)
static void
set_float(Object instance, long offset, float value)
static void
set_floatInBytes(byte[] bytes, int index, float value)
static void
set_int(long address, int value)
static void
set_int(Object instance, long offset, int value)
static void
set_intInBytes(byte[] bytes, int index, int value)
static void
set_long(long address, long value)
static void
set_long(Object instance, long offset, long value)
static void
set_longInBytes(byte[] bytes, int index, long value)
static void
set_short(long address, short value)
static void
set_short(Object instance, long offset, short value)
static void
set_shortInBytes(byte[] bytes, int index, short value)
static void
setDirectBufferAddressGetter(DirectBufferAddressGetter addressGetter)
Allows to set theDirectBufferAddressGetter
used bygetDirectByteBufferAddress(ByteBuffer)
as an override to the means this class inherently tries to provide.
SeeDirectBufferAddressGetter
for details.static void
setDirectBufferDeallocator(DirectBufferDeallocator deallocator)
Allows to set theDirectBufferDeallocator
used bydeallocateDirectBuffer(ByteBuffer)
as an override to the means this class inherently tries to provide.
SeeDirectBufferDeallocator
for details.static void
setObject(Object instance, long offset, Object value)
static void
throwUnchecked(Throwable t)
-
-
-
Method Detail
-
getMemoryAccess
public static final sun.misc.Unsafe getMemoryAccess()
-
guaranteeUsability
public static void guaranteeUsability()
Guarantees the full usability of this class by validating if all functionality is usable.- Throws:
Error
-
initializationWarnings
public static final List<JdkInternals.Warning> initializationWarnings()
-
printInitializationWarnings
public static final void printInitializationWarnings(PrintStream printStream)
-
setDirectBufferDeallocator
public static void setDirectBufferDeallocator(DirectBufferDeallocator deallocator)
Allows to set theDirectBufferDeallocator
used bydeallocateDirectBuffer(ByteBuffer)
as an override to the means this class inherently tries to provide.
SeeDirectBufferDeallocator
for details.The passed instance "should" be immutable or better stateless to ensure concurrency-safe usage, but ultimately, the responsibility resides with the author of the instance's implementation.
Passing a null resets the behavior of
deallocateDirectBuffer(ByteBuffer)
to the inherent logic.- Parameters:
deallocator
- the deallocator to be used, potentially null.- See Also:
DirectBufferDeallocator
-
getDirectBufferDeallocator
public static DirectBufferDeallocator getDirectBufferDeallocator()
-
setDirectBufferAddressGetter
public static void setDirectBufferAddressGetter(DirectBufferAddressGetter addressGetter)
Allows to set theDirectBufferAddressGetter
used bygetDirectByteBufferAddress(ByteBuffer)
as an override to the means this class inherently tries to provide.
SeeDirectBufferAddressGetter
for details.The passed instance "should" be immutable or better stateless to ensure concurrency-safe usage, but ultimately, the responsibility resides with the author of the instance's implementation.
Passing a null resets the behavior of
getDirectByteBufferAddress(ByteBuffer)
to the inherent logic.- Parameters:
addressGetter
- the addressGetter to be used, potentially null.- See Also:
DirectBufferDeallocator
-
getDirectBufferAddressGetter
public static DirectBufferAddressGetter getDirectBufferAddressGetter()
-
internalGetDirectByteBufferAddress
public static final long internalGetDirectByteBufferAddress(ByteBuffer directBuffer)
-
getDirectByteBufferAddress
public static final long getDirectByteBufferAddress(ByteBuffer directBuffer)
-
internalDeallocateDirectBuffer
public static final boolean internalDeallocateDirectBuffer(ByteBuffer directBuffer)
-
deallocateDirectBuffer
public static final boolean deallocateDirectBuffer(ByteBuffer directBuffer)
-
allocateMemory
public static final long allocateMemory(long bytes)
-
reallocateMemory
public static final long reallocateMemory(long address, long bytes)
-
freeMemory
public static final void freeMemory(long address)
-
fillMemory
public static final void fillMemory(long address, long length, byte value)
-
get_byte
public static final byte get_byte(long address)
-
get_boolean
public static final boolean get_boolean(long address)
-
get_short
public static final short get_short(long address)
-
get_char
public static final char get_char(long address)
-
get_int
public static final int get_int(long address)
-
get_float
public static final float get_float(long address)
-
get_long
public static final long get_long(long address)
-
get_double
public static final double get_double(long address)
-
get_byte
public static byte get_byte(Object instance, long offset)
-
get_boolean
public static boolean get_boolean(Object instance, long offset)
-
get_short
public static short get_short(Object instance, long offset)
-
get_char
public static char get_char(Object instance, long offset)
-
get_int
public static int get_int(Object instance, long offset)
-
get_float
public static float get_float(Object instance, long offset)
-
get_long
public static long get_long(Object instance, long offset)
-
get_double
public static double get_double(Object instance, long offset)
-
set_byte
public static void set_byte(long address, byte value)
-
set_boolean
public static void set_boolean(long address, boolean value)
-
set_short
public static void set_short(long address, short value)
-
set_char
public static void set_char(long address, char value)
-
set_int
public static void set_int(long address, int value)
-
set_float
public static void set_float(long address, float value)
-
set_long
public static void set_long(long address, long value)
-
set_double
public static void set_double(long address, double value)
-
set_byte
public static final void set_byte(Object instance, long offset, byte value)
-
set_boolean
public static final void set_boolean(Object instance, long offset, boolean value)
-
set_short
public static void set_short(Object instance, long offset, short value)
-
set_char
public static final void set_char(Object instance, long offset, char value)
-
set_int
public static final void set_int(Object instance, long offset, int value)
-
set_float
public static final void set_float(Object instance, long offset, float value)
-
set_long
public static final void set_long(Object instance, long offset, long value)
-
set_double
public static final void set_double(Object instance, long offset, double value)
-
set_byteInBytes
public static final void set_byteInBytes(byte[] bytes, int index, byte value)
-
set_booleanInBytes
public static final void set_booleanInBytes(byte[] bytes, int index, boolean value)
-
set_shortInBytes
public static final void set_shortInBytes(byte[] bytes, int index, short value)
-
set_charInBytes
public static final void set_charInBytes(byte[] bytes, int index, char value)
-
set_intInBytes
public static final void set_intInBytes(byte[] bytes, int index, int value)
-
set_floatInBytes
public static final void set_floatInBytes(byte[] bytes, int index, float value)
-
set_longInBytes
public static final void set_longInBytes(byte[] bytes, int index, long value)
-
set_doubleInBytes
public static final void set_doubleInBytes(byte[] bytes, int index, double value)
-
copyRange
public static final void copyRange(long sourceAddress, long targetAddress, long length)
-
copyRange
public static final void copyRange(Object source, long sourceOffset, Object target, long targetOffset, long length)
-
copyRangeToArray
public static final void copyRangeToArray(long sourceAddress, byte[] target)
-
copyRangeToArray
public static final void copyRangeToArray(long sourceAddress, boolean[] target)
-
copyRangeToArray
public static final void copyRangeToArray(long sourceAddress, short[] target)
-
copyRangeToArray
public static final void copyRangeToArray(long sourceAddress, char[] target)
-
copyRangeToArray
public static final void copyRangeToArray(long sourceAddress, int[] target)
-
copyRangeToArray
public static final void copyRangeToArray(long sourceAddress, float[] target)
-
copyRangeToArray
public static final void copyRangeToArray(long sourceAddress, long[] target)
-
copyRangeToArray
public static final void copyRangeToArray(long sourceAddress, double[] target)
-
copyArrayToAddress
public static final void copyArrayToAddress(byte[] array, long targetAddress)
-
copyArrayToAddress
public static final void copyArrayToAddress(boolean[] array, long targetAddress)
-
copyArrayToAddress
public static final void copyArrayToAddress(short[] array, long targetAddress)
-
copyArrayToAddress
public static final void copyArrayToAddress(char[] array, long targetAddress)
-
copyArrayToAddress
public static final void copyArrayToAddress(int[] array, long targetAddress)
-
copyArrayToAddress
public static final void copyArrayToAddress(float[] array, long targetAddress)
-
copyArrayToAddress
public static final void copyArrayToAddress(long[] array, long targetAddress)
-
copyArrayToAddress
public static final void copyArrayToAddress(double[] array, long targetAddress)
-
asByteArray
public static final byte[] asByteArray(long[] longArray)
-
asByteArray
public static final byte[] asByteArray(long value)
-
objectFieldOffset
public static final long objectFieldOffset(Field field)
Return the field value's arithmetic memory offset relative to the object base offset.- Parameters:
field
-- Returns:
- the field value's memory offset.
-
objectFieldOffsets
public static final long[] objectFieldOffsets(Field... fields)
Array alias vor #objectFieldOffset(Field).
-
ensureClassInitialized
public static final void ensureClassInitialized(Class<?> c)
-
ensureClassInitialized
public static final void ensureClassInitialized(Class<?>... classes)
-
instantiateBlank
public static final <T> T instantiateBlank(Class<T> c) throws InstantiationRuntimeException
- Throws:
InstantiationRuntimeException
-
InstantiatorBlank
public static final DefaultInstantiator InstantiatorBlank()
-
DirectBufferDeallocator
public static final DirectBufferDeallocator DirectBufferDeallocator()
-
pageSize
public static int pageSize()
-
byteSizeReference
public static final int byteSizeReference()
-
byteSizeInstance
public static int byteSizeInstance(Class<?> type)
-
byteSizeObjectHeader
public static final int byteSizeObjectHeader()
-
byteSizeFieldValue
public static final int byteSizeFieldValue(Class<?> type)
-
byteSizeArray_byte
public static final long byteSizeArray_byte(long elementCount)
-
byteSizeArray_boolean
public static final long byteSizeArray_boolean(long elementCount)
-
byteSizeArray_short
public static final long byteSizeArray_short(long elementCount)
-
byteSizeArray_char
public static final long byteSizeArray_char(long elementCount)
-
byteSizeArray_int
public static final long byteSizeArray_int(long elementCount)
-
byteSizeArray_float
public static final long byteSizeArray_float(long elementCount)
-
byteSizeArray_long
public static final long byteSizeArray_long(long elementCount)
-
byteSizeArray_double
public static final long byteSizeArray_double(long elementCount)
-
byteSizeArrayObject
public static final long byteSizeArrayObject(long elementCount)
-
throwUnchecked
public static final void throwUnchecked(Throwable t)
-
compareAndSwap_int
public static final boolean compareAndSwap_int(Object subject, long offset, int expected, int replacement)
-
compareAndSwap_long
public static final boolean compareAndSwap_long(Object subject, long offset, long expected, long replacement)
-
compareAndSwapObject
public static final boolean compareAndSwapObject(Object subject, long offset, Object expected, Object replacement)
-
alignAddress
public static final long alignAddress(long address)
-
getStaticFieldOffsets
public static long[] getStaticFieldOffsets(Field[] fields)
-
-