org.jikesrvm.classloader
Class RVMField

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

public final class RVMField
extends RVMMember

A field of a java class.


Field Summary
private  int constantValueIndex
          constant pool index of field's value (0 --> not a "static final constant")
private  boolean madeTraced
          Has the field been made traced?
private  boolean reference
          Does the field hold a reference value?
private  byte size
          The size of the field in bytes
 
Fields inherited from class org.jikesrvm.classloader.RVMMember
memRef, modifiers, offset
 
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 RVMField(TypeReference declaringClass, MemberReference memRef, short modifiers, Atom signature, int constantValueIndex, RVMAnnotation[] annotations)
          Create a field.
 
Method Summary
(package private) static RVMField createAnnotationField(TypeReference annotationClass, MemberReference memRef)
          Create a field for a synthetic annotation class
private  int get32Bits(Object obj)
           
private  long get64Bits(Object obj)
           
 Address getAddressValueUnchecked(Object obj)
           
 boolean getBooleanValueUnchecked(Object obj)
           
 byte getByteValueUnchecked(Object obj)
           
 char getCharValueUnchecked(Object obj)
           
(package private)  int getConstantValueIndex()
          Get index of constant pool entry containing this "static final constant" field's value.
 double getDoubleValueUnchecked(Object obj)
           
 Extent getExtentValueUnchecked(Object obj)
           
 float getFloatValueUnchecked(Object obj)
           
 int getIntValueUnchecked(Object obj)
           
 long getLongValueUnchecked(Object obj)
           
 int getNumberOfStackSlots()
          How many stackslots do value of this type take?
 Object getObjectUnchecked(Object obj)
          Read the contents of the field.
 Object getObjectValueUnchecked(Object obj)
          Read one object ref from heap using RVM object model, GC safe.
 Offset getOffsetValueUnchecked(Object obj)
           
 boolean getRuntimeFinalValue()
          Get the value from the runtime final field
 short getShortValueUnchecked(Object obj)
           
 int getSize()
          How many bytes of memory words do value of this type take?
 TypeReference getType()
          Get type of this field's value.
 Word getWordValueUnchecked(Object obj)
           
 boolean isEnumConstant()
          Enum constant
 boolean isFinal()
          May only be assigned once?
 boolean isReferenceType()
          Does the field hold a reference?
 boolean isRuntimeFinal()
          Is the field RuntimeFinal?
 boolean isStatic()
          Shared among all instances of this class?
 boolean isSynthetic()
          Not present in source code file?
 boolean isTraced()
          Does the field hold a reference?
 boolean isTransient()
          Value not to be written/read by persistent object manager?
 boolean isUntraced()
          Is this field invisible to the memory management system.
 boolean isVolatile()
          Value not to be cached in a register?
 boolean madeTraced()
          Does the field hold a made-traced reference?
 void makeTraced()
          Make this field a traced field by garbage collection.
(package private) static RVMField readField(TypeReference declaringClass, int[] constantPool, MemberReference memRef, short modifiers, DataInputStream input)
          Read and create a field.
 void setAddressValueUnchecked(Object obj, Address ref)
           
 void setBooleanValueUnchecked(Object obj, boolean b)
           
 void setByteValueUnchecked(Object obj, byte b)
           
 void setCharValueUnchecked(Object obj, char c)
           
 void setDoubleValueUnchecked(Object obj, double d)
           
 void setExtentValueUnchecked(Object obj, Extent ref)
           
 void setFloatValueUnchecked(Object obj, float f)
           
 void setIntValueUnchecked(Object obj, int i)
           
 void setLongValueUnchecked(Object obj, long l)
           
 void setObjectValueUnchecked(Object obj, Object ref)
          assign one object ref from heap using RVM object model, GC safe.
 void setOffsetValueUnchecked(Object obj, Offset ref)
           
 void setShortValueUnchecked(Object obj, short i)
           
 void setWordValueUnchecked(Object obj, Word ref)
          assign one object ref from heap using RVM object model, GC safe.
 
Methods inherited from class org.jikesrvm.classloader.RVMMember
getDeclaringClass, getDescriptor, getId, getMemberRef, getModifiers, getName, getOffset, getSignature, hashCode, hasOffset, isPrivate, isProtected, isPublic, setOffset, toString
 
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

constantValueIndex

private final int constantValueIndex
constant pool index of field's value (0 --> not a "static final constant")


size

private final byte size
The size of the field in bytes


reference

private final boolean reference
Does the field hold a reference value?


madeTraced

private boolean madeTraced
Has the field been made traced?

Constructor Detail

RVMField

private RVMField(TypeReference declaringClass,
                 MemberReference memRef,
                 short modifiers,
                 Atom signature,
                 int constantValueIndex,
                 RVMAnnotation[] annotations)
Create a field.

Parameters:
declaringClass - the TypeReference object of the class that declared this field
memRef - the canonical memberReference for this member.
modifiers - modifiers associated with this field.
signature - generic type of this field.
constantValueIndex - constant pool index of constant value
annotations - array of runtime visible annotations
Method Detail

readField

static RVMField readField(TypeReference declaringClass,
                          int[] constantPool,
                          MemberReference memRef,
                          short modifiers,
                          DataInputStream input)
                   throws IOException
