|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.classloader.AnnotatedElement org.jikesrvm.classloader.RVMType
public abstract class RVMType
A description of a java type.
This class is the base of the java type system. To the three kinds of java objects (class-instances, array-instances, primitive-instances) there are three corresponding subclasses of RVMType: RVMClass, RVMArray, Primitive.
A RVMClass is constructed in four phases:
Field Summary | |
---|---|
static RVMArray |
AddressArrayType
|
static UnboxedType |
AddressType
|
static Primitive |
BooleanType
|
static Primitive |
ByteType
|
private RVMArray |
cachedElementType
cached RVMArray that corresponds to arrays of this type. |
static Primitive |
CharType
|
private Class<?> |
classForType
instance of java.lang.Class corresponding to this type |
static RVMArray |
CodeArrayType
|
static UnboxedType |
CodeType
|
protected int |
depth
Number of superclasses to Object. |
protected int |
dimension
Number of [ in descriptor for arrays; -1 for primitives; 0 for classes. |
protected int[] |
doesImplement
The interface implementation array for this type. |
static Primitive |
DoubleType
|
protected static RVMClass[] |
emptyVMClass
Canonical representation of no VM classes |
protected static RVMField[] |
emptyVMField
Canonical representation of no fields |
protected static RVMMethod[] |
emptyVMMethod
Canonical representation of no methods |
static RVMArray |
ExtentArrayType
|
static UnboxedType |
ExtentType
|
static Primitive |
FloatType
|
static RVMClass |
FunctionTableType
|
protected int |
id
Type id -- used to index into typechecking datastructures |
static RVMClass |
IMTType
|
static Primitive |
IntType
|
static RVMClass |
ITableArrayType
|
static RVMClass |
ITableType
|
static RVMClass |
JavaIoSerializableType
|
static RVMClass |
JavaLangClassType
|
static RVMClass |
JavaLangCloneableType
|
static RVMArray |
JavaLangObjectArrayType
|
static RVMClass |
JavaLangObjectType
|
static RVMField |
JavaLangRefReferenceReferenceField
|
static RVMClass |
JavaLangRefReferenceType
|
static RVMClass |
JavaLangStringType
|
static RVMClass |
JavaLangThrowableType
|
static RVMClass |
LinkageTripletTableType
|
private static int |
LOG_ROW_SIZE
2^LOG_ROW_SIZE is the number of elements per row |
static Primitive |
LongType
|
static RVMClass |
MagicType
|
private int |
mmAllocator
The memory manager's allocator id for this type. |
private static int |
nextId
Next space in the the type array |
protected static int[] |
NOREFS_OFFSET_ARRAY
A zero-length array, used as GC metadata for primitive arrays. |
static RVMArray |
ObjectReferenceArrayType
|
static RVMClass |
ObjectReferenceType
|
static RVMArray |
OffsetArrayType
|
static UnboxedType |
OffsetType
|
static int[] |
REFARRAY_OFFSET_ARRAY
Alias null for clarity |
protected int[] |
referenceOffsets
GC metadata for this type. |
private static int |
ROW_MASK
Mask to ascertain row from id number |
static Primitive |
ShortType
|
protected short[] |
superclassIds
The superclass ids for this type. |
protected int |
tibOffset
index of JTOC slot that has type information block for this RVMType |
static RVMClass |
TIBType
|
protected TypeReference |
typeRef
Canonical type reference for this RVMType instance |
private static RVMType[][] |
types
All types |
static Primitive |
VoidType
|
static RVMArray |
WordArrayType
|
static UnboxedType |
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.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 |
Constructor Summary | |
---|---|
protected |
RVMType(TypeReference typeRef,
Class<?> classForType,
int dimension,
RVMAnnotation[] annotations)
Create an instance of a RVMType |
protected |
RVMType(TypeReference typeRef,
int dimension,
RVMAnnotation[] annotations)
Create an instance of a RVMType |
Method Summary | |
---|---|
abstract void |
allBootImageTypesResolved()
This method is only called by the bootimage writer. |
RVMArray |
asArray()
|
RVMClass |
asClass()
|
Primitive |
asPrimitive()
|
UnboxedType |
asUnboxedType()
|
protected static Class<?> |
createClassForType(RVMType type,
TypeReference typeRef)
Utility to create a java.lang.Class for the given type using the given type reference |
RVMMethod |
findVirtualMethod(Atom memberName,
Atom memberDescriptor)
Find specified virtual method description. |
RVMArray |
getArrayTypeForElementType()
Get array type corresponding to "this" array element type. |
Class<?> |
getClassForType()
Instance of java.lang.Class corresponding to this type. |
ClassLoader |
getClassLoader()
Get the class loader for this type |
Atom |
getDescriptor()
Descriptor for this type. |
boolean |
getDesiredAssertionStatus()
Should assertions be enabled on this type? |
abstract int |
getDimensionality()
Number of [ in descriptor for arrays; -1 for primitives; 0 for classes |
int[] |
getDoesImplement()
get doesImplement vector (@see DynamicTypeCheck) |
int |
getId()
Get the numeric identifier for this type |
abstract RVMField[] |
getInstanceFields()
Non-static fields of this class/array type (composed with supertypes, if any). |
abstract int |
getMemoryBytes()
Number of bytes in memory required to represent the type |
int |
getMMAllocator()
This returns the allocator id as supplied by the memory manager. |
int[] |
getReferenceOffsets()
Offsets of reference-containing instance fields of this class type. |
Class<?> |
getResolvedClassForType()
Instance of java.lang.Class corresponding to this type. |
abstract int |
getStackWords()
Space required when this type is stored on the stack (or as a field), in words. |
abstract RVMField[] |
getStaticFields()
Static fields of this class/array type. |
abstract RVMMethod[] |
getStaticMethods()
Statically dispatched methods of this class/array type. |
short[] |
getSuperclassIds()
get superclass id vector (@see DynamicTypeCheck) |
abstract Offset |
getThinLockOffset()
Get the offset in instances of this type assigned to the thin lock word. |
RVMMethod |
getTIBMethodAtSlot(int slot)
Return the method at the given TIB slot |
Offset |
getTibOffset()
Get offset of tib slot from start of jtoc, in bytes. |
static RVMType |
getType(int id)
Get the type for the given id |
abstract 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 |
abstract TIB |
getTypeInformationBlock()
Runtime type information for this class/array type. |
TypeReference |
getTypeRef()
Canonical type reference for this type. |
abstract RVMMethod[] |
getVirtualMethods()
Virtually dispatched methods of this class/array type (composed with supertypes, if any). |
abstract boolean |
hasFinalizer()
Does this type override java.lang.Object.finalize()? |
int |
hashCode()
Define hashCode(), to allow use of consistent hash codes during bootImage writing and run-time |
abstract void |
initialize()
Cause initialization to take place. |
abstract void |
instantiate()
Cause instantiation to take place. |
abstract boolean |
isAcyclicReference()
Reference Count GC: Is a reference of this type contained in another object inherently acyclic (without cycles)? |
abstract boolean |
isArrayType()
Is this an instance of RVMArray? |
boolean |
isAssignableFrom(RVMType type)
|
boolean |
isBooleanType()
|
boolean |
isByteType()
|
boolean |
isCharType()
|
abstract boolean |
isClassType()
Is this is an instance of RVMClass? |
boolean |
isDoubleType()
|
boolean |
isFloatType()
|
abstract boolean |
isInBootImage()
Is this class part of the virtual machine's boot image? |
abstract boolean |
isInitialized()
Initialization status. |
abstract boolean |
isInstantiated()
Instantiation status. |
boolean |
isIntLikeType()
|
boolean |
isIntType()
|
boolean |
isJavaLangObjectType()
|
boolean |
isJavaLangStringType()
|
boolean |
isJavaLangThrowableType()
|
boolean |
isLongType()
|
boolean |
isNonMoving()
Is this field a type that must never move? |
abstract boolean |
isPrimitiveType()
Is this a primitive type? |
abstract boolean |
isReferenceType()
Is this a reference type? |
abstract boolean |
isResolved()
Resolution status. |
boolean |
isShortType()
|
abstract boolean |
isUnboxedType()
Is this an unboxed type? |
boolean |
isVoidType()
|
abstract void |
markAsBootImageClass()
Only intended to be used by the BootImageWriter |
private static int |
nextId(RVMType it)
Allocate entry in types array and add it (NB resize array if it's not long enough) |
static int |
numTypes()
How many types have been created? |
abstract void |
resolve()
Cause resolution to take place. |
void |
setMMAllocator(int allocator)
Record the allocator information the memory manager holds about this type. |
void |
setSpecializedMethod(int id,
ArchitectureSpecific.CodeArray code)
Set the specialized method for a class or array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int[] NOREFS_OFFSET_ARRAY
public static final int[] REFARRAY_OFFSET_ARRAY
null
for clarity
private static int nextId
private static final int LOG_ROW_SIZE
private static final int ROW_MASK
private static RVMType[][] types
protected static final RVMField[] emptyVMField
protected static final RVMMethod[] emptyVMMethod
protected static final RVMClass[] emptyVMClass
public static final Primitive VoidType
public static final Primitive BooleanType
public static final Primitive ByteType
public static final Primitive ShortType
public static final Primitive IntType
public static final Primitive LongType
public static final Primitive FloatType
public static final Primitive DoubleType
public static final Primitive CharType
public static final RVMClass JavaLangObjectType
public static final RVMArray JavaLangObjectArrayType
public static final RVMClass JavaLangClassType
public static final RVMClass JavaLangThrowableType
public static final RVMClass JavaLangStringType
public static final RVMClass JavaLangCloneableType
public static final RVMClass JavaIoSerializableType
public static final RVMClass JavaLangRefReferenceType
public static final RVMField JavaLangRefReferenceReferenceField
public static final RVMClass MagicType
public static final UnboxedType WordType
public static final RVMArray WordArrayType
public static final UnboxedType AddressType
public static final RVMArray AddressArrayType
public static final RVMClass ObjectReferenceType
public static final RVMArray ObjectReferenceArrayType
public static final UnboxedType OffsetType
public static final RVMArray OffsetArrayType
public static final UnboxedType ExtentType
public static final RVMArray ExtentArrayType
public static final UnboxedType CodeType
public static final RVMArray CodeArrayType
public static final RVMClass TIBType
public static final RVMClass ITableType
public static final RVMClass ITableArrayType
public static final RVMClass IMTType
public static final RVMClass FunctionTableType
public static final RVMClass LinkageTripletTableType
protected final TypeReference typeRef
protected final int id
protected final int tibOffset
private final Class<?> classForType
protected final int dimension
DynamicTypeCheckExpansion
).
protected int depth
DynamicTypeCheckExpansion
).
private RVMArray cachedElementType
protected short[] superclassIds
protected int[] doesImplement
private int mmAllocator
protected int[] referenceOffsets
Constructor Detail |
---|
protected RVMType(TypeReference typeRef, Class<?> classForType, int dimension, RVMAnnotation[] annotations)
RVMType
typeRef
- The canonical type reference for this type.classForType
- The java.lang.Class representationdimension
- The dimensionalityannotations
- array of runtime visible annotationsprotected RVMType(TypeReference typeRef, int dimension, RVMAnnotation[] annotations)
RVMType
typeRef
- The canonical type reference for this type.dimension
- The dimensionalityannotations
- array of runtime visible annotationsMethod Detail |
---|
public final TypeReference getTypeRef()
public final int getId()
public final Class<?> getClassForType()
public final Class<?> getResolvedClassForType()
public final Offset getTibOffset()
public final ClassLoader getClassLoader()
public boolean getDesiredAssertionStatus()
false
public final Atom getDescriptor()
public final int hashCode()
hashCode
in class Object
public abstract int getTypeDepth()
public abstract boolean isAcyclicReference()
public abstract int getDimensionality()
public final RVMClass asClass()
public final RVMArray asArray()
public final Primitive asPrimitive()
public final UnboxedType asUnboxedType()
public final boolean isVoidType()
public final boolean isBooleanType()
public final boolean isByteType()
public final boolean isShortType()
public final boolean isIntType()
public final boolean isLongType()
public final boolean isFloatType()
public final boolean isDoubleType()
public final boolean isCharType()
public final boolean isIntLikeType()
public final boolean isJavaLangObjectType()
public final boolean isJavaLangThrowableType()
public final boolean isJavaLangStringType()
public final RVMArray getArrayTypeForElementType()
public final short[] getSuperclassIds()
public final int[] getDoesImplement()
private static int nextId(RVMType it)
public static int numTypes()
public static RVMType getType(int id)
protected static Class<?> createClassForType(RVMType type, TypeReference typeRef)
public final RVMMethod findVirtualMethod(Atom memberName, Atom memberDescriptor)
memberName
- method name - something like "foo"memberDescriptor
- method descriptor - something like "I" or "()I"
public final RVMMethod getTIBMethodAtSlot(int slot)
slot
- the slot that contains the method
public abstract boolean isResolved()
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".
public abstract boolean isInstantiated()
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".
public abstract boolean isInitialized()
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".
public abstract void markAsBootImageClass()
public abstract boolean isInBootImage()
public abstract Offset getThinLockOffset()
public abstract boolean isClassType()
public abstract boolean isArrayType()
public abstract boolean isPrimitiveType()
public abstract boolean isUnboxedType()
public abstract boolean isReferenceType()
public boolean isAssignableFrom(RVMType type)
public abstract int getStackWords()
public abstract int getMemoryBytes()
public abstract void resolve()
public abstract void allBootImageTypesResolved()
resolve()
has been called on all
bootimage types but before instantiate()
has been called
on any bootimage type.
This provides a hook to compute various summaries that cannot be computed before types
are resolved.
public abstract void instantiate()
public abstract void initialize()
<clinit>
method to be executed.
public abstract boolean hasFinalizer()
public abstract RVMField[] getStaticFields()
public abstract RVMField[] getInstanceFields()
public abstract RVMMethod[] getStaticMethods()
public abstract RVMMethod[] getVirtualMethods()
public abstract TIB getTypeInformationBlock()
public final void setSpecializedMethod(int id, ArchitectureSpecific.CodeArray code)
public final void setMMAllocator(int allocator)
allocator
- the allocator to recordpublic final int getMMAllocator()
public boolean isNonMoving()
public int[] getReferenceOffsets()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |