org.jikesrvm.objectmodel
Class ObjectModel

java.lang.Object
  extended by org.jikesrvm.objectmodel.ObjectModel
All Implemented Interfaces:
JavaHeaderConstants, SizeConstants

public class ObjectModel
extends Object
implements JavaHeaderConstants, SizeConstants

The interface to the object model definition accessible to the virtual machine.

Conceptually each Java object is composed of the following pieces:

Every object's header contains the three portions outlined above.
 |<- lo memory                                        hi memory ->|

   SCALAR LAYOUT:
 |<---------- scalar header --------->|
 +----------+------------+------------+------+------+------+--------+
 | GCHeader | MiscHeader | JavaHeader | fldO | fld1 | fldx | fldN-1 |
 +----------+------------+------------+------+------+------+--------+
                         ^ JHOFF             ^objref
                                             .
    ARRAY LAYOUT:                            .
 |<---------- array header ----------------->|
 +----------+------------+------------+------+------+------+------+------+
 | GCHeader | MiscHeader | JavaHeader | len  | elt0 | elt1 | ...  |eltN-1|
 +----------+------------+------------+------+------+------+------+------+
                         ^ JHOFF             ^objref
 

Assumptions:

This model allows efficient array access: the array pointer can be used directly in the base+offset subscript calculation, with no additional constant required.

This model allows free null pointer checking for most reads: a small offset from that reference will wrap around to either very high or very low unmapped memory in the case of a null pointer. As long as these segments of memory are not mapped to the current process, loads/stores through such a pointer will cause a trap that we can catch with a unix signal handler.

Note that on AIX we are forced to perform explicit null checks on scalar field accesses as we are unable to protect low memory.

Note the key invariant that all elements of the header are available at the same offset from an objref for both arrays and scalar objects.

Note that this model allows for arbitrary growth of the GC header to the left of the object. A possible TODO item is to modify the necessary interfaces within this class and JavaHeader to allow moveObject, bytesUsed, bytesRequiredWhenCopied, etc. to tell this class how many GC header bytes have been allocated. As these calls would be constant within the constant of the call the optimising compiler should be able to allow this at minimal cost.

Another possible TODO item is to include support for linear scanning, where it is possible to move from one object to the next under contiguous allocation. At the moment this is in conflict with object alignment code for objects with long/double fields. We could possibly include the code anyway but require that the alignment code is switched off, or that all objects are aligned. Linear scanning is used in several GC algorithms including card-marking and compaction.

See Also:
JavaHeader, MiscHeader, MemoryManager

Field Summary
static boolean HASH_STATS
          Should we gather stats on hash code state transitions for address-based hashing?
static int hashRequests
          count number of Object.hashCode() operations
static int hashTransition1
          count transitions from UNHASHED to HASHED
static int hashTransition2
          count transitions from HASHED to HASHED_AND_MOVED
private static FieldLayout layout
          Layout widget
private static boolean PACKED
          Whether to pack bytes and shorts into 32bit fields
 
Fields inherited from interface org.jikesrvm.objectmodel.JavaHeaderConstants
ADDRESS_BASED_HASHING, ALIGNMENT_MASK, ALIGNMENT_VALUE, ALLOWS_LINEAR_SCAN, ARRAY_BASE_OFFSET, ARRAY_LENGTH_BYTES, ARRAY_LENGTH_OFFSET, DYNAMIC_HASH_OFFSET, FIELD_ZERO_OFFSET, FORWARDING_PTR_OVERLAYS_TIB, GC_HEADER_BYTES, GC_HEADER_OFFSET, HASH_STATE_HASHED, HASH_STATE_HASHED_AND_MOVED, HASH_STATE_MASK, HASH_STATE_UNHASHED, HASHCODE_BYTES, HASHCODE_OFFSET, JAVA_HEADER_BYTES, JAVA_HEADER_OFFSET, LOG_MIN_ALIGNMENT, MISC_HEADER_BYTES, MISC_HEADER_OFFSET, NUM_AVAILABLE_BITS, OTHER_HEADER_BYTES, SEGREGATE_ARRAYS_FOR_LINEAR_SCAN, STATUS_BYTES, TIB_BYTES
 
