public final class TypeReference extends Object
Modifier | Constructor and Description |
---|---|
private |
TypeReference(ClassLoader cl,
Atom tn,
int id) |
Modifier and Type | Method and Description |
---|---|
private static void |
canonicalizeCL(ClassLoader cl) |
boolean |
definitelyDifferent(TypeReference that)
Do this and that definitely refer to the different types?
|
boolean |
definitelySame(TypeReference that)
Do
this and that definitely refer to the same type? |
boolean |
equals(Object other)
Are two keys equivalent?
|
static TypeReference |
findOrCreate(Class<?> klass)
Convert a java.lang.Class into a type reference the slow way.
|
static TypeReference |
findOrCreate(ClassLoader cl,
Atom tn)
Find or create the canonical TypeReference instance for
the given pair.
|
static TypeReference |
findOrCreate(String tn)
Shorthand for doing a find or create for a type reference that should
be created using the bootstrap classloader.
|
static TypeReference |
findOrCreateInternal(ClassLoader cl,
Atom tn)
Find or create the canonical TypeReference instance for
the given pair without type descriptor parsing.
|
TypeReference |
getArrayElementType() |
TypeReference |
getArrayTypeForElementType() |
ClassLoader |
getClassLoader() |
static ImmutableEntryHashSetRVM<ClassLoader> |
getCLDict() |
int |
getDimensionality() |
int |
getId() |
TypeReference |
getInnermostElementType() |
int |
getMemoryBytes() |
Atom |
getName() |
int |
getStackWords() |
static TypeReference |
getTypeRef(int id)
Get the canonical type reference given its id.
|
int |
hashCode()
Hash value based on name, used for canonical type dictionary
|
boolean |
isAddressType() |
boolean |
isArrayType() |
boolean |
isBooleanType() |
boolean |
isByteType() |
boolean |
isCharType() |
boolean |
isClassType() |
boolean |
isCodeArrayType() |
boolean |
isCodeType() |
boolean |
isDoubleType() |
boolean |
isExtentType() |
boolean |
isFloatType() |
boolean |
isIntLikeType() |
boolean |
isIntType() |
boolean |
isLoaded() |
boolean |
isLongType() |
boolean |
isMagicType() |
boolean |
isOffsetType() |
boolean |
isPrimitiveType() |
boolean |
isReferenceType() |
boolean |
isResolved() |
boolean |
isRuntimeTable() |
boolean |
isShortType() |
boolean |
isUnboxedArrayType() |
boolean |
isUnboxedType() |
boolean |
isVoidType() |
boolean |
isWordArrayType() |
boolean |
isWordLikeType() |
boolean |
isWordType() |
RVMType |
peekType() |
RVMType |
resolve()
Force the resolution of the type reference.
|
private RVMType |
resolveInternal() |
(package private) void |
setType(RVMType rt) |
String |
toString() |
final ClassLoader classloader
final Atom name
final int id
private RVMType type
private static final ImmutableEntryHashSetRVM<TypeReference> dictionary
private static final ImmutableEntryHashSetRVM<ClassLoader> clDict
private static final int LOG_ROW_SIZE
private static final int ROW_MASK
private static TypeReference[][] types
private static int nextId
RVMClass
).public static final TypeReference Void
public static final TypeReference Boolean
public static final TypeReference Byte
public static final TypeReference Char
public static final TypeReference Short
public static final TypeReference Int
public static final TypeReference Long
public static final TypeReference Float
public static final TypeReference Double
public static final TypeReference BooleanArray
public static final TypeReference ByteArray
public static final TypeReference CharArray
public static final TypeReference ShortArray
public static final TypeReference IntArray
public static final TypeReference LongArray
public static final TypeReference FloatArray
public static final TypeReference DoubleArray
public static final TypeReference Word
public static final TypeReference Address
public static final TypeReference ObjectReference
public static final TypeReference Offset
public static final TypeReference Extent
public static final TypeReference Code
public static final TypeReference WordArray
public static final TypeReference AddressArray
public static final TypeReference ObjectReferenceArray
public static final TypeReference OffsetArray
public static final TypeReference ExtentArray
public static final TypeReference CodeArray
public static final TypeReference Magic
public static final TypeReference SysCall
public static final TypeReference TIB
public static final TypeReference ITableArray
public static final TypeReference ITable
public static final TypeReference IMT
public static final TypeReference Thread
public static final TypeReference FunctionTable
public static final TypeReference LinkageTripletTable
public static final TypeReference JavaLangObject
public static final TypeReference JavaLangClass
public static final TypeReference JavaLangString
public static final TypeReference JavaLangCloneable
public static final TypeReference JavaIoSerializable
public static final TypeReference JavaLangRefReference
public static final TypeReference JavaLangSystem
public static final TypeReference JavaLangObjectArray
public static final TypeReference JavaLangThrowable
public static final TypeReference JavaLangError
public static final TypeReference JavaLangNullPointerException
public static final TypeReference JavaLangArrayIndexOutOfBoundsException
public static final TypeReference JavaLangArithmeticException
public static final TypeReference JavaLangArrayStoreException
public static final TypeReference JavaLangClassCastException
public static final TypeReference JavaLangNegativeArraySizeException
public static final TypeReference JavaLangIllegalMonitorStateException
public static final TypeReference Type
public static final TypeReference Class
public static final TypeReference NativeBridge
public static final TypeReference DynamicBridge
public static final TypeReference SaveVolatile
public static final TypeReference Interruptible
public static final TypeReference LogicallyUninterruptible
public static final TypeReference Preemptible
public static final TypeReference UninterruptibleNoWarn
public static final TypeReference UnpreemptibleNoWarn
public static final TypeReference Uninterruptible
public static final TypeReference NoCheckStore
public static final TypeReference Unpreemptible
public static final TypeReference SpecializedMethodInvoke
public static final TypeReference Untraced
public static final TypeReference NonMoving
public static final TypeReference NonMovingAllocation
public static final TypeReference BaselineNoRegisters
public static final TypeReference BaselineSaveLSRegisters
public static final TypeReference ReferenceFieldsVary
public static final TypeReference ReferenceMaps
public static final TypeReference JNIFunctions
public static final TypeReference RVMArray
static final TypeReference baseReflectionClass
public static final TypeReference NULL_TYPE
public static final TypeReference VALIDATION_TYPE
public static final TypeReference ExceptionTable
public static final TypeReference OptimizationPlanner
private TypeReference(ClassLoader cl, Atom tn, int id)
cl
- the classloadertn
- the type nameid
- the numeric identifierpublic int hashCode()
public boolean equals(Object other)
public static TypeReference findOrCreate(ClassLoader cl, Atom tn) throws IllegalArgumentException
cl
- the classloader (defining/initiating depending on usage)tn
- the name of the typeIllegalArgumentException
- Needs to throw some kind of error in
the case of a Atom that does not represent a type name.public static TypeReference findOrCreate(String tn)
tn
- type namepublic static TypeReference findOrCreate(Class<?> klass)
klass
- java.lang.Class to convert to type referencepublic static TypeReference findOrCreateInternal(ClassLoader cl, Atom tn)
cl
- the classloader (defining/initiating depending on usage)tn
- the name of the typeprivate static void canonicalizeCL(ClassLoader cl)
public static ImmutableEntryHashSetRVM<ClassLoader> getCLDict()
public static TypeReference getTypeRef(int id)
id
- the type references idpublic ClassLoader getClassLoader()
public TypeReference getArrayElementType()
public TypeReference getArrayTypeForElementType()
public int getDimensionality()
public TypeReference getInnermostElementType()
public boolean isClassType()
true
if 'this' refers to a classpublic boolean isArrayType()
true
if 'this' refers to an arraypublic boolean isPrimitiveType()
true
if 'this' refers to a primitive typepublic boolean isReferenceType()
true
if 'this' refers to a reference typepublic boolean isWordLikeType()
true
if 'this' refers to Word, Address, Offset or Extentpublic boolean isWordType()
true
if 'this' refers to Wordpublic boolean isAddressType()
true
if 'this' refers to Addresspublic boolean isOffsetType()
true
if 'this' refers to Offsetpublic boolean isExtentType()
true
if 'this' refers to Extentpublic boolean isUnboxedType()
true
if 'this' refers to an unboxed type.public boolean isCodeType()
true
if 'this' refers to Codepublic boolean isWordArrayType()
true
if 'this' refers to WordArray, AddressArray, OffsetArray or ExtentArraypublic boolean isUnboxedArrayType()
true
if 'this' refers to WordArray, AddressArray, OffsetArray or ExtentArraypublic boolean isRuntimeTable()
true
if 'this' refers to a runtime table typepublic boolean isCodeArrayType()
true
if 'this' refers to CodeArraypublic boolean isMagicType()
true
if 'this' refers to Magicpublic int getStackWords()
public int getMemoryBytes()
public int getId()
public boolean isVoidType()
true
if this is the type reference for the void primitive typepublic boolean isBooleanType()
true
if this is the type reference for the boolean primitive typepublic boolean isByteType()
true
if this is the type reference for the byte primitive typepublic boolean isShortType()
true
if this is the type reference for the short primitive typepublic boolean isCharType()
true
if this is the type reference for the char primitive typepublic boolean isIntType()
true
if this is the type reference for the int primitive typepublic boolean isLongType()
true
if this is the type reference for the long primitive typepublic boolean isFloatType()
true
if this is the type reference for the float primitive typepublic boolean isDoubleType()
true
if this is the type reference for the double primitive typepublic boolean isIntLikeType()
true
if this
is the type reference for an
int-like (1, 8, 16, or 32 bit integral) primitive typepublic boolean definitelyDifferent(TypeReference that)
that
- other typetrue
if this and the other type are definitely
different, false
if it's not known (e.g. because a
type reference is not yet resolved)public boolean definitelySame(TypeReference that)
this
and that definitely refer to the same type?that
- other typetrue
if this and the other type are definitely
the same, false
if it's not known (e.g. because a
type reference is not yet resolved)public boolean isLoaded()
true
if the type for type reference has been loaded.public boolean isResolved()
true
if the type for type reference has been loaded and
it is resolved.public RVMType peekType()
public RVMType resolve() throws NoClassDefFoundError, IllegalArgumentException
NoClassDefFoundError
- When it cannot resolve a class.
we go to the trouble of converting the class loader's
ClassNotFoundException
into this error,
since we need to be able to throw
NoClassDefFoundError
for classes
that we're loading whose existence was compile-time checked.IllegalArgumentException
- In case of a malformed class name
(should never happen, since the right thing to do is probably to
validate them as soon as we insert them into a TypeReference.
This stinks. XXX)private RVMType resolveInternal() throws NoClassDefFoundError, IllegalArgumentException