org.jikesrvm.classloader
Class RVMClass

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

public final class RVMClass
extends RVMType
implements Constants, ClassLoaderConstants

Description of a java "class" type.

This description is read from a ".class" file as classes/field/methods referenced by the running program need to be bound in to the running image.

See Also:
RVMType, RVMArray, Primitive, UnboxedType

Field Summary
private  boolean acyclic
          Reference Count GC: is this type acyclic?
private  int alignment
          The desired alignment for instances of this type.
private  Annotation[] annotations
          Cached set of inherited and declared annotations.
private  RVMMethod classInitializerMethod
          Class initializer method, null if no method or if class is initialized (ie class initializer method has been run)
static boolean classLoadingDisabled
          Flag for closed world testing
static ClassLoadingListener classLoadListener
           
private  int[] constantPool
          The constant pool holds constants used by the class and the Java bytecodes in the methods associated with this class.
private  RVMMethod[] constructorMethods
          constructor methods of class
private  TypeReference[] declaredClasses
          Declared inner classes, may be null
private  RVMField[] declaredFields
          Fields of this class
private  RVMClass[] declaredInterfaces
          Interfaces supported by this class
private  RVMMethod[] declaredMethods
          Methods of this class
private  TypeReference declaringClass
          The outer class, or null if this is not a inner/nested class
private  boolean desiredAssertionStatus
          Are assertions enabled on this class?
private  TypeReference enclosingClass
          The enclosing class if this is a local class
private  MethodReference enclosingMethod
          The enclosing method if this is a local class
private  FieldLayoutContext fieldLayoutContext
          A field layout helper - used to keep context regarding field layouts.
private  boolean hasFinalizer
          Do objects of this class have a finalizer method?
private  IMT imt
          The imt for this class
private  boolean inBootImage
          Is this class type in the bootimage?
private  RVMField[] instanceFields
          fields distinct for each instance of class
private  int instanceSize
          Total size of per-instance data, in bytes
private static int interfaceCount
           
private static Object interfaceCountLock
           
private  int interfaceId
           
private static RVMClass[] interfaces
           
private  short modifiers
          ClassLoaderConstants
(package private)  RVMMethod[] noIMTConflictMap
           
private  Object[] objectCache
          Set of objects that are cached here to ensure they are not collected by GC
private  Atom signature
          The signature is a string representing the generic type for this class declaration, may be null
private  Atom sourceName
          Name of file .class file was compiled from, may be null
private  byte state
          current class-loading stage (loaded, resolved, instantiated, initializing or initialized)
private  RVMField[] staticFields
          fields shared by all instances of class
private  RVMMethod[] staticMethods
          static methods of class
private  RVMClass[] subClasses
          Non-final list of sub-classes.
private  RVMClass superClass
          Super class of this class
private  Offset thinLockOffset
          At what offset is the thin lock word to be found in instances of objects of this type?
private  TIB typeInformationBlock
          type and virtual method dispatch table for class
private  RVMMethod[] virtualMethods
          virtual methods of class
 
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
RVMClass(TypeReference typeRef, int[] constantPool, short modifiers, RVMClass superClass, RVMClass[] declaredInterfaces, RVMField[] declaredFields, RVMMethod[] declaredMethods, TypeReference[] declaredClasses, TypeReference declaringClass, TypeReference enclosingClass, MethodReference enclosingMethod, Atom sourceName, RVMMethod classInitializerMethod, Atom signature, RVMAnnotation[] annotations)
          Construct a class from its constituent loaded parts
 
Method Summary
 void addCachedObject(Object o)
          Add the given cached object.
private  void addSubClass(RVMClass sub)
          Add to list of classes that derive from this one.
 void allBootImageTypesResolved()
          This method is only called by the bootimage writer.
private  void assignInterfaceId()
           