Fields inherited from interface org.jikesrvm.SizeConstants
BITS_IN_ADDRESS, BITS_IN_BOOLEAN, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_DOUBLE, BITS_IN_EXTENT, BITS_IN_FLOAT, BITS_IN_INT, BITS_IN_LONG, BITS_IN_OFFSET, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BOOLEAN, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_DOUBLE, BYTES_IN_EXTENT, BYTES_IN_FLOAT, BYTES_IN_INT, BYTES_IN_LONG, BYTES_IN_OFFSET, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BOOLEAN, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_DOUBLE, LOG_BITS_IN_EXTENT, LOG_BITS_IN_FLOAT, LOG_BITS_IN_INT, LOG_BITS_IN_LONG, LOG_BITS_IN_OFFSET, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_BOOLEAN, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_DOUBLE, LOG_BYTES_IN_EXTENT, LOG_BYTES_IN_FLOAT, LOG_BYTES_IN_INT, LOG_BYTES_IN_LONG, LOG_BYTES_IN_OFFSET, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD
 
Constructor Summary
ObjectModel()
           
 
Method Summary
static Address allocateArray(BootImageInterface bootImage, RVMArray array, int numElements, boolean needsIdentityHash, int identityHashValue, int alignCode)
          Allocate and initialize space in the bootimage (at bootimage writing time) to be an uninitialized instance of the (array) type specified by array.
static Address allocateArray(BootImageInterface bootImage, RVMArray array, int numElements, boolean needsIdentityHash, int identityHashValue, int align, int alignCode)
          Allocate and initialize space in the bootimage (at bootimage writing time) to be an uninitialized instance of the (array) type specified by array.
static Address allocateCode(BootImageInterface bootImage, RVMArray array, int numElements)
          Allocate and initialize space in the bootimage (at bootimage writing time) to be an uninitialized instance of the (array) type specified by array.
static Address allocateScalar(BootImageInterface bootImage, RVMClass klass, boolean needsIdentityHash, int identityHashValue)
          Allocate and initialize space in the bootimage (at bootimage writing time) to be an uninitialized instance of the (scalar) type specified by klass.
static void allocateThinLock(RVMType t)
          Allocate a thin lock word for instances of the type (if they already have one, then has no effect).
static boolean attemptAvailableBits(Object o, Word oldVal, Word newVal)
          An attempt on the word containing the available bits
static void baselineEmitLoadTIB(ArchitectureSpecific.Assembler asm, int dest, int object)
          The following method will emit code that moves a reference to an object's TIB into a destination register.
static int bytesRequiredWhenCopied(Object obj)
          how many bytes are required when the object is copied by GC?
static int bytesRequiredWhenCopied(Object fromObj, RVMArray type, int numElements)
          how many bytes are needed when the array object is copied by GC?
static int bytesRequiredWhenCopied(Object fromObj, RVMClass type)
          how many bytes are needed when the scalar object is copied by GC?
static int bytesUsed(Object obj)
          how many bytes are used by the object?
static int bytesUsed(Object obj, RVMArray type, int numElements)
          how many bytes are used by the array?
static int bytesUsed(Object obj, RVMClass type)
          how many bytes are used by the scalar?
static int computeArrayHeaderSize(RVMArray type)
          Compute the header size of an instance of the given type.
static int computeHeaderSize(Object ref)
          Compute the header size of an object
static int computeHeaderSize(Object[] tib)
          Given a TIB, compute the header size of an instance of the TIB's class
static int computeHeaderSize(RVMType type)
          Compute the header size of an instance of the given type.
static int computeScalarHeaderSize(RVMClass type)
          Compute the header size of an instance of the given type.
static Offset defaultThinLockOffset()
          what is the default offset for a thin lock?
static void describeObject(ObjectReference addr)
          For debugging.
static void dumpHeader(Object ref)
          For low level debugging of GC subsystem.
static void dumpHeader(ObjectReference ptr)
          For low level debugging of GC subsystem.
static void fillAlignmentGap(BootImageInterface bootImage, Address address, Extent size)
          Fill an alignment gap with the alignment value
static void genericLock(Object o)
          Generic lock
static void genericUnlock(Object o)
          Generic unlock
static int getAlignment(RVMArray t)
          Return the desired alignment of the alignment point returned by getOffsetForAlignment in instances of the argument RVMArray.
