org.jikesrvm.objectmodel
Class TIB

java.lang.Object
  extended by org.jikesrvm.objectmodel.TIB
All Implemented Interfaces:
RuntimeTable<Object>, TIBLayoutConstants, SizeConstants

public final class TIB
extends Object
implements RuntimeTable<Object>, TIBLayoutConstants, SizeConstants

This class represents an instance of a type information block, at runtime it is an array with Object elements.

See Also:
TIBLayoutConstants

Field Summary
private  int alignData
          Alignment encoded data for this TIB - only used at build time
private  Object[] data
          The backing data used during boot image writing.
 
Fields inherited from interface org.jikesrvm.objectmodel.TIBLayoutConstants
IMT_METHOD_SLOTS, NEEDS_DYNAMIC_LINK, TIB_ARRAY_ELEMENT_TIB_INDEX, TIB_DOES_IMPLEMENT_INDEX, TIB_FIRST_SPECIALIZED_METHOD_INDEX, TIB_FIRST_VIRTUAL_METHOD_INDEX, TIB_INTERFACE_DISPATCH_TABLE_INDEX, TIB_SUPERCLASS_IDS_INDEX, TIB_TYPE_INDEX
 
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
private TIB(int size)
          Private constructor.
 
Method Summary
static TIB allocate(int size, int alignData)
          Create a new TIB of the specified size.
static int computeSize(int numVirtualMethods)
          Calculate the size of a TIB
 Object get(int index)
          Get a TIB entry.
 int getAlignData()
           
 Object[] getBacking()
          Only called at boot image write time.
 int[] getDoesImplement()
          Get the does implement entry of the TIB
 IMT getImt()
          Get the IMT from the TIB
 ITableArray getITableArray()
          Get the ITable array for this type.
 short[] getSuperclassIds()
          Get the superclass id set for this type.
 RVMType getType()
          Get the type for this TIB.
 ArchitectureSpecific.CodeArray getVirtualMethod(int virtualMethodIndex)
          Get a virtual method from this TIB.
 ArchitectureSpecific.CodeArray getVirtualMethod(Offset virtualMethodOffset)
          Get a virtual method from this TIB by offset.
static int getVirtualMethodIndex(int slot)
          Calculate the virtual method index for the given raw slot index.
static int getVirtualMethodIndex(Offset virtualMethodOffset)
          Calculate the virtual method index for the given offset.
static Offset getVirtualMethodOffset(int virtualMethodIndex)
          Calculate the virtual method offset for the given index.
 void initializeInternalLazyCompilationTrampoline()
          Initialize the lazy method invoker trampoline for this tib.
 boolean isInternalLazyCompilationTrampoline(int virtualMethodIndex)
          Determine if a virtual method is the internal lazy compilation trampoline.
 int lazyMethodInvokerTrampolineIndex()
          Calculate the address that is the call target for the lazy method invoker trampoline.
static int lazyMethodInvokerTrampolineWords()
           
 int length()
          Return the length of the TIB
 int numVirtualMethods()
          The number of virtual methods in this TIB.
 void set(int index, Object value)
          Set a TIB entry.
 void setAlignData(int alignData)
           
 void setArrayElementTib(TIB arrayElementTIB)
          Set the TIB of the elements of this array (null if not an array).
 void setDoesImplement(int[] doesImplement)
          Set the does implement entry of the TIB
 void setImt(IMT imt)
          Set the IMT of the TIB
 void setITableArray(ITableArray iTableArray)
          Set the ITable array for this type.
 void setSpecializedMethod(int specializedMethodIndex, ArchitectureSpecific.CodeArray code)
          Set a specialized method in this TIB.
 void setSuperclassIds(short[] superclassIds)
          Set the superclass id set for this type.
 void setType(RVMType type)
          Set the type for this TIB.
 void setVirtualMethod(int virtualMethodIndex, ArchitectureSpecific.CodeArray code)
          Set a virtual method in this TIB.
 void setVirtualMethod(Offset virtualMethodOffset, ArchitectureSpecific.CodeArray code)
          Set a virtual method in this TIB by offset.
 boolean slotContainsCode(int slot)
          Does this slot in the TIB hold code?
 boolean slotContainsTib(int slot)
          Does this slot in the TIB hold a TIB entry?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alignData

private int alignData
Alignment encoded data for this TIB - only used at build time


data

private final Object[] data
The backing data used during boot image writing.

Constructor Detail

TIB

private TIB(int size)
Private constructor. Can not create instances.

Method Detail

lazyMethodInvokerTrampolineWords

public static int lazyMethodInvokerTrampolineWords()
Returns:
the number of words required to hold the lazy method invoker trampoline.

computeSize

public static int computeSize(int numVirtualMethods)
Calculate the size of a TIB


getVirtualMethodOffset

