public abstract class RVMType extends AnnotatedElement
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:
Modifier and Type | Field and Description |
---|---|
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 |
declaredAnnotationDatas
Modifier | Constructor and Description |
---|---|
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 |
Modifier and Type | Method and Description |
---|---|
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) |
RVMMethod |
findVirtualMethod(Atom memberName,
Atom memberDescriptor)
Find specified virtual method description.
|
RVMArray |
getArrayTypeForElementType() |
Class<?> |
getClassForType() |
ClassLoader |
getClassLoader() |
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() |
int |
getId() |
abstract RVMField[] |
getInstanceFields() |
abstract int |
getMemoryBytes() |
int |
getMMAllocator()
This returns the allocator id as supplied by the memory manager.
|
int[] |
getReferenceOffsets() |
Class<?> |
getResolvedClassForType()
Gets the resolved class for a type.
|
abstract int |
getStackWords()
Space required when this type is stored on the stack
(or as a field), in words.
|
abstract RVMField[] |
getStaticFields() |
abstract RVMMethod[] |
getStaticMethods() |
short[] |
getSuperclassIds() |
abstract Offset |
getThinLockOffset() |
RVMMethod |
getTIBMethodAtSlot(int slot)
Return the method at the given TIB slot
|
Offset |
getTibOffset() |
static RVMType |
getType(int 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() |
TypeReference |
getTypeRef() |
abstract RVMMethod[] |
getVirtualMethods() |
abstract boolean |
hasFinalizer() |
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() |
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)
Records the allocator information the memory manager holds about this type.
|
void |
setSpecializedMethod(int id,
CodeArray code) |
(package private) static void |
updateArrayMethods(RVMMethod m)
Updates the TIB for all array types with the newly (re)compiled method.
|
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
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType
protected static final int[] NOREFS_OFFSET_ARRAY
public static final int[] REFARRAY_OFFSET_ARRAY
null
for clarityprivate static int nextId
private static final int LOG_ROW_SIZE
private static final int ROW_MASK
protected static final RVMField[] emptyVMField
protected static final RVMMethod[] emptyVMMethod
protected static final RVMClass[] emptyVMClass
public static final Primitive BooleanType
public static final Primitive DoubleType
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 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 ITableType
public static final RVMClass ITableArrayType
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
protected int depth
private RVMArray cachedElementType
protected short[] superclassIds
protected int[] doesImplement
private int mmAllocator
protected int[] referenceOffsets
null
.
In a class with pointers, it contains the offsets of
reference-containing instance fieldsprotected 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 annotationspublic final TypeReference getTypeRef()
public final int getId()
public final Class<?> getClassForType()
public final Class<?> getResolvedClassForType()
Note that this method may only be called when it's clear that the
class has already been resolved. If that is not guaranteed, use
getClassForType()
.
public final Offset getTibOffset()
public final ClassLoader getClassLoader()
public boolean getDesiredAssertionStatus()
false
public final Atom getDescriptor()
public final int hashCode()
public abstract int getTypeDepth()
public abstract boolean isAcyclicReference()
true
if the reference is acyclicpublic abstract int getDimensionality()
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)
it
- the type to addpublic static int numTypes()
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 methodpublic 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".
true
when the class has been resolvedpublic 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".
true
when the class has been instantiatedpublic 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".
true
when the class has been initializedpublic abstract void markAsBootImageClass()
public abstract boolean isInBootImage()
true
if the class is in the bootimagepublic 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)
type
- type to checjpublic 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()
true
if this type overrides java.lang.Object.finalize()
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, CodeArray code)
static void updateArrayMethods(RVMMethod m)
m
- the method that was recompiled. Must be a virtual method
declared by java.lang.Object
.public final void setMMAllocator(int allocator)
allocator
- the allocator to recordpublic final int getMMAllocator()
public boolean isNonMoving()
public int[] getReferenceOffsets()