public final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, HotSpotProxified, MethodIdHolder
JavaMethod for resolved HotSpot methods.| Modifier and Type | Class and Description |
|---|---|
static class |
HotSpotResolvedJavaMethodImpl.Options |
MethodIdHolder.MethodIdAllocator| Modifier and Type | Field and Description |
|---|---|
private byte[] |
code |
private HotSpotConstantPool |
constantPool |
private HotSpotResolvedObjectTypeImpl |
holder |
private long |
metaspaceMethod
Reference to metaspace Method object.
|
private HotSpotMethodData |
methodData |
private int |
methodId |
private HotSpotSignature |
signature |
private static ClassValue<Map<Long,SpeculationLog>> |
SpeculationLogs
The
SpeculationLog for methods compiled by JVMCI hang off this per-declaring-type
ClassValue. |
private Member |
toJavaCache |
private static String |
TraceMethodDataFilter |
FULLY_QUALIFIED_METHOD_NAME, nameANNOTATION, BRIDGE, ENUM, MANDATED, SYNTHETIC, VARARGS| Constructor and Description |
|---|
HotSpotResolvedJavaMethodImpl(HotSpotResolvedObjectTypeImpl holder,
long metaspaceMethod) |
| Modifier and Type | Method and Description |
|---|---|
int |
allocateCompileId(int entryBCI)
Allocates a compile id for this method by asking the VM for one.
|
StackTraceElement |
asStackTraceElement(int bci)
Returns a stack trace element for this method and a given bytecode index.
|
boolean |
canBeInlined()
Returns
true if this method is not excluded from inlining and has associated Java
bytecodes (@see ResolvedJavaMethod.hasBytecodes()). |
boolean |
canBeStaticallyBound()
Checks whether this method can be statically bound (usually, that means it is final or
private or static, but not abstract, or the declaring class is final).
|
boolean |
equals(Object obj) |
static HotSpotResolvedJavaMethod |
fromMetaspace(long metaspaceMethod)
Gets the
ResolvedJavaMethod for a HotSpot metaspace method native object. |
int |
getAllModifiers()
Gets the complete set of modifiers for this method which includes the JVM specification
modifiers as well as the HotSpot internal modifiers.
|
<T extends Annotation> |
getAnnotation(Class<T> annotationClass)
Returns the annotation for the specified type of this method, if such an annotation is
present.
|
Annotation[] |
getAnnotations()
Returns all annotations of this method.
|
byte[] |
getCode()
Returns the bytecode of this method, if the method has code.
|
int |
getCodeSize()
Returns the size of the bytecode of this method, if the method has code.
|
private long |
getCompiledCode()
Gets the value of
Method::_code. |
ConstantPool |
getConstantPool()
Returns the constant pool of this method.
|
private long |
getConstMethod()
Returns a pointer to this method's constant method data structure (
Method::_constMethod). |
private int |
getConstMethodFlags()
Returns this method's constant method flags (
ConstMethod::_flags). |
HotSpotResolvedObjectTypeImpl |
getDeclaringClass()
Returns the
ResolvedJavaType object representing the class or interface that declares
this method. |
JavaConstant |
getEncoding()
Gets the encoding of (that is, a constant representing the value of) this method.
|
ExceptionHandler[] |
getExceptionHandlers()
Returns the list of exception handlers for this method.
|
private int |
getFlags()
Returns this method's flags (
Method::_flags). |
Type[] |
getGenericParameterTypes()
Returns an array of
Type objects that represent the formal parameter types, in
declaration order, of this method. |
static HotSpotResolvedObjectTypeImpl |
getHolder(long metaspaceMethod)
Gets the holder of a HotSpot metaspace method native object.
|
LineNumberTable |
getLineNumberTable()
Returns the LineNumberTable of this method or null if this method does not have a line
numbers table.
|
LocalVariableTable |
getLocalVariableTable()
Returns the local variable table of this method or null if this method does not have a local
variable table.
|
int |
getMaxLocals()
Returns the maximum number of locals used in this method's bytecodes.
|
int |
getMaxStackSize()
Returns the maximum number of stack slots used in this method's bytecodes.
|
long |
getMetaspaceMethod() |
JavaConstant |
getMetaspaceMethodConstant()
Gets the address of the C++ Method object for this method.
|
int |
getMethodId()
Gets the identifier set by
MethodIdHolder.setMethodId(int) or 0 if no identifier was assigned to
this method. |
int |
getModifiers()
Returns the Java Virtual Machine modifiers for this element.
|
Annotation[][] |
getParameterAnnotations()
Returns an array of arrays that represent the annotations on the formal parameters, in
declaration order, of this method.
|
ProfilingInfo |
getProfilingInfo(boolean includeNormal,
boolean includeOSR)
Returns an object that provides access to the profiling information recorded for this method.
|
HotSpotSignature |
getSignature()
Returns the signature of this method.
|
SpeculationLog |
getSpeculationLog() |
private int |
getVtableIndex()
Returns this method's virtual table index.
|
private int |
getVtableIndex(HotSpotResolvedObjectTypeImpl resolved) |
private int |
getVtableIndexForInterface(ResolvedJavaType resolved) |
boolean |
hasBalancedMonitors() |
boolean |
hasCodeAtLevel(int entryBCI,
int level) |
boolean |
hasCompiledCode()
Returns whether this method has compiled code.
|
boolean |
hasCompiledCodeAtLevel(int level) |
int |
hashCode() |
boolean |
ignoredBySecurityStackWalk()
Returns true if this method is one of the special methods that is ignored by security stack
walks.
|
int |
intrinsicId() |
JavaConstant |
invoke(JavaConstant receiver,
JavaConstant[] arguments)
Invokes the underlying method represented by this object, on the specified object with the
specified parameters.
|
boolean |
isCallerSensitive()
Returns true if this method has a
CallerSensitive annotation. |
boolean |
isClassInitializer()
Checks whether this method is a class initializer.
|
boolean |
isConstructor()
Checks whether this method is a constructor.
|
boolean |
isDefault()
Returns
true if this method is a default method; returns false otherwise. |
boolean |
isDontInline()
Returns true if this method has a
DontInline annotation. |
boolean |
isForceInline()
Returns true if this method has a
ForceInline annotation. |
boolean |
isInVirtualMethodTable(ResolvedJavaType resolved)
Checks if this method is present in the virtual table for subtypes of the specified
type.
|
void |
reprofile()
Invalidates the profiling information and restarts profiling upon the next invocation.
|
void |
setMethodId(int id)
Sets the unique, positive, non-zero identifier for this method.
|
void |
setNotInlineable()
Manually adds a DontInline annotation to this method.
|
boolean |
shouldBeInlined()
Returns
true if the inlining of this method should be forced. |
Class<?>[] |
signatureToTypes() |
private Method |
toJava() |
private Constructor<?> |
toJavaConstructor() |
ResolvedJavaMethod |
uniqueConcreteMethod(HotSpotResolvedObjectType receiver) |
int |
vtableEntryOffset(ResolvedJavaType resolved)
Returns the offset of this method into the v-table.
|
applyFormattingFlagsAndWidth, asJavaMethod, formatTo, getName, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetParameterAnnotation, getParameterAnnotations, getProfilingInfo, hasBytecodes, hasReceiver, isBridge, isFinal, isJavaLangObjectInit, isSignaturePolymorphic, isSynthetic, isVarArgs, toParameterTypesformat, getNameisAbstract, isConcrete, isFinalFlagSet, isInterface, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isTransient, isVolatile, jvmClassModifiers, jvmFieldModifiers, jvmMethodModifiersassignIdsprivate final long metaspaceMethod
private final HotSpotResolvedObjectTypeImpl holder
private final HotSpotConstantPool constantPool
private final HotSpotSignature signature
private HotSpotMethodData methodData
private byte[] code
private Member toJavaCache
private static final String TraceMethodDataFilter
private static final ClassValue<Map<Long,SpeculationLog>> SpeculationLogs
SpeculationLog for methods compiled by JVMCI hang off this per-declaring-type
ClassValue. The raw Method* value is safe to use as a key in the map as a) it is
never moves and b) we never read from it.
One implication is that we will preserve SpeculationLogs for methods that have been
redefined via class redefinition. It's tempting to periodically flush such logs but we cannot
read the JVM_ACC_IS_OBSOLETE bit (or anything else) via the raw pointer as obsoleted methods
are subject to clean up and deletion (see InstanceKlass::purge_previous_versions_internal).
private int methodId
public HotSpotResolvedJavaMethodImpl(HotSpotResolvedObjectTypeImpl holder, long metaspaceMethod)
public static HotSpotResolvedObjectTypeImpl getHolder(long metaspaceMethod)
metaspaceMethod - a metaspace Method objectResolvedJavaType corresponding to the holder of the
metaspaceMethodpublic static HotSpotResolvedJavaMethod fromMetaspace(long metaspaceMethod)
ResolvedJavaMethod for a HotSpot metaspace method native object.metaspaceMethod - a metaspace Method objectResolvedJavaMethod corresponding to metaspaceMethodprivate long getConstMethod()
Method::_constMethod).private int getFlags()
Method::_flags).private int getConstMethodFlags()
ConstMethod::_flags).public HotSpotResolvedObjectTypeImpl getDeclaringClass()
ResolvedJavaMethodResolvedJavaType object representing the class or interface that declares
this method.getDeclaringClass in interface HotSpotResolvedJavaMethodgetDeclaringClass in interface JavaMethodgetDeclaringClass in interface ResolvedJavaMethodpublic JavaConstant getMetaspaceMethodConstant()
public long getMetaspaceMethod()
public JavaConstant getEncoding()
ResolvedJavaMethodgetEncoding in interface ResolvedJavaMethodpublic int getAllModifiers()
public int getModifiers()
ResolvedJavaMethodResolvedJavaType) can not be private or protected.
Only the method flags specified in the JVM specification will be included in the returned mask.
getModifiers in interface ModifiersProvidergetModifiers in interface ResolvedJavaMethodpublic boolean canBeStaticallyBound()
ResolvedJavaMethodcanBeStaticallyBound in interface ResolvedJavaMethodtrue if this method can be statically boundpublic byte[] getCode()
ResolvedJavaMethodholder is not linked.
The contained constant pool indices may not be the ones found in the original class file but
they can be used with the JVMCI API (e.g. methods in ConstantPool).getCode in interface ResolvedJavaMethodnull if getCodeSize() == 0 or if the
code is not ready.public int getCodeSize()
ResolvedJavaMethodResolvedJavaMethod.getCode(). length if the method has code.getCodeSize in interface ResolvedJavaMethodpublic ExceptionHandler[] getExceptionHandlers()
ResolvedJavaMethodgetExceptionHandlers in interface ResolvedJavaMethodpublic boolean isCallerSensitive()
CallerSensitive annotation.isCallerSensitive in interface HotSpotResolvedJavaMethodpublic boolean isForceInline()
ForceInline annotation.isForceInline in interface HotSpotResolvedJavaMethodpublic boolean isDontInline()
DontInline annotation.isDontInline in interface HotSpotResolvedJavaMethodpublic void setNotInlineable()
setNotInlineable in interface HotSpotResolvedJavaMethodpublic boolean ignoredBySecurityStackWalk()
ignoredBySecurityStackWalk in interface HotSpotResolvedJavaMethodpublic boolean hasBalancedMonitors()
hasBalancedMonitors in interface HotSpotResolvedJavaMethodpublic boolean isClassInitializer()
ResolvedJavaMethodisClassInitializer in interface ResolvedJavaMethodtrue if the method is a class initializerpublic boolean isConstructor()
ResolvedJavaMethodisConstructor in interface ResolvedJavaMethodtrue if the method is a constructorpublic int getMaxLocals()
ResolvedJavaMethodgetMaxLocals in interface ResolvedJavaMethodpublic int getMaxStackSize()
ResolvedJavaMethodgetMaxStackSize in interface ResolvedJavaMethodpublic StackTraceElement asStackTraceElement(int bci)
ResolvedJavaMethodasStackTraceElement in interface ResolvedJavaMethodpublic ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver)
uniqueConcreteMethod in interface HotSpotResolvedJavaMethodpublic HotSpotSignature getSignature()
JavaMethodgetSignature in interface JavaMethodprivate long getCompiledCode()
Method::_code.Method::_codepublic boolean hasCompiledCode()
hasCompiledCode in interface HotSpotResolvedJavaMethodpublic boolean hasCompiledCodeAtLevel(int level)
hasCompiledCodeAtLevel in interface HotSpotResolvedJavaMethodlevel - level.public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR)
ResolvedJavaMethodgetProfilingInfo in interface ResolvedJavaMethodincludeNormal - if true,
deoptimization counts will include deoptimization that happened during execution
of standard non-osr methods.includeOSR - if true,
deoptimization counts will include deoptimization that happened during execution
of on-stack-replacement methods.public void reprofile()
ResolvedJavaMethodreprofile in interface ResolvedJavaMethodpublic ConstantPool getConstantPool()
ResolvedJavaMethodgetConstantPool in interface ResolvedJavaMethodpublic Annotation[][] getParameterAnnotations()
ResolvedJavaMethodgetParameterAnnotations in interface ResolvedJavaMethodMethod.getParameterAnnotations()public Annotation[] getAnnotations()
ResolvedJavaMethodgetAnnotations in interface ResolvedJavaMethodpublic <T extends Annotation> T getAnnotation(Class<T> annotationClass)
ResolvedJavaMethodgetAnnotation in interface ResolvedJavaMethodannotationClass - the Class object corresponding to the annotation typenullpublic boolean isDefault()
ResolvedJavaMethodtrue if this method is a default method; returns false otherwise.
A default method is a public non-abstract instance method, that is, a non-static method with
a body, declared in an interface type.isDefault in interface HotSpotResolvedJavaMethodisDefault in interface ResolvedJavaMethodpublic Type[] getGenericParameterTypes()
ResolvedJavaMethodType objects that represent the formal parameter types, in
declaration order, of this method.getGenericParameterTypes in interface ResolvedJavaMethodMethod.getGenericParameterTypes()public Class<?>[] signatureToTypes()
private Constructor<?> toJavaConstructor()
public boolean canBeInlined()
ResolvedJavaMethodtrue if this method is not excluded from inlining and has associated Java
bytecodes (@see ResolvedJavaMethod.hasBytecodes()).canBeInlined in interface ResolvedJavaMethodpublic boolean shouldBeInlined()
ResolvedJavaMethodtrue if the inlining of this method should be forced.shouldBeInlined in interface ResolvedJavaMethodpublic LineNumberTable getLineNumberTable()
ResolvedJavaMethodgetLineNumberTable in interface ResolvedJavaMethodpublic LocalVariableTable getLocalVariableTable()
ResolvedJavaMethodgetLocalVariableTable in interface ResolvedJavaMethodpublic int vtableEntryOffset(ResolvedJavaType resolved)
isInVirtualMethodTable(ResolvedJavaType), otherwise an exception is
thrown.vtableEntryOffset in interface HotSpotResolvedJavaMethodpublic boolean isInVirtualMethodTable(ResolvedJavaType resolved)
ResolvedJavaMethodisInVirtualMethodTable in interface ResolvedJavaMethodprivate int getVtableIndex(HotSpotResolvedObjectTypeImpl resolved)
private int getVtableIndex()
private int getVtableIndexForInterface(ResolvedJavaType resolved)
public SpeculationLog getSpeculationLog()
getSpeculationLog in interface ResolvedJavaMethodpublic int intrinsicId()
intrinsicId in interface HotSpotResolvedJavaMethodpublic JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments)
ResolvedJavaMethodMethod.invoke(java.lang.Object, java.lang.Object...).invoke in interface ResolvedJavaMethodreceiver - The receiver for the invocation, or null if it is a static method.arguments - The arguments for the invocation.null if the return type is
void.public int allocateCompileId(int entryBCI)
allocateCompileId in interface HotSpotResolvedJavaMethodentryBCI - entry bcipublic boolean hasCodeAtLevel(int entryBCI, int level)
hasCodeAtLevel in interface HotSpotResolvedJavaMethodpublic void setMethodId(int id)
MethodIdHoldersetMethodId in interface MethodIdHolderpublic int getMethodId()
MethodIdHolderMethodIdHolder.setMethodId(int) or 0 if no identifier was assigned to
this method.getMethodId in interface MethodIdHolder