public abstract class RVMMethod extends RVMMember
readMethod(org.jikesrvm.classloader.TypeReference, int[], org.jikesrvm.classloader.MemberReference, short, java.io.DataInputStream)
method.Modifier and Type | Field and Description |
---|---|
private static HashMapRVM<RVMMethod,Object> |
annotationDefaults
A table mapping to values present in the method info tables of annotation
types.
|
protected CompiledMethod |
currentCompiledMethod
current compiled method for this method
|
private static ImmutableEntryHashMapRVM<RVMMethod,Annotation[][]> |
declaredParameterAnnotations
Cache of arrays of declared parameter annotations.
|
private static ImmutableEntryHashMapRVM<RVMMethod,TypeReference[]> |
exceptionTypes
exceptions this method might throw (null --> none)
|
private static ImmutableEntryHashMapRVM<RVMMethod,ReflectionBase> |
invokeMethods
Map from a method to a reflective method capable of invoking it
|
private static ImmutableEntryHashMapRVM<RVMMethod,Integer> |
jtocOffsets
The offsets of virtual methods in the JTOC, if it's been placed
there by constant propagation.
|
private static ImmutableEntryHashMapRVM<RVMMethod,RVMAnnotation[][]> |
parameterAnnotations
Method parameter annotations from the class file that are
described as runtime visible.
|
declaredAnnotationDatas
Modifier | Constructor and Description |
---|---|
protected |
RVMMethod(TypeReference declaringClass,
MemberReference memRef,
short modifiers,
TypeReference[] exceptionTypes,
Atom signature,
RVMAnnotation[] annotations,
RVMAnnotation[][] parameterAnnotations,
Object annotationDefault)
Construct a read method
|
Modifier and Type | Method and Description |
---|---|
void |
compile()
Generate machine code for this method if valid
machine code doesn't already exist.
|
(package private) static RVMMethod |
createDefaultConstructor(TypeReference klass,
MemberReference memRef)
Create a method to act as a default constructor (just return)
|
(package private) RVMMethod |
createReflectionMethod(TypeReference reflectionClass,
int[] constantPool,
MethodReference memRef)
Create a method for reflectively invoking this method
|
Offset |
findOrCreateJtocOffset()
Finds or create a JTOC offset for this method.
|
protected abstract CompiledMethod |
genCode()
Generates the code for this method.
|
Object |
getAnnotationDefault() |
CompiledMethod |
getCurrentCompiledMethod()
Get the current compiled method for this method.
|
CodeArray |
getCurrentEntryCodeArray()
Get the code array that corresponds to the entry point (prologue)
for the method.
|
Annotation[][] |
getDeclaredParameterAnnotations() |
TypeReference[] |
getExceptionTypes()
Exceptions thrown by this method -
something like
{ "java/lang/IOException", "java/lang/EOFException" } |
ReflectionBase |
getInvoker() |
private Offset |
getJtocOffset()
Gets the offset used to hold a JTOC addressable version of the current entry
code array.
|
private RVMAnnotation[][] |
getParameterAnnotations() |
TypeReference[] |
getParameterTypes() |
int |
getParameterWords() |
TypeReference |
getReturnType() |
boolean |
hasNoInlinePragma()
Has this method been marked as forbidden to inline?
|
void |
invalidateCompiledMethod(CompiledMethod cm)
Invalidates the given compiled method if it is the current compiled code
for this method.
|
boolean |
isAbstract() |
boolean |
isBridge() |
boolean |
isClassInitializer() |
boolean |
isCompiled() |
boolean |
isFinal() |
boolean |
isInterruptible()
Is this method interruptible?
|
boolean |
isNative() |
boolean |
isNonMovingAllocation() |
boolean |
isObjectInitializer() |
boolean |
isObjectInitializerHelper() |
boolean |
isPure()
Is the method Pure?
|
boolean |
isRuntimePure()
Is the method RuntimePure?
|
boolean |
isRuntimeServiceMethod() |
boolean |
isSpecializedInvoke() |
boolean |
isStatic() |
boolean |
isStrictFP() |
boolean |
isSynchronized() |
boolean |
isSynthetic() |
boolean |
isSysCall() |
boolean |
isUninterruptible()
Is the method Uninterruptible?
|
boolean |
isUnpreemptible()
Is the method Unpreemptible?
|
boolean |
isVarArgs() |
boolean |
mayWrite(RVMField field) |
(package private) static RVMMethod |
readMethod(TypeReference declaringClass,
int[] constantPool,
MemberReference memRef,
short modifiers,
DataInputStream input)
Called from
ClassFileReader.readClass(TypeReference,DataInputStream) to create an
instance of a RVMMethod by reading the relevant data from the argument bytecode stream. |
void |
replaceCompiledMethod(CompiledMethod compiledMethod)
Change machine code that will be used by future executions of this method
(ie. optimized <-> non-optimized)
Side effect: updates JTOC or method dispatch tables
("type information blocks")
for this class and its subclasses
|
getDeclaringClass, getDescriptor, getId, getMemberRef, getModifiers, getName, getOffset, getSignature, hashCode, hasOffset, isPrivate, isProtected, isPublic, setOffset, toString
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
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType
protected CompiledMethod currentCompiledMethod
private static final ImmutableEntryHashMapRVM<RVMMethod,TypeReference[]> exceptionTypes
private static final ImmutableEntryHashMapRVM<RVMMethod,RVMAnnotation[][]> parameterAnnotations
private static final HashMapRVM<RVMMethod,Object> annotationDefaults
private static final ImmutableEntryHashMapRVM<RVMMethod,Integer> jtocOffsets
private static final ImmutableEntryHashMapRVM<RVMMethod,Annotation[][]> declaredParameterAnnotations
private static final ImmutableEntryHashMapRVM<RVMMethod,ReflectionBase> invokeMethods
protected RVMMethod(TypeReference declaringClass, MemberReference memRef, short modifiers, TypeReference[] exceptionTypes, Atom signature, RVMAnnotation[] annotations, RVMAnnotation[][] parameterAnnotations, Object annotationDefault)
declaringClass
- the RVMClass object of the class that declared this fieldmemRef
- the canonical memberReference for this method.modifiers
- modifiers associated with this method.exceptionTypes
- exceptions thrown by this method.signature
- generic type of this method.annotations
- array of runtime visible annotationsparameterAnnotations
- array of runtime visible parameter annotationsannotationDefault
- value for this annotation that appearsprivate RVMAnnotation[][] getParameterAnnotations()
public Object getAnnotationDefault()
static RVMMethod readMethod(TypeReference declaringClass, int[] constantPool, MemberReference memRef, short modifiers, DataInputStream input) throws IOException
ClassFileReader.readClass(TypeReference,DataInputStream)
to create an
instance of a RVMMethod by reading the relevant data from the argument bytecode stream.declaringClass
- the TypeReference of the class being loadedconstantPool
- the constantPool of the RVMClass object that's being constructedmemRef
- the canonical memberReference for this member.modifiers
- modifiers associated with this member.input
- the DataInputStream to read the method's attributes fromIOException
- when the underlying stream throws an IOException or when
the skipping of attributes does not work as expectedpublic final boolean isClassInitializer()
true
if this method is a class initializerpublic final boolean isObjectInitializer()
true
if this method is an object initializerpublic final boolean isObjectInitializerHelper()
true
if this method is a a compiler-generated
object initializer helperpublic final TypeReference getReturnType()
public final TypeReference[] getParameterTypes()
public final int getParameterWords()
public final boolean isCompiled()
true
if machine code has been generated
for this method's bytecodespublic final CompiledMethod getCurrentCompiledMethod()
We make this method Unpreemptible to avoid a race-condition in Reflection.invoke.
null
if none existspublic final boolean isStatic()
true
if this method is declared as statically
dispatchedpublic final boolean isFinal()
true
if this method is declared as non-overridable
by subclassespublic final boolean isSynchronized()
true
if this method is guarded by
monitorenter/monitorexitpublic final boolean isNative()
true
if this method is not implemented in javapublic final boolean isStrictFP()
true
if IEEE 754 rules need to be strictly
enforced for this methodpublic final boolean isSysCall()
true
if this is a method that's not implemented in Java
and use C not JNI calling conventionSysCall
public final boolean isSpecializedInvoke()
true
if this is a specialized method invokeSpecializedMethod
,
SpecializedMethodManager
public final boolean isAbstract()
true
if this method needs to be implemented by subclassespublic boolean isSynthetic()
true
if this method is not present in the source code file
(e.g. because it has been added by a Java compiler like javac)public boolean isBridge()
true
if this method is a bridge method. Bridge methods are
generated in some cases of generics and inheritance.public boolean isVarArgs()
true
if ts this a varargs method taking a variable number
of argumentspublic final TypeReference[] getExceptionTypes()
{ "java/lang/IOException", "java/lang/EOFException" }
null
if this method doesn't throw any
exceptionspublic final boolean isInterruptible()
<clinit>
or <init>
method then it is interruptible.
<init>
methods then it is interruptible.
@Interruptible
it is interruptible.
@Preemptible
it is interruptible.
@Uninterruptible
it is not interruptible.
@UninterruptibleNoWarn
it is not interruptible.
@Unpreemptible
it is not interruptible.
@Uninterruptible
or @Unpreemptible
it is not interruptible.
true
if and only if this method is interruptiblepublic final boolean isUnpreemptible()
isInterruptible()
true
if and only if this method is unpreemptiblepublic final boolean isUninterruptible()
isInterruptible()
true
if and only if this method is uninterruptiblepublic final boolean isPure()
public final boolean isRuntimePure()
public final boolean hasNoInlinePragma()
NoInline
annotation or
the NoOptCompile
annotation?true
if this method must not be inlinedpublic boolean mayWrite(RVMField field)
field
- the field whose write access is supposed to be checkedtrue
if the method may write to a given fieldpublic boolean isRuntimeServiceMethod()
true
if the method is the implementation of a runtime service
that is called "under the covers" from the generated code and thus is not subject to
inlining via the normal mechanisms.public boolean isNonMovingAllocation()
true
if all allocation from this method must go to
a non-moving spaceNonMovingAllocation
public final CodeArray getCurrentEntryCodeArray()
public final void compile()
protected abstract CompiledMethod genCode()
public final void replaceCompiledMethod(CompiledMethod compiledMethod)
Side effect: updates JTOC or method dispatch tables ("type information blocks") for this class and its subclasses
compiledMethod
- new machine codepublic final void invalidateCompiledMethod(CompiledMethod cm)
cm
- the compiled method to try to invalidateprivate Offset getJtocOffset()
public final Offset findOrCreateJtocOffset()
public final Annotation[][] getDeclaredParameterAnnotations()
public ReflectionBase getInvoker()
static RVMMethod createDefaultConstructor(TypeReference klass, MemberReference memRef)
klass
- class for methodmemRef
- reference for default constructorRVMMethod createReflectionMethod(TypeReference reflectionClass, int[] constantPool, MethodReference memRef)
reflectionClass
- the class this method will belong toconstantPool
- for the classmemRef
- the member reference corresponding to this method