Interface SemanticDomain<D extends SemanticDomain<D,​E,​I>,​E extends SymbolicExpression,​I extends Identifier>

    • Method Detail

      • assign

        D assign​(I id,
                 E expression,
                 ProgramPoint pp,
                 SemanticOracle oracle)
          throws SemanticException
        Yields a copy of this domain, where id has been assigned to value.
        Parameters:
        id - the identifier to assign the value to
        expression - the expression to assign
        pp - the program point that where this operation is being evaluated
        oracle - the oracle for inter-domain communication
        Returns:
        a copy of this domain, modified by the assignment
        Throws:
        SemanticException - if an error occurs during the computation
      • smallStepSemantics

        D smallStepSemantics​(E expression,
                             ProgramPoint pp,
                             SemanticOracle oracle)
                      throws SemanticException
        Yields a copy of this domain, that has been modified accordingly to the semantics of the given expression.
        Parameters:
        expression - the expression whose semantics need to be computed
        pp - the program point that where this operation is being evaluated
        oracle - the oracle for inter-domain communication
        Returns:
        a copy of this domain, modified accordingly to the semantics of expression
        Throws:
        SemanticException - if an error occurs during the computation
      • assume

        D assume​(E expression,
                 ProgramPoint src,
                 ProgramPoint dest,
                 SemanticOracle oracle)
          throws SemanticException
        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.
        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
      • knowsIdentifier

        boolean knowsIdentifier​(Identifier id)
        Yields true if this instance is currently tracking abstract information for the given identifier.
        Parameters:
        id - the identifier
        Returns:
        whether or not this domain knows about id
      • forgetIdentifier

        D forgetIdentifier​(Identifier id)
                    throws SemanticException
        Forgets an Identifier. This means that all information regarding the given id will be lost. This method should be invoked whenever an identifier gets out of scope.
        Parameters:
        id - the identifier to forget
        Returns:
        the semantic domain without information about the given id
        Throws:
        SemanticException - if an error occurs during the computation
      • forgetIdentifiersIf

        D forgetIdentifiersIf​(java.util.function.Predicate<Identifier> test)
                       throws SemanticException
        Forgets all Identifiers that match the given predicate. This means that all information regarding the those identifiers will be lost. This method should be invoked whenever an identifier gets out of scope.
        Parameters:
        test - the test to identify the targets of the removal
        Returns:
        the semantic domain without information about the ids
        Throws:
        SemanticException - if an error occurs during the computation
      • forgetIdentifiers

        default D forgetIdentifiers​(java.lang.Iterable<Identifier> ids)
                             throws SemanticException
        Forgets all the given Identifiers. The default implementation of this method iterates on ids, invoking forgetIdentifier(Identifier) on each element.
        Parameters:
        ids - the collection of identifiers to forget
        Returns:
        the semantic domain without information about the given ids
        Throws:
        SemanticException - if an error occurs during the computation
      • satisfies

        Satisfiability satisfies​(E expression,
                                 ProgramPoint pp,
                                 SemanticOracle oracle)
                          throws SemanticException
        Checks if the given expression is satisfied by the abstract values of this domain, returning an instance of Satisfiability.
        Parameters:
        expression - the expression whose satisfiability is to be evaluated
        pp - the program point that where this operation is being evaluated
        oracle - the oracle for inter-domain communication
        Returns:
        Satisfiability.SATISFIED is the expression is satisfied by the values of this domain, Satisfiability.NOT_SATISFIED if it is not satisfied, or Satisfiability.UNKNOWN if it is either impossible to determine if it satisfied, or if it is satisfied by some values and not by some others (this is equivalent to a TOP boolean value)
        Throws:
        SemanticException - if an error occurs during the computation
      • getDomainInstance

        default <T extends SemanticDomain<T,​?,​?> & Lattice<T>> T getDomainInstance​(java.lang.Class<T> domain)
                                                                                        throws SemanticException
        Yields a unique instance of the specific domain, of class domain, contained inside the domain, also recursively querying inner domains (enabling retrieval of semantic domains through Cartesian products or other types of combinations).

        The default implementation of this method lubs together (using Lattice.lub(Lattice)) all instances returned by getAllDomainInstances(Class), defaulting to null if no instance is returned.
        Type Parameters:
        T - the type of domain to retrieve
        Parameters:
        domain - the class of the domain instance to retrieve
        Returns:
        the instance of that domain, or null
        Throws:
        SemanticException - if an exception happens while lubbing the results
      • getAllDomainInstances

        default <T extends SemanticDomain<?,​?,​?>> java.util.Collection<T> getAllDomainInstances​(java.lang.Class<T> domain)
        Yields all of the instances of a specific domain, of class domain, contained inside this domain, also recursively querying inner domains (enabling retrieval of semantic domains through Cartesian products or other types of combinations).

        The default implementation of this method returns a singleton collection containing this if domain.isAssignableFrom(getClass()) holds, otherwise it returns an empty collection.
        Type Parameters:
        T - the type of domain to retrieve
        Parameters:
        domain - the class of the domain instance to retrieve
        Returns:
        the instances of that domain