|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.stack.Analyzer.ContextSensitivePolicy
The ContextSensitive
class implements the context-sensitive analysis similar to 1-CFA. It
is an implementation of the Analyzer.Policy
interface that determines what should be done
in the case of a call, return, push, pop, indirect call, etc. The context-sensitive analysis does not
model the contents of the stack, so pushes and pops essentially only modify the height of the stack.
Field Summary | |
protected int |
edgeType
|
StateCache.State |
frontierState
|
Constructor Summary | |
Analyzer.ContextSensitivePolicy()
|
Method Summary | |
MutableState |
call(MutableState s,
int target_address)
The call() method is called by the abstract interpreter when it encounters a call
instruction within the program. |
MutableState |
indirectCall(MutableState s,
char addr_low,
char addr_hi)
The indirectCall() method is called by the abstract interpreter when it encounters an
indirect call within the program. |
MutableState |
indirectCall(MutableState s,
char addr_low,
char addr_hi,
char ext)
The indirectCall() method is called by the abstract interpreter when it encounters an
indirect call within the program. |
MutableState |
indirectJump(MutableState s,
char addr_low,
char addr_hi)
The indirectJump() method is called by the abstract interpreter when it encounters an
indirect jump within the program. |
MutableState |
indirectJump(MutableState s,
char addr_low,
char addr_hi,
char ext)
The indirectJump() method is called by the abstract interpreter when it encounters an
indirect jump within the program. |
MutableState |
interrupt(MutableState s,
int num)
The interrupt() is called by the abstract interrupt when it encounters a place in the
program when an interrupt might occur. |
char |
pop(MutableState s)
The pop() method is called by the abstract interpreter when a pop from the stack is
ecountered in the program. |
void |
push(MutableState s,
char val)
The push() method is called by the abstract interpreter when a push to the stack is
encountered in the program. |
void |
pushState(MutableState newState)
The pushState method is called by the abstract interpreter when a state is forked by
the abstract interpreter (for example when a branch condition is not known and both branches must
be taken. |
MutableState |
ret(MutableState s)
The ret() method is called by the abstract interpreter when it encounters a return
within the program. |
MutableState |
reti(MutableState s)
The reti() method is called by the abstract interpreter when it encounters a return
from an interrupt within the program. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public StateCache.State frontierState
protected int edgeType
Constructor Detail |
public Analyzer.ContextSensitivePolicy()
Method Detail |
public MutableState call(MutableState s, int target_address)
call()
method is called by the abstract interpreter when it encounters a call
instruction within the program. Different policies may handle calls differently. This
context-sensitive analysis keeps track of the call site every time a new method is entered. Thus
the states coming into a method call are merged according to the call site, instead of all merged
together.
call
in interface AnalyzerPolicy
s
- the current abstract statetarget_address
- the concrete target address of the call
public MutableState interrupt(MutableState s, int num)
interrupt()
is called by the abstract interrupt when it encounters a place in the
program when an interrupt might occur.
interrupt
in interface AnalyzerPolicy
s
- the abstract state just before interruptnum
- the interrupt number that might occur
public MutableState ret(MutableState s)
ret()
method is called by the abstract interpreter when it encounters a return
within the program. In the context-sensitive analysis, the return state must be connected with the
call site. This is done by accessing the call site list which is stored in this frontier state and
inserting edges for each call site.
ret
in interface AnalyzerPolicy
s
- the current abstract state
public MutableState reti(MutableState s)
reti()
method is called by the abstract interpreter when it encounters a return
from an interrupt within the program.
reti
in interface AnalyzerPolicy
s
- the current abstract state
public MutableState indirectCall(MutableState s, char addr_low, char addr_hi)
indirectCall()
method is called by the abstract interpreter when it encounters an
indirect call within the program. The abstract values of the address are given as parameters, so
that a policy can choose to compute possible targets or be conservative or whatever it so chooses.
indirectCall
in interface AnalyzerPolicy
s
- the current abstract stateaddr_low
- the (abstract) low byte of the addressaddr_hi
- the (abstract) high byte of the address
public MutableState indirectJump(MutableState s, char addr_low, char addr_hi)
indirectJump()
method is called by the abstract interpreter when it encounters an
indirect jump within the program. The abstract values of the address are given as parameters, so
that a policy can choose to compute possible targets or be conservative or whatever it so chooses.
indirectJump
in interface AnalyzerPolicy
s
- the current abstract stateaddr_low
- the (abstract) low byte of the addressaddr_hi
- the (abstract) high byte of the address
public MutableState indirectCall(MutableState s, char addr_low, char addr_hi, char ext)
indirectCall()
method is called by the abstract interpreter when it encounters an
indirect call within the program. The abstract values of the address are given as parameters, so
that a policy can choose to compute possible targets or be conservative or whatever it so chooses.
indirectCall
in interface AnalyzerPolicy
s
- the current abstract stateaddr_low
- the (abstract) low byte of the addressaddr_hi
- the (abstract) high byte of the addressext
- the (abstract) extended part of the address
public MutableState indirectJump(MutableState s, char addr_low, char addr_hi, char ext)
indirectJump()
method is called by the abstract interpreter when it encounters an
indirect jump within the program. The abstract values of the address are given as parameters, so
that a policy can choose to compute possible targets or be conservative or whatever it so chooses.
indirectJump
in interface AnalyzerPolicy
s
- the current abstract stateaddr_low
- the (abstract) low byte of the addressaddr_hi
- the (abstract) high byte of the addressext
- the (abstract) extended part of the address
public void push(MutableState s, char val)
push()
method is called by the abstract interpreter when a push to the stack is
encountered in the program. The policy can then choose what outgoing and/or modelling of the stack
needs to be done.
push
in interface AnalyzerPolicy
s
- the current abstract stateval
- the abstract value to push onto the stackpublic char pop(MutableState s)
pop()
method is called by the abstract interpreter when a pop from the stack is
ecountered in the program. The policy can then choose to either return whatever information it has
about the stack contents, or return an UNKNOWN value.
pop
in interface AnalyzerPolicy
s
- the current abstract state
public void pushState(MutableState newState)
pushState
method is called by the abstract interpreter when a state is forked by
the abstract interpreter (for example when a branch condition is not known and both branches must
be taken.
pushState
in interface AnalyzerPolicy
newState
- the new state created
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |