|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.objectmodel.JavaHeader
public class JavaHeader
Defines the JavaHeader portion of the object header for the default JikesRVM object model. The default object model uses a two word header.
One word holds a TIB pointer.
The other word ("status word") contains an inline thin lock,
either the hash code or hash code state, and a few unallocated
bits that can be used for other purposes.
If JavaHeaderConstants.ADDRESS_BASED_HASHING
is false,
then to implement default hashcodes, Jikes RVM uses a 10 bit hash code
that is completely stored in the status word, which is laid out as
shown below:
TTTT TTTT TTTT TTTT TTTT HHHH HHHH HHAA T = thin lock bits H = hash code A = available for use by GCHeader and/or MiscHeader.If
ADDRESS_BASED_HASHING
is true,
then Jikes RVM uses two bits of the status word to record the hash code state in
a typical three state scheme (JavaHeaderConstants.HASH_STATE_UNHASHED
, JavaHeaderConstants.HASH_STATE_HASHED
,
and JavaHeaderConstants.HASH_STATE_HASHED_AND_MOVED
). In this case, the status word is laid
out as shown below:
TTTT TTTT TTTT TTTT TTTT TTHH AAAA AAAA T = thin lock bits H = hash code state bits A = available for use by GCHeader and/or MiscHeader.
Field Summary | |
---|---|
static int |
ALIGNMENT_VALUE
The alignment value |
protected static int |
ARRAY_HEADER_SIZE
|
protected static Offset |
AVAILABLE_BITS_OFFSET
|
protected static Word |
HASH_CODE_MASK
|
protected static int |
HASH_CODE_SHIFT
|
protected static Word |
hashCodeGenerator
|
static int |
LOG_MIN_ALIGNMENT
|
static int |
NUM_THIN_LOCK_BITS
How many bits are allocated to a thin lock? |
static int |
OBJECT_REF_OFFSET
offset of object reference from the lowest memory word |
protected static int |
SCALAR_HEADER_SIZE
|
protected static Offset |
STATUS_OFFSET
|
static int |
THIN_LOCK_DEDICATED_U16_OFFSET
How many bytes do we have to offset to get to the high locking bits |
static int |
THIN_LOCK_DEDICATED_U16_SHIFT
How many bits do we have to shift to only hold the high locking bits |
static int |
THIN_LOCK_SHIFT
How many bits to shift to get the thin lock? |
protected static Offset |
TIB_OFFSET
|
Constructor Summary | |
---|---|
JavaHeader()
|
Method Summary | |
---|---|
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 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,
RVMArray type,
int numElements)
how many bytes are used by the array object? |
static int |
bytesUsed(Object obj,
RVMClass type)
how many bytes are used by the scalar object? |
static int |
computeArrayHeaderSize(RVMArray 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 |
dumpHeader(Object ref)
For low level debugging of GC subsystem. |
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 returned by getOffsetForAlignment in instances of the argument RVMClass. |
static int |
getAlignment(RVMClass t,
Object obj)
Return the desired aligment 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 |
getHeaderEndOffset()
What is the last word of the header from an out-to-in perspective? |
static Lock |
getHeavyLock(Object o,
boolean create)
Obtains the heavy-weight lock, if there is one, associated with the indicated object. |
protected static ObjectReference |
getNextObject(ObjectReference obj,
int size)
Get the next object in the heap under contiguous allocation. |
static ObjectReference |
getNextObject(ObjectReference obj,
RVMArray type,
int numElements)
Get the next array in the heap under contiguous allocation. |
static ObjectReference |
getNextObject(ObjectReference obj,
RVMClass type)
Get the next scalar in the heap under contiguous allocation. |
static Address |
getObjectEndAddress(Object obj,
RVMArray type,
int numElements)
What is the first word after the array? |
static Address |
getObjectEndAddress(Object obj,
RVMClass type)
What is the first word after the class? |
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 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. |
protected static Object |
getReferenceWhenCopiedTo(Object obj,
Address to)
|
static Object |
getReferenceWhenCopiedTo(Object obj,
Address to,
RVMArray type)
Get the reference of an array when copied to the specified region. |
static Object |
getReferenceWhenCopiedTo(Object obj,
Address to,
RVMClass type)
Get the reference of a scalar when copied to the 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 Offset |
getTibOffset()
Return the TIB offset. |
static boolean |
holdsLock(Object obj,
RVMThread thread)
|
static Object |
initializeArrayHeader(Address ptr,
TIB tib,
int size)
Perform any required initialization of the JAVA portion of the header. |
static Address |
initializeArrayHeader(BootImageInterface bootImage,
Address ptr,
TIB tib,
int size,
int numElements,
boolean needsIdentityHash,
int identityHashValue)
Perform any required initialization of the JAVA portion of the header. |
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 |
initializeScalarHeader(Address ptr,
TIB tib,
int size)
Perform any required initialization of the JAVA portion of the header. |
static Address |
initializeScalarHeader(BootImageInterface bootImage,
Address ptr,
TIB tib,
int size,
boolean needsIdentityHash,
int identityHashValue)
Perform any required initialization of the JAVA portion of the header. |
protected static int |
installHashCode(Object o)
Install a new hashcode (only used if ! |
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 int |
minimumObjectSize()
How small is the minimum object header size? |
static Object |
moveObject(Address toAddress,
Object fromObj,
int numBytes,
RVMArray type)
Copy an array to the given raw storage address |
static Object |
moveObject(Address toAddress,
Object fromObj,
int numBytes,
RVMClass type)
Copy a scalar to the given raw storage address |
static Object |
moveObject(Address toAddress,
Object fromObj,
Object toObj,
int numBytes)
Copy an object to the given raw storage address |
static Object |
moveObject(Object fromObj,
Object toObj,
int numBytes,
RVMArray type)
Copy an array to the given location. |
static Object |
moveObject(Object fromObj,
Object toObj,
int numBytes,
RVMClass type)
Copy an array to the given location. |
static Offset |
objectEndOffset(RVMClass klass)
What is the offset of the first word after the class? |
static int |
objectStartOffset(RVMClass klass)
What is the offset of the first word of the class? |
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 |
setAvailableBit(Object o,
int idx,
boolean flag)
Set argument bit to 1 if value is true, 0 if value is false |
static void |
setTIB(BootImageInterface bootImage,
Address refOffset,
Address tibAddr,
RVMType type)
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(BootImageInterface bootImage,
Address ref,
byte 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 |
---|
protected static final int SCALAR_HEADER_SIZE
protected static final int ARRAY_HEADER_SIZE
public static final int OBJECT_REF_OFFSET
protected static final Offset TIB_OFFSET
protected static final Offset STATUS_OFFSET
protected static final Offset AVAILABLE_BITS_OFFSET
protected static final int HASH_CODE_SHIFT
protected static final Word HASH_CODE_MASK
protected static Word hashCodeGenerator
public static final int NUM_THIN_LOCK_BITS
public static final int THIN_LOCK_SHIFT
public static final int THIN_LOCK_DEDICATED_U16_OFFSET
public static final int THIN_LOCK_DEDICATED_U16_SHIFT
public static final int ALIGNMENT_VALUE
public static final int LOG_MIN_ALIGNMENT
Constructor Detail |
---|
public JavaHeader()
Method Detail |
---|
public static Offset getTibOffset()
public static Offset objectEndOffset(RVMClass klass)
public static Address getObjectEndAddress(Object obj, RVMClass type)
public static Address getObjectEndAddress(Object obj, RVMArray type, int numElements)
public static int objectStartOffset(RVMClass klass)
public static int getHeaderEndOffset()
public static int minimumObjectSize()
public static Address getPointerInMemoryRegion(ObjectReference ref)
public static TIB getTIB(Object o)
public static void setTIB(Object ref, TIB tib)
public static void setTIB(BootImageInterface bootImage, Address refOffset, Address tibAddr, RVMType type)
public static int bytesRequiredWhenCopied(Object fromObj, RVMClass type)
public static int bytesUsed(Object obj, RVMClass type)
public static int bytesRequiredWhenCopied(Object fromObj, RVMArray type, int numElements)
public static int bytesUsed(Object obj, RVMArray type, int numElements)
public static Address objectStartRef(ObjectReference obj)
public static ObjectReference getObjectFromStartAddress(Address start)
public static ObjectReference getScalarFromStartAddress(Address start)
public static ObjectReference getArrayFromStartAddress(Address start)
protected static ObjectReference getNextObject(ObjectReference obj, int size)
public static ObjectReference getNextObject(ObjectReference obj, RVMClass type)
public static ObjectReference getNextObject(ObjectReference obj, RVMArray type, int numElements)
public static Object getReferenceWhenCopiedTo(Object obj, Address to, RVMArray type)
public static Object getReferenceWhenCopiedTo(Object obj, Address to, RVMClass type)
protected static Object getReferenceWhenCopiedTo(Object obj, Address to)
public static Object moveObject(Address toAddress, Object fromObj, int numBytes, RVMClass type)
public static Object moveObject(Object fromObj, Object toObj, int numBytes, RVMClass type)
public static Object moveObject(Address toAddress, Object fromObj, int numBytes, RVMArray type)
public static Object moveObject(Object fromObj, Object toObj, int numBytes, RVMArray type)
public static Object moveObject(Address toAddress, Object fromObj, Object toObj, int numBytes)
public static int getObjectHashCode(Object o)
protected static int installHashCode(Object o)
public static Offset getThinLockOffset(Object o)
public static Offset defaultThinLockOffset()
public static void allocateThinLock(RVMType t)
public static void genericLock(Object o)
public static void genericUnlock(Object o)
public static boolean holdsLock(Object obj, RVMThread thread)
obj
- an objectthread
- a thread
true
if the lock on obj is currently owned
by thread false
if it is not.public static Lock getHeavyLock(Object o, boolean create)
null
, if there is no
heavy-weight lock associated with the object.
o
- the object from which a lock is desiredcreate
- if true, create heavy lock if none found
public static Word readAvailableBitsWord(Object o)
public static byte readAvailableByte(Object o)
public static void writeAvailableBitsWord(Object o, Word val)
public static void writeAvailableByte(BootImageInterface bootImage, Address ref, byte val)
public static void writeAvailableByte(Object o, byte val)
public static boolean testAvailableBit(Object o, int idx)
public static void setAvailableBit(Object o, int idx, boolean flag)
public static void initializeAvailableByte(Object o)
public static Word prepareAvailableBits(Object o)
public static boolean attemptAvailableBits(Object o, Word oldVal, Word newVal)
public static Address minimumObjectRef(Address regionBaseAddr)
public static Address maximumObjectRef(Address regionHighAddr)
public static int computeScalarHeaderSize(RVMClass type)
public static int computeArrayHeaderSize(RVMArray type)
public static int getAlignment(RVMClass t)
t
- RVMClass instance being createdpublic static int getAlignment(RVMClass t, Object obj)
t
- RVMClass instance being copiedobj
- the object being copiedpublic static int getAlignment(RVMArray t)
t
- RVMArray instance being createdpublic static int getAlignment(RVMArray t, Object obj)
t
- RVMArray instance being copiedobj
- the object being copiedpublic static int getOffsetForAlignment(RVMClass t, boolean needsIdentityHash)
t
- RVMClass instance being createdpublic static int getOffsetForAlignment(RVMClass t, ObjectReference obj)
t
- RVMClass instance being copiedobj
- the object being copiedpublic static int getOffsetForAlignment(RVMArray t, boolean needsIdentityHash)
t
- RVMArray instance being createdpublic static int getOffsetForAlignment(RVMArray t, ObjectReference obj)
t
- RVMArray instance being copiedobj
- the object being copiedpublic static Object initializeScalarHeader(Address ptr, TIB tib, int size)
ptr
- the raw storage to be initializedtib
- the TIB of the instance being createdsize
- the number of bytes allocated by the GC system for this object.public static Address initializeScalarHeader(BootImageInterface bootImage, Address ptr, TIB tib, int size, boolean needsIdentityHash, int identityHashValue)
bootImage
- The bootimage being writtenptr
- The object ref to the storage to be initializedtib
- The TIB of the instance being createdsize
- The number of bytes allocated by the GC system for this object.needsIdentityHash
- needs an identity hash valueidentityHashValue
- the value for the identity hash
public static Object initializeArrayHeader(Address ptr, TIB tib, int size)
ptr
- the raw storage to be initializedtib
- the TIB of the instance being createdsize
- the number of bytes allocated by the GC system for this object.public static Address initializeArrayHeader(BootImageInterface bootImage, Address ptr, TIB tib, int size, int numElements, boolean needsIdentityHash, int identityHashValue)
bootImage
- the bootimage being writtenptr
- the object ref to the storage to be initializedtib
- the TIB of the instance being createdsize
- the number of bytes allocated by the GC system for this object.numElements
- the number of elements in the array
public static void dumpHeader(Object ref)
ref
- the object reference whose header should be dumpedpublic static void baselineEmitLoadTIB(ArchitectureSpecific.Assembler asm, int dest, int object)
asm
- the assembler object to emit code withdest
- the number of the destination registerobject
- the number of the register holding the object reference
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |