Package it.unive.lisa.analysis.heap
Interface MemoryOracle
-
- All Known Subinterfaces:
AbstractState<A>
,BaseHeapDomain<H>
,HeapDomain<D>
,SemanticOracle
- All Known Implementing Classes:
HeapEnvironment
public interface MemoryOracle
An oracle that can be queried for information about the static and dynamic memory of the program.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Satisfiability
alias(SymbolicExpression x, SymbolicExpression y, ProgramPoint pp, SemanticOracle oracle)
Yields whether or not the two given expressions are aliases, that is, if they point to the same region of memory.default Satisfiability
areMutuallyReachable(SymbolicExpression x, SymbolicExpression y, ProgramPoint pp, SemanticOracle oracle)
Yields whether or not theIdentifier
represented (directly or after rewriting) by the second expression is reachable starting from theIdentifier
represented (directly or after rewriting) by the first expression, and vice versa.Satisfiability
isReachableFrom(SymbolicExpression x, SymbolicExpression y, ProgramPoint pp, SemanticOracle oracle)
Yields whether or not theIdentifier
represented (directly or after rewriting) by the second expression is reachable starting from theIdentifier
represented (directly or after rewriting) by the first expression.default ExpressionSet
reachableFrom(SymbolicExpression e, ProgramPoint pp, SemanticOracle oracle)
Yields all theIdentifier
s that are reachable starting from theIdentifier
represented (directly or after rewriting) by the given expression.default ExpressionSet
rewrite(ExpressionSet expressions, ProgramPoint pp, SemanticOracle oracle)
Rewrites the given expressions to a simpler form containing no sub expressions regarding the heap (that is,HeapExpression
s).ExpressionSet
rewrite(SymbolicExpression expression, ProgramPoint pp, SemanticOracle oracle)
Rewrites the given expression to a simpler form containing no sub expressions regarding the heap (that is,HeapExpression
s).
-
-
-
Method Detail
-
rewrite
ExpressionSet rewrite(SymbolicExpression expression, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Rewrites the given expression to a simpler form containing no sub expressions regarding the heap (that is,HeapExpression
s). Every expression contained in the result can be safely cast toValueExpression
.- Parameters:
expression
- the expression to rewritepp
- the program point where the rewrite happensoracle
- the oracle for inter-domain communication- Returns:
- the rewritten expressions
- Throws:
SemanticException
- if something goes wrong while rewriting
-
rewrite
default ExpressionSet rewrite(ExpressionSet expressions, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Rewrites the given expressions to a simpler form containing no sub expressions regarding the heap (that is,HeapExpression
s). Every expression contained in the result can be safely cast toValueExpression
.- Parameters:
expressions
- the expressions to rewritepp
- the program point where the rewrite happensoracle
- the oracle for inter-domain communication- Returns:
- the rewritten expressions
- Throws:
SemanticException
- if something goes wrong while rewriting
-
alias
Satisfiability alias(SymbolicExpression x, SymbolicExpression y, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields whether or not the two given expressions are aliases, that is, if they point to the same region of memory. Note that, for this method to returnSatisfiability.SATISFIED
, both expressions should be pointers to other expressions.- Parameters:
x
- the first expressiony
- the second expressionpp
- theProgramPoint
where the computation happensoracle
- the oracle for inter-domain communication- Returns:
- whether or not the two expressions are aliases
- Throws:
SemanticException
- if something goes wrong during the computation
-
reachableFrom
default ExpressionSet reachableFrom(SymbolicExpression e, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields all theIdentifier
s that are reachable starting from theIdentifier
represented (directly or after rewriting) by the given expression. This corresponds to recursively explore the memory region reachable bye
, traversing all possible pointers until no more are available.- Parameters:
e
- the expression corresponding to the starting pointpp
- theProgramPoint
where the computation happensoracle
- the oracle for inter-domain communication- Returns:
- the expressions representing memory regions reachable from
e
- Throws:
SemanticException
- if something goes wrong during the computation
-
isReachableFrom
Satisfiability isReachableFrom(SymbolicExpression x, SymbolicExpression y, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields whether or not theIdentifier
represented (directly or after rewriting) by the second expression is reachable starting from theIdentifier
represented (directly or after rewriting) by the first expression. Note that, for this method to returnSatisfiability.SATISFIED
, not onlyx
needs to be a pointer to another expression, but the latter should be a pointer as well, and so on untily
is reached.- Parameters:
x
- the first expressiony
- the second expressionpp
- theProgramPoint
where the computation happensoracle
- the oracle for inter-domain communication- Returns:
- whether or not the second expression can be reached from the first one
- Throws:
SemanticException
- if something goes wrong during the computation
-
areMutuallyReachable
default Satisfiability areMutuallyReachable(SymbolicExpression x, SymbolicExpression y, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields whether or not theIdentifier
represented (directly or after rewriting) by the second expression is reachable starting from theIdentifier
represented (directly or after rewriting) by the first expression, and vice versa. This is equivalent to invokingisReachableFrom(x, y, pp, oracle).and(isReachableFrom(y, x, pp, oracle))
, that corresponds to the default implementation of this method.- Parameters:
x
- the first expressiony
- the second expressionpp
- theProgramPoint
where the computation happensoracle
- the oracle for inter-domain communication- Returns:
- whether or not the two expressions are mutually reachable
- Throws:
SemanticException
- if something goes wrong during the computation
-
-