Public Member Functions | |
long | getFieldOffset (Field field) |
int | getArrayBaseOffset (Class<?> clazz) |
int | getArrayIndexScale (Class<?> clazz) |
boolean | compareAndSwapInt (Object object, long fieldOffset, int expected, int update) |
boolean | compareAndSwapLong (Object object, long fieldOffset, long expected, long update) |
boolean | compareAndSwapObject (Object object, long fieldOffset, Object expected, Object update) |
void | putIntVolatile (Object object, long fieldOffset, int newValue) |
int | getIntVolatile (Object object, long fieldOffset) |
void | putLongVolatile (Object object, long fieldOffset, long newValue) |
long | getLongVolatile (Object object, long fieldOffset) |
void | putObjectVolatile (Object object, long fieldOffset, Object newValue) |
Object | getObjectVolatile (Object object, long fieldOffset) |
void | putLong (Object object, long fieldOffset, long newValue) |
long | getLong (Object object, long fieldOffset) |
Static Public Member Functions | |
static Objects | getInstance () |
Static Private Attributes | |
static final Objects | INSTANCE = new Objects() |
static Objects org.apache.harmony.kernel.vm.Objects.getInstance | ( | ) | [static] |
long org.apache.harmony.kernel.vm.Objects.getFieldOffset | ( | Field | field | ) |
int org.apache.harmony.kernel.vm.Objects.getArrayBaseOffset | ( | Class<?> | clazz | ) |
Retrieves the base offset for the array Class given. The Class passed MUST me an array type, such that the method Class#isArray() returns true
. For example, int[].class
.
clazz | The array Class object. |
NullPointerException | if clazz is null . | |
IllegalArgumentException | if clazz is not an array type. |
int org.apache.harmony.kernel.vm.Objects.getArrayIndexScale | ( | Class<?> | clazz | ) |
Retrieves the array index scale for the array Class given. The index scale is the value used to determine the offset of a particular element in the array given the array's base offset and an index. The following code snippet illustrates the usage.
int base = Objects.getArrayBaseOffset(int[].class);
int scale = Objects.getArrayIndexScale(int[].class);
int elementIdx = 1;
int[] array = { 0, 1, 2 };
long offsetForIdx = base + (elementIdx * scale);
The Class passed MUST me an array type, such that the method Class#isArray() returns true
. For example, int[].class
.
clazz | The array Class object. |
NullPointerException | if clazz is null . | |
IllegalArgumentException | if clazz is not an array type. |
boolean org.apache.harmony.kernel.vm.Objects.compareAndSwapInt | ( | Object | object, | |
long | fieldOffset, | |||
int | expected, | |||
int | update | |||
) |
Compares and swaps the value of an int-typed field on an Object instance.
object | The instance containing the field. | |
fieldOffset | The offset value of the field. | |
expected | The expected value of the field. | |
update | The new value to write to the field. |
true
if the field was updated, false
otherwise. boolean org.apache.harmony.kernel.vm.Objects.compareAndSwapLong | ( | Object | object, | |
long | fieldOffset, | |||
long | expected, | |||
long | update | |||
) |
Compares and swaps the value of a long-typed field on an Object instance.
object | The instance containing the field. | |
fieldOffset | The offset value of the field. | |
expected | The expected value of the field. | |
update | The new value to write to the field. |
true
if the field was updated, false
otherwise. boolean org.apache.harmony.kernel.vm.Objects.compareAndSwapObject | ( | Object | object, | |
long | fieldOffset, | |||
Object | expected, | |||
Object | update | |||
) |
Compares and swaps the value of an Object-typed field on an Object instance.
object | The instance containing the field. | |
fieldOffset | The offset value of the field. | |
expected | The expected value of the field. | |
update | The new value to write to the field. |
true
if the field was updated, false
otherwise. void org.apache.harmony.kernel.vm.Objects.putIntVolatile | ( | Object | object, | |
long | fieldOffset, | |||
int | newValue | |||
) |
Writes an int value to an Object's field as though it were declared volatile
.
object | The instance containing the field to write to. | |
fieldOffset | The offset of the field to write to. | |
newValue | The value to write. |
int org.apache.harmony.kernel.vm.Objects.getIntVolatile | ( | Object | object, | |
long | fieldOffset | |||
) |
Reads an int value from an Object's field as though it were declared volatile
.
object | The instance containing the field to read from. | |
fieldOffset | The offset of the field to read from. |
void org.apache.harmony.kernel.vm.Objects.putLongVolatile | ( | Object | object, | |
long | fieldOffset, | |||
long | newValue | |||
) |
Writes a long value to an Object's field as though it were declared volatile
.
object | The instance containing the field to write to. | |
fieldOffset | The offset of the field to write to. | |
newValue | The value to write. |
long org.apache.harmony.kernel.vm.Objects.getLongVolatile | ( | Object | object, | |
long | fieldOffset | |||
) |
Reads a long value from an Object's field as though it were declared volatile
.
object | The instance containing the field to read from. | |
fieldOffset | The offset of the field to read from. |
void org.apache.harmony.kernel.vm.Objects.putObjectVolatile | ( | Object | object, | |
long | fieldOffset, | |||
Object | newValue | |||
) |
Writes an Object reference value to an Object's field as though it were declared volatile
.
object | The instance containing the field to write to. | |
fieldOffset | The offset of the field to write to. | |
newValue | The value to write. |
Object org.apache.harmony.kernel.vm.Objects.getObjectVolatile | ( | Object | object, | |
long | fieldOffset | |||
) |
Writes an int value to an Object's field as though it were declared volatile
.
object | The instance containing the field to write to. | |
fieldOffset | The offset of the field to write to. | |
newValue | The value to write. |
void org.apache.harmony.kernel.vm.Objects.putLong | ( | Object | object, | |
long | fieldOffset, | |||
long | newValue | |||
) |
Writes a long value to an Object's field.
object | The instance containing the field to write to. | |
fieldOffset | The offset of the field to write to. | |
newValue | The value to write. |
long org.apache.harmony.kernel.vm.Objects.getLong | ( | Object | object, | |
long | fieldOffset | |||
) |
Reads a long value from an Object's field.
object | The instance containing the field to read from. | |
fieldOffset | The offset of the field to read from. |
Genereated on Tue Dec 9 14:09:48 2008 by Doxygen.
(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.