Package it.unive.lisa.analysis
Interface SemanticDomain<D extends SemanticDomain<D,E,I>,E extends SymbolicExpression,I extends Identifier>
-
- Type Parameters:
D
- the concreteSemanticDomain
instanceE
- the type ofSymbolicExpression
that this domain can processI
- the type of variableIdentifier
that this domain can handle
- All Superinterfaces:
ScopedObject<D>
,StructuredObject
- All Known Subinterfaces:
AbstractState<A>
,BaseHeapDomain<H>
,HeapDomain<D>
,TypeDomain<T>
,ValueDomain<D>
- All Known Implementing Classes:
DataflowDomain
,DefiniteDataflowDomain
,Environment
,HeapEnvironment
,InferenceSystem
,PossibleDataflowDomain
,TypeEnvironment
,ValueEnvironment
,VariableLift
public interface SemanticDomain<D extends SemanticDomain<D,E,I>,E extends SymbolicExpression,I extends Identifier> extends StructuredObject, ScopedObject<D>
A domain able to determine how abstract information evolves thanks to the semantics of statements and expressions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description D
assign(I id, E expression, ProgramPoint pp, SemanticOracle oracle)
Yields a copy of this domain, whereid
has been assigned tovalue
.D
assume(E expression, ProgramPoint src, ProgramPoint dest, SemanticOracle oracle)
Yields a copy of this domain, modified by assuming that the given expression holds.D
forgetIdentifier(Identifier id)
Forgets anIdentifier
.default D
forgetIdentifiers(java.lang.Iterable<Identifier> ids)
Forgets all the givenIdentifier
s.D
forgetIdentifiersIf(java.util.function.Predicate<Identifier> test)
Forgets allIdentifier
s that match the given predicate.default <T extends SemanticDomain<?,?,?>>
java.util.Collection<T>getAllDomainInstances(java.lang.Class<T> domain)
Yields all of the instances of a specific domain, of classdomain
, 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 containingthis
ifdomain.isAssignableFrom(getClass())
holds, otherwise it returns an empty collection.default <T extends SemanticDomain<T,?,?> & Lattice<T>>
TgetDomainInstance(java.lang.Class<T> domain)
Yields a unique instance of the specific domain, of classdomain
, 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 (usingLattice.lub(Lattice)
) all instances returned bygetAllDomainInstances(Class)
, defaulting tonull
if no instance is returned.boolean
knowsIdentifier(Identifier id)
Yieldstrue
if this instance is currently tracking abstract information for the given identifier.Satisfiability
satisfies(E expression, ProgramPoint pp, SemanticOracle oracle)
Checks if the given expression is satisfied by the abstract values of this domain, returning an instance ofSatisfiability
.D
smallStepSemantics(E expression, ProgramPoint pp, SemanticOracle oracle)
Yields a copy of this domain, that has been modified accordingly to the semantics of the givenexpression
.-
Methods inherited from interface it.unive.lisa.analysis.ScopedObject
popScope, pushScope
-
Methods inherited from interface it.unive.lisa.util.representation.StructuredObject
representation
-
-
-
-
Method Detail
-
assign
D assign(I id, E expression, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields a copy of this domain, whereid
has been assigned tovalue
.- Parameters:
id
- the identifier to assign the value toexpression
- the expression to assignpp
- the program point that where this operation is being evaluatedoracle
- 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 givenexpression
.- Parameters:
expression
- the expression whose semantics need to be computedpp
- the program point that where this operation is being evaluatedoracle
- 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 returnthis
.- 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 expressiondest
- the program point where the execution will move after the expression has been assumedoracle
- 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)
Yieldstrue
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 anIdentifier
. This means that all information regarding the givenid
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 allIdentifier
s 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 givenIdentifier
s. The default implementation of this method iterates onids
, invokingforgetIdentifier(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 ofSatisfiability
.- Parameters:
expression
- the expression whose satisfiability is to be evaluatedpp
- the program point that where this operation is being evaluatedoracle
- 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, orSatisfiability.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 classdomain
, 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 (usingLattice.lub(Lattice)
) all instances returned bygetAllDomainInstances(Class)
, defaulting tonull
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 classdomain
, 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 containingthis
ifdomain.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
-
-