org.jikesrvm.classloader
Class UnboxedType

java.lang.Object
  extended by org.jikesrvm.classloader.AnnotatedElement
      extended by org.jikesrvm.classloader.RVMType
          extended by org.jikesrvm.classloader.UnboxedType
All Implemented Interfaces:
AnnotatedElement, ClassLoaderConstants, Constants, HeapLayoutConstants, ThinLockConstants, TIBLayoutConstants, SizeConstants

public final class UnboxedType
extends RVMType
implements Constants, ClassLoaderConstants

Description of an Unboxed Magic type.

Currently, unboxed types are restricted to be values that can fit in a single machines word.

See Also:
RVMType, RVMClass, RVMArray, Primitive

Field Summary
private  int memoryBytes
          How many bytes in memory does it take to hold a value of this primitive type?
private  Atom name
          The pretty (external) name for this Unboxed type.
private  int stackWords
          How many slots in the Java Expression Stack does it take to hold a value of this primitive type?
 
Fields inherited from class org.jikesrvm.classloader.RVMType
AddressArrayType, AddressType, BooleanType, ByteType, CharType, CodeArrayType, CodeType, depth, dimension, doesImplement, DoubleType, emptyVMClass, emptyVMField, emptyVMMethod, ExtentArrayType, ExtentType, FloatType, FunctionTableType, id, IMTType, IntType, ITableArrayType, ITableType, JavaIoSerializableType, JavaLangClassType, JavaLangCloneableType, JavaLangObjectArrayType, JavaLangObjectType, JavaLangRefReferenceReferenceField, JavaLangRefReferenceType, JavaLangStringType, JavaLangThrowableType, LinkageTripletTableType, LongType, MagicType, NOREFS_OFFSET_ARRAY, ObjectReferenceArrayType, ObjectReferenceType, OffsetArrayType, OffsetType, REFARRAY_OFFSET_ARRAY, referenceOffsets, ShortType, superclassIds, tibOffset, TIBType, typeRef, VoidType, WordArrayType, WordType
 
Fields inherited from class org.jikesrvm.classloader.AnnotatedElement
declaredAnnotationDatas
 
Fields inherited from interface org.jikesrvm.Constants
NOT_REACHED, REFLECTION_FPRS_BITS, REFLECTION_FPRS_MASK, REFLECTION_GPRS_BITS, REFLECTION_GPRS_MASK
 
Fields inherited from interface org.jikesrvm.objectmodel.ThinLockConstants
TL_DEDICATED_U16_OFFSET, TL_DEDICATED_U16_SHIFT, TL_LOCK_COUNT_MASK, TL_LOCK_COUNT_SHIFT, TL_LOCK_COUNT_UNIT, TL_LOCK_ID_MASK, TL_LOCK_ID_SHIFT, TL_NUM_BITS_RC, TL_NUM_BITS_STAT, TL_NUM_BITS_TID, TL_STAT_BIASABLE, TL_STAT_FAT, TL_STAT_MASK, TL_STAT_SHIFT, TL_STAT_THIN, TL_THREAD_ID_MASK, TL_THREAD_ID_SHIFT, TL_UNLOCK_MASK
 
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
 
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.HeapLayoutConstants
BAD_MAP_COMPRESSION, BOOT_IMAGE_CODE_END, BOOT_IMAGE_CODE_SIZE, BOOT_IMAGE_CODE_START, BOOT_IMAGE_DATA_END, BOOT_IMAGE_DATA_SIZE, BOOT_IMAGE_DATA_START, BOOT_IMAGE_END, BOOT_IMAGE_RMAP_END, BOOT_IMAGE_RMAP_START, MAX_BOOT_IMAGE_RMAP_SIZE, MAXIMUM_MAPPABLE
 