(package private) static Class<?> createReflectionClass(RVMMethod methodToCall)
          Create a synthetic class that extends ReflectionBase and invokes the given method
 boolean declaresFinalInstanceField()
          Does this class directly define a final instance field (has implications for JMM).
 RVMField findDeclaredField(Atom fieldName)
          Find description of a field of this class.
 RVMField findDeclaredField(Atom fieldName, Atom fieldDescriptor)
          Find description of a field of this class.
 RVMMethod findDeclaredMethod(Atom methodName)
          Find the first description of a method of this class.
 RVMMethod findDeclaredMethod(Atom methodName, Atom methodDescriptor)
          Find description of a method of this class.
 RVMMethod findInitializerMethod(Atom memberDescriptor)
          Find specified initializer method description.
 RVMMethod findMainMethod()
          Find description of "public static void main(String[])" method of this class.
 RVMMethod findStaticMethod(Atom memberName, Atom memberDescriptor)
          Find specified static method description.
 int getAlignment()
           
 RVMClass[] getAllImplementedInterfaces()
           
(package private)  Annotation[] getAnnotationsInternal()
           
static RVMClass getClassFromStackFrame(int skip)
          Used for accessibility checks in reflection code.
 RVMMethod getClassInitializerMethod()
          Static initializer method for this class (null -> no static initializer or initializer already been run).
