|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vasco.InterProceduralAnalysis<M,N,A> vasco.OldForwardInterProceduralAnalysis<M,N,A>
M
- the type of a methodN
- the type of a node in the CFGA
- the type of a data flow valuePointsToAnalysis
class is migrated to the new API.
After that work is done, this class will be permanently removed from VASCO.
public abstract class OldForwardInterProceduralAnalysis<M,N,A>
A generic forward-flow inter-procedural analysis which is fully context-sensitive.
This class essentially captures a forward data flow problem which can be
solved using the context-sensitive inter-procedural analysis framework as
described in InterProceduralAnalysis
.
This is the class that client analyses will extend in order to perform forward-flow inter-procedural analysis.
Field Summary | |
---|---|
protected Stack<Context<M,N,A>> |
analysisStack
Deprecated. |
Fields inherited from class vasco.InterProceduralAnalysis |
---|
contexts, contextTransitions, freeResultsOnTheFly, reverse, verbose, worklist |
Constructor Summary | |
---|---|
OldForwardInterProceduralAnalysis()
Deprecated. Constructs a new forward-flow inter-procedural analysis. |
Method Summary | |
---|---|
void |
doAnalysis()
Deprecated. Performs the actual data flow analysis. |
protected abstract A |
flowFunction(Context<M,N,A> context,
N unit,
A in)
Deprecated. |
protected void |
initContext(Context<M,N,A> context,
A entryValue)
Deprecated. Creates a new context and initialises data flow values. |
protected A |
processCall(Context<M,N,A> callerContext,
N callNode,
M method,
A entryValue)
Deprecated. Processes a call statement. |
Methods inherited from class vasco.InterProceduralAnalysis |
---|
boundaryValue, copy, getCallers, getContext, getContexts, getContextTransitionTable, getMeetOverValidPathsSolution, getMethods, getTargets, meet, programRepresentation, topValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Stack<Context<M,N,A>> analysisStack
Constructor Detail |
---|
public OldForwardInterProceduralAnalysis()
Method Detail |
---|
public void doAnalysis()
A work-list of contexts is maintained, each with it's own work-list of CFG nodes to process. For each node removed from the work-list of the newest context, the meet of values along incoming edges (in the direction of analysis) is computed and then the flow function is processed depending on whether the node contains a call or not. If the resulting data flow value has changed, then nodes along outgoing edges (in the direction of analysis) are also added to the work-list.
Analysis starts with the context for the program entry points with the given boundary values and ends when the work-list is empty.
See the SOAP '13 paper for the full algorithm in Figure 1.
doAnalysis
in class InterProceduralAnalysis<M,N,A>
protected void initContext(Context<M,N,A> context, A entryValue)
The following steps are performed:
context
- the context to initialiseentryValue
- the data flow value at the entry of this methodprotected A processCall(Context<M,N,A> callerContext, N callNode, M method, A entryValue)
Retrieves a value context for the callee if one exists with the given entry value, or else creates a new one and adds the transition to the context transition table.
If the callee context has already been analysed, returns the resulting exit value. For newly created contexts the result would be null, as they are obviously not analysed even once.
Note that this method is not directly called by doAnalysis
, but
is instead called by flowFunction
when a method
call statement is encountered. The reason for this design decision is
that client analyses may want their own setup and tear down sequences
before a call is made (similar to edge flow functions at the call and
return site). Also, analyses may want to choose which method call to
process at an invoke statement in the case of virtual calls (e.g. a
points-to analysis may build the call-graph on-the-fly).
Therefore, it is the responsibility of the client analysis to detect
an invoke expression when implementing flowFunction
,
and suitably invoke processCall
with
the input data flow value which may be different from the IN/OUT value of the node due to
handling of arguments, etc. Similarly, the result of processCall
may be modified by the client to handle return values, etc. before returning from flowFunction
.
Ideally, flowFunction
should return
null if and only if processCall
returns null.
callerContext
- the analysis context at the call-sitecallNode
- the calling statementmethod
- the method being calledentryValue
- the data flow value at the entry of the called method.
protected abstract A flowFunction(Context<M,N,A> context, N unit, A in)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |