Class ContextBasedAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
- java.lang.Object
-
- it.unive.lisa.interprocedural.CallGraphBasedAnalysis<A>
-
- it.unive.lisa.interprocedural.context.ContextBasedAnalysis<A>
-
- Type Parameters:
A
- theAbstractState
of the analysis
- All Implemented Interfaces:
it.unive.lisa.interprocedural.InterproceduralAnalysis<A>
- Direct Known Subclasses:
BaseCasesFinder
,RecursionSolver
public class ContextBasedAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>> extends CallGraphBasedAnalysis<A>
A context sensitive interprocedural analysis. The context sensitivity is tuned by the kind ofContextSensitivityToken
used. Recursions are approximated applying the iterates of the recursion starting from bottom and using the same widening threshold of cfg fixpoints.
-
-
Field Summary
Fields Modifier and Type Field Description protected it.unive.lisa.conf.FixpointConfiguration
conf
The fixpoint configuration.protected it.unive.lisa.interprocedural.FixpointResults<A>
results
The results computed by this analysis.protected ContextSensitivityToken
token
The current sensitivity token.-
Fields inherited from class it.unive.lisa.interprocedural.CallGraphBasedAnalysis
app, callgraph, policy
-
-
Constructor Summary
Constructors Modifier Constructor Description ContextBasedAnalysis()
Builds the analysis, usingLastCallToken
s.protected
ContextBasedAnalysis(ContextBasedAnalysis<A> other)
Builds the analysis by copying the given one.ContextBasedAnalysis(ContextSensitivityToken token)
Builds the analysis.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canShortcut(it.unive.lisa.program.cfg.CFG cfg)
Whether or not this analysis can avoid computing a fixpoint for the given cfg when it is invoked by a call, and shortcut to the result for the same token if it exists and if it was produced with a greater entry state.void
fixpoint(it.unive.lisa.analysis.AnalysisState<A> entryState, java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> fixpointWorkingSet, it.unive.lisa.conf.FixpointConfiguration conf)
it.unive.lisa.analysis.AnalysisState<A>
getAbstractResultOf(it.unive.lisa.program.cfg.statement.call.CFGCall call, it.unive.lisa.analysis.AnalysisState<A> entryState, it.unive.lisa.analysis.lattices.ExpressionSet[] parameters, it.unive.lisa.analysis.StatementStore<A> expressions)
java.util.Collection<it.unive.lisa.analysis.AnalyzedCFG<A>>
getAnalysisResultsOf(it.unive.lisa.program.cfg.CFG cfg)
it.unive.lisa.interprocedural.FixpointResults<A>
getFixpointResults()
void
init(it.unive.lisa.program.Application app, it.unive.lisa.interprocedural.callgraph.CallGraph callgraph, it.unive.lisa.interprocedural.OpenCallPolicy policy)
protected boolean
shouldCheckForRecursions()
Whether or not this analysis should look for recursions when evaluating calls, immediately returning bottom when one is found.protected boolean
shouldStoreFixpointResults()
Whether or not this analysis should store the results of fixpoint executions for them to be returned as part ofgetFixpointResults()
.-
Methods inherited from class it.unive.lisa.interprocedural.CallGraphBasedAnalysis
getAbstractResultOf, needsCallGraph, prepareEntryStateOfEntryPoint, resolve
-
-
-
-
Field Detail
-
results
protected it.unive.lisa.interprocedural.FixpointResults<A extends it.unive.lisa.analysis.AbstractState<A>> results
The results computed by this analysis.
-
token
protected ContextSensitivityToken token
The current sensitivity token.
-
conf
protected it.unive.lisa.conf.FixpointConfiguration conf
The fixpoint configuration.
-
-
Constructor Detail
-
ContextBasedAnalysis
public ContextBasedAnalysis()
Builds the analysis, usingLastCallToken
s.
-
ContextBasedAnalysis
public ContextBasedAnalysis(ContextSensitivityToken token)
Builds the analysis.- Parameters:
token
- an instance of the tokens to be used to partition w.r.t. context sensitivity
-
ContextBasedAnalysis
protected ContextBasedAnalysis(ContextBasedAnalysis<A> other)
Builds the analysis by copying the given one.- Parameters:
other
- the original analysis to copy
-
-
Method Detail
-
init
public void init(it.unive.lisa.program.Application app, it.unive.lisa.interprocedural.callgraph.CallGraph callgraph, it.unive.lisa.interprocedural.OpenCallPolicy policy) throws it.unive.lisa.interprocedural.InterproceduralAnalysisException
- Specified by:
init
in interfaceit.unive.lisa.interprocedural.InterproceduralAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
- Overrides:
init
in classCallGraphBasedAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
- Throws:
it.unive.lisa.interprocedural.InterproceduralAnalysisException
-
fixpoint
public void fixpoint(it.unive.lisa.analysis.AnalysisState<A> entryState, java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> fixpointWorkingSet, it.unive.lisa.conf.FixpointConfiguration conf) throws it.unive.lisa.util.datastructures.graph.algorithms.FixpointException
- Throws:
it.unive.lisa.util.datastructures.graph.algorithms.FixpointException
-
getAnalysisResultsOf
public java.util.Collection<it.unive.lisa.analysis.AnalyzedCFG<A>> getAnalysisResultsOf(it.unive.lisa.program.cfg.CFG cfg)
-
canShortcut
protected boolean canShortcut(it.unive.lisa.program.cfg.CFG cfg)
Whether or not this analysis can avoid computing a fixpoint for the given cfg when it is invoked by a call, and shortcut to the result for the same token if it exists and if it was produced with a greater entry state.- Parameters:
cfg
- the cfg under evaluation- Returns:
true
if that condition holds (defaults totrue
)
-
shouldCheckForRecursions
protected boolean shouldCheckForRecursions()
Whether or not this analysis should look for recursions when evaluating calls, immediately returning bottom when one is found.- Returns:
true
if that condition holds (defaults totrue
)
-
shouldStoreFixpointResults
protected boolean shouldStoreFixpointResults()
Whether or not this analysis should store the results of fixpoint executions for them to be returned as part ofgetFixpointResults()
.- Returns:
true
if that condition holds (defaults totrue
)
-
getFixpointResults
public it.unive.lisa.interprocedural.FixpointResults<A> getFixpointResults()
-
getAbstractResultOf
public it.unive.lisa.analysis.AnalysisState<A> getAbstractResultOf(it.unive.lisa.program.cfg.statement.call.CFGCall call, it.unive.lisa.analysis.AnalysisState<A> entryState, it.unive.lisa.analysis.lattices.ExpressionSet[] parameters, it.unive.lisa.analysis.StatementStore<A> expressions) throws it.unive.lisa.analysis.SemanticException
- Throws:
it.unive.lisa.analysis.SemanticException
-
-