static ClassLoader getClassLoaderFromStackFrame(int skip)
          Support for user-written class loaders: It's required to find the classloader of the class whose method requires another class to be loaded; the initiating loader of the required class is the defining loader of the requiring class.
 RVMMethod[] getConstructorMethods()
          Constructors () methods of this class.
 TypeReference[] getDeclaredClasses()
          Declared inner and static member classes.
 RVMField[] getDeclaredFields()
          Fields defined directly by this class (i.e. not including superclasses).
 RVMClass[] getDeclaredInterfaces()
          Interfaces implemented directly by this class (ie. not including superclasses).
 RVMMethod[] getDeclaredMethods()
          Methods defined directly by this class (i.e. not including superclasses).
 TypeReference getDeclaringClass()
          Class that declared this class, or null if this is not an inner/nested class.
 boolean getDesiredAssertionStatus()
          Should assertions be enabled on this type?
 int getDimensionality()
          Number of [ in descriptor for arrays; -1 for primitives; 0 for classes
 int getDoesImplementBitMask()
           
 int getDoesImplementIndex()
           
 TypeReference getEnclosingClass()
          Class that immediately encloses this class, or null if this is not an inner/nested class.
 FieldLayoutContext getFieldLayoutContext()
          Set object representing available holes in the field layout
 FieldReference getFieldRef(int constantPoolIndex)
          Get contents of a "fieldRef" constant pool entry.
 RVMField[] getInstanceFields()
          Non-static fields of this class (composed with supertypes, if any).
 int getInstanceSize()
          Total size, in bytes, of an instance of this class (including object header).
 int getInstanceSizeInternal()
          Total size, in bytes, of an instance of this class (including object header).
static RVMClass getInterface(int id)
           
 int getInterfaceId()
          Classes used as Interfaces get assigned an interface id.
 byte getLiteralDescription(int constantPoolIndex)
          Get description of a literal constant.
 Offset getLiteralOffset(int constantPoolIndex)
          Get offset of a literal constant, in bytes.
 int getMemoryBytes()
          Number of bytes in memory required to represent the type
 MethodReference getMethodRef(int constantPoolIndex)
          Get contents of a "methodRef" constant pool entry.
 int getModifiers()
          Get the modifiers associated with this class ClassLoaderConstants.
 int getNumberOfNonFinalReferences()
           
 String getPackageName()
          Package name - something like "java.lang".
 Atom getSignature()
          Generic type information for class
 Atom getSourceName()
          Name of source file from which class was compiled - something like "c:\java\src\java\lang\Object.java".
 int getStackWords()
          Space required when this type is stored on the stack (or as a field), in words.
 RVMField[] getStaticFields()
          Static fields of this class.
 RVMMethod[] getStaticMethods()
          Statically dispatched methods of this class.
 RVMClass[] getSubClasses()
          Currently loaded classes that "extend" this class.
 RVMClass getSuperClass()
          Superclass of this class (null means "no superclass", i.e. class is "java/lang/Object").
 Offset getThinLockOffset()
          Get the offset in instances of this type assigned to the thin lock word.
 int getTypeDepth()
          Get number of superclasses to Object.
 TIB getTypeInformationBlock()
          Runtime type information for this class type.
 TypeReference getTypeRef(int constantPoolIndex)
          Get contents of a "typeRef" constant pool entry.
(package private)  Atom getUtf(int constantPoolIndex)
          Get contents of a "utf" constant pool entry.
 RVMMethod[] getVirtualMethods()
          Virtually dispatched methods of this class (composed with supertypes, if any).
 boolean hasBridgeFromNativeAnnotation()
          The methods of this class are only called from native code, they are compiled with a special prolog to interface with the native stack frame.
 boolean hasDynamicBridgeAnnotation()
          Should the methods of this class be compiled with special register save/restore logic?
 boolean hasFinalizer()
          Does this class override java.lang.Object.finalize()?
 boolean hasSaveVolatileAnnotation()
          Should the methods of this class save incoming registers ?
 void initialize()
          Cause initialization to take place.
 void instantiate()
          Cause instantiation to take place.
 boolean isAbstract()
          Non-instantiable?
 boolean isAcyclicReference()
          Reference Count GC: Is a reference of this type contained in another object inherently acyclic (without cycles)?
 boolean isAnnotation()
          Annotation type
 boolean isAnonymousClass()
           
 boolean isArrayType()
          Is this an instance of RVMArray?
 boolean isClassType()
          Is this is an instance of RVMClass?
 boolean isEnum()
          Is enumeration?
 boolean isFinal()
          Non-subclassable?
 boolean isInBootImage()
          Is this class part of the virtual machine's boot image?
 boolean isInitialized()
          Initialization status.
 boolean isInstantiated()
          Instantiation status.
 boolean isInterface()
          An "interface" description rather than a "class" description?
 boolean isLocalClass()
           
 boolean isMemberClass()
           
 boolean isPrimitiveType()
          Is this a primitive type?
 boolean isPublic()
          Usable from other packages?
 boolean isReferenceType()
          Is this a reference type?
 boolean isResolved()
          Resolution status.
 boolean isSpecial()
          Use new-style "invokespecial" semantics for method calls in this class?
 boolean isSynthetic()
          Not present in source code file?
 boolean isThrowable()
           
 boolean isUnboxedType()
          Is this an unboxed type?
 void makeFieldTraced(RVMField field)
          Make the passed field a traced field by garbage collection.
 void markAsBootImageClass()
          Only intended to be used by the BootImageWriter
private  void markFinalFieldsAsLiterals()
          Mark final fields as being available as literals
private  void publishResolved(TIB allocatedTib, short[] superclassIds, int[] doesImplement)
          Atomically initialize the important parts of the TIB and let the world know this type is resolved.
 void resolve()
          Cause resolution to take place.
(package private)  void resolveNativeMethods()
           
private  void resolveNativeMethodsInternal(RVMMethod[] methods)
           
 void setAlignment(int align)
          Set the alignment for instances of this class type
 void setAllFinalStaticJTOCEntries()
          Copy the values of all static final fields into the JTOC.
 void setFieldLayoutContext(FieldLayoutContext newLayout)
          Set object representing available holes in the field layout
private  void setFinalStaticJTOCEntry(RVMField field, Offset fieldOffset)
          Insert the value of a final static field into the JTOC
 void setIMT(IMT imt)
          Set the imt object.
 void setInstanceSizeInternal(int size)
          Set the size of the instance.
(package private)  void setResolvedMembers()
          Set the resolvedMember in all declared members.
 void setThinLockOffset(Offset offset)
          Set the thin lock offset for instances of this type.
 String toString()
          Name - something like "java.lang.String".
 void unregisterNativeMethods()
          Unregisters all native methods
 void updateJTOCEntry(RVMMethod m)
          Update the JTOC slot for the given static method to point to the current compiled code for the given method.
 void updateMethod(RVMMethod m)
          Given a method declared by this class, update all dispatching tables to refer to the current compiled code for the method.
 void updateTIBEntry(RVMMethod m)
          Update this class's TIB entry for the given method to point to the current compiled code for the given method.
 void updateVirtualMethod(RVMMethod m)
          Update the TIB entry's for all classes that inherit the given method to point to the current compiled code for the given method.
 
Methods inherited from class org.jikesrvm.classloader.RVMType
asArray, asClass, asPrimitive, asUnboxedType, createClassForType, findVirtualMethod, getArrayTypeForElementType, getClassForType, getClassLoader, getDescriptor, 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, 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

classLoadingDisabled

public static boolean classLoadingDisabled
Flag for closed world testing


constantPool

private final int[] constantPool
The constant pool holds constants used by the class and the Java bytecodes in the methods associated with this class. This constant pool isn't that from the class file, instead it has been processed during class loading (see ClassFileReader.readClass(org.jikesrvm.classloader.TypeReference, java.io.DataInputStream)). The loaded class' constant pool has 3 bits of type information (such as (see ClassLoaderConstants.CP_INT)), the rest of the int holds data as follows:


modifiers

private final short modifiers
ClassLoaderConstants


superClass

private final RVMClass superClass
Super class of this class


subClasses

private RVMClass[] subClasses
Non-final list of sub-classes. Classes added as sub-classes are loaded.


declaredInterfaces

private final RVMClass[] declaredInterfaces
Interfaces supported by this class


declaredFields

private final RVMField[] declaredFields
Fields of this class


declaredMethods

private final RVMMethod[] declaredMethods
Methods of this class


declaredClasses

private final TypeReference[] declaredClasses
Declared inner classes, may be null


declaringClass

private final TypeReference declaringClass
The outer class, or null if this is not a inner/nested class


enclosingClass

private final TypeReference enclosingClass
The enclosing class if this is a local class


enclosingMethod

private final MethodReference enclosingMethod
The enclosing method if this is a local class


sourceName

private final Atom sourceName
Name of file .class file was compiled from, may be null


signature

private final Atom signature
The signature is a string representing the generic type for this class declaration, may be null


classInitializerMethod

private RVMMethod classInitializerMethod
Class initializer method, null if no method or if class is initialized (ie class initializer method has been run)


state

private byte state
current class-loading stage (loaded, resolved, instantiated, initializing or initialized)


staticFields

private RVMField[] staticFields
fields shared by all instances of class


instanceFields

private RVMField[] instanceFields
fields distinct for each instance of class


instanceSize

private int instanceSize
Total size of per-instance data, in bytes


alignment

private int alignment
The desired alignment for instances of this type.


fieldLayoutContext

private FieldLayoutContext fieldLayoutContext
A field layout helper - used to keep context regarding field layouts. Managed by the field layout objects in the ObjectModel.


staticMethods

private RVMMethod[] staticMethods
static methods of class


constructorMethods

private RVMMethod[] constructorMethods
constructor methods of class


virtualMethods

private RVMMethod[] virtualMethods
virtual methods of class


hasFinalizer

private boolean hasFinalizer
Do objects of this class have a finalizer method?


typeInformationBlock

private TIB typeInformationBlock
type and virtual method dispatch table for class


inBootImage

private boolean inBootImage
Is this class type in the bootimage? Types in the boot image can be initialized prior to execution (therefore removing runtime resolution).


thinLockOffset

private Offset thinLockOffset
At what offset is the thin lock word to be found in instances of objects of this type? A value of -1 indicates that the instances of this type do not have inline thin locks.


acyclic

private boolean acyclic
Reference Count GC: is this type acyclic?


annotations

private Annotation[] annotations
Cached set of inherited and declared annotations.


objectCache

private Object[] objectCache
Set of objects that are cached here to ensure they are not collected by GC


imt

private IMT imt
The imt for this class


desiredAssertionStatus

private final boolean desiredAssertionStatus
Are assertions enabled on this class?


classLoadListener

public static final ClassLoadingListener classLoadListener

interfaceCountLock

private static final Object interfaceCountLock

interfaceCount

private static int interfaceCount

interfaces

private static RVMClass[] interfaces

interfaceId

private int interfaceId

noIMTConflictMap

RVMMethod[] noIMTConflictMap
Constructor Detail

RVMClass

RVMClass(TypeReference typeRef,
         int[] constantPool,
         short modifiers,
         RVMClass superClass,
         RVMClass[] declaredInterfaces,
         RVMField[] declaredFields,
         RVMMethod[] declaredMethods,
         TypeReference[] declaredClasses,
         TypeReference declaringClass,
         TypeReference enclosingClass,
         MethodReference enclosingMethod,
         Atom sourceName,
         RVMMethod classInitializerMethod,
         Atom signature,
         RVMAnnotation[] annotations)
Construct a class from its constituent loaded parts

Parameters:
typeRef - the type reference that was resolved to this class
constantPool - array of ints encoding constant value
modifiers - ClassLoaderConstants
superClass - parent of this class
declaredInterfaces - array of interfaces this class implements
declaredFields - fields of the class
declaredMethods - methods of the class
declaredClasses - declared inner classes
declaringClass - outer class if an inner class
sourceName - source file name
classInitializerMethod - handle to class initializer method
signature - the generic type name for this class
annotations - array of runtime visible annotations
Method Detail

toString

public String toString()
Name - something like "java.lang.String".

Overrides:
toString in class Object

getPackageName

public String getPackageName()
Package name - something like "java.lang".

Returns:
package name or the empty string if the class is a member of the unnamed package

getStackWords

public int getStackWords()
Description copied from class: RVMType
Space required when this type is stored on the stack (or as a field), in words. Ie. 0, 1, or 2 words:

Specified by:
getStackWords in class RVMType
Returns:
1

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

isInterface

public boolean isInterface()
An "interface" description rather than a "class" description?


isPublic

public boolean isPublic()
Usable from other packages?


isFinal

public boolean isFinal()
Non-subclassable?


isAbstract

public boolean isAbstract()
Non-instantiable?


isSpecial

public boolean isSpecial()
Use new-style "invokespecial" semantics for method calls in this class?


isSynthetic

public boolean isSynthetic()
Not present in source code file?


isEnum

public boolean isEnum()
Is enumeration?


isAnnotation

public boolean isAnnotation()
Annotation type


isAnonymousClass

public boolean isAnonymousClass()
Returns:
true if this is a representation of an anonymous class

isLocalClass

public boolean isLocalClass()
Returns:
true if this is a representation of a local class, ie local to a block of code.

isMemberClass

public boolean isMemberClass()
Returns:
true if this is a representation of a member class

isThrowable

public boolean isThrowable()
Returns:
true if this an object of this class could be assigned to Throwable

getModifiers

public int getModifiers()
Get the modifiers associated with this class ClassLoaderConstants.


getSignature

public Atom getSignature()
Generic type information for class


getSourceName

public Atom getSourceName()
Name of source file from which class was compiled - something like "c:\java\src\java\lang\Object.java". (null --> "unknown - wasn't recorded by compiler").


getSuperClass

public RVMClass getSuperClass()
Superclass of this class (null means "no superclass", i.e. class is "java/lang/Object").


getSubClasses

public RVMClass[] getSubClasses()
Currently loaded classes that "extend" this class.


getDeclaredInterfaces

public RVMClass[] getDeclaredInterfaces()
Interfaces implemented directly by this class (ie. not including superclasses).


getDeclaredFields

public RVMField[] getDeclaredFields()
Fields defined directly by this class (i.e. not including superclasses).


declaresFinalInstanceField

public boolean declaresFinalInstanceField()
Does this class directly define a final instance field (has implications for JMM).


getDeclaredMethods

public RVMMethod[] getDeclaredMethods()
Methods defined directly by this class (i.e. not including superclasses).


getDeclaredClasses

public TypeReference[] getDeclaredClasses()
Declared inner and static member classes.


getDeclaringClass

public TypeReference getDeclaringClass()
Class that declared this class, or null if this is not an inner/nested class.


getEnclosingClass

public TypeReference getEnclosingClass()
Class that immediately encloses this class, or null if this is not an inner/nested class.


setResolvedMembers

void setResolvedMembers()
Set the resolvedMember in all declared members.


getClassInitializerMethod

public RVMMethod getClassInitializerMethod()
Static initializer method for this class (null -> no static initializer or initializer already been run).


getAnnotationsInternal

Annotation[] getAnnotationsInternal()
Overrides:
getAnnotationsInternal in class AnnotatedElement

findDeclaredField

public RVMField findDeclaredField(Atom fieldName,
                                  Atom fieldDescriptor)
Find description of a field of this class.

Parameters:
fieldName - field name - something like "foo"
fieldDescriptor - field descriptor - something like "I"
Returns:
description (null --> not found)

findDeclaredField

public RVMField findDeclaredField(Atom fieldName)
Find description of a field of this class. NB. ignores descriptor.

Parameters:
fieldName - field name - something like "foo"
Returns:
description (null --> not found)

findDeclaredMethod

public RVMMethod findDeclaredMethod(Atom methodName,
                                    Atom methodDescriptor)
Find description of a method of this class.

Parameters:
methodName - method name - something like "foo"
methodDescriptor - method descriptor - something like "()I"
Returns:
description (null --> not found)

findDeclaredMethod

public RVMMethod findDeclaredMethod(Atom methodName)
Find the first description of a method of this class.

Parameters:
methodName - method name - something like "foo"
Returns:
description (null --> not found)

findMainMethod

public RVMMethod findMainMethod()
Find description of "public static void main(String[])" method of this class.

Returns:
description (null --> not found)

addCachedObject

public void addCachedObject(Object o)
Add the given cached object.


setIMT

public void setIMT(IMT imt)
Set the imt object.


getLiteralOffset

public Offset getLiteralOffset(int constantPoolIndex)
Get offset of a literal constant, in bytes. Offset is with respect to virtual machine's "table of contents" (HTOC).


getLiteralDescription

public byte getLiteralDescription(int constantPoolIndex)
Get description of a literal constant.


getTypeRef

public TypeReference getTypeRef(int constantPoolIndex)
Get contents of a "typeRef" constant pool entry.

Returns:
type that was referenced

getMethodRef

public MethodReference getMethodRef(int constantPoolIndex)
Get contents of a "methodRef" constant pool entry.


getFieldRef

public FieldReference getFieldRef(int constantPoolIndex)
Get contents of a "fieldRef" constant pool entry.


getUtf

Atom getUtf(int constantPoolIndex)
Get contents of a "utf" constant pool entry.


hasDynamicBridgeAnnotation

public boolean hasDynamicBridgeAnnotation()
Should the methods of this class be compiled with special register save/restore logic?

See Also:
DynamicBridge

hasBridgeFromNativeAnnotation

public boolean hasBridgeFromNativeAnnotation()
The methods of this class are only called from native code, they are compiled with a special prolog to interface with the native stack frame.


hasSaveVolatileAnnotation

public boolean hasSaveVolatileAnnotation()
Should the methods of this class save incoming registers ?

See Also:
SaveVolatile

hasFinalizer

public boolean hasFinalizer()
Does this class override java.lang.Object.finalize()?

Specified by:
hasFinalizer in class RVMType

getStaticFields

public RVMField[] getStaticFields()
Static fields of this class. Values in these fields are shared by all class instances.

Specified by:
getStaticFields in class RVMType

getInstanceFields

public RVMField[] getInstanceFields()
Non-static fields of this class (composed with supertypes, if any). Values in these fields are distinct for each class instance.

Specified by:
getInstanceFields in class RVMType

getStaticMethods

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

Specified by:
getStaticMethods in class RVMType

getConstructorMethods

public RVMMethod[] getConstructorMethods()
Constructors () methods of this class.


getVirtualMethods

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

Specified by:
getVirtualMethods in class RVMType

getAllImplementedInterfaces

public RVMClass[] getAllImplementedInterfaces()
Returns:
All of the interfaces implemented by this class either directly or by inheritance from superclass and superinterfaces recursively.

getInstanceSize

public int getInstanceSize()
Total size, in bytes, of an instance of this class (including object header).


getInstanceSizeInternal

public int getInstanceSizeInternal()
Total size, in bytes, of an instance of this class (including object header). Doesn't perform any verification.


setInstanceSizeInternal

public void setInstanceSizeInternal(int size)
Set the size of the instance. Only meant to be called from ObjectModel et al. must be called when lock on class object is already held (ie from resolve).


getNumberOfNonFinalReferences

public int getNumberOfNonFinalReferences()
Returns:
number of fields that are non-final

getFieldLayoutContext

public FieldLayoutContext getFieldLayoutContext()
Set object representing available holes in the field layout


setFieldLayoutContext

public void setFieldLayoutContext(FieldLayoutContext newLayout)
Set object representing available holes in the field layout


getAlignment

public int getAlignment()
Returns:
alignment for instances of this class type

setAlignment

public void setAlignment(int align)
Set the alignment for instances of this class type


findStaticMethod

public RVMMethod findStaticMethod(Atom memberName,
                                  Atom memberDescriptor)
Find specified static method description.

Parameters:
memberName - method name - something like "foo"
memberDescriptor - method descriptor - something like "I" or "()I"
Returns:
method description (null --> not found)

findInitializerMethod

public RVMMethod findInitializerMethod(Atom memberDescriptor)
Find specified initializer method description.

Parameters:
memberDescriptor - init method descriptor - something like "(I)V"
Returns:
method description (null --> not found)

getTypeInformationBlock

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

Specified by:
getTypeInformationBlock in class RVMType

getClassLoaderFromStackFrame

public static ClassLoader getClassLoaderFromStackFrame(int skip)
Support for user-written class loaders: It's required to find the classloader of the class whose method requires another class to be loaded; the initiating loader of the required class is the defining loader of the requiring class.

Parameters:
skip - specifies the number of frames back from the caller to the method whose class's loader is required

getClassFromStackFrame

public static RVMClass getClassFromStackFrame(int skip)
Used for accessibility checks in reflection code. Find the class of the method that corresponds to the requested frame.

Parameters:
skip - Specifies the number of frames back from the caller to the method whose class is required

getDesiredAssertionStatus

public boolean getDesiredAssertionStatus()
Description copied from class: RVMType
Should assertions be enabled on this type?

Overrides:
getDesiredAssertionStatus in class RVMType
Returns:
whether or not assertions should be enabled

resolve

public void resolve()
Cause resolution to take place. This will cause slots to be allocated in the JTOC. Space in the JTOC is allocated for static fields, static methods and constructors. Moreover, this method generates size and offset information for members of this class.

Side effects: superclasses and superinterfaces are resolved.

Specified by:
resolve in class RVMType

publishResolved

private void publishResolved(TIB allocatedTib,
                             short[] superclassIds,
                             int[] doesImplement)
Atomically initialize the important parts of the TIB and let the world know this type is resolved.

Parameters:
allocatedTib - The TIB that has been allocated for this type
superclassIds - The calculated superclass ids array
doesImplement - The calculated does implement array

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

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 if the class is acyclic and final (otherwise the reference could be to a subsequently loaded cyclic subclass)

setFinalStaticJTOCEntry

private void setFinalStaticJTOCEntry(RVMField field,
                                     Offset fieldOffset)
Insert the value of a final static field into the JTOC


instantiate

public void instantiate()
Cause instantiation to take place. This will cause the class's methods to be compiled and slots in the JTOC to be filled-in. The TIB will also be built.

Side effects: superclasses are instantiated.

Specified by:
instantiate in class RVMType

makeFieldTraced

public void makeFieldTraced(RVMField field)
Make the passed field a traced field by garbage collection. Also affects all subclasses.


initialize

public void initialize()
                throws ExceptionInInitializerError
Cause initialization to take place. This will cause the class's <clinit> method to be executed.

Side effects: superclasses are initialized, static fields receive initial values.

Specified by:
initialize in class RVMType
Throws:
ExceptionInInitializerError

markFinalFieldsAsLiterals

private void markFinalFieldsAsLiterals()
Mark final fields as being available as literals


setAllFinalStaticJTOCEntries

public void setAllFinalStaticJTOCEntries()
Copy the values of all static final fields into the JTOC. Note: This method should only be run AFTER the class initializer has run.


resolveNativeMethods

void resolveNativeMethods()

resolveNativeMethodsInternal

private void resolveNativeMethodsInternal(RVMMethod[] methods)

unregisterNativeMethods

public void unregisterNativeMethods()
Unregisters all native methods


addSubClass

private void addSubClass(RVMClass sub)
Add to list of classes that derive from this one.


updateMethod

public void updateMethod(RVMMethod m)
Given a method declared by this class, update all dispatching tables to refer to the current compiled code for the method.


updateJTOCEntry

public void updateJTOCEntry(RVMMethod m)
Update the JTOC slot for the given static method to point to the current compiled code for the given method. NOTE: This method is intentionally not synchronized to avoid deadlocks. We instead rely on the fact that we are always updating the JTOC with the most recent instructions for the method.


updateTIBEntry

public void updateTIBEntry(RVMMethod m)
Update this class's TIB entry for the given method to point to the current compiled code for the given method.

NOTE: This method is intentionally not synchronized to avoid deadlocks. We instead rely on the fact that we are always updating the JTOC with the most recent instructions for the method.


updateVirtualMethod

public void updateVirtualMethod(RVMMethod m)
Update the TIB entry's for all classes that inherit the given method to point to the current compiled code for the given method.

NOTE: This method is intentionally not synchronized to avoid deadlocks. We instead rely on the fact that we are always updating the JTOC with the most recent instructions for the method.


getInterfaceId

public int getInterfaceId()
Classes used as Interfaces get assigned an interface id. If the class is not an interface, attempting to use this id will cause an IncompatibleClassChangeError to be thrown


getDoesImplementIndex

public int getDoesImplementIndex()

getDoesImplementBitMask

public int getDoesImplementBitMask()

getInterface

public static RVMClass getInterface(int id)

assignInterfaceId

private void assignInterfaceId()

getDimensionality

public int getDimensionality()
Number of [ in descriptor for arrays; -1 for primitives; 0 for classes

Specified by:
getDimensionality in class RVMType
Returns:
0

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

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

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

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

getThinLockOffset

public Offset getThinLockOffset()
Get the offset in instances of this type assigned to the thin lock word. Is only known after class has been resolved.

Specified by:
getThinLockOffset in class RVMType

setThinLockOffset

public void setThinLockOffset(Offset offset)
Set the thin lock offset for instances of this type. Can be called at most once. and is invoked from ObjectModel.allocateThinLock (in object models which do not allocate thin locks for all scalar object types).


getTypeDepth

public int getTypeDepth()
Get number of superclasses to Object.

Specified by:
getTypeDepth in class RVMType

isClassType

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

Specified by:
isClassType in class RVMType
Returns:
true

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:
true

isUnboxedType

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

Specified by:
isUnboxedType in class RVMType
Returns:
false

createReflectionClass

static Class<?> createReflectionClass(RVMMethod methodToCall)
Create a synthetic class that extends ReflectionBase and invokes the given method

Parameters:
methodToCall - the method we wish to call reflectively
Returns:
the synthetic class