Package it.unive.lisa.analysis.inference
Class BaseInferredValue<T extends BaseInferredValue<T>>
- java.lang.Object
-
- it.unive.lisa.analysis.BaseLattice<T>
-
- it.unive.lisa.analysis.inference.BaseInferredValue<T>
-
- Type Parameters:
T- the concrete type of this domain
- All Implemented Interfaces:
InferredValue<T>,Lattice<T>,NonRelationalDomain<T,ValueExpression,InferenceSystem<T>>,SemanticEvaluator
- Direct Known Subclasses:
InferredTypes
public abstract class BaseInferredValue<T extends BaseInferredValue<T>> extends BaseLattice<T> implements InferredValue<T>
Base implementation forInferredValues. This class extendsBaseLatticeand implementsNonRelationalDomain.eval(it.unive.lisa.symbolic.SymbolicExpression, it.unive.lisa.analysis.lattices.FunctionalLattice, ProgramPoint)by taking care of the recursive computation of inner expressions evaluation.
-
-
Field Summary
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_STRING, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description BaseInferredValue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Teval(ValueExpression expression, InferenceSystem<T> environment, ProgramPoint pp)Evaluates aSymbolicExpression, assuming that the values of program variables are the ones stored inenvironment.protected TevalBinaryExpression(BinaryOperator operator, T left, T right, ProgramPoint pp)Yields the evaluation of aBinaryExpressionapplyingoperatorto two expressions whose abstract value areleftandright, respectively.protected TevalIdentifier(Identifier id, InferenceSystem<T> environment)Yields the evaluation of an identifier in a given environment.protected TevalNonNullConstant(Constant constant, ProgramPoint pp)Yields the evaluation of the given non-null constant.protected TevalNullConstant(ProgramPoint pp)Yields the evaluation of the null constantNullConstant.protected TevalPushAny(PushAny pushAny)Yields the evaluation of a push-any expression.protected TevalTernaryExpression(TernaryOperator operator, T left, T middle, T right, ProgramPoint pp)Yields the evaluation of aTernaryExpressionapplyingoperatorto two expressions whose abstract value areleft,middleandright, respectively.protected TevalUnaryExpression(UnaryOperator operator, T arg, ProgramPoint pp)Yields the evaluation of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg.SemanticDomain.Satisfiabilitysatisfies(ValueExpression expression, InferenceSystem<T> environment, ProgramPoint pp)Checks whetherexpressionis satisfied inenvironment, assuming that the values of program variables are the ones stored inenvironmentand returning an instance ofSemanticDomain.Satisfiability.protected SemanticDomain.SatisfiabilitysatisfiesAbstractValue(T value, ProgramPoint pp)Yields the satisfiability of an abstract value of type<T>.protected SemanticDomain.SatisfiabilitysatisfiesBinaryExpression(BinaryOperator operator, T left, T right, ProgramPoint pp)Yields the satisfiability of aBinaryExpressionapplyingoperatorto two expressions whose abstract values areleft, andright.protected SemanticDomain.SatisfiabilitysatisfiesNonNullConstant(Constant constant, ProgramPoint pp)Yields the satisfiability of the given non-null constant on this abstract domain.protected SemanticDomain.SatisfiabilitysatisfiesNullConstant(ProgramPoint pp)Yields the satisfiability of the null constantNullConstanton this abstract domain.protected SemanticDomain.SatisfiabilitysatisfiesPushAny(PushAny pushAny)Yields the satisfiability of the push any expression.protected SemanticDomain.SatisfiabilitysatisfiesTernaryExpression(TernaryOperator operator, T left, T middle, T right, ProgramPoint pp)Yields the satisfiability of aTernaryExpressionapplyingoperatorto three expressions whose abstract values areleft,middleandright.protected SemanticDomain.SatisfiabilitysatisfiesUnaryExpression(UnaryOperator operator, T arg, ProgramPoint pp)Yields the satisfiability of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg, returning an instance ofSemanticDomain.Satisfiability.java.lang.StringtoString()-
Methods inherited from class it.unive.lisa.analysis.BaseLattice
equals, hashCode, lessOrEqual, lessOrEqualAux, lub, lubAux, widening, wideningAux
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.inference.InferredValue
executionState, variable
-
Methods inherited from interface it.unive.lisa.analysis.Lattice
bottom, isBottom, isTop, lessOrEqual, lub, top, widening
-
Methods inherited from interface it.unive.lisa.analysis.nonrelational.NonRelationalDomain
representation
-
Methods inherited from interface it.unive.lisa.analysis.SemanticEvaluator
canProcess, tracksIdentifiers
-
-
-
-
Method Detail
-
satisfies
public final SemanticDomain.Satisfiability satisfies(ValueExpression expression, InferenceSystem<T> environment, ProgramPoint pp)
Description copied from interface:NonRelationalDomainChecks whetherexpressionis satisfied inenvironment, assuming that the values of program variables are the ones stored inenvironmentand returning an instance ofSemanticDomain.Satisfiability.- Specified by:
satisfiesin interfaceNonRelationalDomain<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 evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDif the expression is satisfied by the environment,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.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)
-
eval
public final T eval(ValueExpression expression, InferenceSystem<T> environment, ProgramPoint pp)
Description copied from interface:NonRelationalDomainEvaluates aSymbolicExpression, assuming that the values of program variables are the ones stored inenvironment.- Specified by:
evalin interfaceNonRelationalDomain<T extends BaseInferredValue<T>,ValueExpression,InferenceSystem<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 evaluated- Returns:
- an new instance of this domain, representing the abstract result
of
expressionwhen evaluated onenvironment
-
evalIdentifier
protected T evalIdentifier(Identifier id, InferenceSystem<T> environment)
Yields the evaluation of an identifier in a given environment.- Parameters:
id- the identifier to be evaluatedenvironment- the environment where the identifier must be evaluated- Returns:
- the evaluation of the identifier
-
evalPushAny
protected T evalPushAny(PushAny pushAny)
Yields the evaluation of a push-any expression.- Parameters:
pushAny- the push-any expression to be evaluated- Returns:
- the evaluation of the push-any expression
-
evalNullConstant
protected T evalNullConstant(ProgramPoint pp)
Yields the evaluation of the null constantNullConstant.- Parameters:
pp- the program point that where this operation is being evaluated- Returns:
- the evaluation of the constant
-
evalNonNullConstant
protected T evalNonNullConstant(Constant constant, ProgramPoint pp)
Yields the evaluation of the given non-null constant.- Parameters:
constant- the constant to evaluatepp- the program point that where this operation is being evaluated- Returns:
- the evaluation of the constant
-
evalUnaryExpression
protected T evalUnaryExpression(UnaryOperator operator, T arg, ProgramPoint pp)
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 argumentpp- the program point that where this operation is being evaluated- Returns:
- the evaluation of the expression
-
evalBinaryExpression
protected T evalBinaryExpression(BinaryOperator operator, T left, T right, ProgramPoint pp)
Yields the evaluation of aBinaryExpressionapplyingoperatorto two expressions whose abstract value areleftandright, 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 argumentright- the instance of this domain representing the abstract value of the right-hand side argumentpp- the program point that where this operation is being evaluated- Returns:
- the evaluation of the expression
-
evalTernaryExpression
protected T evalTernaryExpression(TernaryOperator operator, T left, T middle, T right, ProgramPoint pp)
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 argumentpp- the program point that where this operation is being evaluated- Returns:
- the evaluation of the expression
-
satisfiesAbstractValue
protected SemanticDomain.Satisfiability satisfiesAbstractValue(T value, ProgramPoint pp)
Yields the satisfiability of an abstract value of type<T>.- Parameters:
value- the abstract value whose satisfiability is to be evaluatedpp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDif the expression is satisfied by this domain,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.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)
-
satisfiesPushAny
protected SemanticDomain.Satisfiability satisfiesPushAny(PushAny pushAny)
Yields the satisfiability of the push any expression.- Parameters:
pushAny- the push any expression to satisfy- Returns:
SemanticDomain.Satisfiability.SATISFIEDif the expression is satisfied by this domain,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.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)
-
satisfiesNullConstant
protected SemanticDomain.Satisfiability satisfiesNullConstant(ProgramPoint pp)
Yields the satisfiability of the null constantNullConstanton this abstract domain.- Parameters:
pp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDif the expression is satisfied by this domain,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.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)
-
satisfiesNonNullConstant
protected SemanticDomain.Satisfiability satisfiesNonNullConstant(Constant constant, ProgramPoint pp)
Yields the satisfiability of the given non-null constant on this abstract domain.- Parameters:
constant- the constant to satisfiedpp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDis the constant is satisfied by this domain,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.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)
-
satisfiesUnaryExpression
protected SemanticDomain.Satisfiability satisfiesUnaryExpression(UnaryOperator operator, T arg, ProgramPoint pp)
Yields the satisfiability of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg, returning an instance ofSemanticDomain.Satisfiability. It is guaranteed thatoperatoris notUnaryOperator.LOGICAL_NOTandargis notLattice.bottom().- Parameters:
operator- the unary operator applied by the expressionarg- an instance of this abstract domain representing the argument of the unary expressionpp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDif the expression is satisfied by this domain,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.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)
-
satisfiesBinaryExpression
protected SemanticDomain.Satisfiability satisfiesBinaryExpression(BinaryOperator operator, T left, T right, ProgramPoint pp)
Yields the satisfiability of aBinaryExpressionapplyingoperatorto two expressions whose abstract values areleft, andright. This method returns an instance ofSemanticDomain.Satisfiability. It is guaranteed thatoperatoris neitherBinaryOperator.LOGICAL_ANDnorBinaryOperator.LOGICAL_OR, 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 expressionpp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDif the expression is satisfied by this domain,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.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)
-
satisfiesTernaryExpression
protected SemanticDomain.Satisfiability satisfiesTernaryExpression(TernaryOperator operator, T left, T middle, T right, ProgramPoint pp)
Yields the satisfiability of aTernaryExpressionapplyingoperatorto three expressions whose abstract values areleft,middleandright. This method returns an instance ofSemanticDomain.Satisfiability. 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 expressionpp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDif the expression is satisfied by this domain,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.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)
-
toString
public final java.lang.String toString()
- Specified by:
toStringin classBaseLattice<T extends BaseInferredValue<T>>
-
-