public final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implements HotSpotResolvedObjectType, HotSpotProxified
JavaType for resolved non-primitive HotSpot classes.| Modifier and Type | Class and Description |
|---|---|
private class |
HotSpotResolvedObjectTypeImpl.FieldInfo
This class represents the field information for one field contained in the fields array of an
InstanceKlass. |
private static class |
HotSpotResolvedObjectTypeImpl.OffsetComparator |
| Modifier and Type | Field and Description |
|---|---|
private HotSpotResolvedObjectType |
arrayOfType |
private ConstantPool |
constantPool |
private HashMap<Long,HotSpotResolvedJavaField> |
fieldCache |
private HotSpotResolvedJavaField[] |
instanceFields |
private HotSpotResolvedObjectTypeImpl[] |
interfaces |
private Class<?> |
javaClass
The Java class this type represents.
|
private HashMap<Long,HotSpotResolvedJavaMethod> |
methodCache |
ANNOTATION, BRIDGE, ENUM, MANDATED, SYNTHETIC, VARARGS| Constructor and Description |
|---|
HotSpotResolvedObjectTypeImpl(Class<?> javaClass)
Creates the JVMCI mirror for a
Class object. |
| Modifier and Type | Method and Description |
|---|---|
HotSpotResolvedObjectType |
asExactType()
Returns this type if it is an exact type otherwise returns null.
|
ConstantPool |
constantPool() |
HotSpotResolvedJavaField |
createField(String fieldName,
JavaType type,
long offset,
int rawFlags) |
HotSpotResolvedJavaMethod |
createMethod(long metaspaceMethod) |
ResolvedJavaField |
findInstanceFieldWithOffset(long offset,
Kind expectedEntryKind)
Returns the instance field of this class (or one of its super classes) at the given offset,
or
null if there is no such field. |
Assumptions.AssumptionResult<ResolvedJavaType> |
findLeafConcreteSubtype()
Attempts to get a leaf concrete subclass of this type.
|
HotSpotResolvedObjectType |
findLeastCommonAncestor(ResolvedJavaType otherType)
Walks the class hierarchy upwards and returns the least common class that is a superclass of
both the current and the given type.
|
Assumptions.AssumptionResult<ResolvedJavaMethod> |
findUniqueConcreteMethod(ResolvedJavaMethod method)
Given a
ResolvedJavaMethod A, returns a concrete ResolvedJavaMethod B that is
the only possible unique target for a virtual call on A(). |
static HotSpotResolvedObjectTypeImpl |
fromMetaspaceKlass(long metaspaceKlass)
Gets the JVMCI mirror from a HotSpot metaspace Klass native object.
|
static HotSpotResolvedObjectTypeImpl |
fromObjectClass(Class<?> javaClass)
Gets the JVMCI mirror for a
Class object. |
int |
getAccessFlags() |
<T extends Annotation> |
getAnnotation(Class<T> annotationClass)
Returns the annotation for the specified type of this class, if such an annotation is
present.
|
HotSpotResolvedObjectType |
getArrayClass()
Gets the array class type representing an array with elements of this type.
|
URL |
getClassFilePath()
Returns the class file path - if available - of this type, or
null. |
ResolvedJavaMethod |
getClassInitializer()
Returns the
<clinit> method for this class if there is one. |
ResolvedJavaType |
getComponentType()
For array types, gets the type of the components, or
null if this is not an array
type. |
ResolvedJavaMethod[] |
getDeclaredConstructors()
Returns an array reflecting all the constructors declared by this type.
|
ResolvedJavaMethod[] |
getDeclaredMethods()
Returns an array reflecting all the methods declared by this type.
|
HotSpotResolvedObjectTypeImpl |
getEnclosingType()
Returns the enclosing type of this type, if it exists, or
null. |
private int |
getFieldCount()
Returns the actual field count of this class's internal
InstanceKlass::_fields array
by walking the array and discounting the generic signature slots at the end of the array. |
private int |
getInitState()
Returns the value of the state field
InstanceKlass::_init_state of the metaspace
klass. |
ResolvedJavaField[] |
getInstanceFields(boolean includeSuperclasses)
Returns the instance fields of this class, including
internal fields.
|
HotSpotResolvedObjectTypeImpl[] |
getInterfaces()
Gets the interfaces implemented or extended by this type.
|
JavaConstant |
getJavaClass()
Gets the runtime representation of the Java class object of this type.
|
Kind |
getKind()
Gets the kind of this type.
|
long |
getMetaspaceKlass()
Gets the metaspace Klass for this type.
|
int |
getModifiers()
Returns the Java Virtual Machine modifiers for this element.
|
JavaConstant |
getObjectHub()
Gets the runtime representation of the "hub" of this type--that is, the closest part of the
type representation which is typically stored in the object header.
|
private static String |
getSignatureName(Class<?> javaClass)
Returns the name of this type as it would appear in a signature.
|
HotSpotResolvedObjectTypeImpl |
getSingleImplementor()
Gets the single implementor of this type.
|
String |
getSourceFileName()
Returns name of source file of this type.
|
ResolvedJavaField[] |
getStaticFields()
Returns the static fields of this class, including
internal fields.
|
private long |
getSubklass()
Returns the
Klass::_subklass field of the underlying metaspace klass for the given
type type. |
HotSpotResolvedObjectTypeImpl |
getSuperclass()
Gets the super class of this type.
|
HotSpotResolvedObjectTypeImpl |
getSupertype() |
int |
getVtableLength() |
Assumptions.AssumptionResult<Boolean> |
hasFinalizableSubclass()
Checks whether this type has any finalizable subclasses so far.
|
boolean |
hasFinalizer()
Checks whether this type has a finalizer method.
|
void |
initialize()
Initializes this type.
|
int |
instanceSize()
Gets the instance size of this type.
|
boolean |
isArray()
Checks whether this type is an array class.
|
boolean |
isAssignableFrom(ResolvedJavaType other)
Determines if this type is either the same as, or is a superclass or superinterface of, the
type represented by the specified parameter.
|
boolean |
isDefinitelyResolvedWithRespectTo(ResolvedJavaType accessingClass)
Performs a fast-path check that this type is resolved in the context of a given accessing
class.
|
boolean |
isInitialized()
Checks whether this type is initialized.
|
boolean |
isInstance(JavaConstant obj)
Checks whether the specified object is an instance of this type.
|
boolean |
isInstanceClass()
Checks whether this type is an instance class.
|
boolean |
isInterface()
Checks whether this type is an interface.
|
boolean |
isJavaLangObject()
Returns true if this type is exactly the type
Object. |
private boolean |
isLeafClass()
Returns if type
type is a leaf class. |
boolean |
isLinked()
Checks whether this type is linked and verified.
|
boolean |
isLocal()
Returns
true if the type is a local type. |
boolean |
isMember()
Returns
true if the type is a member type. |
boolean |
isPrimaryType() |
boolean |
isPrimitive()
Checks whether this type is primitive.
|
boolean |
isTrustedInterfaceType()
Returns true if this type represents an interface and it should be trusted even in places
where the JVM verifier would not give any guarantees other than
Object. |
JavaConstant |
klass()
Gets the metaspace Klass boxed in a
JavaConstant. |
int |
layoutHelper() |
Class<?> |
mirror() |
long |
prototypeMarkWord() |
ResolvedJavaType |
resolve(ResolvedJavaType accessingClass)
Resolves this type to a
ResolvedJavaType. |
ResolvedJavaMethod |
resolveConcreteMethod(ResolvedJavaMethod method,
ResolvedJavaType callerType)
Resolves the method implementation for virtual dispatches on objects of this dynamic type.
|
ResolvedJavaMethod |
resolveMethod(ResolvedJavaMethod method,
ResolvedJavaType callerType)
Resolves the method implementation for virtual dispatches on objects of this dynamic type.
|
int |
superCheckOffset() |
String |
toString() |
equals, fromClass, hashCodegetNameclone, finalize, getClass, notify, notifyAll, wait, wait, waitfindMethod, getElementalType, isLeafgetName, getUnqualifiedName, toClassName, toJavaName, toJavaNameisAbstract, isConcrete, isFinalFlagSet, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isTransient, isVolatile, jvmClassModifiers, jvmFieldModifiers, jvmMethodModifiersprivate HashMap<Long,HotSpotResolvedJavaField> fieldCache
private HashMap<Long,HotSpotResolvedJavaMethod> methodCache
private HotSpotResolvedJavaField[] instanceFields
private HotSpotResolvedObjectTypeImpl[] interfaces
private ConstantPool constantPool
private HotSpotResolvedObjectType arrayOfType
public HotSpotResolvedObjectTypeImpl(Class<?> javaClass)
Class object.
NOTE: Creating an instance of this class does not install the mirror for the
Class type. Use fromObjectClass(Class) or fromMetaspaceKlass(long)
instead.
javaClass - the Class to create the mirror forpublic static HotSpotResolvedObjectTypeImpl fromObjectClass(Class<?> javaClass)
Class object.HotSpotResolvedJavaType corresponding to javaClasspublic static HotSpotResolvedObjectTypeImpl fromMetaspaceKlass(long metaspaceKlass)
metaspaceKlass - a metaspace Klass objectResolvedJavaType corresponding to metaspaceKlassprivate static String getSignatureName(Class<?> javaClass)
public long getMetaspaceKlass()
public int getModifiers()
ResolvedJavaTypeResolvedJavaType) can not be private or protected.
Only the flags specified in the JVM specification will be included in the returned mask. This
method is identical to Class.getModifiers() in terms of the value return for this
type.
getModifiers in interface ModifiersProvidergetModifiers in interface ResolvedJavaTypepublic int getAccessFlags()
public HotSpotResolvedObjectType getArrayClass()
JavaTypegetArrayClass in interface HotSpotResolvedObjectTypegetArrayClass in interface JavaTypegetArrayClass in interface ResolvedJavaTypepublic ResolvedJavaType getComponentType()
JavaTypenull if this is not an array
type. This method is analogous to Class.getComponentType().getComponentType in interface HotSpotResolvedObjectTypegetComponentType in interface JavaTypegetComponentType in interface ResolvedJavaTypepublic Assumptions.AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype()
ResolvedJavaType
For an array type A, the leaf concrete subclass is A if the
elemental type of A is final (which includes primitive
types). Otherwise null is returned for A.
For a non-array type T, the result is the leaf concrete type in the current hierarchy of T.
A runtime may decide not to manage or walk a large hierarchy and so the result is conservative. That is, a non-null result is guaranteed to be the leaf concrete class in T's hierarchy at the current point in time but a null result does not necessarily imply that there is no leaf concrete class in T's hierarchy.
If the compiler uses the result of this method for its compilation, it must register the
Assumptions.AssumptionResult in its Assumptions because dynamic class loading can
invalidate the result of this method.
findLeafConcreteSubtype in interface HotSpotResolvedObjectTypefindLeafConcreteSubtype in interface ResolvedJavaTypeAssumptions.AssumptionResult containing the leaf concrete subclass for this type as
described aboveprivate boolean isLeafClass()
type is a leaf class. This is the case if the
Klass::_subklass field of the underlying class is zero.private long getSubklass()
Klass::_subklass field of the underlying metaspace klass for the given
type type.public HotSpotResolvedObjectTypeImpl getSuperclass()
ResolvedJavaTypeObject class,
an interface, a primitive type, or void, then null is returned. If this object represents an
array class then the type object representing the Object class is returned.getSuperclass in interface HotSpotResolvedObjectTypegetSuperclass in interface ResolvedJavaTypepublic HotSpotResolvedObjectTypeImpl[] getInterfaces()
ResolvedJavaTypeClass.getInterfaces() and as such, only returns the interfaces directly implemented
or extended by this type.getInterfaces in interface HotSpotResolvedObjectTypegetInterfaces in interface ResolvedJavaTypepublic HotSpotResolvedObjectTypeImpl getSingleImplementor()
ResolvedJavaTypeIf the compiler uses the result of this method for its compilation, the usage must be guarded because the verifier can not guarantee that the assigned type really implements this interface. Additionally, class loading can invalidate the result of this method.
getSingleImplementor in interface ResolvedJavaTypenull if there is no implementor, the implementor if there is only one, or
this if there are more than one.public HotSpotResolvedObjectTypeImpl getSupertype()
getSupertype in interface HotSpotResolvedObjectTypepublic HotSpotResolvedObjectType findLeastCommonAncestor(ResolvedJavaType otherType)
ResolvedJavaTypefindLeastCommonAncestor in interface HotSpotResolvedObjectTypefindLeastCommonAncestor in interface ResolvedJavaTypenull if primitive types are involved.public HotSpotResolvedObjectType asExactType()
ResolvedJavaTypeasExactType in interface HotSpotResolvedObjectTypeasExactType in interface ResolvedJavaTypenull otherwisepublic JavaConstant getJavaClass()
ResolvedJavaTypegetJavaClass in interface ResolvedJavaTypepublic JavaConstant getObjectHub()
ResolvedJavaTypegetObjectHub in interface ResolvedJavaTypepublic Assumptions.AssumptionResult<Boolean> hasFinalizableSubclass()
ResolvedJavaTypehasFinalizableSubclass in interface ResolvedJavaTypetrue if this class has any subclasses with finalizerspublic boolean hasFinalizer()
ResolvedJavaTypehasFinalizer in interface ResolvedJavaTypetrue if this class has a finalizerpublic boolean isPrimitive()
ResolvedJavaTypeisPrimitive in interface HotSpotResolvedObjectTypeisPrimitive in interface ResolvedJavaTypetrue if this type is primitivepublic boolean isArray()
ResolvedJavaTypeisArray in interface ResolvedJavaTypetrue if this type is an array classpublic boolean isInitialized()
ResolvedJavaTypelinked and that the static initializer has run.isInitialized in interface ResolvedJavaTypetrue if this type is initializedpublic boolean isLinked()
ResolvedJavaTypeinitialized type is always linked.isLinked in interface ResolvedJavaTypetrue if this type is linkedprivate int getInitState()
InstanceKlass::_init_state of the metaspace
klass.public void initialize()
ResolvedJavaTypeinitialize in interface ResolvedJavaTypepublic boolean isInstance(JavaConstant obj)
ResolvedJavaTypeisInstance in interface ResolvedJavaTypeobj - the object to testtrue if the object is an instance of this typepublic boolean isInstanceClass()
ResolvedJavaTypeisInstanceClass in interface ResolvedJavaTypetrue if this type is an instance classpublic boolean isInterface()
ResolvedJavaTypeisInterface in interface ModifiersProviderisInterface in interface ResolvedJavaTypetrue if this type is an interfaceModifier.isInterface(int)public boolean isAssignableFrom(ResolvedJavaType other)
ResolvedJavaTypeClass.isAssignableFrom(Class) in terms of the value return for this type.isAssignableFrom in interface ResolvedJavaTypepublic boolean isJavaLangObject()
ResolvedJavaTypeObject.isJavaLangObject in interface ResolvedJavaTypepublic Kind getKind()
JavaTypegetKind in interface HotSpotResolvedObjectTypegetKind in interface JavaTypepublic ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType)
ResolvedJavaTypeResolvedJavaType.findUniqueConcreteMethod(ResolvedJavaMethod).resolveConcreteMethod in interface ResolvedJavaTypemethod - the method to select the implementation ofcallerType - the caller or context type used to perform access checksnull if there is no
concrete implementation of method in this type or any of its superclassespublic ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType)
ResolvedJavaTyperesolveMethod in interface ResolvedJavaTypemethod - the method to select the implementation ofcallerType - the caller or context type used to perform access checksnull if it can not be
linkedpublic ConstantPool constantPool()
constantPool in interface HotSpotResolvedObjectTypepublic int instanceSize()
instanceSize in interface HotSpotResolvedObjectTypepublic int layoutHelper()
layoutHelper in interface HotSpotResolvedObjectTypepublic HotSpotResolvedJavaMethod createMethod(long metaspaceMethod)
public int getVtableLength()
getVtableLength in interface HotSpotResolvedObjectTypepublic HotSpotResolvedJavaField createField(String fieldName, JavaType type, long offset, int rawFlags)
createField in interface HotSpotResolvedObjectTypepublic Assumptions.AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method)
ResolvedJavaTypeResolvedJavaMethod A, returns a concrete ResolvedJavaMethod B that is
the only possible unique target for a virtual call on A(). Returns null if either no
such concrete method or more than one such method exists. Returns the method A if A is a
concrete method that is not overridden.
If the compiler uses the result of this method for its compilation, it must register an assumption because dynamic class loading can invalidate the result of this method.
findUniqueConcreteMethod in interface HotSpotResolvedObjectTypefindUniqueConcreteMethod in interface ResolvedJavaTypemethod - the method A for which a unique concrete target is searchednull if no such target exists or assumptions
are not supported by this runtimepublic ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses)
ResolvedJavaTypegetInstanceFields in interface ResolvedJavaTypeincludeSuperclasses - if true, then instance fields for the complete hierarchy of this
type are included in the resultpublic ResolvedJavaField[] getStaticFields()
ResolvedJavaTypegetStaticFields in interface ResolvedJavaTypeprivate int getFieldCount()
InstanceKlass::_fields array
by walking the array and discounting the generic signature slots at the end of the array.
See FieldStreamBase::init_generic_signature_start_slot
public Class<?> mirror()
mirror in class HotSpotResolvedJavaTypepublic String getSourceFileName()
ResolvedJavaTypegetSourceFileName in interface ResolvedJavaTypepublic <T extends Annotation> T getAnnotation(Class<T> annotationClass)
ResolvedJavaTypegetAnnotation in interface ResolvedJavaTypeannotationClass - the Class object corresponding to the annotation typenullpublic boolean isDefinitelyResolvedWithRespectTo(ResolvedJavaType accessingClass)
accessingClass. That can only be determined by
re-resolving the type.isDefinitelyResolvedWithRespectTo in interface HotSpotResolvedObjectTypepublic ResolvedJavaType resolve(ResolvedJavaType accessingClass)
JavaTypeResolvedJavaType.public JavaConstant klass()
JavaConstant.klass in interface HotSpotResolvedObjectTypepublic boolean isPrimaryType()
isPrimaryType in interface HotSpotResolvedObjectTypepublic int superCheckOffset()
superCheckOffset in interface HotSpotResolvedObjectTypepublic long prototypeMarkWord()
prototypeMarkWord in interface HotSpotResolvedObjectTypepublic ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedEntryKind)
ResolvedJavaTypenull if there is no such field.findInstanceFieldWithOffset in interface ResolvedJavaTypeoffset - the offset of the field to look fornull if there is no such field.public URL getClassFilePath()
ResolvedJavaTypenull.getClassFilePath in interface ResolvedJavaTypepublic boolean isLocal()
ResolvedJavaTypetrue if the type is a local type.isLocal in interface ResolvedJavaTypepublic boolean isMember()
ResolvedJavaTypetrue if the type is a member type.isMember in interface ResolvedJavaTypepublic HotSpotResolvedObjectTypeImpl getEnclosingType()
ResolvedJavaTypenull.getEnclosingType in interface HotSpotResolvedObjectTypegetEnclosingType in interface ResolvedJavaTypepublic ResolvedJavaMethod[] getDeclaredConstructors()
ResolvedJavaTypeClass.getDeclaredConstructors() in terms of returned constructors.getDeclaredConstructors in interface ResolvedJavaTypepublic ResolvedJavaMethod[] getDeclaredMethods()
ResolvedJavaTypeClass.getDeclaredMethods() in terms of returned methods.getDeclaredMethods in interface ResolvedJavaTypepublic ResolvedJavaMethod getClassInitializer()
ResolvedJavaType<clinit> method for this class if there is one.getClassInitializer in interface HotSpotResolvedObjectTypegetClassInitializer in interface ResolvedJavaTypepublic boolean isTrustedInterfaceType()
ResolvedJavaTypeObject.isTrustedInterfaceType in interface ResolvedJavaType