Interface BaseInferredValue<T extends BaseInferredValue<T>>
-
- Type Parameters:
T- the concrete type of this domain
- All Superinterfaces:
BaseLattice<T>,InferredValue<T>,Lattice<T>,NonRelationalElement<T,ValueExpression,InferenceSystem<T>>,SemanticEvaluator,StructuredObject
public interface BaseInferredValue<T extends BaseInferredValue<T>> extends BaseLattice<T>, InferredValue<T>
Base implementation forInferredValues. This class extendsBaseLatticeand implementsInferredValue.eval(ValueExpression, InferenceSystem, ProgramPoint, SemanticOracle)by taking care of the recursive computation of inner expressions evaluation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classBaseInferredValue.EvaluationVisitor<T extends BaseInferredValue<T>>AExpressionVisitorforBaseInferredValueinstances.-
Nested classes/interfaces inherited from interface it.unive.lisa.analysis.nonrelational.inference.InferredValue
InferredValue.InferredPair<T extends InferredValue<T>>
-
-
Field Summary
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_STRING, TOP_STRING
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default InferenceSystem<T>assume(InferenceSystem<T> environment, ValueExpression expression, ProgramPoint src, ProgramPoint dest, SemanticOracle oracle)Yields the environmentenvironmenton which the expressionexpressionis assumed to hold by this domain.default booleancanProcess(SymbolicExpression expression, ProgramPoint pp, SemanticOracle oracle)Yieldstrueif the domain can processexpression,falseotherwise.default InferredValue.InferredPair<T>eval(ValueExpression expression, InferenceSystem<T> environment, ProgramPoint pp, SemanticOracle oracle)Evaluates aValueExpression, assuming that the values of program variables are the ones stored inenvironment.default InferredValue.InferredPair<T>evalBinaryExpression(BinaryOperator operator, T left, T right, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of aBinaryExpressionapplyingoperatorto two expressions whose abstract value areleftandright, respectively.default InferredValue.InferredPair<T>evalIdentifier(Identifier id, InferenceSystem<T> environment, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of an identifier in a given environment.default InferredValue.InferredPair<T>evalNonNullConstant(Constant constant, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of the given non-null constant.default InferredValue.InferredPair<T>evalNullConstant(T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of the null constantNullConstant.default InferredValue.InferredPair<T>evalPushAny(PushAny pushAny, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of a push-any expression.default InferredValue.InferredPair<T>evalPushInv(PushInv pushInv, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of a push-inv expression.default InferredValue.InferredPair<T>evalSkip(Skip skip, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of a skip expression.default InferredValue.InferredPair<T>evalTernaryExpression(TernaryOperator operator, T left, T middle, T right, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of aTernaryExpressionapplyingoperatorto two expressions whose abstract value areleft,middleandright, respectively.default InferredValue.InferredPair<T>evalTypeCast(BinaryExpression cast, T left, T right, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of a type cast expression.default InferredValue.InferredPair<T>evalTypeConv(BinaryExpression conv, T left, T right, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of a type conversion expression.default InferredValue.InferredPair<T>evalUnaryExpression(UnaryOperator operator, T arg, T state, ProgramPoint pp, SemanticOracle oracle)Yields the evaluation of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg.default Satisfiabilitysatisfies(ValueExpression expression, InferenceSystem<T> environment, ProgramPoint pp, SemanticOracle oracle)Checks whetherexpressionis satisfied inenvironment, assuming that the values of program variables are the ones stored inenvironmentand returning an instance ofSatisfiability.default SatisfiabilitysatisfiesAbstractValue(T value, T state, ProgramPoint pp, SemanticOracle oracle)Yields the satisfiability of an abstract value of type<T>.default SatisfiabilitysatisfiesBinaryExpression(BinaryOperator operator, T left, T right, T state, ProgramPoint pp, SemanticOracle oracle)Yields the satisfiability of aBinaryExpressionapplyingoperatorto two expressions whose abstract values areleft, andright.default SatisfiabilitysatisfiesNonNullConstant(Constant constant, T state, ProgramPoint pp, SemanticOracle oracle)Yields the satisfiability of the given non-null constant on this abstract domain.default SatisfiabilitysatisfiesNullConstant(T state, ProgramPoint pp, SemanticOracle oracle)Yields the satisfiability of the null constantNullConstanton this abstract domain.default SatisfiabilitysatisfiesPushAny(PushAny pushAny, T state, SemanticOracle oracle)Yields the satisfiability of the push any expression.default SatisfiabilitysatisfiesTernaryExpression(TernaryOperator operator, T left, T middle, T right, T state, ProgramPoint pp, SemanticOracle oracle)Yields the satisfiability of aTernaryExpressionapplyingoperatorto three expressions whose abstract values areleft,middleandright.default SatisfiabilitysatisfiesUnaryExpression(UnaryOperator operator, T arg, T state, ProgramPoint pp, SemanticOracle oracle)Yields the satisfiability of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg, returning an instance ofSatisfiability.-
Methods inherited from interface it.unive.lisa.analysis.BaseLattice
equals, glb, glbAux, hashCode, lessOrEqual, lessOrEqualAux, lub, lubAux, narrowing, narrowingAux, toString, widening, wideningAux
-
Methods inherited from interface it.unive.lisa.analysis.nonrelational.NonRelationalElement
fixedVariable, unknownVariable
-
Methods inherited from interface it.unive.lisa.util.representation.StructuredObject
representation
-
-
-
-
Method Detail
-
satisfies
default Satisfiability satisfies(ValueExpression expression, InferenceSystem<T> environment, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Description copied from interface:NonRelationalElementChecks whetherexpressionis satisfied inenvironment, assuming that the values of program variables are the ones stored inenvironmentand returning an instance ofSatisfiability.- Specified by:
satisfiesin interfaceNonRelationalElement<T extends BaseInferredValue<T>,ValueExpression,InferenceSystem<T extends BaseInferredValue<T>>>- Parameters:
expression- the expression whose satisfiability is to be evaluatedenvironment- the environment containing the values of program variables for the satisfiabilitypp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
Satisfiability.SATISFIEDif the expression is satisfied by the environment,Satisfiability.NOT_SATISFIEDif it is not satisfied, orSatisfiability.UNKNOWNif 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 something goes wrong during the computation
-
eval
default InferredValue.InferredPair<T> eval(ValueExpression expression, InferenceSystem<T> environment, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Description copied from interface:InferredValueEvaluates aValueExpression, assuming that the values of program variables are the ones stored inenvironment.- Specified by:
evalin interfaceInferredValue<T extends BaseInferredValue<T>>- Parameters:
expression- the expression to evaluateenvironment- the environment containing the values of program variables for the evaluationpp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- an new instance of this domain, representing the abstract result
of
expressionwhen evaluated onenvironment. The returned value is a pair that express both the result of the evaluation and the updated execution state - Throws:
SemanticException- if something goes wrong during the computation
-
evalIdentifier
default InferredValue.InferredPair<T> evalIdentifier(Identifier id, InferenceSystem<T> environment, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of an identifier in a given environment.- Parameters:
id- the identifier to be evaluatedenvironment- the environment where the identifier must be evaluatedpp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the identifier
- Throws:
SemanticException- if an error occurs during the computation
-
evalSkip
default InferredValue.InferredPair<T> evalSkip(Skip skip, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of a skip expression.- Parameters:
skip- the skip expression to be evaluatedstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the skip expression
- Throws:
SemanticException- if an error occurs during the computation
-
evalPushAny
default InferredValue.InferredPair<T> evalPushAny(PushAny pushAny, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of a push-any expression.- Parameters:
pushAny- the push-any expression to be evaluatedstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the push-any expression
- Throws:
SemanticException- if an error occurs during the computation
-
evalPushInv
default InferredValue.InferredPair<T> evalPushInv(PushInv pushInv, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of a push-inv expression.- Parameters:
pushInv- the push-inv expression to be evaluatedstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the push-inv expression
- Throws:
SemanticException- if an error occurs during the computation
-
evalNullConstant
default InferredValue.InferredPair<T> evalNullConstant(T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of the null constantNullConstant.- Parameters:
state- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the constant
- Throws:
SemanticException- if an error occurs during the computation
-
evalNonNullConstant
default InferredValue.InferredPair<T> evalNonNullConstant(Constant constant, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of the given non-null constant.- Parameters:
constant- the constant to evaluatestate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the constant
- Throws:
SemanticException- if an error occurs during the computation
-
evalUnaryExpression
default InferredValue.InferredPair<T> evalUnaryExpression(UnaryOperator operator, T arg, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg. It is guaranteed thatargis notLattice.bottom().- Parameters:
operator- the operator applied by the expressionarg- the instance of this domain representing the abstract value of the expresion's argumentstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the expression
- Throws:
SemanticException- if an error occurs during the computation
-
evalBinaryExpression
default InferredValue.InferredPair<T> evalBinaryExpression(BinaryOperator operator, T left, T right, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of aBinaryExpressionapplyingoperatorto two expressions whose abstract value areleftandright, respectively. It is guaranteed that bothleftandrightare notLattice.bottom()and thatoperatoris neitherTypeCastnorTypeConv.- Parameters:
operator- the operator applied by the expressionleft- the instance of this domain representing the abstract value of the left-hand side argumentright- the instance of this domain representing the abstract value of the right-hand side argumentstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the expression
- Throws:
SemanticException- if an error occurs during the computation
-
evalTypeConv
default InferredValue.InferredPair<T> evalTypeConv(BinaryExpression conv, T left, T right, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of a type conversion expression.- Parameters:
conv- the type conversion expressionleft- the left expression, namely the expression to be convertedright- the right expression, namely the types to which left should be convertedstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the type conversion expression
- Throws:
SemanticException- if an error occurs during the computation
-
evalTypeCast
default InferredValue.InferredPair<T> evalTypeCast(BinaryExpression cast, T left, T right, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of a type cast expression.- Parameters:
cast- the type casted expressionleft- the left expression, namely the expression to be castedright- the right expression, namely the types to which left should be castedstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the type cast expression
- Throws:
SemanticException- if an error occurs during the computation
-
evalTernaryExpression
default InferredValue.InferredPair<T> evalTernaryExpression(TernaryOperator operator, T left, T middle, T right, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the evaluation of aTernaryExpressionapplyingoperatorto two expressions whose abstract value areleft,middleandright, respectively. It is guaranteed that bothleftandrightare notLattice.bottom().- Parameters:
operator- the operator applied by the expressionleft- the instance of this domain representing the abstract value of the left-hand side argumentmiddle- the instance of this domain representing the abstract value of the middle argumentright- the instance of this domain representing the abstract value of the right-hand side argumentstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
- the evaluation of the expression
- Throws:
SemanticException- if an error occurs during the computation
-
satisfiesAbstractValue
default Satisfiability satisfiesAbstractValue(T value, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the satisfiability of an abstract value of type<T>.- Parameters:
value- the abstract value whose satisfiability is to be evaluatedstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
Satisfiability.SATISFIEDif the expression is satisfied by this domain,Satisfiability.NOT_SATISFIEDif it is not satisfied, orSatisfiability.UNKNOWNif 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
-
satisfiesPushAny
default Satisfiability satisfiesPushAny(PushAny pushAny, T state, SemanticOracle oracle) throws SemanticException
Yields the satisfiability of the push any expression.- Parameters:
pushAny- the push any expression to satisfystate- the current execution stateoracle- the oracle for inter-domain communication- Returns:
Satisfiability.SATISFIEDif the expression is satisfied by this domain,Satisfiability.NOT_SATISFIEDif it is not satisfied, orSatisfiability.UNKNOWNif 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
-
satisfiesNullConstant
default Satisfiability satisfiesNullConstant(T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the satisfiability of the null constantNullConstanton this abstract domain.- Parameters:
state- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
Satisfiability.SATISFIEDif the expression is satisfied by this domain,Satisfiability.NOT_SATISFIEDif it is not satisfied, orSatisfiability.UNKNOWNif 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
-
satisfiesNonNullConstant
default Satisfiability satisfiesNonNullConstant(Constant constant, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the satisfiability of the given non-null constant on this abstract domain.- Parameters:
constant- the constant to satisfiedstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
Satisfiability.SATISFIEDis the constant is satisfied by this domain,Satisfiability.NOT_SATISFIEDif it is not satisfied, orSatisfiability.UNKNOWNif 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
-
satisfiesUnaryExpression
default Satisfiability satisfiesUnaryExpression(UnaryOperator operator, T arg, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the satisfiability of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg, returning an instance ofSatisfiability. It is guaranteed thatoperatoris notLogicalNegationandargis notLattice.bottom().- Parameters:
operator- the unary operator applied by the expressionarg- an instance of this abstract domain representing the argument of the unary expressionstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
Satisfiability.SATISFIEDif the expression is satisfied by this domain,Satisfiability.NOT_SATISFIEDif it is not satisfied, orSatisfiability.UNKNOWNif 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
-
satisfiesBinaryExpression
default Satisfiability satisfiesBinaryExpression(BinaryOperator operator, T left, T right, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the satisfiability of aBinaryExpressionapplyingoperatorto two expressions whose abstract values areleft, andright. This method returns an instance ofSatisfiability. It is guaranteed thatoperatoris neitherLogicalAndnorLogicalOr, and that bothleftandrightare notLattice.bottom().- Parameters:
operator- the binary operator applied by the expressionleft- an instance of this abstract domain representing the argument of the left-hand side of the binary expressionright- an instance of this abstract domain representing the argument of the right-hand side of the binary expressionstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
Satisfiability.SATISFIEDif the expression is satisfied by this domain,Satisfiability.NOT_SATISFIEDif it is not satisfied, orSatisfiability.UNKNOWNif 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
-
satisfiesTernaryExpression
default Satisfiability satisfiesTernaryExpression(TernaryOperator operator, T left, T middle, T right, T state, ProgramPoint pp, SemanticOracle oracle) throws SemanticException
Yields the satisfiability of aTernaryExpressionapplyingoperatorto three expressions whose abstract values areleft,middleandright. This method returns an instance ofSatisfiability. It is guaranteed thatleft,middleandrightare notLattice.bottom().- Parameters:
operator- the ternary operator applied by the expressionleft- an instance of this abstract domain representing the argument of the left-most side of the ternary expressionmiddle- an instance of this abstract domain representing the argument in the middle of the ternary expressionright- an instance of this abstract domain representing the argument of the right-most side of the ternary expressionstate- the current execution statepp- the program point that where this operation is being evaluatedoracle- the oracle for inter-domain communication- Returns:
Satisfiability.SATISFIEDif the expression is satisfied by this domain,Satisfiability.NOT_SATISFIEDif it is not satisfied, orSatisfiability.UNKNOWNif 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
-
canProcess
default boolean canProcess(SymbolicExpression expression, ProgramPoint pp, SemanticOracle oracle)
Description copied from interface:SemanticEvaluatorYieldstrueif the domain can processexpression,falseotherwise.- Specified by:
canProcessin interfaceSemanticEvaluator- Parameters:
expression- the expressionpp- the program point where this method is queriedoracle- the oracle for inter-domain communication- Returns:
trueif the domain can processexpression,falseotherwise.
-
assume
default InferenceSystem<T> assume(InferenceSystem<T> environment, ValueExpression expression, ProgramPoint src, ProgramPoint dest, SemanticOracle oracle) throws SemanticException
Description copied from interface:NonRelationalElementYields the environmentenvironmenton which the expressionexpressionis assumed to hold by this domain. The returned environment must be an updated version of the given one, where the relevant abstractions have been (optionally) updated. Returning the given environment as-is is always a sound implementation.- Specified by:
assumein interfaceNonRelationalElement<T extends BaseInferredValue<T>,ValueExpression,InferenceSystem<T extends BaseInferredValue<T>>>- Parameters:
environment- the environmentexpression- the expression to be assumedsrc- 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 environment
environmentwhereexpressionis assumed to hold - Throws:
SemanticException- if an error occurs during the computation
-
-