Class DataflowDomain<D extends DataflowDomain<D,​E>,​E extends DataflowElement<D,​E>>

    • Constructor Detail

      • DataflowDomain

        public DataflowDomain​(E domain,
                              java.util.Set<E> elements,
                              boolean isTop,
                              boolean isBottom)
        Builds the domain.
        Parameters:
        domain - a singleton instance to be used during semantic operations to perform kill and gen operations
        elements - the set of elements contained in this domain
        isTop - whether or not this domain is the top of the lattice
        isBottom - whether or not this domain is the bottom of the lattice
    • Method Detail

      • mk

        public abstract D mk​(E domain,
                             java.util.Set<E> elements,
                             boolean isTop,
                             boolean isBottom)
        Utility for creating a concrete instance of DataflowDomain given its core fields.
        Parameters:
        domain - the underlying domain
        elements - the elements contained in the instance to be created
        isTop - whether the created domain is the top element of the lattice
        isBottom - whether the created domain is the bottom element of the lattice
        Returns:
        the concrete instance of domain
      • assume

        public D assume​(ValueExpression expression,
                        ProgramPoint src,
                        ProgramPoint dest,
                        SemanticOracle oracle)
                 throws SemanticException
        Description copied from interface: SemanticDomain
        Yields a copy of this domain, modified by assuming that the given expression holds. It is required that the returned domain is in relation with this one. A safe (but imprecise) implementation of this method can always return this.
        Specified by:
        assume in interface SemanticDomain<D extends DataflowDomain<D,​E>,​ValueExpression,​Identifier>
        Parameters:
        expression - the expression to assume to hold.
        src - the program point that where this operation is being evaluated, corresponding to the one that generated the given expression
        dest - the program point where the execution will move after the expression has been assumed
        oracle - the oracle for inter-domain communication
        Returns:
        the (optionally) modified copy of this domain
        Throws:
        SemanticException - if an error occurs during the computation
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface BaseLattice<D extends DataflowDomain<D,​E>>
        Overrides:
        equals in class java.lang.Object
      • top

        public D 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<D extends DataflowDomain<D,​E>>
        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<D extends DataflowDomain<D,​E>>
        Returns:
        true if this is the top of the lattice
      • bottom

        public D 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<D extends DataflowDomain<D,​E>>
        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<D extends DataflowDomain<D,​E>>
        Returns:
        true if this is the bottom of the lattice
      • getDataflowElements

        public final java.util.Set<E> getDataflowElements()
        Yields the DataflowElements contained in this domain instance.
        Returns:
        the elements
      • pushScope

        public D pushScope​(ScopeToken scope)
                    throws SemanticException
        Description copied from interface: ScopedObject
        Pushes a new scope, identified by the give token, in this object. This causes all variables not associated with a scope (and thus visible) to be mapped to the given scope and hidden away, until the scope is popped with ScopedObject.popScope(ScopeToken).
        Specified by:
        pushScope in interface ScopedObject<D extends DataflowDomain<D,​E>>
        Parameters:
        scope - the token identifying the scope to push
        Returns:
        a copy of this object where the local unscoped variables have been hidden
        Throws:
        SemanticException - if an error occurs during the computation
      • popScope

        public D popScope​(ScopeToken scope)
                   throws SemanticException
        Description copied from interface: ScopedObject
        Pops the scope identified by the given token from this object. This causes all the visible variables (i.e. that are not mapped to a scope) to be removed, while the local variables that were associated to the given scope token (and thus hidden) will become visible again.
        Specified by:
        popScope in interface ScopedObject<D extends DataflowDomain<D,​E>>
        Parameters:
        scope - the token of the scope to be restored
        Returns:
        a copy of this object where the local variables have been removed, while the variables mapped to the given scope are visible again
        Throws:
        SemanticException - if an error occurs during the computation
      • toString

        public final java.lang.String toString()
        Specified by:
        toString in interface BaseLattice<D extends DataflowDomain<D,​E>>
        Overrides:
        toString in class java.lang.Object