S
- public abstract class AbstractInterproceduralAnalysis<S>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected CallGraph |
cg |
protected java.util.Map<SootMethod,S> |
data |
protected DirectedGraph<SootMethod> |
dg |
static boolean |
doCheck |
protected java.util.Map<SootMethod,java.lang.Integer> |
order |
protected java.util.Map<SootMethod,S> |
unanalysed |
Constructor and Description |
---|
AbstractInterproceduralAnalysis(CallGraph cg,
SootMethodFilter filter,
java.util.Iterator<SootMethod> heads,
boolean verbose)
The constructor performs some preprocessing, but you have to call
doAnalysis to preform the real stuff.
|
Modifier and Type | Method and Description |
---|---|
void |
analyseCall(S src,
Stmt callStmt,
S dst)
Analyse the call
callStmt in the context src , and put the
result into dst . |
protected abstract void |
analyseMethod(SootMethod method,
S dst)
Compute the summary for a method by analysing its body.
|
protected abstract void |
applySummary(S src,
Stmt callStmt,
S summary,
S dst)
Interprocedural analysis will call applySummary repeatedly as a
consequence to
analyseCall(Object, Stmt, Object) , once for each
possible target method of the callStmt , provided with its
summary. |
protected abstract void |
copy(S sr,
S dst)
Copy src into dst.
|
protected void |
doAnalysis(boolean verbose)
Carry out the analysis.
|
void |
drawAsManyDot(java.lang.String prefix,
boolean drawUnanalysed)
Dump the each summary computed by the interprocedural analysis as a
separate graph.
|
void |
drawAsOneDot(java.lang.String name)
Dump the interprocedural analysis result as a graph.
|
protected void |
fillDotGraph(java.lang.String prefix,
S o,
DotGraph out)
Called by drawAsOneDot to fill dot subgraph out with the contents of
summary o.
|
java.util.Iterator<SootMethod> |
getAnalysedMethods()
Get an iterator over the list of SootMethod with an associated summary.
|
S |
getSummaryFor(SootMethod m)
Query the analysis result.
|
protected abstract void |
merge(S in1,
S in2,
S out)
Merge in1 and in2 into out.
|
protected abstract S |
newInitialSummary()
Initial summary value for analysed functions.
|
protected abstract S |
summaryOfUnanalysedMethod(SootMethod method)
Whenever the analyse requires the summary of a method you filtered-out,
this function is called instead of analyseMethod.
|
public static final boolean doCheck
protected final CallGraph cg
protected final DirectedGraph<SootMethod> dg
protected final java.util.Map<SootMethod,S> data
protected final java.util.Map<SootMethod,java.lang.Integer> order
protected final java.util.Map<SootMethod,S> unanalysed
public AbstractInterproceduralAnalysis(CallGraph cg, SootMethodFilter filter, java.util.Iterator<SootMethod> heads, boolean verbose)
cg
- filter
- verbose
- heads
- protected abstract S newInitialSummary()
protected abstract S summaryOfUnanalysedMethod(SootMethod method)
Note: This function is called at most once per filtered-out method. It is the equivalent of entryInitialFlow!
method
- protected abstract void analyseMethod(SootMethod method, S dst)
method
- is the method to be analyseddst
- is where to put the computed method summaryprotected abstract void applySummary(S src, Stmt callStmt, S summary, S dst)
analyseCall(Object, Stmt, Object)
, once for each
possible target method of the callStmt
, provided with its
summary.src
- summary valid before the call statementcallStmt
- a statement containing a InvokeStmt or InvokeExprsummary
- summary of the possible target of callStmt considered
heredst
- where to put the resultanalyseCall
protected abstract void merge(S in1, S in2, S out)
in1
- in2
- out
- protected void fillDotGraph(java.lang.String prefix, S o, DotGraph out)
prefix
- gives you a unique string to prefix your node names and
avoid name-clasho
- out
- public void analyseCall(S src, Stmt callStmt, S dst)
callStmt
in the context src
, and put the
result into dst
. For each possible target of the call, this will
get the summary for the target method (possibly
summaryOfUnanalysedMethod(SootMethod)
) and
applySummary(Object, Stmt, Object, Object)
, then merge the
results into dst
using merge(Object, Object, Object)
.src
- dst
- callStmt
- summaryOfUnanalysedMethod(SootMethod)
,
applySummary(Object, Stmt, Object, Object)
public void drawAsOneDot(java.lang.String name)
name
- output filenamefillDotGraph
public void drawAsManyDot(java.lang.String prefix, boolean drawUnanalysed)
prefix
- is prepended before method name in output filenamedrawUnanalysed
- do you also want info for the unanalysed methods
required by the analysis via
summaryOfUnanalysedMethod ?fillDotGraph
public S getSummaryFor(SootMethod m)
m
- public java.util.Iterator<SootMethod> getAnalysedMethods()
protected void doAnalysis(boolean verbose)
verbose
-