Fields inherited from interface org.jikesrvm.classloader.ClassLoaderConstants
ACC_ABSTRACT, ACC_ANNOTATION, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VOLATILE, APPLICABLE_TO_CLASSES, APPLICABLE_TO_FIELDS, APPLICABLE_TO_METHODS, ArrayTypeCode, BooleanTypeCode, BRIDGE, ByteTypeCode, CharTypeCode, CLASS_INITIALIZED, CLASS_INITIALIZER_FAILED, CLASS_INITIALIZING, CLASS_INSTANTIATED, CLASS_LOADED, CLASS_RESOLVED, CLASS_VACANT, ClassTypeCode, CP_CLASS, CP_DOUBLE, CP_FLOAT, CP_INT, CP_LONG, CP_MEMBER, CP_STRING, CP_UTF, DoubleTypeCode, FloatTypeCode, IntTypeCode, LongTypeCode, ShortTypeCode, TAG_DOUBLE, TAG_FIELDREF, TAG_FLOAT, TAG_INT, TAG_INTERFACE_METHODREF, TAG_LONG, TAG_MEMBERNAME_AND_DESCRIPTOR, TAG_METHODREF, TAG_STRING, TAG_TYPEREF, TAG_UNUSED, TAG_UTF, VARARGS, VoidTypeCode
 
Constructor Summary
private UnboxedType(TypeReference tr, Class<?> classForType, Atom name, int stackWords, int memoryBytes)
          Constructor
 
Method Summary
 void allBootImageTypesResolved()
          This method is only called by the bootimage writer.
