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

  • Type Parameters:
    A - the AbstractState 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 of ContextSensitivityToken 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.
    • 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 of getFixpointResults().
      • 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
    • Field Detail

      • results

        protected it.unive.lisa.interprocedural.FixpointResults<A extends it.unive.lisa.analysis.AbstractState<A>> results
        The results computed by this analysis.
      • conf

        protected it.unive.lisa.conf.FixpointConfiguration conf
        The fixpoint configuration.
    • Constructor Detail

      • ContextBasedAnalysis

        public ContextBasedAnalysis()
        Builds the analysis, using LastCallTokens.
      • 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 interface it.unive.lisa.interprocedural.InterproceduralAnalysis<A extends it.unive.lisa.analysis.AbstractState<A>>
        Overrides:
        init in class CallGraphBasedAnalysis<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 to true)
      • 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 to true)
      • shouldStoreFixpointResults

        protected boolean shouldStoreFixpointResults()
        Whether or not this analysis should store the results of fixpoint executions for them to be returned as part of getFixpointResults().
        Returns:
        true if that condition holds (defaults to true)
      • 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