public final class ObjectModel extends ObjectModel
| Constructor and Description |
|---|
ObjectModel() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
attemptAvailableBits(ObjectReference object,
Word oldVal,
Word newVal)
Attempts to set the bits available for memory manager use in an
object.
|
ObjectReference |
copy(ObjectReference from,
int allocator)
Copy an object using a plan's allocCopy to get space and install
the forwarding pointer.
|
private ObjectReference |
copyArray(ObjectReference from,
TIB tib,
RVMArray type,
int allocator) |
private ObjectReference |
copyScalar(ObjectReference from,
TIB tib,
RVMClass type,
int allocator) |
Address |
copyTo(ObjectReference from,
ObjectReference to,
Address region)
Copy an object to be pointer to by the to address.
|
void |
dumpObject(ObjectReference object)
Dump debugging information for an object.
|
Offset |
GC_HEADER_OFFSET()
Gets the offset of the memory management header from the object
reference address.
|
int |
getAlignOffsetWhenCopied(ObjectReference object)
Return the alignment offset requirements for a copy of this object
|
int |
getAlignWhenCopied(ObjectReference object)
Return the alignment requirement for a copy of this object
|
protected Offset |
getArrayBaseOffset() |
int |
getArrayLength(ObjectReference object)
Get the length of an array object.
|
int |
getCurrentSize(ObjectReference object)
Return the size used by an object
|
ObjectReference |
getNextObject(ObjectReference object) |
Address |
getObjectEndAddress(ObjectReference object)
Gets a pointer to the address just past the end of the object.
|
ObjectReference |
getObjectFromStartAddress(Address start) |
(package private) static int |
getObjectSize(ObjectReference object)
Return the size of a given object, in bytes
|
ObjectReference |
getReferenceWhenCopiedTo(ObjectReference from,
Address to)
Return the reference that an object will be referred to after it is copied
to the specified region.
|
int |
getSizeWhenCopied(ObjectReference object)
Return the size required to copy an object
|
byte[] |
getTypeDescriptor(ObjectReference ref)
Get the type descriptor for an object.
|
boolean |
isAcyclic(ObjectReference typeRef)
Checks if a reference of the given type in another object is
inherently acyclic.
|
boolean |
isArray(ObjectReference object) |
boolean |
isPrimitiveArray(ObjectReference object) |
Address |
objectStartRef(ObjectReference object)
Returns the lowest address of the storage associated with an object.
|
Word |
prepareAvailableBits(ObjectReference object)
Gets the value of bits available for memory manager use in an
object, in preparation for setting those bits.
|
Word |
readAvailableBitsWord(ObjectReference object)
Read the bits available for memory manager use in an object.
|
byte |
readAvailableByte(ObjectReference object)
Read the byte available for memory manager use in an object.
|
Address |
refToAddress(ObjectReference object)
Returns an address guaranteed to be inside the storage assocatied
with and object.
|
void |
setAvailableBit(ObjectReference object,
int idx,
boolean flag)
Sets a bit available for memory manager use in an object.
|
boolean |
testAvailableBit(ObjectReference object,
int idx)
Tests a bit available for memory manager use in an object.
|
void |
writeAvailableBitsWord(ObjectReference object,
Word val)
Sets the bits available for memory manager use in an object.
|
void |
writeAvailableByte(ObjectReference object,
byte val)
Sets the byte available for memory manager use in an object.
|
public ObjectModel()
protected Offset getArrayBaseOffset()
getArrayBaseOffset in class ObjectModelpublic ObjectReference copy(ObjectReference from, int allocator)
ObjectModelfrom must have
been reserved for copying by the caller. This method calls the
plan's getStatusForCopy() method to establish a new
status word for the copied object and postCopy() to
allow the plan to perform any post copy actions.copy in class ObjectModelfrom - the address of the object to be copiedallocator - The allocator to use.private ObjectReference copyScalar(ObjectReference from, TIB tib, RVMClass type, int allocator)
private ObjectReference copyArray(ObjectReference from, TIB tib, RVMArray type, int allocator)
static int getObjectSize(ObjectReference object)
object - The object whose size is being queriedpublic Address copyTo(ObjectReference from, ObjectReference to, Address region)
ObjectModelcopyTo in class ObjectModelregion - The start (or an address less than) the region that was reserved for this object.from - the address of the object to be copiedto - The target location.public ObjectReference getReferenceWhenCopiedTo(ObjectReference from, Address to)
ObjectModelgetReferenceWhenCopiedTo in class ObjectModelfrom - The object to be copied.to - The region to be copied to.public Address getObjectEndAddress(ObjectReference object)
ObjectModelgetObjectEndAddress in class ObjectModelobject - The objectpublic int getSizeWhenCopied(ObjectReference object)
ObjectModelgetSizeWhenCopied in class ObjectModelobject - The object whose size is to be queriedobjpublic int getAlignWhenCopied(ObjectReference object)
ObjectModelgetAlignWhenCopied in class ObjectModelobject - The object whose size is to be queriedobjpublic int getAlignOffsetWhenCopied(ObjectReference object)
ObjectModelgetAlignOffsetWhenCopied in class ObjectModelobject - The object whose size is to be queriedobjpublic int getCurrentSize(ObjectReference object)
ObjectModelgetCurrentSize in class ObjectModelobject - The object whose size is to be queriedobjpublic ObjectReference getNextObject(ObjectReference object)
getNextObject in class ObjectModelobject - the current objectpublic ObjectReference getObjectFromStartAddress(Address start)
getObjectFromStartAddress in class ObjectModelstart - the start address of the objectpublic byte[] getTypeDescriptor(ObjectReference ref)
ObjectModelgetTypeDescriptor in class ObjectModelref - address of the objectpublic int getArrayLength(ObjectReference object)
ObjectModelgetArrayLength in class ObjectModelobject - address of the objectpublic boolean isArray(ObjectReference object)
isArray in class ObjectModelobject - address of the objectpublic boolean isPrimitiveArray(ObjectReference object)
isPrimitiveArray in class ObjectModelobject - address of the objectpublic boolean testAvailableBit(ObjectReference object, int idx)
object - the address of the objectidx - the index of the bittrue if argument bit is 1, false if it is 0public void setAvailableBit(ObjectReference object, int idx, boolean flag)
object - the address of the objectidx - the index of the bitflag - true to set the bit to 1,
false to set it to 0public boolean attemptAvailableBits(ObjectReference object, Word oldVal, Word newVal)
ObjectModeloldVal. The comparison with the
current value and setting are atomic with respect to other
allocators.attemptAvailableBits in class ObjectModelobject - the address of the objectoldVal - the required current value of the bitsnewVal - the desired new value of the bitstrue if the bits were set,
false otherwisepublic Word prepareAvailableBits(ObjectReference object)
ObjectModelprepareAvailableBits in class ObjectModelobject - the address of the objectpublic void writeAvailableByte(ObjectReference object, byte val)
ObjectModelwriteAvailableByte in class ObjectModelobject - the address of the objectval - the new value of the bytepublic byte readAvailableByte(ObjectReference object)
ObjectModelreadAvailableByte in class ObjectModelobject - the address of the objectpublic void writeAvailableBitsWord(ObjectReference object, Word val)
ObjectModelwriteAvailableBitsWord in class ObjectModelobject - the address of the objectval - the new value of the bitspublic Word readAvailableBitsWord(ObjectReference object)
ObjectModelreadAvailableBitsWord in class ObjectModelobject - the address of the objectpublic Offset GC_HEADER_OFFSET()
ObjectModelGC_HEADER_OFFSET in class ObjectModelpublic Address objectStartRef(ObjectReference object)
ObjectModelobjectStartRef in class ObjectModelobject - the reference address of the objectpublic Address refToAddress(ObjectReference object)
ObjectModelrefToAddress in class ObjectModelobject - the reference address of the objectpublic boolean isAcyclic(ObjectReference typeRef)
ObjectModelisAcyclic in class ObjectModeltypeRef - the type of the reference (as a TIB)true if a reference of the type is
inherently acyclicpublic void dumpObject(ObjectReference object)
ObjectModeldumpObject in class ObjectModelobject - The object whose information is to be dumped