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, name
ANNOTATION, 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, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getParameterAnnotation, getParameterAnnotations, getProfilingInfo, hasBytecodes, hasReceiver, isBridge, isFinal, isJavaLangObjectInit, isSignaturePolymorphic, isSynthetic, isVarArgs, toParameterTypes
format, getName
isAbstract, isConcrete, isFinalFlagSet, isInterface, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isTransient, isVolatile, jvmClassModifiers, jvmFieldModifiers, jvmMethodModifiers
assignIds
private 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 SpeculationLog
s 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
metaspaceMethod
public static HotSpotResolvedJavaMethod fromMetaspace(long metaspaceMethod)
ResolvedJavaMethod
for a HotSpot metaspace method native object.metaspaceMethod
- a metaspace Method objectResolvedJavaMethod
corresponding to metaspaceMethod
private long getConstMethod()
Method::_constMethod
).private int getFlags()
Method::_flags
).private int getConstMethodFlags()
ConstMethod::_flags
).public HotSpotResolvedObjectTypeImpl getDeclaringClass()
ResolvedJavaMethod
ResolvedJavaType
object representing the class or interface that declares
this method.getDeclaringClass
in interface HotSpotResolvedJavaMethod
getDeclaringClass
in interface JavaMethod
getDeclaringClass
in interface ResolvedJavaMethod
public JavaConstant getMetaspaceMethodConstant()
public long getMetaspaceMethod()
public JavaConstant getEncoding()
ResolvedJavaMethod
getEncoding
in interface ResolvedJavaMethod
public int getAllModifiers()
public int getModifiers()
ResolvedJavaMethod
ResolvedJavaType
) 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 ModifiersProvider
getModifiers
in interface ResolvedJavaMethod
public boolean canBeStaticallyBound()
ResolvedJavaMethod
canBeStaticallyBound
in interface ResolvedJavaMethod
true
if this method can be statically boundpublic byte[] getCode()
ResolvedJavaMethod
holder
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 ResolvedJavaMethod
null
if getCodeSize() == 0
or if the
code is not ready.public int getCodeSize()
ResolvedJavaMethod
ResolvedJavaMethod.getCode()
. length
if the method has code.getCodeSize
in interface ResolvedJavaMethod
public ExceptionHandler[] getExceptionHandlers()
ResolvedJavaMethod
getExceptionHandlers
in interface ResolvedJavaMethod
public boolean isCallerSensitive()
CallerSensitive
annotation.isCallerSensitive
in interface HotSpotResolvedJavaMethod
public boolean isForceInline()
ForceInline
annotation.isForceInline
in interface HotSpotResolvedJavaMethod
public boolean isDontInline()
DontInline
annotation.isDontInline
in interface HotSpotResolvedJavaMethod
public void setNotInlineable()
setNotInlineable
in interface HotSpotResolvedJavaMethod
public boolean ignoredBySecurityStackWalk()
ignoredBySecurityStackWalk
in interface HotSpotResolvedJavaMethod
public boolean hasBalancedMonitors()
hasBalancedMonitors
in interface HotSpotResolvedJavaMethod
public boolean isClassInitializer()
ResolvedJavaMethod
isClassInitializer
in interface ResolvedJavaMethod
true
if the method is a class initializerpublic boolean isConstructor()
ResolvedJavaMethod
isConstructor
in interface ResolvedJavaMethod
true
if the method is a constructorpublic int getMaxLocals()
ResolvedJavaMethod
getMaxLocals
in interface ResolvedJavaMethod
public int getMaxStackSize()
ResolvedJavaMethod
getMaxStackSize
in interface ResolvedJavaMethod
public StackTraceElement asStackTraceElement(int bci)
ResolvedJavaMethod
asStackTraceElement
in interface ResolvedJavaMethod
public ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver)
uniqueConcreteMethod
in interface HotSpotResolvedJavaMethod
public HotSpotSignature getSignature()
JavaMethod
getSignature
in interface JavaMethod
private long getCompiledCode()
Method::_code
.Method::_code
public boolean hasCompiledCode()
hasCompiledCode
in interface HotSpotResolvedJavaMethod
public boolean hasCompiledCodeAtLevel(int level)
hasCompiledCodeAtLevel
in interface HotSpotResolvedJavaMethod
level
- level
.public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR)
ResolvedJavaMethod
getProfilingInfo
in interface ResolvedJavaMethod
includeNormal
- 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()
ResolvedJavaMethod
reprofile
in interface ResolvedJavaMethod
public ConstantPool getConstantPool()
ResolvedJavaMethod
getConstantPool
in interface ResolvedJavaMethod
public Annotation[][] getParameterAnnotations()
ResolvedJavaMethod
getParameterAnnotations
in interface ResolvedJavaMethod
Method.getParameterAnnotations()
public Annotation[] getAnnotations()
ResolvedJavaMethod
getAnnotations
in interface ResolvedJavaMethod
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
ResolvedJavaMethod
getAnnotation
in interface ResolvedJavaMethod
annotationClass
- the Class object corresponding to the annotation typenull
public boolean isDefault()
ResolvedJavaMethod
true
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 HotSpotResolvedJavaMethod
isDefault
in interface ResolvedJavaMethod
public Type[] getGenericParameterTypes()
ResolvedJavaMethod
Type
objects that represent the formal parameter types, in
declaration order, of this method.getGenericParameterTypes
in interface ResolvedJavaMethod
Method.getGenericParameterTypes()
public Class<?>[] signatureToTypes()
private Constructor<?> toJavaConstructor()
public boolean canBeInlined()
ResolvedJavaMethod
true
if this method is not excluded from inlining and has associated Java
bytecodes (@see ResolvedJavaMethod.hasBytecodes()
).canBeInlined
in interface ResolvedJavaMethod
public boolean shouldBeInlined()
ResolvedJavaMethod
true
if the inlining of this method should be forced.shouldBeInlined
in interface ResolvedJavaMethod
public LineNumberTable getLineNumberTable()
ResolvedJavaMethod
getLineNumberTable
in interface ResolvedJavaMethod
public LocalVariableTable getLocalVariableTable()
ResolvedJavaMethod
getLocalVariableTable
in interface ResolvedJavaMethod
public int vtableEntryOffset(ResolvedJavaType resolved)
isInVirtualMethodTable(ResolvedJavaType)
, otherwise an exception is
thrown.vtableEntryOffset
in interface HotSpotResolvedJavaMethod
public boolean isInVirtualMethodTable(ResolvedJavaType resolved)
ResolvedJavaMethod
isInVirtualMethodTable
in interface ResolvedJavaMethod
private int getVtableIndex(HotSpotResolvedObjectTypeImpl resolved)
private int getVtableIndex()
private int getVtableIndexForInterface(ResolvedJavaType resolved)
public SpeculationLog getSpeculationLog()
getSpeculationLog
in interface ResolvedJavaMethod
public int intrinsicId()
intrinsicId
in interface HotSpotResolvedJavaMethod
public JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments)
ResolvedJavaMethod
Method.invoke(java.lang.Object, java.lang.Object...)
.invoke
in interface ResolvedJavaMethod
receiver
- 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 HotSpotResolvedJavaMethod
entryBCI
- entry bcipublic boolean hasCodeAtLevel(int entryBCI, int level)
hasCodeAtLevel
in interface HotSpotResolvedJavaMethod
public void setMethodId(int id)
MethodIdHolder
setMethodId
in interface MethodIdHolder
public int getMethodId()
MethodIdHolder
MethodIdHolder.setMethodId(int)
or 0 if no identifier was assigned to
this method.getMethodId
in interface MethodIdHolder