static int getAlignment(RVMArray t, Object obj)
          Return the desired alignment of the alignment point returned by getOffsetForAlignment in instances of the argument RVMArray.
static int getAlignment(RVMClass t)
          Return the desired aligment of the alignment point in the object returned by getScalarOffsetForAlignment.
static int getAlignment(RVMClass t, Object obj)
          Return the desired alignment of the alignment point returned by getOffsetForAlignment in instances of the argument RVMClass.
static ObjectReference getArrayFromStartAddress(Address start)
          Get an object reference from the address the lowest word of the object was allocated.
static int getArrayLength(Object o)
          Get the length of an array
static Offset getArrayLengthOffset()
          Return the offset of the array length field from an object reference (in bytes)
static int getHeaderEndOffset()
          For a reference to an object, what is the offset in bytes to the last word of the header from an out-to-in perspective for the object?
static Lock getHeavyLock(Object o, boolean create)
          Obtains the heavy-weight lock, if there is one, associated with the indicated object.
static ObjectReference getNextObject(ObjectReference obj)
          Get the next object in the heap under contiguous allocation.
static ObjectReference getNextObject(ObjectReference obj, RVMArray type, int numElements)
          Get the next object after this array under contiguous allocation.
static ObjectReference getNextObject(ObjectReference obj, RVMClass type)
          Get the next object after this scalar under contiguous allocation.
static Address getObjectEndAddress(Object obj)
          Get the pointer just past an object
static Address getObjectEndAddress(Object object, RVMArray type, int elements)
          Get the pointer just past an object
static Address getObjectEndAddress(Object object, RVMClass type)
          Get the pointer just past an object
static ObjectReference getObjectFromStartAddress(Address start)
          Get an object reference from the address the lowest word of the object was allocated.
static int getObjectHashCode(Object o)
          Get the hash code of an object.
static RVMType getObjectType(Object o)
          Get the type of an object.
static int getOffsetForAlignment(RVMArray t, boolean needsIdentityHash)
          Return the offset relative to physical beginning of object that must be aligned.
static int getOffsetForAlignment(RVMArray t, ObjectReference obj)
          Return the offset relative to physical beginning of object that must be aligned.
static int getOffsetForAlignment(RVMClass t, boolean needsIdentityHash)
          Return the offset relative to physical beginning of object that must be aligned.
static int getOffsetForAlignment(RVMClass t, ObjectReference obj)
          Return the offset relative to physical beginning of object that must be aligned.
static Address getPointerInMemoryRegion(ObjectReference ref)
          Given a reference, return an address which is guaranteed to be inside the memory region allocated to the object.
static Object getReferenceWhenCopiedTo(Object obj, Address to)
          how many bytes are used by the object?
static Object getReferenceWhenCopiedTo(Object obj, Address region, RVMArray type)
          Get the reference of an object after copying to a specified region.
static Object getReferenceWhenCopiedTo(Object obj, Address region, RVMClass type)
          Get the reference of an object after copying to a specified region.
static ObjectReference getScalarFromStartAddress(Address start)
          Get an object reference from the address the lowest word of the object was allocated.
static Offset getThinLockOffset(Object o)
          Get the offset of the thin lock word in this object
static TIB getTIB(Object o)
          Get the TIB for an object.
static TIB getTIB(ObjectReference ptr)
          Get the TIB for an object.
static boolean holdsLock(Object obj, RVMThread thread)
           
static Object initializeArray(Address ptr, TIB tib, int numElems, int size)
          Initialize raw storage with low memory word ptr of size bytes to be an uninitialized instance of the array type specific by tib with numElems elements.
static void initializeAvailableByte(Object o)
          Freeze the other bits in the byte containing the available bits so that it is safe to update them using setAvailableBits.
static Object initializeScalar(Address ptr, TIB tib, int size)
          Initialize raw storage with low memory word ptr of size bytes to be an uninitialized instance of the (scalar) type specified by tib.
static void layoutInstanceFields(RVMClass klass)
          Layout the instance fields declared in this class.
static Address maximumObjectRef(Address regionHighAddr)
          Given the largest base address in a region, return the largest object reference that could refer to an object in the region.
