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 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 ArrayList<MethodInfo> |
mthTable |
protected 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 String |
signature
Signature of the method
|
protected String[] |
thrownExceptionClassNames
classnames of checked exception thrown by the method
|
protected 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
Constructor and Description |
---|
MethodInfo(ClassInfo ci,
String name,
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(String name,
String signature,
int modifiers) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
boolean |
containsLineNumber(int n) |
static MethodInfo |
create(String name,
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() |
String[] |
getArgumentTypeNames() |
byte[] |
getArgumentTypes() |
String |
getBaseName()
return classname.name (but w/o signature)
|
ClassInfo |
getClassInfo()
Returns the class the method belongs to.
|
String |
getClassName() |
String |
getCompleteName()
Deprecated.
- use getFullName
|
ExceptionHandler[] |
getExceptions() |
Instruction |
getFirstInsn() |
String |
getFullName()
Returns the full classname (if any) + name + signature.
|
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) |
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(String name,
int pc) |
String[] |
getLocalVariableNames()
note that this might contain duplicates for variables with multiple
scope entries
|
LocalVarInfo[] |
getLocalVars() |
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() |
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
|
Class<? extends ChoiceGenerator<?>> |
getReturnChoiceGeneratorType() |
int |
getReturnSize()
what is the slot size of the return value
|
String |
getReturnType() |
byte |
getReturnTypeCode() |
String |
getReturnTypeName() |
String |
getSignature()
Returns the signature of the method.
|
String |
getSourceFileName() |
String |
getStackTraceName()
returns stack trace name: classname (if any) + name
|
String |
getStackTraceSource() |
String[] |
getThrownExceptionClassNames() |
String |
getUniqueName() |
static String |
getUniqueName(String mname,
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 |
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 |
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,
String exceptionType) |
protected void |
setExceptionHandler(int index,
int startPc,
int endPc,
int handlerPc,
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(String sig) |
protected void |
setLineNumber(int index,
int lineNumber,
int startPc) |
void |
setLineNumbers(int[] lines,
int[] startPcs)
note - this depends on that we already have a code array
(we might want to store lines and startPcs directly)
|
protected void |
setLocalVar(int index,
String varName,
String descriptor,
int scopeStartPc,
int scopeEndPc,
int slotIndex) |
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(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) |
String |
toString() |
addAnnotation, addAttr, attrIterator, attrIterator, getAnnotation, getAnnotations, getAttr, getAttr, getDeclaredAnnotations, getNextAttr, hasAnnotations, hasAttr, hasAttr, hasAttrValue, removeAttr, replaceAttr, setAnnotations, setAttr
protected static final ArrayList<MethodInfo> mthTable
protected static boolean warnedLocalInfo
protected int globalId
protected String uniqueName
protected String name
protected String signature
protected String genericSignature
protected ClassInfo ci
protected Instruction[] code
protected ExceptionHandler[] exceptionHandlers
protected 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(MethodInfo mi)
public MethodInfo(ClassInfo ci, String name, String signature, int modifiers, int maxLocals, int maxStack)
public static MethodInfo getMethodInfo(int globalId)
public static MethodInfo create(String name, 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 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 String getLongName()
public static String getUniqueName(String mname, String signature)
public String getStackTraceSource()
public byte[] getArgumentTypes()
public String[] getArgumentTypeNames()
public int getArgumentsSize()
public LocalVarInfo[] getArgumentLocalVars()
public String getReturnType()
public String getReturnTypeName()
public String getSourceFileName()
public String getClassName()
public ClassInfo getClassInfo()
public String getCompleteName()
public String getBaseName()
public boolean isCtor()
public boolean isInternalMethod()
public boolean isThreadEntry(ThreadInfo ti)
public String getFullName()
public 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 String[] getThrownExceptionClassNames()
public LocalVarInfo getLocalVar(String name, int pc)
public LocalVarInfo getLocalVar(int slotIdx, int pc)
public LocalVarInfo[] getLocalVars()
public String[] getLocalVariableNames()
public MethodInfo getOverriddenMethodInfo()
public String getName()
public String getJNIName()
public int getModifiers()
public boolean isNative()
public boolean isAbstract()
public boolean isUnresolvedNativeMethod()
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 Class<? extends ChoiceGenerator<?>> getReturnChoiceGeneratorType()
public String getSignature()
public String getGenericSignature()
getGenericSignature
in interface GenericSignatureHolder
public void setGenericSignature(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 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, String exceptionType)
protected void finishThrownExceptions()
public void setThrownExceptions(String[] exceptions)
protected void startExceptionHandlerTable(int handlerCount)
protected void setExceptionHandler(int index, int startPc, int endPc, int handlerPc, String catchType)
protected void finishExceptionHandlerTable()
public void setExceptionHandlers(ExceptionHandler[] handlers)
protected void startLocalVarTable(int localVarCount)
protected void setLocalVar(int index, String varName, String descriptor, int scopeStartPc, int scopeEndPc, int slotIndex)
protected void finishLocalVarTable()
public void setLocalVarTable(LocalVarInfo[] locals)
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 dump()
public MethodInfo getInstanceFor(ClassInfo ci)