Read and create a field. NB only RVMClass is allowed to create an instance of a RVMField.

Parameters:
declaringClass - the TypeReference object of the class that declared this field
constantPool - the constant pool of the class loading this field
memRef - the canonical memberReference for this member.
modifiers - modifiers associated with this member.
input - the DataInputStream to read the field's attributed from
Throws:
IOException

createAnnotationField

static RVMField createAnnotationField(TypeReference annotationClass,
                                      MemberReference memRef)
Create a field for a synthetic annotation class


getType

public TypeReference getType()
Get type of this field's value.


getNumberOfStackSlots

public int getNumberOfStackSlots()
How many stackslots do value of this type take?


getSize

public int getSize()
How many bytes of memory words do value of this type take?


isTraced

public boolean isTraced()
Does the field hold a reference?


madeTraced

public boolean madeTraced()
Does the field hold a made-traced reference?


isReferenceType

public boolean isReferenceType()
Does the field hold a reference?


isStatic

public boolean isStatic()
Shared among all instances of this class?


isFinal

public boolean isFinal()
May only be assigned once?


isVolatile

public boolean isVolatile()
Value not to be cached in a register?


isTransient

public boolean isTransient()
Value not to be written/read by persistent object manager?


isSynthetic

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


isEnumConstant

public boolean isEnumConstant()
Enum constant


isRuntimeFinal

public boolean isRuntimeFinal()
Is the field RuntimeFinal? That is can the annotation value be used in place a reading the field.

Returns:
whether the method has a pure annotation

isUntraced

public boolean isUntraced()
Is this field invisible to the memory management system.


makeTraced

public void makeTraced()
Make this field a traced field by garbage collection. Affects all subclasses of the class in which this field is defined.


getRuntimeFinalValue

public boolean getRuntimeFinalValue()
Get the value from the runtime final field

Returns:
whether the method has a pure annotation

getConstantValueIndex

int getConstantValueIndex()
Get index of constant pool entry containing this "static final constant" field's value.

Returns:
constant pool index (0 --> field is not a "static final constant")

getObjectUnchecked

public Object getObjectUnchecked(Object obj)
Read the contents of the field. If the contents of this field is an object, return that object. If the contents of this field is a primitive, get the value and wrap it in an object.


getObjectValueUnchecked

public Object getObjectValueUnchecked(Object obj)
Read one object ref from heap using RVM object model, GC safe.

Parameters:
obj - the object whose field is to be read, or null if the field is static.
Returns:
the reference described by this RVMField from the given object.

getWordValueUnchecked

public Word getWordValueUnchecked(Object obj)

getAddressValueUnchecked

public Address getAddressValueUnchecked(Object obj)

getOffsetValueUnchecked

public Offset getOffsetValueUnchecked(Object obj)

getExtentValueUnchecked

public Extent getExtentValueUnchecked(Object obj)

getBooleanValueUnchecked

public boolean getBooleanValueUnchecked(Object obj)

getByteValueUnchecked

public byte getByteValueUnchecked(Object obj)

getCharValueUnchecked

public char getCharValueUnchecked(Object obj)

getShortValueUnchecked

public short getShortValueUnchecked(Object obj)

getIntValueUnchecked

public int getIntValueUnchecked(Object obj)

getLongValueUnchecked

public long getLongValueUnchecked(Object obj)

getFloatValueUnchecked

public float getFloatValueUnchecked(Object obj)

getDoubleValueUnchecked

public double getDoubleValueUnchecked(Object obj)

get32Bits

private int get32Bits(Object obj)

get64Bits

private long get64Bits(Object obj)

setObjectValueUnchecked

public void setObjectValueUnchecked(Object obj,
                                    Object ref)
assign one object ref from heap using RVM object model, GC safe.

Parameters:
obj - the object whose field is to be modified, or null if the field is static.
ref - the object reference to be assigned.

setWordValueUnchecked

public void setWordValueUnchecked(Object obj,
                                  Word ref)
assign one object ref from heap using RVM object model, GC safe.

Parameters:
obj - the object whose field is to be modified, or null if the field is static.
ref - the object reference to be assigned.

setAddressValueUnchecked

public void setAddressValueUnchecked(Object obj,
                                     Address ref)

setExtentValueUnchecked

public void setExtentValueUnchecked(Object obj,
                                    Extent ref)

setOffsetValueUnchecked

public void setOffsetValueUnchecked(Object obj,
                                    Offset ref)

setBooleanValueUnchecked

public void setBooleanValueUnchecked(Object obj,
                                     boolean b)

setByteValueUnchecked

public void setByteValueUnchecked(Object obj,
                                  byte b)

setCharValueUnchecked

public void setCharValueUnchecked(Object obj,
                                  char c)

setShortValueUnchecked

public void setShortValueUnchecked(Object obj,
                                   short i)

setIntValueUnchecked

public void setIntValueUnchecked(Object obj,
                                 int i)

setFloatValueUnchecked

public void setFloatValueUnchecked(Object obj,
                                   float f)

setLongValueUnchecked

public void setLongValueUnchecked(Object obj,
                                  long l)

setDoubleValueUnchecked

public void setDoubleValueUnchecked(Object obj,
                                    double d)