static Address minimumObjectRef(Address regionBaseAddr)
          Given the smallest base address in a region, return the smallest object reference that could refer to an object in the region.
static Object moveObject(Address toAddress, Object fromObj, int numBytes, RVMArray type)
          Copy an array object to the given raw storage address
static Object moveObject(Address toAddress, Object fromObj, int numBytes, RVMClass type)
          Copy a scalar object to the given raw storage address
static Object moveObject(Object fromObj, Object toObj, int numBytes, RVMArray type)
          Copy an array object to the given raw storage address
static Object moveObject(Object fromObj, Object toObj, int numBytes, RVMClass type)
          Copy a scalar object to the given raw storage address
static int objectStartOffset(RVMClass t)
          For a reference to an object, what is the offset in bytes to the bottom word of the object?
static Address objectStartRef(ObjectReference obj)
          Map from the object ref to the lowest address of the storage associated with the object
static Word prepareAvailableBits(Object o)
          A prepare on the word containing the available bits
static Word readAvailableBitsWord(Object o)
          Non-atomic read of word containing available bits
static byte readAvailableByte(Object o)
          Non-atomic read of byte containing available bits
static void setArrayLength(Object o, int len)
          Set the length of an array
static void setAvailableBit(Object o, int idx, boolean flag)
          Set argument bit to 1 if flag is true, 0 if flag is false
static void setTIB(BootImageInterface bootImage, Address refAddress, Address tibAddr, RVMType type)
          Set the TIB for an object.
static void setTIB(ObjectReference ptr, TIB tib)
          Set the TIB for an object.
static void setTIB(Object ref, TIB tib)
          Set the TIB for an object.
static boolean testAvailableBit(Object o, int idx)
          Return true if argument bit is 1, false if it is 0
static void writeAvailableBitsWord(Object o, Word val)
          Non-atomic write of word containing available bits
static void writeAvailableByte(Object o, byte val)
          Non-atomic write of byte containing available bits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HASH_STATS

public static final boolean HASH_STATS
Should we gather stats on hash code state transitions for address-based hashing?

See Also:
Constant Field Values

hashRequests

public static int hashRequests
count number of Object.hashCode() operations


hashTransition1

public static int hashTransition1
count transitions from UNHASHED to HASHED


hashTransition2

public static int hashTransition2
count transitions from HASHED to HASHED_AND_MOVED


PACKED

private static final boolean PACKED
Whether to pack bytes and shorts into 32bit fields

See Also:
Constant Field Values

layout

private static final FieldLayout layout
Layout widget

Constructor Detail

ObjectModel

public ObjectModel()
Method Detail

layoutInstanceFields

public static void layoutInstanceFields(RVMClass klass)
Layout the instance fields declared in this class.

Parameters:
klass - the class to layout

getPointerInMemoryRegion

public static Address getPointerInMemoryRegion(ObjectReference ref)
Given a reference, return an address which is guaranteed to be inside the memory region allocated to the object.


getArrayLengthOffset

public static Offset getArrayLengthOffset()
Return the offset of the array length field from an object reference (in bytes)


getTIB

public static TIB getTIB(ObjectReference ptr)
Get the TIB for an object.


getTIB

public static TIB getTIB(Object o)
Get the TIB for an object.


setTIB

public static void setTIB(ObjectReference ptr,
                          TIB tib)
Set the TIB for an object.


setTIB

public static void setTIB(Object ref,
                          TIB tib)
Set the TIB for an object.


setTIB

public static void setTIB(BootImageInterface bootImage,
                          Address refAddress,
                          Address tibAddr,
                          RVMType type)
Set the TIB for an object.


getObjectEndAddress

public static Address getObjectEndAddress(Object obj)
Get the pointer just past an object


getObjectEndAddress

public static Address getObjectEndAddress(Object object,
                                          RVMClass type)
Get the pointer just past an object


getObjectEndAddress

public static Address getObjectEndAddress(Object object,
                                          RVMArray type,
                                          int elements)
Get the pointer just past an object


getObjectFromStartAddress

public static ObjectReference getObjectFromStartAddress(Address start)
Get an object reference from the address the lowest word of the object was allocated.


getScalarFromStartAddress

