public class MethodInfo extends InfoObject implements GenericSignatureHolder
Modifier and Type | Field and Description |
---|---|
protected int |
argSize
the number of stack slots for the arguments (incl.
|
protected byte[] |
argTypes
used for native method parameter conversion (lazy evaluated)
|
protected int |
attributes
a batch of execution related JPF attributes
|
protected ClassInfo |
ci
Class the method belongs to
|
protected Instruction[] |
code
Instructions associated with the method
|
protected ExceptionHandler[] |
exceptionHandlers
JPFConfigException handlers
|
protected java.lang.String |
genericSignature
Generic signature of the method
|
protected int |
globalId
a unique int assigned to this method
|
protected int[] |
lineNumbers
Table used for line numbers
this assigns a line number to every instruction index, instead of
using an array of ranges.
|
protected LocalVarInfo[] |
localVars
Local variable information
|
protected int |
maxLocals
Maximum number of local variables
|
protected int |
maxStack
Maximum number of elements on the stack
|
protected int |
modifiers
the standard Java modifier attributes
|
protected static java.util.ArrayList<MethodInfo> |
mthTable |
protected java.lang.String |
name
Name of the method
|
protected int |
nArgs
number of arguments (excl.
|
protected int |
retSize
number of stack slots for return value
|
protected byte |
returnType
what return type do we have (again, lazy evaluated)
|
protected java.lang.String |
signature
Signature of the method
|
protected java.lang.String[] |
thrownExceptionClassNames
classnames of checked exception thrown by the method
|
protected java.lang.String |
uniqueName
this is a lazy evaluated mangled name consisting of the name and
arg type signature
|
protected static boolean |
warnedLocalInfo
Used to warn about local variable information.
|
annotations, attr, typeAnnotations
Constructor and Description |
---|
MethodInfo(ClassInfo ci,
java.lang.String name,
java.lang.String signature,
int modifiers) |
MethodInfo(ClassInfo ci,
java.lang.String name,
java.lang.String signature,
int modifiers,
int maxLocals,
int maxStack) |
MethodInfo(MethodInfo mi)
for NativeMethodInfo creation
|
MethodInfo(MethodInfo callee,
int nLocals,
int nOperands)
for direct call construction
Note: this is only a partial initialization, the code still has to be created/installed by the caller
|
MethodInfo(java.lang.String name,
java.lang.String signature,
int modifiers) |
MethodInfo(java.lang.String name,
java.lang.String signature,
int modifiers,
int nLocals,
int nOperands)
This is used to create synthetic methods of function object types
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
boolean |
containsLineNumber(int n) |
static MethodInfo |
create(ClassInfo ci,
java.lang.String name,
java.lang.String signature,
int modifiers) |
static MethodInfo |
create(java.lang.String name,
java.lang.String signature,
int modifiers) |
DirectCallStackFrame |
createDirectCallStackFrame(ThreadInfo ti,
int nLocals) |
DirectCallStackFrame |
createRunStartStackFrame(ThreadInfo ti) |
void |
dump() |
protected void |
finishExceptionHandlerTable() |
protected void |
finishLineNumberTable() |
protected void |
finishLocalVarTable() |
protected void |
finishParameterAnnotations() |
protected void |
finishThrownExceptions() |
LocalVarInfo[] |
getArgumentLocalVars()
return only the LocalVarInfos for arguments, in order of definition
or null if there are no localVarInfos.
|
int |
getArgumentsSize() |
java.lang.String[] |
getArgumentTypeNames() |
byte[] |
getArgumentTypes() |
java.lang.String |
getBaseName()
return classname.name (but w/o signature)
|
ClassInfo |
getClassInfo()
Returns the class the method belongs to.
|
java.lang.String |
getClassName() |
java.lang.String |
getCompleteName()
Deprecated.
- use getFullName
|
ExceptionHandler[] |
getExceptions() |
Instruction |
getFirstInsn() |
java.lang.String |
getFullName()
Returns the full classname (if any) + name + signature.
|
java.lang.String |
getGenericSignature() |
int |
getGlobalId() |
ExceptionHandler |
getHandlerFor(ClassInfo ciException,
Instruction insn) |
MethodInfo |
getInstanceFor(ClassInfo ci)
Creates a method for a given class, by cloning this MethodInfo
and all the instructions belong to the method
|
Instruction |
getInstruction(int i)
Returns a specific instruction.
|
Instruction |
getInstructionAt(int position)
Returns the instruction at a certain position.
|
Instruction[] |
getInstructions()
Returns the instructions of the method.
|
Instruction[] |
getInstructionsForLine(int line) |
Instruction[] |
getInstructionsForLineInterval(int l1,
int l2) |
java.lang.String |
getJNIName() |
Instruction |
getLastInsn() |
int |
getLineNumber(Instruction pc)
Returns the line number for a given position.
|
int[] |
getLineNumbers()
Returns a table to translate positions into line numbers.
|
LocalVarInfo |
getLocalVar(int slotIdx,
int pc) |
LocalVarInfo |
getLocalVar(java.lang.String name,
int pc) |
java.lang.String[] |
getLocalVariableNames()
note that this might contain duplicates for variables with multiple
scope entries
|
LocalVarInfo[] |
getLocalVars() |
java.lang.String |
getLongName()
yet another name - this time with a non-mangled, but abbreviated signature
and without return type (e.g.
|
Instruction[] |
getMatchingInstructions(LocationSpec lspec) |
int |
getMaxLocals() |
int |
getMaxStack() |
static MethodInfo |
getMethodInfo(int globalId) |
int |
getModifiers() |
java.lang.String |
getName()
Returns the name of the method.
|
int |
getNumberOfArguments() |
int |
getNumberOfCallerStackSlots() |
int |
getNumberOfInstructions()
return number of instructions
|
static int |
getNumberOfLoadedMethods() |
int |
getNumberOfStackArguments()
Returns the size of the arguments.
|
MethodInfo |
getOverriddenMethodInfo() |
AnnotationInfo[][] |
getParameterAnnotations() |
AnnotationInfo[] |
getParameterAnnotations(int parameterIndex)
return annotations for parameterIndex
|
java.lang.Class<? extends ChoiceGenerator<?>> |
getReturnChoiceGeneratorType() |
int |
getReturnSize()
what is the slot size of the return value
|
java.lang.String |
getReturnType() |
byte |
getReturnTypeCode() |
java.lang.String |
getReturnTypeName() |
java.lang.String |
getSignature()
Returns the signature of the method.
|
java.lang.String |
getSourceFileName() |
java.lang.String |
getStackTraceName()
returns stack trace name: classname (if any) + name
|
java.lang.String |
getStackTraceSource() |
java.lang.String[] |
getThrownExceptionClassNames() |
java.util.List<LocalVarInfo> |
getTypeAnnotatedLocalVars() |
java.util.List<LocalVarInfo> |
getTypeAnnotatedLocalVars(java.lang.String annotationClsName) |
java.lang.String |
getUniqueName() |
static java.lang.String |
getUniqueName(java.lang.String mname,
java.lang.String signature)
return the minimal name that has to be unique for overloading
used as a lookup key
NOTE: with the silent introduction of covariant return types
in Java 5.0, we have to use the full signature to be unique
|
boolean |
hasCode() |
boolean |
hasEmptyBody() |
boolean |
hasParameterAnnotations() |
boolean |
hasTypeAnnotatedLocalVars() |
boolean |
includesLine(int line) |
boolean |
intersectsLineNumbers(int first,
int last) |
boolean |
isAbstract() |
boolean |
isAtomic() |
boolean |
isClinit() |
boolean |
isClinit(ClassInfo ci) |
boolean |
isCtor() |
boolean |
isDirectCallStub() |
boolean |
isFirewall() |
boolean |
isHidden() |
boolean |
isInit() |
boolean |
isInitOrClinit() |
boolean |
isInternalMethod() |
boolean |
isJPFExecutable() |
boolean |
isJPFInternal() |
boolean |
isMJI() |
boolean |
isNative()
Returns true if the method is native
|
boolean |
isPrivate() |
boolean |
isProtected() |
boolean |
isPublic()
is this a public method
|
boolean |
isReferenceReturnType()
do we return Object references?
|
boolean |
isStatic()
Returns true if the method is static.
|
boolean |
isSynchronized()
Returns true if the method is synchronized.
|
boolean |
isSyncRelevant() |
boolean |
isSynthetic() |
boolean |
isThreadEntry(ThreadInfo ti) |
boolean |
isUnresolvedNativeMethod() |
boolean |
isVarargs() |
void |
linkToClass(ClassInfo ci) |
void |
setCode(Instruction[] code) |
protected void |
setException(int index,
java.lang.String exceptionType) |
protected void |
setExceptionHandler(int index,
int startPc,
int endPc,
int handlerPc,
java.lang.String catchType) |
void |
setExceptionHandlers(ExceptionHandler[] handlers) |
void |
setFirewall(boolean isFirewalled)
turn unhandled exceptionHandlers at the JPF execution level
into UnhandledException throws at the host VM level
this is useful to implement firewalls for direct calls
which should not let exceptionHandlers permeate into bytecode/
application code
|
void |
setGenericSignature(java.lang.String sig) |
protected void |
setLineNumber(int index,
int lineNumber,
int startPc) |
void |
setLineNumbers(int[] lines)
this version takes an already expanded line number array which has to be of
the same size as the code array
|
void |
setLineNumbers(int[] lines,
int[] startPcs)
note - this depends on that we already have a code array
and that the lines/startPcs are sorted (monotonic increasing)
|
protected void |
setLocalVar(int index,
java.lang.String varName,
java.lang.String descriptor,
int scopeStartPc,
int scopeEndPc,
int slotIndex) |
void |
setLocalVarAnnotations() |
void |
setLocalVarTable(LocalVarInfo[] locals) |
void |
setMaxLocals(int maxLocals) |
void |
setMaxStack(int maxStack) |
void |
setParameterAnnotations(AnnotationInfo[][] parameterAnnotations) |
protected void |
setParameterAnnotations(int index,
AnnotationInfo[] ai) |
void |
setThrownExceptions(java.lang.String[] exceptions) |
protected void |
startExceptionHandlerTable(int handlerCount) |
protected void |
startLineNumberTable(int lineNumberCount) |
protected void |
startLocalVarTable(int localVarCount) |
protected void |
startParameterAnnotations(int annotationCount) |
protected void |
startTrownExceptions(int exceptionCount) |
java.lang.String |
toString() |
addAnnotation, addAnnotations, addAttr, addTypeAnnotation, addTypeAnnotations, attrIterator, attrIterator, getAnnotation, getAnnotations, getAttr, getAttr, getDeclaredAnnotations, getNextAttr, getTargetTypeAnnotations, getTypeAnnotation, getTypeAnnotations, hasAnnotation, hasAnnotations, hasAttr, hasAttr, hasAttrValue, hasTypeAnnotation, hasTypeAnnotations, removeAttr, replaceAttr, setAnnotations, setAttr, setTypeAnnotations
protected static final java.util.ArrayList<MethodInfo> mthTable
protected static boolean warnedLocalInfo
protected int globalId
protected java.lang.String uniqueName
protected java.lang.String name
protected java.lang.String signature
protected java.lang.String genericSignature
protected ClassInfo ci
protected Instruction[] code
protected ExceptionHandler[] exceptionHandlers
protected java.lang.String[] thrownExceptionClassNames
protected int[] lineNumbers
protected LocalVarInfo[] localVars
protected int maxLocals
protected int maxStack
protected int modifiers
protected int attributes
protected int argSize
protected int nArgs
protected byte returnType
protected int retSize
protected byte[] argTypes
public MethodInfo(MethodInfo callee, int nLocals, int nOperands)
public MethodInfo(java.lang.String name, java.lang.String signature, int modifiers, int nLocals, int nOperands)
public MethodInfo(MethodInfo mi)
public MethodInfo(ClassInfo ci, java.lang.String name, java.lang.String signature, int modifiers, int maxLocals, int maxStack)
public MethodInfo(java.lang.String name, java.lang.String signature, int modifiers)
public MethodInfo(ClassInfo ci, java.lang.String name, java.lang.String signature, int modifiers)
public static MethodInfo getMethodInfo(int globalId)
public static MethodInfo create(java.lang.String name, java.lang.String signature, int modifiers)
public static MethodInfo create(ClassInfo ci, java.lang.String name, java.lang.String signature, int modifiers)
public void linkToClass(ClassInfo ci)
public void setMaxLocals(int maxLocals)
public void setMaxStack(int maxStack)
public void setCode(Instruction[] code)
public boolean hasParameterAnnotations()
public AnnotationInfo[][] getParameterAnnotations()
public AnnotationInfo[] getParameterAnnotations(int parameterIndex)
public static int getNumberOfLoadedMethods()
public boolean isAtomic()
public boolean isHidden()
public void setFirewall(boolean isFirewalled)
public boolean isFirewall()
public java.lang.Object clone()
clone
in class java.lang.Object
public int getGlobalId()
public DirectCallStackFrame createRunStartStackFrame(ThreadInfo ti)
public DirectCallStackFrame createDirectCallStackFrame(ThreadInfo ti, int nLocals)
public boolean isSyncRelevant()
public boolean isInitOrClinit()
public boolean isClinit()
public boolean isClinit(ClassInfo ci)
public boolean isInit()
public boolean isDirectCallStub()
public java.lang.String getLongName()
public static java.lang.String getUniqueName(java.lang.String mname, java.lang.String signature)
public java.lang.String getStackTraceSource()
public byte[] getArgumentTypes()
public java.lang.String[] getArgumentTypeNames()
public int getArgumentsSize()
public LocalVarInfo[] getArgumentLocalVars()
public java.lang.String getReturnType()
public java.lang.String getReturnTypeName()
public java.lang.String getSourceFileName()
public java.lang.String getClassName()
public ClassInfo getClassInfo()
@Deprecated public java.lang.String getCompleteName()
public java.lang.String getBaseName()
public boolean isCtor()
public boolean isInternalMethod()
public boolean isThreadEntry(ThreadInfo ti)
public java.lang.String getFullName()
public java.lang.String getStackTraceName()
public int getNumberOfInstructions()
public Instruction getInstruction(int i)
public Instruction getInstructionAt(int position)
public Instruction[] getInstructions()
public boolean includesLine(int line)
public Instruction[] getInstructionsForLine(int line)
public Instruction[] getInstructionsForLineInterval(int l1, int l2)
public Instruction[] getMatchingInstructions(LocationSpec lspec)
public int getLineNumber(Instruction pc)
public int[] getLineNumbers()
public boolean containsLineNumber(int n)
public boolean intersectsLineNumbers(int first, int last)
public ExceptionHandler getHandlerFor(ClassInfo ciException, Instruction insn)
public boolean isMJI()
public int getMaxLocals()
public int getMaxStack()
public ExceptionHandler[] getExceptions()
public java.lang.String[] getThrownExceptionClassNames()
public LocalVarInfo getLocalVar(java.lang.String name, int pc)
public LocalVarInfo getLocalVar(int slotIdx, int pc)
public LocalVarInfo[] getLocalVars()
public java.lang.String[] getLocalVariableNames()
public MethodInfo getOverriddenMethodInfo()
public java.lang.String getName()
public java.lang.String getJNIName()
public int getModifiers()
public boolean isNative()
public boolean isAbstract()
public boolean isUnresolvedNativeMethod()
public boolean isJPFExecutable()
public int getNumberOfArguments()
public int getNumberOfStackArguments()
public int getNumberOfCallerStackSlots()
public Instruction getFirstInsn()
public Instruction getLastInsn()
public boolean isReferenceReturnType()
public byte getReturnTypeCode()
public int getReturnSize()
public java.lang.Class<? extends ChoiceGenerator<?>> getReturnChoiceGeneratorType()
public java.lang.String getSignature()
public java.lang.String getGenericSignature()
getGenericSignature
in interface GenericSignatureHolder
public void setGenericSignature(java.lang.String sig)
setGenericSignature
in interface GenericSignatureHolder
public boolean isStatic()
public boolean isPublic()
public boolean isPrivate()
public boolean isProtected()
public boolean isSynchronized()
public boolean isSynthetic()
public boolean isVarargs()
public boolean isJPFInternal()
public java.lang.String getUniqueName()
public boolean hasCode()
public boolean hasEmptyBody()
protected void startParameterAnnotations(int annotationCount)
protected void setParameterAnnotations(int index, AnnotationInfo[] ai)
protected void finishParameterAnnotations()
public void setParameterAnnotations(AnnotationInfo[][] parameterAnnotations)
protected void startTrownExceptions(int exceptionCount)
protected void setException(int index, java.lang.String exceptionType)
protected void finishThrownExceptions()
public void setThrownExceptions(java.lang.String[] exceptions)
protected void startExceptionHandlerTable(int handlerCount)
protected void setExceptionHandler(int index, int startPc, int endPc, int handlerPc, java.lang.String catchType)
protected void finishExceptionHandlerTable()
public void setExceptionHandlers(ExceptionHandler[] handlers)
protected void startLocalVarTable(int localVarCount)
protected void setLocalVar(int index, java.lang.String varName, java.lang.String descriptor, int scopeStartPc, int scopeEndPc, int slotIndex)
protected void finishLocalVarTable()
public void setLocalVarTable(LocalVarInfo[] locals)
public void setLocalVarAnnotations()
public boolean hasTypeAnnotatedLocalVars()
public java.util.List<LocalVarInfo> getTypeAnnotatedLocalVars()
public java.util.List<LocalVarInfo> getTypeAnnotatedLocalVars(java.lang.String annotationClsName)
protected void startLineNumberTable(int lineNumberCount)
protected void setLineNumber(int index, int lineNumber, int startPc)
protected void finishLineNumberTable()
public void setLineNumbers(int[] lines, int[] startPcs)
public void setLineNumbers(int[] lines)
public java.lang.String toString()
toString
in class java.lang.Object
public void dump()
public MethodInfo getInstanceFor(ClassInfo ci)