Interface Analysis<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>

Type Parameters:
V - the abstract value type to be tracked by the analysis
S - the store type used in the analysis
T - the transfer function type that is used to approximated runtime behavior
All Known Subinterfaces:
BackwardAnalysis<V,S,T>, ForwardAnalysis<V,S,T>
All Known Implementing Classes:
AbstractAnalysis, BackwardAnalysisImpl, CalledMethodsAnalysis, CFAbstractAnalysis, CFAnalysis, ForwardAnalysisImpl, KeyForAnalysis, LockAnalysis, NullnessAnalysis, ResourceLeakAnalysis

public interface Analysis<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
This interface defines a dataflow analysis, given a control flow graph and a transfer function. A dataflow analysis has a direction, either forward or backward. The direction of corresponding transfer function is consistent with the analysis, i.e. a forward analysis has a forward transfer function, and a backward analysis has a backward transfer function.
  • Method Details

    • getDirection

      Analysis.Direction getDirection()
      Get the direction of this analysis.
      Returns:
      the direction of this analysis
    • isRunning

      boolean isRunning()
      Is the analysis currently running?
      Returns:
      true if the analysis is running currently, else false
    • performAnalysis

      void performAnalysis(ControlFlowGraph cfg)
      Perform the actual analysis.
      Parameters:
      cfg - the control flow graph
    • performAnalysisBlock

      void performAnalysisBlock(Block b)
      Perform the actual analysis on one block.
      Parameters:
      b - the block to analyze
    • runAnalysisFor

      S runAnalysisFor(Node node, Analysis.BeforeOrAfter preOrPost, TransferInput<V,S> blockTransferInput, IdentityHashMap<Node,V> nodeValues, Map<TransferInput<V,S>,IdentityHashMap<Node,TransferResult<V,S>>> analysisCaches)
      Runs the analysis again within the block of node and returns the store at the location of node. If before is true, then the store immediately before the Node node is returned. Otherwise, the store immediately after node is returned. If analysisCaches is not null, this method uses a cache. analysisCaches is a map of a block of node to the cached analysis result. If the cache for transferInput is not in analysisCaches, this method creates new cache and stores it in analysisCaches. The cache is a map of nodes to the analysis results of the nodes.
      Parameters:
      node - the node to analyze
      preOrPost - which store to return: the store immediately before node or the store after node
      blockTransferInput - the transfer input of the block of this node
      nodeValues - abstract values of nodes
      analysisCaches - caches of analysis results
      Returns:
      the store before or after node (depends on the value of before) after running the analysis
    • getResult

      AnalysisResult<V,S> getResult()
      The result of running the analysis. This is only available once the analysis finished running.
      Returns:
      the result of running the analysis
    • getTransferFunction

      @Nullable T getTransferFunction()
      Get the transfer function of this analysis.
      Returns:
      the transfer function of this analysis
    • getInput

      Get the transfer input of a given Block b.
      Parameters:
      b - a given Block
      Returns:
      the transfer input of this Block
    • getValue

      @Nullable V getValue(Node n)
      Returns the abstract value for Node n, or null if no information is available. Note that if the analysis has not finished yet, this value might not represent the final value for this node.
      Parameters:
      n - n a node
      Returns:
      the abstract value for node n, or null if no information is available
    • getValue

      @Nullable V getValue(Tree t)
      Return the abstract value for Tree t, or null if no information is available. Note that if the analysis has not finished yet, this value might not represent the final value for this node.
      Parameters:
      t - the given tree
      Returns:
      the abstract value for the given tree
    • getRegularExitStore

      @Nullable S getRegularExitStore()
      Returns the regular exit store, or null, if there is no such store (because the method cannot exit through the regular exit block).
      Returns:
      the regular exit store, or null, if there is no such store (because the method cannot exit through the regular exit block)
    • getExceptionalExitStore

      @Nullable S getExceptionalExitStore()
      Returns the exceptional exit store.
      Returns:
      the exceptional exit store