public static ObjectReference getScalarFromStartAddress(Address start)
Get an object reference from the address the lowest word of the object was allocated.


getArrayFromStartAddress

public static ObjectReference getArrayFromStartAddress(Address start)
Get an object reference from the address the lowest word of the object was allocated.


getNextObject

public static ObjectReference getNextObject(ObjectReference obj)
Get the next object in the heap under contiguous allocation.


getNextObject

public static ObjectReference getNextObject(ObjectReference obj,
                                            RVMClass type)
Get the next object after this scalar under contiguous allocation.


getNextObject

public static ObjectReference getNextObject(ObjectReference obj,
                                            RVMArray type,
                                            int numElements)
Get the next object after this array under contiguous allocation.


getReferenceWhenCopiedTo

public static Object getReferenceWhenCopiedTo(Object obj,
                                              Address to)
how many bytes are used by the object?


bytesUsed

public static int bytesUsed(Object obj)
how many bytes are used by the object?


bytesUsed

public static int bytesUsed(Object obj,
                            RVMClass type)
how many bytes are used by the scalar?


bytesUsed

public static int bytesUsed(Object obj,
                            RVMArray type,
                            int numElements)
how many bytes are used by the array?


bytesRequiredWhenCopied

public static int bytesRequiredWhenCopied(Object obj)
how many bytes are required when the object is copied by GC?


bytesRequiredWhenCopied

public static int bytesRequiredWhenCopied(Object fromObj,
                                          RVMClass type)
how many bytes are needed when the scalar object is copied by GC?


bytesRequiredWhenCopied

public static int bytesRequiredWhenCopied(Object fromObj,
                                          RVMArray type,
                                          int numElements)
how many bytes are needed when the array object is copied by GC?


objectStartRef

public static Address objectStartRef(ObjectReference obj)
Map from the object ref to the lowest address of the storage associated with the object


getReferenceWhenCopiedTo

public static Object getReferenceWhenCopiedTo(Object obj,
                                              Address region,
                                              RVMClass type)
Get the reference of an object after copying to a specified region.


getReferenceWhenCopiedTo

public static Object getReferenceWhenCopiedTo(Object obj,
                                              Address region,
                                              RVMArray type)
Get the reference of an object after copying to a specified region.


moveObject

public static Object moveObject(Object fromObj,
                                Object toObj,
                                int numBytes,
                                RVMClass type)
Copy a scalar object to the given raw storage address


moveObject

public static Object moveObject(Object fromObj,
                                Object toObj,
                                int numBytes,
                                RVMArray type)
Copy an array object to the given raw storage address


moveObject

public static Object moveObject(Address toAddress,
                                Object fromObj,
                                int numBytes,
                                RVMClass type)
Copy a scalar object to the given raw storage address


moveObject

public static Object moveObject(Address toAddress,
                                Object fromObj,
                                int numBytes,
                                RVMArray type)
Copy an array object to the given raw storage address


getObjectType

public static RVMType getObjectType(Object o)
Get the type of an object.


getArrayLength

public static int getArrayLength(Object o)
Get the length of an array


setArrayLength

public static void setArrayLength(Object o,
                                  int len)
Set the length of an array


getObjectHashCode

public static int getObjectHashCode(Object o)
Get the hash code of an object.


getThinLockOffset

public static Offset getThinLockOffset(Object o)
Get the offset of the thin lock word in this object


defaultThinLockOffset

public static Offset defaultThinLockOffset()
what is the default offset for a thin lock?


allocateThinLock

public static void allocateThinLock(RVMType t)
Allocate a thin lock word for instances of the type (if they already have one, then has no effect).


genericLock

public static void genericLock(Object o)
Generic lock


genericUnlock

public static void genericUnlock(Object o)
Generic unlock


holdsLock

public static boolean holdsLock(Object obj,
                                RVMThread thread)
Parameters:
obj - an object
thread - a thread
Returns:
true if the lock on obj is currently owned by thread false if it is not.

getHeavyLock

public static Lock getHeavyLock(Object o,
                                boolean create)
Obtains the heavy-weight lock, if there is one, associated with the indicated object. Returns null, if there is no heavy-weight lock associated with the object.

Parameters:
o - the object from which a lock is desired
create - if true, create heavy lock if none found
Returns:
the heavy-weight lock on the object (if any)