public static Offset getVirtualMethodOffset(int virtualMethodIndex)
Calculate the virtual method offset for the given index.

Parameters:
virtualMethodIndex - The index to calculate the offset for
Returns:
The offset.

getVirtualMethodIndex

public static int getVirtualMethodIndex(Offset virtualMethodOffset)
Calculate the virtual method index for the given offset.

Parameters:
virtualMethodOffset - The offset to calculate the index for
Returns:
The index.

getVirtualMethodIndex

public static int getVirtualMethodIndex(int slot)
Calculate the virtual method index for the given raw slot index.

Parameters:
slot - The raw slot to find the virtual method index for.
Returns:
The index.

getBacking

public Object[] getBacking()
Description copied from interface: RuntimeTable
Only called at boot image write time. This returns the backing array to the boot image writer.

Specified by:
getBacking in interface RuntimeTable<Object>
Returns:
backing array of elements

allocate

public static TIB allocate(int size,
                           int alignData)
Create a new TIB of the specified size.

Parameters:
size - The size of the TIB
alignData - Alignment-encoded data for this TIB, AlignmentEncoding.ALIGN_CODE_NONE for no alignment encoding.
Returns:
The created TIB instance.

get

public Object get(int index)
Get a TIB entry.

Specified by:
get in interface RuntimeTable<Object>
Parameters:
index - The index of the entry to get
Returns:
The value of that entry

set

public void set(int index,
                Object value)
Set a TIB entry.

Specified by:
set in interface RuntimeTable<Object>
Parameters:
index - The index of the entry to set
value - The value to set the entry to.

length

public int length()
Return the length of the TIB

Specified by:
length in interface RuntimeTable<Object>
Returns:
length of table

getType

public RVMType getType()
Get the type for this TIB.


setType

public void setType(RVMType type)
Set the type for this TIB.


getSuperclassIds

public short[] getSuperclassIds()
Get the superclass id set for this type.


setSuperclassIds

public void setSuperclassIds(short[] superclassIds)
Set the superclass id set for this type.


getITableArray

public ITableArray getITableArray()
Get the ITable array for this type.


setITableArray

public void setITableArray(ITableArray iTableArray)
Set the ITable array for this type.


getDoesImplement

public int[] getDoesImplement()
Get the does implement entry of the TIB


setDoesImplement

public void setDoesImplement(int[] doesImplement)
Set the does implement entry of the TIB


getImt

public IMT getImt()
Get the IMT from the TIB


setImt

public void setImt(IMT imt)
Set the IMT of the TIB


setArrayElementTib

public void setArrayElementTib(TIB arrayElementTIB)
Set the TIB of the elements of this array (null if not an array).


getVirtualMethod

public ArchitectureSpecific.CodeArray getVirtualMethod(int virtualMethodIndex)
Get a virtual method from this TIB. When running the VM, we must translate requests to return the internal lazy compilation trampoline marker.


isInternalLazyCompilationTrampoline

public boolean isInternalLazyCompilationTrampoline(int virtualMethodIndex)
Determine if a virtual method is the internal lazy compilation trampoline.


getVirtualMethod

public ArchitectureSpecific.CodeArray getVirtualMethod(Offset virtualMethodOffset)
Get a virtual method from this TIB by offset.


setVirtualMethod

public void setVirtualMethod(int virtualMethodIndex,
                             ArchitectureSpecific.CodeArray code)
Set a virtual method in this TIB. When running the VM, we must translate requests to use the internal lazy compilation trampoline.


setVirtualMethod

public void setVirtualMethod(Offset virtualMethodOffset,
                             ArchitectureSpecific.CodeArray code)
Set a virtual method in this TIB by offset.


lazyMethodInvokerTrampolineIndex

public int lazyMethodInvokerTrampolineIndex()
Calculate the address that is the call target for the lazy method invoker trampoline.

Returns:
the offset of the instruction that is the call target

initializeInternalLazyCompilationTrampoline

public void initializeInternalLazyCompilationTrampoline()
Initialize the lazy method invoker trampoline for this tib.


setSpecializedMethod

public void setSpecializedMethod(int specializedMethodIndex,
                                 ArchitectureSpecific.CodeArray code)
Set a specialized method in this TIB.


numVirtualMethods

public int numVirtualMethods()
The number of virtual methods in this TIB.


slotContainsTib

public boolean slotContainsTib(int slot)
Does this slot in the TIB hold a TIB entry?

Parameters:
slot - the TIB slot
Returns:
true if this the array element TIB

slotContainsCode

public boolean slotContainsCode(int slot)
Does this slot in the TIB hold code?

Parameters:
slot - the TIB slot
Returns:
true if slot is one that holds a code array reference

setAlignData

public void setAlignData(int alignData)

getAlignData

public int getAlignData()