Class RecursionSolver<A extends it.unive.lisa.analysis.AbstractState<A>>

  • Type Parameters:
    A - the type of AbstractState contained into the analysis state
    All Implemented Interfaces:
    it.unive.lisa.interprocedural.InterproceduralAnalysis<A>

    public class RecursionSolver<A extends it.unive.lisa.analysis.AbstractState<A>>
    extends ContextBasedAnalysis<A>
    A recursion solver that applies the iterates of the recursion starting from bottom. This solver operates by restarting the recursion from Recursion.getInvocation() a number of times, until the results of all the members stabilize.
    • 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)  
      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.
      void solve()
      Solves the recursion by applying its iterates starting from bottom.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface it.unive.lisa.interprocedural.InterproceduralAnalysis

        returnsVoid, scope, unscope
    • Constructor Detail

      • RecursionSolver

        public RecursionSolver​(ContextBasedAnalysis<A> backing,
                               Recursion<A> recursion)
        Builds the solver.
        Parameters:
        backing - the analysis that backs this solver, and that can be used to query call results
        recursion - the recursion to solve
    • 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 interface it.unive.lisa.interprocedural.InterproceduralAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
        Overrides:
        init in class ContextBasedAnalysis<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
        Specified by:
        fixpoint in interface it.unive.lisa.interprocedural.InterproceduralAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
        Overrides:
        fixpoint in class ContextBasedAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
        Throws:
        it.unive.lisa.util.datastructures.graph.algorithms.FixpointException
      • 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
        Specified by:
        getAbstractResultOf in interface it.unive.lisa.interprocedural.InterproceduralAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
        Overrides:
        getAbstractResultOf in class ContextBasedAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • canShortcut

        protected boolean canShortcut​(it.unive.lisa.program.cfg.CFG cfg)
        Description copied from class: ContextBasedAnalysis
        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.
        Overrides:
        canShortcut in class ContextBasedAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
        Parameters:
        cfg - the cfg under evaluation
        Returns:
        true if that condition holds (defaults to true)
      • shouldCheckForRecursions

        protected boolean shouldCheckForRecursions()
        Description copied from class: ContextBasedAnalysis
        Whether or not this analysis should look for recursions when evaluating calls, immediately returning bottom when one is found.
        Overrides:
        shouldCheckForRecursions in class ContextBasedAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
        Returns:
        true if that condition holds (defaults to true)
      • solve

        public void solve()
                   throws it.unive.lisa.analysis.SemanticException
        Solves the recursion by applying its iterates starting from bottom.
        Throws:
        it.unive.lisa.analysis.SemanticException - if an exception happens during the computation