readAvailableBitsWord

public static Word readAvailableBitsWord(Object o)
Non-atomic read of word containing available bits


readAvailableByte

public static byte readAvailableByte(Object o)
Non-atomic read of byte containing available bits


writeAvailableBitsWord

public static void writeAvailableBitsWord(Object o,
                                          Word val)
Non-atomic write of word containing available bits


writeAvailableByte

public static void writeAvailableByte(Object o,
                                      byte val)
Non-atomic write of byte containing available bits


testAvailableBit

public static boolean testAvailableBit(Object o,
                                       int idx)
Return true if argument bit is 1, false if it is 0


setAvailableBit

public static void setAvailableBit(Object o,
                                   int idx,
                                   boolean flag)
Set argument bit to 1 if flag is true, 0 if flag is false


initializeAvailableByte

public static void initializeAvailableByte(Object o)
Freeze the other bits in the byte containing the available bits so that it is safe to update them using setAvailableBits.


prepareAvailableBits

public static Word prepareAvailableBits(Object o)
A prepare on the word containing the available bits


attemptAvailableBits

public static boolean attemptAvailableBits(Object o,
                                           Word oldVal,
                                           Word newVal)
An attempt on the word containing the available bits


minimumObjectRef

public static Address minimumObjectRef(Address regionBaseAddr)
Given the smallest base address in a region, return the smallest object reference that could refer to an object in the region.


maximumObjectRef

public static Address maximumObjectRef(Address regionHighAddr)
Given the largest base address in a region, return the largest object reference that could refer to an object in the region.


computeHeaderSize

public static int computeHeaderSize(RVMType type)
Compute the header size of an instance of the given type.


computeHeaderSize

public static int computeHeaderSize(Object ref)
Compute the header size of an object


computeScalarHeaderSize

public static int computeScalarHeaderSize(RVMClass type)
Compute the header size of an instance of the given type.


computeArrayHeaderSize

public static int computeArrayHeaderSize(RVMArray type)
Compute the header size of an instance of the given type.


computeHeaderSize

public static int computeHeaderSize(Object[] tib)
Given a TIB, compute the header size of an instance of the TIB's class


getHeaderEndOffset

public static int getHeaderEndOffset()
For a reference to an object, what is the offset in bytes to the last word of the header from an out-to-in perspective for the object?


objectStartOffset

public static int objectStartOffset(RVMClass t)
For a reference to an object, what is the offset in bytes to the bottom word of the object?


getAlignment

public static int getAlignment(RVMClass t)
Return the desired aligment of the alignment point in the object returned by getScalarOffsetForAlignment.

Parameters:
t - RVMClass instance being created

getAlignment

public static int getAlignment(RVMClass t,
                               Object obj)
Return the desired alignment of the alignment point returned by getOffsetForAlignment in instances of the argument RVMClass.

Parameters:
t - RVMClass instance being copied
obj - the object being copied

getAlignment

public static int getAlignment(RVMArray t)
Return the desired alignment of the alignment point returned by getOffsetForAlignment in instances of the argument RVMArray.

Parameters:
t - RVMArray instance being created

getAlignment

public static int getAlignment(RVMArray t,
                               Object obj)
Return the desired alignment of the alignment point returned by getOffsetForAlignment in instances of the argument RVMArray.

Parameters:
t - RVMArray instance being copied
obj - the object being copied

getOffsetForAlignment

public static int getOffsetForAlignment(RVMClass t,
                                        boolean needsIdentityHash)
Return the offset relative to physical beginning of object that must be aligned.

Parameters:
t - RVMClass instance being created

getOffsetForAlignment

public static int getOffsetForAlignment(RVMClass t,
                                        ObjectReference obj)
Return the offset relative to physical beginning of object that must be aligned.

Parameters:
t - RVMClass instance being copied
obj - the object being copied

getOffsetForAlignment

public static int getOffsetForAlignment(RVMArray t,
                                        boolean needsIdentityHash)
Return the offset relative to physical beginning of object that must be aligned.

Parameters:
t - RVMArray instance being created

getOffsetForAlignment

public static int getOffsetForAlignment(RVMArray t,
                                        ObjectReference obj)
