Class AnalyzedCFG<A extends AbstractState<A>>

    • Field Detail

      • CANNOT_LUB_ERROR

        protected static final java.lang.String CANNOT_LUB_ERROR
        Error message for the inability to lub two graphs.
        See Also:
        Constant Field Values
      • CANNOT_GLB_ERROR

        protected static final java.lang.String CANNOT_GLB_ERROR
        Error message for the inability to glb two graphs.
        See Also:
        Constant Field Values
      • CANNOT_WIDEN_ERROR

        protected static final java.lang.String CANNOT_WIDEN_ERROR
        Error message for the inability to widen two graphs.
        See Also:
        Constant Field Values
      • CANNOT_NARROW_ERROR

        protected static final java.lang.String CANNOT_NARROW_ERROR
        Error message for the inability to narrow two graphs.
        See Also:
        Constant Field Values
      • CANNOT_COMPARE_ERROR

        protected static final java.lang.String CANNOT_COMPARE_ERROR
        Error message for the inability to compare two graphs.
        See Also:
        Constant Field Values
      • id

        protected final ScopeId id
        An id meant to identify this specific result, based on how it has been produced.
    • Constructor Detail

      • AnalyzedCFG

        public AnalyzedCFG​(CFG cfg,
                           ScopeId id,
                           AnalysisState<A> singleton)
        Builds the control flow graph, storing the given mapping between nodes and fixpoint computation results.
        Parameters:
        cfg - the original control flow graph
        id - a ScopeId meant to identify this specific result based on how it has been produced
        singleton - an instance of the AnalysisState containing the abstract state of the analysis that was executed, used to retrieve top and bottom values
      • AnalyzedCFG

        public AnalyzedCFG​(CFG cfg,
                           ScopeId id,
                           AnalysisState<A> singleton,
                           java.util.Map<Statement,​AnalysisState<A>> entryStates,
                           java.util.Map<Statement,​AnalysisState<A>> results)
        Builds the control flow graph, storing the given mapping between nodes and fixpoint computation results.
        Parameters:
        cfg - the original control flow graph
        id - a ScopeId meant to identify this specific result based on how it has been produced
        singleton - an instance of the AnalysisState containing the abstract state of the analysis that was executed, used to retrieve top and bottom values
        entryStates - the entry state for each entry point of the cfg
        results - the results of the fixpoint computation
      • AnalyzedCFG

        public AnalyzedCFG​(CFG cfg,
                           ScopeId id,
                           StatementStore<A> entryStates,
                           StatementStore<A> results)
        Builds the control flow graph, storing the given mapping between nodes and fixpoint computation results.
        Parameters:
        cfg - the original control flow graph
        id - a ScopeId meant to identify this specific result based on how it has been produced
        entryStates - the entry state for each entry point of the cfg
        results - the results of the fixpoint computation
    • Method Detail

      • getId

        public ScopeId getId()
        Yields an id meant to identify this specific result, based on how it has been produced. This method might return null.
        Returns:
        the identifier of this result
      • getAnalysisStateBefore

        public AnalysisState<A> getAnalysisStateBefore​(Statement st)
                                                throws SemanticException
        Yields the computed result before a given statement (entry state).
        Parameters:
        st - the statement
        Returns:
        the result computed before the given statement
        Throws:
        SemanticException - if the lub operator fails
      • getAnalysisStateAfter

        public AnalysisState<A> getAnalysisStateAfter​(Statement st)
        Yields the computed result at a given statement (exit state).
        Parameters:
        st - the statement
        Returns:
        the result computed at the given statement
      • lubAux

        public AnalyzedCFG<A> lubAux​(AnalyzedCFG<A> other)
                              throws SemanticException
        Description copied from interface: BaseLattice
        Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        Specified by:
        lubAux in interface BaseLattice<A extends AbstractState<A>>
        Parameters:
        other - the other lattice element
        Returns:
        the least upper bound between this and other
        Throws:
        SemanticException - if an error occurs during the computation
      • glbAux

        public AnalyzedCFG<A> glbAux​(AnalyzedCFG<A> other)
                              throws SemanticException
        Description copied from interface: BaseLattice
        Performs the greatest lower bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        Specified by:
        glbAux in interface BaseLattice<A extends AbstractState<A>>
        Parameters:
        other - the other lattice element
        Returns:
        the greatest lower bound between this and other
        Throws:
        SemanticException - if an error occurs during the computation
      • wideningAux

        public AnalyzedCFG<A> wideningAux​(AnalyzedCFG<A> other)
                                   throws SemanticException
        Description copied from interface: BaseLattice
        Performs the widening operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        The default implementation of this method delegates to BaseLattice.lubAux(BaseLattice), and is thus safe for finite lattices and ACC ones.
        Specified by:
        wideningAux in interface BaseLattice<A extends AbstractState<A>>
        Parameters:
        other - the other lattice element
        Returns:
        the widening between this and other
        Throws:
        SemanticException - if an error occurs during the computation
      • narrowingAux

        public AnalyzedCFG<A> narrowingAux​(AnalyzedCFG<A> other)
                                    throws SemanticException
        Description copied from interface: BaseLattice
        Performs the narrowing operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        The default implementation of this method delegates to BaseLattice.glbAux(BaseLattice), and is thus safe for finite lattices and DCC ones.
        Specified by:
        narrowingAux in interface BaseLattice<A extends AbstractState<A>>
        Parameters:
        other - the other lattice element
        Returns:
        the narrowing between this and other
        Throws:
        SemanticException - if an error occurs during the computation
      • lessOrEqualAux

        public boolean lessOrEqualAux​(AnalyzedCFG<A> other)
                               throws SemanticException
        Description copied from interface: BaseLattice
        Yields true if and only if this lattice element is in relation with (usually represented through ≤) the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        Specified by:
        lessOrEqualAux in interface BaseLattice<A extends AbstractState<A>>
        Parameters:
        other - the other lattice element
        Returns:
        true if and only if that condition holds
        Throws:
        SemanticException - if an error occurs during the computation
      • sameIDs

        protected boolean sameIDs​(AnalyzedCFG<A> other)
        Yields whether or not the id of this graph and the given one are the same.
        Parameters:
        other - the other graph
        Returns:
        true if that condition holds
      • top

        public AnalyzedCFG<A> top()
        Description copied from interface: Lattice
        Yields the top element of this lattice. The returned element should be unique across different calls to this method, since Lattice.isTop() uses reference equality by default. If the value returned by this method is not a singleton, override Lattice.isTop() accordingly to provide a coherent test.
        Specified by:
        top in interface Lattice<A extends AbstractState<A>>
        Returns:
        the top element
      • isTop

        public boolean isTop()
        Description copied from interface: Lattice
        Yields true if and only if this object represents the top of the lattice. The default implementation of this method uses reference equality between this and the value returned by Lattice.top(), thus assuming that the top element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.
        Specified by:
        isTop in interface Lattice<A extends AbstractState<A>>
        Returns:
        true if this is the top of the lattice
      • bottom

        public AnalyzedCFG<A> bottom()
        Description copied from interface: Lattice
        Yields the bottom element of this lattice. The returned element should be unique across different calls to this method, since Lattice.isBottom() uses reference equality by default. If the value returned by this method is not a singleton, override Lattice.isBottom() accordingly to provide a coherent test.
        Specified by:
        bottom in interface Lattice<A extends AbstractState<A>>
        Returns:
        the bottom element
      • isBottom

        public boolean isBottom()
        Description copied from interface: Lattice
        Yields true if and only if this object represents the bottom of the lattice. The default implementation of this method uses reference equality between this and the value returned by Lattice.bottom(), thus assuming that the bottom element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.
        Specified by:
        isBottom in interface Lattice<A extends AbstractState<A>>
        Returns:
        true if this is the bottom of the lattice
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface BaseLattice<A extends AbstractState<A>>
        Overrides:
        equals in class java.lang.Object