Class UnsafeWrapper
java.lang.Object
com.aparapi.internal.util.UnsafeWrapper
A wrapper around sun.misc.Unsafe for handling atomic operations, copies from fields to arrays and vice versa.
We avoid using
sun.misc.Unsafe directly using reflection, mostly just to avoid getting 'unsafe' compiler errors.
This might need to be changed if we start to see performance issues.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static intprivate static intprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Methodprivate static Object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intarrayBaseOffset(Class<?> _arrayClass) static intarrayIndexScale(Class<?> _arrayClass) static intatomicAdd(int[] _arr, int _index, int _delta) static booleangetBoolean(Object _object, long _offset) static bytestatic floatstatic intstatic longstatic Objectstatic longobjectFieldOffset(Field _field) static voidputBoolean(Object _object, long _offset, boolean _boolean) static voidstatic voidstatic voidstatic voidstatic void
-
Field Details
-
unsafe
-
getIntVolatileMethod
-
arrayBaseOffsetMethod
-
arrayIndexScaleMethod
-
getObjectMethod
-
getIntMethod
-
getFloatMethod
-
getByteMethod
-
getBooleanMethod
-
getLongMethod
-
objectFieldOffsetMethod
-
putBooleanMethod
-
putIntMethod
-
putFloatMethod
-
putDoubleMethod
-
putByteMethod
-
putLongMethod
-
compareAndSwapIntMethod
-
intArrayBase
private static int intArrayBase -
intArrayScale
private static int intArrayScale
-
-
Constructor Details
-
UnsafeWrapper
public UnsafeWrapper()
-
-
Method Details
-
atomicAdd
public static int atomicAdd(int[] _arr, int _index, int _delta) -
arrayBaseOffset
-
arrayIndexScale
-
getObject
-
getInt
-
getFloat
-
getByte
-
getBoolean
-
getLong
-
putBoolean
-
putFloat
-
putInt
-
putDouble
-
putByte
-
putLong
-
objectFieldOffset
-