Return the offset relative to physical beginning of object that must be aligned.

Parameters:
t - RVMArray instance being copied
obj - the object being copied

initializeScalar

public static Object initializeScalar(Address ptr,
                                      TIB tib,
                                      int size)
Initialize raw storage with low memory word ptr of size bytes to be an uninitialized instance of the (scalar) type specified by tib.

Parameters:
ptr - address of raw storage
tib - the type information block
size - number of bytes of raw storage allocated.

allocateScalar

public static Address allocateScalar(BootImageInterface bootImage,
                                     RVMClass klass,
                                     boolean needsIdentityHash,
                                     int identityHashValue)
Allocate and initialize space in the bootimage (at bootimage writing time) to be an uninitialized instance of the (scalar) type specified by klass. NOTE: TIB is set by BootImageWriter2

Parameters:
bootImage - the bootimage to put the object in
klass - the RVMClass object of the instance to create.
needsIdentityHash - needs an identity hash value
identityHashValue - the value for the identity hash
Returns:
the offset of object in bootimage (in bytes)

fillAlignmentGap

public static void fillAlignmentGap(BootImageInterface bootImage,
                                    Address address,
                                    Extent size)
Fill an alignment gap with the alignment value


initializeArray

public static Object initializeArray(Address ptr,
                                     TIB tib,
                                     int numElems,
                                     int size)
Initialize raw storage with low memory word ptr of size bytes to be an uninitialized instance of the array type specific by tib with numElems elements.

Parameters:
ptr - address of raw storage
tib - the type information block
numElems - number of elements in the array
size - number of bytes of raw storage allocated.

allocateArray

public static Address allocateArray(BootImageInterface bootImage,
                                    RVMArray array,
                                    int numElements,
                                    boolean needsIdentityHash,
                                    int identityHashValue,
                                    int alignCode)
Allocate and initialize space in the bootimage (at bootimage writing time) to be an uninitialized instance of the (array) type specified by array. NOTE: TIB is set by BootimageWriter2

Parameters:
bootImage - the bootimage to put the object in
array - RVMArray object of array being allocated.
numElements - number of elements
needsIdentityHash - needs an identity hash value
identityHashValue - the value for the identity hash
alignCode - TODO
Returns:
Address of object in bootimage (in bytes)

allocateArray

public static Address allocateArray(BootImageInterface bootImage,
                                    RVMArray array,
                                    int numElements,
                                    boolean needsIdentityHash,
                                    int identityHashValue,
                                    int align,
                                    int alignCode)
Allocate and initialize space in the bootimage (at bootimage writing time) to be an uninitialized instance of the (array) type specified by array. NOTE: TIB is set by BootimageWriter2

Parameters:
bootImage - the bootimage to put the object in
array - RVMArray object of array being allocated.
numElements - number of elements
needsIdentityHash - needs an identity hash value
identityHashValue - the value for the identity hash
alignCode - TODO
Returns:
Address of object in bootimage (in bytes)

allocateCode

public static Address allocateCode(BootImageInterface bootImage,
                                   RVMArray array,
                                   int numElements)
Allocate and initialize space in the bootimage (at bootimage writing time) to be an uninitialized instance of the (array) type specified by array. NOTE: TIB is set by BootimageWriter2

Parameters:
bootImage - the bootimage to put the object in
array - RVMArray object of array being allocated.
numElements - number of elements
Returns:
Address of object in bootimage

dumpHeader

public static void dumpHeader(ObjectReference ptr)
For low level debugging of GC subsystem. Dump the header word(s) of the given object reference.

Parameters:
ptr - the object reference whose header should be dumped

dumpHeader

public static void dumpHeader(Object ref)
For low level debugging of GC subsystem. Dump the header word(s) of the given object reference.

Parameters:
ref - the object reference whose header should be dumped

describeObject

public static void describeObject(ObjectReference addr)
For debugging.


baselineEmitLoadTIB

public static void baselineEmitLoadTIB(ArchitectureSpecific.Assembler asm,
                                       int dest,
                                       int object)
The following method will emit code that moves a reference to an object's TIB into a destination register.

Parameters:
asm - the assembler object to emit code with
dest - the number of the destination register
object - the number of the register holding the object reference