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 ObjectModel
public ObjectReference copy(ObjectReference from, int allocator)
ObjectModel
from
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 ObjectModel
from
- 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)
ObjectModel
copyTo
in class ObjectModel
region
- 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)
ObjectModel
getReferenceWhenCopiedTo
in class ObjectModel
from
- The object to be copied.to
- The region to be copied to.public Address getObjectEndAddress(ObjectReference object)
ObjectModel
getObjectEndAddress
in class ObjectModel
object
- The objectpublic int getSizeWhenCopied(ObjectReference object)
ObjectModel
getSizeWhenCopied
in class ObjectModel
object
- The object whose size is to be queriedobj
public int getAlignWhenCopied(ObjectReference object)
ObjectModel
getAlignWhenCopied
in class ObjectModel
object
- The object whose size is to be queriedobj
public int getAlignOffsetWhenCopied(ObjectReference object)
ObjectModel
getAlignOffsetWhenCopied
in class ObjectModel
object
- The object whose size is to be queriedobj
public int getCurrentSize(ObjectReference object)
ObjectModel
getCurrentSize
in class ObjectModel
object
- The object whose size is to be queriedobj
public ObjectReference getNextObject(ObjectReference object)
getNextObject
in class ObjectModel
object
- the current objectpublic ObjectReference getObjectFromStartAddress(Address start)
getObjectFromStartAddress
in class ObjectModel
start
- the start address of the objectpublic byte[] getTypeDescriptor(ObjectReference ref)
ObjectModel
getTypeDescriptor
in class ObjectModel
ref
- address of the objectpublic int getArrayLength(ObjectReference object)
ObjectModel
getArrayLength
in class ObjectModel
object
- address of the objectpublic boolean isArray(ObjectReference object)
isArray
in class ObjectModel
object
- address of the objectpublic boolean isPrimitiveArray(ObjectReference object)
isPrimitiveArray
in class ObjectModel
object
- 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)
ObjectModel
oldVal
. The comparison with the
current value and setting are atomic with respect to other
allocators.attemptAvailableBits
in class ObjectModel
object
- 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)
ObjectModel
prepareAvailableBits
in class ObjectModel
object
- the address of the objectpublic void writeAvailableByte(ObjectReference object, byte val)
ObjectModel
writeAvailableByte
in class ObjectModel
object
- the address of the objectval
- the new value of the bytepublic byte readAvailableByte(ObjectReference object)
ObjectModel
readAvailableByte
in class ObjectModel
object
- the address of the objectpublic void writeAvailableBitsWord(ObjectReference object, Word val)
ObjectModel
writeAvailableBitsWord
in class ObjectModel
object
- the address of the objectval
- the new value of the bitspublic Word readAvailableBitsWord(ObjectReference object)
ObjectModel
readAvailableBitsWord
in class ObjectModel
object
- the address of the objectpublic Offset GC_HEADER_OFFSET()
ObjectModel
GC_HEADER_OFFSET
in class ObjectModel
public Address objectStartRef(ObjectReference object)
ObjectModel
objectStartRef
in class ObjectModel
object
- the reference address of the objectpublic Address refToAddress(ObjectReference object)
ObjectModel
refToAddress
in class ObjectModel
object
- the reference address of the objectpublic boolean isAcyclic(ObjectReference typeRef)
ObjectModel
isAcyclic
in class ObjectModel
typeRef
- the type of the reference (as a TIB)true
if a reference of the type is
inherently acyclicpublic void dumpObject(ObjectReference object)
ObjectModel
dumpObject
in class ObjectModel
object
- The object whose information is to be dumped