public abstract class StackFrame extends Object implements Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
ATTR_IS_FROZEN
this StackFrame is not allowed to be modified anymore because it has been state stored.
|
protected int |
attributes
state management related attributes similar to ElementInfo.
|
protected Object[] |
attrs |
protected Object |
frameAttr |
protected FixedBitSet |
isRef |
protected MethodInfo |
mi |
protected Instruction |
pc |
protected StackFrame |
prev
the previous StackFrame (usually the caller, null if first).
|
protected int[] |
slots |
protected int |
stackBase |
protected int |
thisRef |
protected int |
top |
Modifier | Constructor and Description |
---|---|
protected |
StackFrame()
Creates an empty stack frame.
|
protected |
StackFrame(int nLocals,
int nOperands)
creates callerSlots dummy Stackframe for testing of operand/local operations
NOTE - TESTING ONLY! this does not have a MethodInfo
|
|
StackFrame(MethodInfo callee) |
protected |
StackFrame(MethodInfo m,
int nLocals,
int nOperands) |
Modifier and Type | Method and Description |
---|---|
void |
addFrameAttr(Object attr) |
void |
addLocalAttr(int index,
Object attr) |
void |
addLongOperandAttr(Object a) |
void |
addOperandAttr(int offset,
Object a) |
void |
addOperandAttr(Object a) |
void |
advancePC() |
protected void |
checkIsModifiable() |
void |
clearOperandStack() |
StackFrame |
clone() |
protected FixedBitSet |
createReferenceMap(int nSlots) |
void |
defreeze() |
void |
dup_x1() |
void |
dup_x2() |
void |
dup() |
void |
dup2_x1() |
void |
dup2_x2() |
void |
dup2() |
boolean |
equals(Object o)
default implementation is just an identity check
|
ObjectList.Iterator |
frameAttrIterator() |
<T> ObjectList.TypedIterator<T> |
frameAttrIterator(Class<T> attrType) |
void |
freeze() |
Object[] |
getArgumentAttrs(MethodInfo miCallee)
return an array of all argument attrs, which in turn can be lists.
|
int |
getCalleeThis(int size)
return reference of called object in the context of the caller
(i.e.
|
int |
getCalleeThis(MethodInfo mi)
return the object reference for an instance method to be called (we are still in the
caller's frame).
|
ClassInfo |
getClassInfo() |
String |
getClassName() |
int |
getDepth() |
double |
getDoubleLocalVariable(int idx) |
double |
getDoubleLocalVariable(String name) |
double |
getDoubleResult() |
Object |
getDoubleResultAttr() |
Object |
getFieldValue(String id) |
float |
getFloatLocalVariable(int idx) |
float |
getFloatResult() |
Object |
getFloatResultAttr() |
Object |
getFrameAttr()
this returns all of them - use either if you know there will be only
one attribute at callerSlots time, or check/process result with ObjectList
|
<T> T |
getFrameAttr(Class<T> attrType)
this only returns the first attr of this type, there can be more
if you don't use client private types or the provided type is too general
|
int |
getLine() |
Object |
getLocalAttr(int index)
this returns all of them - use either if you know there will be only
one attribute at callerSlots time, or check/process result with ObjectList
|
<T> T |
getLocalAttr(int index,
Class<T> attrType)
this only returns the first attr of this type, there can be more
if you don't use client private types or the provided type is too general
|
int |
getLocalAttrIndex(Class<?> attrType,
int startIdx)
helper to quickly find out if any of the locals slots holds
an attribute of the provided type
|
Object |
getLocalOrFieldValue(String id) |
Object |
getLocalValueObject(LocalVarInfo lv) |
int |
getLocalVariable(int i) |
int |
getLocalVariable(String name) |
int |
getLocalVariableCount() |
int |
getLocalVariableSlotIndex(String name) |
String |
getLocalVariableType(int idx) |
String |
getLocalVariableType(String name) |
LocalVarInfo |
getLocalVarInfo(int idx) |
LocalVarInfo |
getLocalVarInfo(String name) |
LocalVarInfo[] |
getLocalVars()
<2do> - this should return only LocalVarInfo for the current pc
|
long |
getLongLocalVariable(int idx) |
long |
getLongLocalVariable(String name) |
Object |
getLongOperandAttr()
this returns all of them - use either if you know there will be only
one attribute at callerSlots time, or check/process result with ObjectList
|
<T> T |
getLongOperandAttr(Class<T> attrType)
this only returns the first attr of this type, there can be more
if you don't use client private types or the provided type is too general
|
abstract long |
getLongResult() |
abstract Object |
getLongResultAttr() |
MethodInfo |
getMethodInfo() |
String |
getMethodName() |
<T> T |
getNextFrameAttr(Class<T> attrType,
Object prev) |
<T> T |
getNextLocalAttr(int index,
Class<T> attrType,
Object prev) |
<T> T |
getNextLongOperandAttr(Class<T> attrType,
Object prev) |
<T> T |
getNextOperandAttr(Class<T> attrType,
Object prev) |
<T> T |
getNextOperandAttr(int offset,
Class<T> attrType,
Object prev) |
Object |
getOperandAttr()
this returns all of them - use either if you know there will be only
one attribute at callerSlots time, or check/process result with ObjectList
|
<T> T |
getOperandAttr(Class<T> attrType)
this only returns the first attr of this type, there can be more
if you don't use client private types or the provided type is too general
|
Object |
getOperandAttr(int offset)
this returns all of them - use either if you know there will be only
one attribute at callerSlots time, or check/process result with ObjectList
|
<T> T |
getOperandAttr(int offset,
Class<T> attrType)
this only returns the first attr of this type, there can be more
if you don't use client private types or the provided type is too general
|
Instruction |
getPC() |
StackFrame |
getPrevious() |
FixedBitSet |
getReferenceMap() |
abstract int |
getReferenceResult() |
abstract int |
getResult() |
abstract Object |
getResultAttr() |
int |
getSlot(int idx) |
Object |
getSlotAttr(int i) |
Object[] |
getSlotAttrs() |
int[] |
getSlots() |
String |
getSourceFile() |
String |
getStackTraceInfo() |
int |
getThis()
if this is an instance method, return the reference of the corresponding object
(note this only has to be in slot 0 upon entry)
|
int |
getTopPos() |
boolean |
hasAnyRef() |
boolean |
hasArgumentAttr(MethodInfo miCallee,
Class<?> attrType)
check if there is any argument attr of the provided type on the operand stack
this is far more efficient than retrieving attribute values (we don't
care for argument types)
|
boolean |
hasAttrs() |
boolean |
hasFrameAttr() |
boolean |
hasFrameAttr(Class<?> attrType) |
boolean |
hasFrameAttrValue(Object a) |
protected void |
hash(HashData hd) |
int |
hashCode() |
boolean |
hasLocalAttr(int index) |
boolean |
hasLocalAttr(int index,
Class<?> type) |
boolean |
hasLongOperandAttr() |
boolean |
hasLongOperandAttr(Class<?> type) |
boolean |
hasOperandAttr() |
boolean |
hasOperandAttr(Class<?> type) |
boolean |
hasOperandAttr(int offset) |
boolean |
hasOperandAttr(int offset,
Class<?> type) |
boolean |
includesReferenceOperand(int objRef)
does any of the operand slots hold callerSlots reference value of 'objRef'
|
boolean |
includesReferenceOperand(int nTopSlots,
int objRef)
does any of the 'nTopSlots' hold callerSlots reference value of 'objRef'
'nTopSlots' is usually obtained from MethodInfo.getNumberOfCallerStackSlots()
|
boolean |
isDirectCallFrame() |
boolean |
isFirewall() |
boolean |
isFrozen() |
boolean |
isLocalVariableRef(int idx) |
boolean |
isNative() |
boolean |
isOperandRef() |
boolean |
isOperandRef(int offset) |
boolean |
isReferenceSlot(int idx) |
boolean |
isReflection() |
boolean |
isSynthetic() |
ObjectList.Iterator |
localAttrIterator(int index) |
<T> ObjectList.TypedIterator<T> |
localAttrIterator(int index,
Class<T> attrType) |
ObjectList.Iterator |
longOperandAttrIterator() |
<T> ObjectList.TypedIterator<T> |
longOperandAttrIterator(Class<T> attrType) |
void |
markThreadRoots(Heap heap,
int tid)
mark all objects reachable from local or operand stack positions containing
references.
|
int |
mixinExecutionStateHash(int h) |
boolean |
modifiesState()
is this StackFrame modifying the KernelState
this is true unless this is callerSlots NativeStackFrame
|
protected int |
objectHashCode() |
Iterator |
operandAttrIterator() |
<T> Iterator<T> |
operandAttrIterator(Class<T> attrType) |
ObjectList.Iterator |
operandAttrIterator(int offset) |
<T> ObjectList.TypedIterator<T> |
operandAttrIterator(int offset,
Class<T> attrType) |
int |
peek() |
int |
peek(int offset) |
double |
peekDouble() |
double |
peekDouble(int offset) |
float |
peekFloat() |
float |
peekFloat(int offset) |
long |
peekLong() |
long |
peekLong(int offset) |
int |
pop() |
void |
pop(int n) |
double |
popDouble() |
float |
popFloat() |
long |
popLong() |
protected void |
printContentsOn(PrintWriter pw) |
void |
printOperands(PrintStream pw) |
void |
printSlots(PrintStream ps) |
void |
printStackContent()
this includes locals and pc
|
void |
printStackTrace() |
void |
processRefArguments(MethodInfo miCallee,
ReferenceProcessor visitor)
generic visitor for reference arguments
|
void |
push(int v) |
void |
push(int v,
boolean ref) |
void |
pushDouble(double v) |
void |
pushFloat(float v) |
void |
pushLocal(int index) |
void |
pushLong(long v) |
void |
pushLongLocal(int index) |
void |
pushRef(int ref) |
void |
removeArguments(MethodInfo mi) |
void |
removeFrameAttr(Object attr) |
void |
removeLocalAttr(int index,
Object attr) |
void |
removeLongOperandAttr(Object a) |
void |
removeOperandAttr(int offset,
Object a) |
void |
removeOperandAttr(Object a) |
void |
replaceFrameAttr(Object oldAttr,
Object newAttr) |
void |
replaceLocalAttr(int index,
Object oldAttr,
Object newAttr) |
void |
replaceLongOperandAttr(Object oldAttr,
Object newAttr) |
void |
replaceOperandAttr(int offset,
Object oldAttr,
Object newAttr) |
void |
replaceOperandAttr(Object oldAttr,
Object newAttr) |
void |
reset()
re-execute method from the beginning - use with care
|
abstract void |
setArgumentLocal(int idx,
int value,
Object attr) |
void |
setDoubleArgumentLocal(int idx,
double value,
Object attr) |
void |
setFloatArgumentLocal(int idx,
float value,
Object attr) |
void |
setFrameAttr(Object attr)
this replaces all of them - use only if you know there are no
SystemAttributes in the list (which would cause an exception)
|
void |
setLocalAttr(int index,
Object a)
this replaces all of them - use only if you know
- there will be only one attribute at callerSlots time
- you obtained the value you set by callerSlots previous getXAttr()
- you constructed callerSlots multi value list with ObjectList.createList()
|
void |
setLocalReferenceVariable(int index,
int ref) |
void |
setLocalVariable(int index,
int v) |
void |
setLocalVariable(int index,
int v,
boolean ref) |
abstract void |
setLongArgumentLocal(int idx,
long value,
Object attr) |
void |
setLongLocalVariable(int index,
long v) |
void |
setLongOperandAttr(Object a)
this replaces all of them - use only if you know
- there will be only one attribute at callerSlots time
- you obtained the value you set by callerSlots previous getXAttr()
- you constructed callerSlots multi value list with ObjectList.createList()
|
void |
setOperand(int offset,
int v,
boolean isRefValue) |
void |
setOperandAttr(int offset,
Object a)
this replaces all of them - use only if you know
- there will be only one attribute at callerSlots time
- you obtained the value you set by callerSlots previous getXAttr()
- you constructed callerSlots multi value list with ObjectList.createList()
|
void |
setOperandAttr(Object a)
this replaces all of them - use only if you know
- there will be only one attribute at callerSlots time
- you obtained the value you set by callerSlots previous getXAttr()
- you constructed callerSlots multi value list with ObjectList.createList()
|
void |
setPC(Instruction newpc) |
void |
setPrevious(StackFrame frame)
to be set (by ThreadInfo) when the frame is pushed.
|
abstract void |
setReferenceArgumentLocal(int idx,
int ref,
Object attr) |
void |
setReflection() |
void |
setSlotAttr(int i,
Object a) |
void |
setThis(int objRef) |
void |
storeLongOperand(int index) |
void |
storeOperand(int index) |
void |
swap() |
String |
toString() |
void |
visitReferenceSlots(ReferenceProcessor visitor) |
public static final int ATTR_IS_FROZEN
protected StackFrame prev
protected int attributes
protected int top
protected int thisRef
protected int stackBase
protected int[] slots
protected FixedBitSet isRef
protected Object frameAttr
protected Object[] attrs
protected Instruction pc
protected MethodInfo mi
public StackFrame(MethodInfo callee)
protected StackFrame(MethodInfo m, int nLocals, int nOperands)
protected StackFrame()
protected StackFrame(int nLocals, int nOperands)
public void reset()
protected FixedBitSet createReferenceMap(int nSlots)
public boolean isNative()
public int getCalleeThis(MethodInfo mi)
public int getCalleeThis(int size)
public StackFrame getPrevious()
public void setPrevious(StackFrame frame)
public Object getLocalValueObject(LocalVarInfo lv)
public ClassInfo getClassInfo()
public String getClassName()
public String getSourceFile()
public boolean includesReferenceOperand(int nTopSlots, int objRef)
public boolean includesReferenceOperand(int objRef)
public boolean modifiesState()
public boolean isDirectCallFrame()
public boolean isSynthetic()
public int getLine()
public void processRefArguments(MethodInfo miCallee, ReferenceProcessor visitor)
public int getSlot(int idx)
public boolean isReferenceSlot(int idx)
public void setOperand(int offset, int v, boolean isRefValue)
public boolean hasAttrs()
public boolean hasFrameAttr()
public boolean hasFrameAttr(Class<?> attrType)
public boolean hasFrameAttrValue(Object a)
public Object getFrameAttr()
public void setFrameAttr(Object attr)
public void addFrameAttr(Object attr)
public void removeFrameAttr(Object attr)
public <T> T getFrameAttr(Class<T> attrType)
public ObjectList.Iterator frameAttrIterator()
public <T> ObjectList.TypedIterator<T> frameAttrIterator(Class<T> attrType)
public boolean hasOperandAttr()
public boolean hasOperandAttr(Class<?> type)
public Object getOperandAttr()
public void setOperandAttr(Object a)
public <T> T getOperandAttr(Class<T> attrType)
public Iterator operandAttrIterator()
public void addOperandAttr(Object a)
public void removeOperandAttr(Object a)
public boolean hasOperandAttr(int offset)
public boolean hasOperandAttr(int offset, Class<?> type)
public Object getOperandAttr(int offset)
public void setOperandAttr(int offset, Object a)
public <T> T getOperandAttr(int offset, Class<T> attrType)
public ObjectList.Iterator operandAttrIterator(int offset)
public <T> ObjectList.TypedIterator<T> operandAttrIterator(int offset, Class<T> attrType)
public void addOperandAttr(int offset, Object a)
public void removeOperandAttr(int offset, Object a)
public boolean hasLongOperandAttr()
public boolean hasLongOperandAttr(Class<?> type)
public Object getLongOperandAttr()
public void setLongOperandAttr(Object a)
public <T> T getLongOperandAttr(Class<T> attrType)
public ObjectList.Iterator longOperandAttrIterator()
public <T> ObjectList.TypedIterator<T> longOperandAttrIterator(Class<T> attrType)
public void addLongOperandAttr(Object a)
public void removeLongOperandAttr(Object a)
public boolean hasLocalAttr(int index)
public boolean hasLocalAttr(int index, Class<?> type)
public Object getLocalAttr(int index)
public void setLocalAttr(int index, Object a)
public <T> T getLocalAttr(int index, Class<T> attrType)
public ObjectList.Iterator localAttrIterator(int index)
public <T> ObjectList.TypedIterator<T> localAttrIterator(int index, Class<T> attrType)
public void addLocalAttr(int index, Object attr)
public void removeLocalAttr(int index, Object attr)
public int getLocalAttrIndex(Class<?> attrType, int startIdx)
attrType
- type of attribute to look forstartIdx
- local index to start frompublic Object[] getArgumentAttrs(MethodInfo miCallee)
public boolean hasArgumentAttr(MethodInfo miCallee, Class<?> attrType)
public void setLocalReferenceVariable(int index, int ref)
public void setLocalVariable(int index, int v)
public void setLocalVariable(int index, int v, boolean ref)
public int getLocalVariable(int i)
public int getLocalVariable(String name)
public int getLocalVariableCount()
public LocalVarInfo[] getLocalVars()
public boolean isLocalVariableRef(int idx)
public String getLocalVariableType(int idx)
public LocalVarInfo getLocalVarInfo(String name)
public LocalVarInfo getLocalVarInfo(int idx)
public int[] getSlots()
public FixedBitSet getReferenceMap()
public Object[] getSlotAttrs()
public Object getSlotAttr(int i)
public void setSlotAttr(int i, Object a)
public void setThis(int objRef)
public void visitReferenceSlots(ReferenceProcessor visitor)
public void setLongLocalVariable(int index, long v)
public long getLongLocalVariable(int idx)
public double getDoubleLocalVariable(int idx)
public float getFloatLocalVariable(int idx)
public double getDoubleLocalVariable(String name)
public long getLongLocalVariable(String name)
public MethodInfo getMethodInfo()
public String getMethodName()
public boolean isOperandRef(int offset)
public boolean isOperandRef()
public void setPC(Instruction newpc)
public Instruction getPC()
public void advancePC()
public int getTopPos()
public boolean isFirewall()
public String getStackTraceInfo()
public int getThis()
public void clearOperandStack()
public StackFrame clone()
protected void checkIsModifiable()
public void freeze()
public void defreeze()
public boolean isFrozen()
public void setReflection()
public boolean isReflection()
public void dup()
public void dup2()
public void dup2_x1()
public void dup2_x2()
public void dup_x1()
public void dup_x2()
public boolean equals(Object o)
Object
public boolean hasAnyRef()
public int mixinExecutionStateHash(int h)
protected void hash(HashData hd)
public void markThreadRoots(Heap heap, int tid)
public void printOperands(PrintStream pw)
public void printStackContent()
public void printStackTrace()
public void swap()
protected void printContentsOn(PrintWriter pw)
public void printSlots(PrintStream ps)
public int getDepth()
protected int objectHashCode()
public float peekFloat()
public float peekFloat(int offset)
public double peekDouble()
public double peekDouble(int offset)
public long peekLong()
public long peekLong(int offset)
public void pushLong(long v)
public void pushDouble(double v)
public void pushFloat(float v)
public double popDouble()
public long popLong()
public int peek()
public int peek(int offset)
public void removeArguments(MethodInfo mi)
public void pop(int n)
public float popFloat()
public int pop()
public void pushLocal(int index)
public void pushLongLocal(int index)
public void storeOperand(int index)
public void storeLongOperand(int index)
public void push(int v)
public void pushRef(int ref)
public void push(int v, boolean ref)
public int getLocalVariableSlotIndex(String name)
public abstract int getResult()
public abstract int getReferenceResult()
public abstract long getLongResult()
public abstract Object getResultAttr()
public abstract Object getLongResultAttr()
public float getFloatResult()
public double getDoubleResult()
public Object getFloatResultAttr()
public Object getDoubleResultAttr()
public abstract void setArgumentLocal(int idx, int value, Object attr)
public abstract void setLongArgumentLocal(int idx, long value, Object attr)
public abstract void setReferenceArgumentLocal(int idx, int ref, Object attr)
public void setFloatArgumentLocal(int idx, float value, Object attr)
public void setDoubleArgumentLocal(int idx, double value, Object attr)