(package private) static UnboxedType createUnboxedType(TypeReference tr)
          Create an instance of a UnboxedType
 int getDimensionality()
          Number of [ in descriptor for arrays; -1 for primitives; 0 for classes
 RVMField[] getInstanceFields()
          Non-static fields of this class/array type (composed with supertypes, if any).
 int getMemoryBytes()
          Number of bytes in memory required to represent the type
 int getStackWords()
          Stack space requirement in words.
 RVMField[] getStaticFields()
          Static fields of this class/array type.
 RVMMethod[] getStaticMethods()
          Statically dispatched methods of this class/array type.
 Offset getThinLockOffset()
          Get the offset in instances of this type assigned to the thin lock word.
 int getTypeDepth()
          get number of superclasses to Object 0 java.lang.Object, Primitive, and Classes that are interfaces 1 for RVMArrays and classes that extend Object directly
 TIB getTypeInformationBlock()
          Runtime type information for this class/array type.
 RVMMethod[] getVirtualMethods()
          Virtually dispatched methods of this class/array type (composed with supertypes, if any).
 boolean hasFinalizer()
          Does this type override java.lang.Object.finalize()?
 void initialize()
          Cause initialization to take place.
 void instantiate()
          Cause instantiation to take place.
 boolean isAcyclicReference()
          Reference Count GC: Is a reference of this type contained in another object inherently acyclic (without cycles)?
 boolean isArrayType()
          Is this an instance of RVMArray?
 boolean isClassType()
          Is this is an instance of RVMClass?
 boolean isInBootImage()
          Is this class part of the virtual machine's boot image?
 boolean isInitialized()
          Initialization status.
 boolean isInstantiated()
          Instantiation status.
 boolean isPrimitiveType()
          Is this a primitive type?
 boolean isReferenceType()
          Is this a reference type?
 boolean isResolved()
          Resolution status.
 boolean isUnboxedType()
          Is this an unboxed type?
 void markAsBootImageClass()
          Only intended to be used by the BootImageWriter
 void resolve()
          Cause resolution to take place.
 String toString()
          Name - something like "int".
 
Methods inherited from class org.jikesrvm.classloader.RVMType
asArray, asClass, asPrimitive, asUnboxedType, createClassForType, findVirtualMethod, getArrayTypeForElementType, getClassForType, getClassLoader, getDescriptor, getDesiredAssertionStatus, getDoesImplement, getId, getMMAllocator, getReferenceOffsets, getResolvedClassForType, getSuperclassIds, getTIBMethodAtSlot, getTibOffset, getType, getTypeRef, hashCode, isAssignableFrom, isBooleanType, isByteType, isCharType, isDoubleType, isFloatType, isIntLikeType, isIntType, isJavaLangObjectType, isJavaLangStringType, isJavaLangThrowableType, isLongType, isNonMoving, isShortType, isVoidType, numTypes, setMMAllocator, setSpecializedMethod
 
Methods inherited from class org.jikesrvm.classloader.AnnotatedElement
getAnnotation, getAnnotations, getAnnotationsInternal, getDeclaredAnnotations, getDeclaredAnnotationsInternal, hasAnnotations, hasBaselineNoRegistersAnnotation, hasBaselineSaveLSRegistersAnnotation, hasInlineAnnotation, hasInterruptibleAnnotation, hasLogicallyUninterruptibleAnnotation, hasNoBoundsCheckAnnotation, hasNoCheckStoreAnnotation, hasNoEscapesAnnotation, hasNoInlineAnnotation, hasNonMovingAllocationAnnotation, hasNonMovingAnnotation, hasNoNullCheckAnnotation, hasNoOptCompileAnnotation, hasPreemptibleAnnotation, hasPureAnnotation, hasRuntimeFinalAnnotation, hasRuntimePureAnnotation, hasUninterruptibleAnnotation, hasUninterruptibleNoWarnAnnotation, hasUnpreemptibleAnnotation, hasUnpreemptibleNoWarnAnnotation, hasUntracedAnnotation, isAnnotationDeclared, isAnnotationPresent, readAnnotations, toAnnotations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private final Atom name
The pretty (external) name for this Unboxed type.


stackWords

private final int stackWords
How many slots in the Java Expression Stack does it take to hold a value of this primitive type?


memoryBytes

private final int memoryBytes
How many bytes in memory does it take to hold a value of this primitive type?

Constructor Detail

UnboxedType

private UnboxedType(TypeReference tr,
                    Class<?> classForType,
                    Atom name,
                    int stackWords,
                    int memoryBytes)
Constructor

Parameters:
tr - The canonical type reference for this primitive
classForType - The java.lang.Class representation
name - The name for this primitive
stackWords - The stack slots used by this primitive
memoryBytes - The bytes in memory used by this primitive
Method Detail

toString

public String toString()
Name - something like "int".

Overrides:
toString in class Object

createUnboxedType

static UnboxedType createUnboxedType(TypeReference tr)
Create an instance of a UnboxedType

Parameters:
tr - The canonical type reference for this primitive

getTypeDepth

public int getTypeDepth()
Description copied from class: RVMType
get number of superclasses to Object

Specified by:
getTypeDepth in class RVMType
Returns:
0 because unboxed types do not extend java.lang.Object

isAcyclicReference

public boolean isAcyclicReference()
Description copied from class: RVMType
Reference Count GC: Is a reference of this type contained in another object inherently acyclic (without cycles)?

Specified by:
isAcyclicReference in class RVMType
Returns:
true because unboxed types cannot contain any references

getDimensionality

public int getDimensionality()
Description copied from class: RVMType
Number of [ in descriptor for arrays; -1 for primitives; 0 for classes

Specified by:
getDimensionality in class RVMType
Returns:
-1

isResolved

public boolean isResolved()
Description copied from class: RVMType
Resolution status.

If the class/array has been "resolved", then size and offset information is available by which the compiler can generate code to access this class/array's fields/methods via direct loads/stores/calls (rather than generating code to access fields/methods symbolically, via dynamic linking stubs).

Primitives are always treated as "resolved".

Specified by:
isResolved in class RVMType
Returns:
true because unboxed types are always considered resolved"

isInstantiated

public boolean isInstantiated()
Description copied from class: RVMType
Instantiation status.

If the class/array has been "instantiated", then all its methods have been compiled and its type information block has been placed in the JTOC.

Primitives are always treated as "instantiated".

Specified by:
isInstantiated in class RVMType
Returns:
true because unboxed types are always considered "instantiated"

isInitialized

public boolean isInitialized()
Description copied from class: RVMType
Initialization status.

If the class has been "initialized", then its <clinit> method has been executed. Arrays have no <clinit> methods so they become "initialized" immediately upon "instantiation".

Primitives are always treated as "initialized".

Specified by:
isInitialized in class RVMType
Returns:
true because unboxed types are always considered "initialized"

markAsBootImageClass

public void markAsBootImageClass()
Description copied from class: RVMType
Only intended to be used by the BootImageWriter

Specified by:
markAsBootImageClass in class RVMType

isInBootImage

public boolean isInBootImage()
Description copied from class: RVMType
Is this class part of the virtual machine's boot image?

Specified by:
isInBootImage in class RVMType
Returns:
true. All unboxed types are included in the bootimage because they are needed for starting Jikes RVM.

getThinLockOffset

public Offset getThinLockOffset()
Description copied from class: RVMType
Get the offset in instances of this type assigned to the thin lock word. Offset.max() if instances of this type do not have thin lock words.

Specified by:
getThinLockOffset in class RVMType
Returns:
Offset.max()

isClassType

public boolean isClassType()
Description copied from class: RVMType
Is this is an instance of RVMClass?

Specified by:
isClassType in class RVMType
Returns:
false

isArrayType

public boolean isArrayType()
Description copied from class: RVMType
Is this an instance of RVMArray?

Specified by:
isArrayType in class RVMType
Returns:
false

isPrimitiveType

public boolean isPrimitiveType()
Description copied from class: RVMType
Is this a primitive type?

Specified by:
isPrimitiveType in class RVMType
Returns:
false

isReferenceType

public boolean isReferenceType()
Description copied from class: RVMType
Is this a reference type?

Specified by:
isReferenceType in class RVMType
Returns:
false

isUnboxedType

public boolean isUnboxedType()
Description copied from class: RVMType
Is this an unboxed type?

Specified by:
isUnboxedType in class RVMType
Returns:
true

getStackWords

public int getStackWords()
Stack space requirement in words.

Specified by:
getStackWords in class RVMType

getMemoryBytes

public int getMemoryBytes()
Description copied from class: RVMType
Number of bytes in memory required to represent the type

Specified by:
getMemoryBytes in class RVMType

resolve

public void resolve()
Cause resolution to take place. This is a no-op for unboxed types.

Specified by:
resolve in class RVMType
See Also:
isResolved()

allBootImageTypesResolved

public void allBootImageTypesResolved()
Description copied from class: RVMType
This method is only called by the bootimage writer. It is called after RVMType.resolve() has been called on all bootimage types but before RVMType.instantiate() has been called on any bootimage type. This provides a hook to compute various summaries that cannot be computed before types are resolved.

Specified by:
allBootImageTypesResolved in class RVMType

instantiate

public void instantiate()
Cause instantiation to take place. This is a no-op for unboxed types.

Specified by:
instantiate in class RVMType
See Also:
isInstantiated()

initialize

public void initialize()
Cause initialization to take place. This is a no-op for unboxed types.

Specified by:
initialize in class RVMType
See Also:
isInitialized()

hasFinalizer

public boolean hasFinalizer()
Description copied from class: RVMType
Does this type override java.lang.Object.finalize()?

Specified by:
hasFinalizer in class RVMType
Returns:
false

getStaticFields

public RVMField[] getStaticFields()
Static fields of this class/array type.

Specified by:
getStaticFields in class RVMType
Returns:
zero length array

getInstanceFields

public RVMField[] getInstanceFields()
Non-static fields of this class/array type (composed with supertypes, if any).

Specified by:
getInstanceFields in class RVMType
Returns:
zero length array

getStaticMethods

public RVMMethod[] getStaticMethods()
Statically dispatched methods of this class/array type.

Specified by:
getStaticMethods in class RVMType
Returns:
zero length array

getVirtualMethods

public RVMMethod[] getVirtualMethods()
Virtually dispatched methods of this class/array type (composed with supertypes, if any).

Specified by:
getVirtualMethods in class RVMType
Returns:
zero length array

getTypeInformationBlock

public TIB getTypeInformationBlock()
Runtime type information for this class/array type.

Specified by:
getTypeInformationBlock in class RVMType