| java.lang.Object org.apache.harmony.kernel.vm.Objects
Objects | public class Objects (Code) | |
This class must be implemented by the VM to support Object manipulation.
|
Method Summary | |
public boolean | compareAndSwapInt(Object object, long fieldOffset, int expected, int update)
Compares and swaps the value of an int-typed field on an Object instance.
Parameters: object - The instance containing the field. Parameters: fieldOffset - The offset value of the field. Parameters: expected - The expected value of the field. Parameters: update - The new value to write to the field. | public boolean | compareAndSwapLong(Object object, long fieldOffset, long expected, long update)
Compares and swaps the value of a long-typed field on an Object instance.
Parameters: object - The instance containing the field. Parameters: fieldOffset - The offset value of the field. Parameters: expected - The expected value of the field. Parameters: update - The new value to write to the field. | public boolean | compareAndSwapObject(Object object, long fieldOffset, Object expected, Object update)
Compares and swaps the value of an Object-typed field on an Object
instance.
Parameters: object - The instance containing the field. Parameters: fieldOffset - The offset value of the field. Parameters: expected - The expected value of the field. Parameters: update - The new value to write to the field. | public int | getArrayBaseOffset(Class> clazz)
Retrieves the base offset for the array Class given. | public int | getArrayIndexScale(Class> clazz)
Retrieves the array index scale for the array Class given. | public long | getFieldOffset(Field field)
Retrieves the offset value of the
Field for use by other methods
in this class.
Parameters: field - The Field to retrieve the offset for. | public static Objects | getInstance()
Retrieves an instance of the Objects service. | public int | getIntVolatile(Object object, long fieldOffset)
Reads an int value from an Object's field as though it were declared
volatile .
Parameters: object - The instance containing the field to read from. Parameters: fieldOffset - The offset of the field to read from. | public long | getLong(Object object, long fieldOffset)
Reads a long value from an Object's field.
Parameters: object - The instance containing the field to read from. Parameters: fieldOffset - The offset of the field to read from. | public long | getLongVolatile(Object object, long fieldOffset)
Reads a long value from an Object's field as though it were declared
volatile .
Parameters: object - The instance containing the field to read from. Parameters: fieldOffset - The offset of the field to read from. | public Object | getObjectVolatile(Object object, long fieldOffset)
Writes an int value to an Object's field as though it were declared
volatile . | public void | putIntVolatile(Object object, long fieldOffset, int newValue)
Writes an int value to an Object's field as though it were declared
volatile . | public void | putLong(Object object, long fieldOffset, long newValue)
Writes a long value to an Object's field. | public void | putLongVolatile(Object object, long fieldOffset, long newValue)
Writes a long value to an Object's field as though it were declared
volatile . | public void | putObjectVolatile(Object object, long fieldOffset, Object newValue)
Writes an Object reference value to an Object's field as though it were
declared volatile . |
compareAndSwapInt | public boolean compareAndSwapInt(Object object, long fieldOffset, int expected, int update)(Code) | |
Compares and swaps the value of an int-typed field on an Object instance.
Parameters: object - The instance containing the field. Parameters: fieldOffset - The offset value of the field. Parameters: expected - The expected value of the field. Parameters: update - The new value to write to the field. true if the field was updated, false otherwise. |
compareAndSwapLong | public boolean compareAndSwapLong(Object object, long fieldOffset, long expected, long update)(Code) | |
Compares and swaps the value of a long-typed field on an Object instance.
Parameters: object - The instance containing the field. Parameters: fieldOffset - The offset value of the field. Parameters: expected - The expected value of the field. Parameters: update - The new value to write to the field. true if the field was updated, false otherwise. |
compareAndSwapObject | public boolean compareAndSwapObject(Object object, long fieldOffset, Object expected, Object update)(Code) | |
Compares and swaps the value of an Object-typed field on an Object
instance.
Parameters: object - The instance containing the field. Parameters: fieldOffset - The offset value of the field. Parameters: expected - The expected value of the field. Parameters: update - The new value to write to the field. true if the field was updated, false otherwise. |
getArrayBaseOffset | public int getArrayBaseOffset(Class> clazz)(Code) | |
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 .
Parameters: clazz - The array Class object. The base offset value. throws: NullPointerException - if clazz is null . throws: IllegalArgumentException - if clazz is not an array type. |
getArrayIndexScale | public int getArrayIndexScale(Class> clazz)(Code) | |
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 .
Parameters: clazz - The array Class object. The index scale value. throws: NullPointerException - if clazz is null . throws: IllegalArgumentException - if clazz is not an array type. |
getFieldOffset | public long getFieldOffset(Field field)(Code) | |
Retrieves the offset value of the
Field for use by other methods
in this class.
Parameters: field - The Field to retrieve the offset for. The offset value. |
getInstance | public static Objects getInstance()(Code) | |
Retrieves an instance of the Objects service.
An instance of Objects. |
getIntVolatile | public int getIntVolatile(Object object, long fieldOffset)(Code) | |
Reads an int value from an Object's field as though it were declared
volatile .
Parameters: object - The instance containing the field to read from. Parameters: fieldOffset - The offset of the field to read from. The value that was read. |
getLong | public long getLong(Object object, long fieldOffset)(Code) | |
Reads a long value from an Object's field.
Parameters: object - The instance containing the field to read from. Parameters: fieldOffset - The offset of the field to read from. The value that was read. |
getLongVolatile | public long getLongVolatile(Object object, long fieldOffset)(Code) | |
Reads a long value from an Object's field as though it were declared
volatile .
Parameters: object - The instance containing the field to read from. Parameters: fieldOffset - The offset of the field to read from. The value that was read. |
getObjectVolatile | public Object getObjectVolatile(Object object, long fieldOffset)(Code) | |
Writes an int value to an Object's field as though it were declared
volatile .
Parameters: object - The instance containing the field to write to. Parameters: fieldOffset - The offset of the field to write to. Parameters: newValue - The value to write. |
putIntVolatile | public void putIntVolatile(Object object, long fieldOffset, int newValue)(Code) | |
Writes an int value to an Object's field as though it were declared
volatile .
Parameters: object - The instance containing the field to write to. Parameters: fieldOffset - The offset of the field to write to. Parameters: newValue - The value to write. |
putLong | public void putLong(Object object, long fieldOffset, long newValue)(Code) | |
Writes a long value to an Object's field.
Parameters: object - The instance containing the field to write to. Parameters: fieldOffset - The offset of the field to write to. Parameters: newValue - The value to write. |
putLongVolatile | public void putLongVolatile(Object object, long fieldOffset, long newValue)(Code) | |
Writes a long value to an Object's field as though it were declared
volatile .
Parameters: object - The instance containing the field to write to. Parameters: fieldOffset - The offset of the field to write to. Parameters: newValue - The value to write. |
putObjectVolatile | public void putObjectVolatile(Object object, long fieldOffset, Object newValue)(Code) | |
Writes an Object reference value to an Object's field as though it were
declared volatile .
Parameters: object - The instance containing the field to write to. Parameters: fieldOffset - The offset of the field to write to. Parameters: newValue - The value to write. |
|
|