Class IntegerConstantPropagation
- java.lang.Object
-
- it.unive.lisa.analysis.BaseLattice<T>
-
- it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<IntegerConstantPropagation>
-
- it.unive.lisa.analysis.impl.numeric.IntegerConstantPropagation
-
- All Implemented Interfaces:
Lattice<IntegerConstantPropagation>,NonRelationalDomain<IntegerConstantPropagation,ValueExpression,ValueEnvironment<IntegerConstantPropagation>>,NonRelationalElement<IntegerConstantPropagation,ValueExpression,ValueEnvironment<IntegerConstantPropagation>>,NonRelationalValueDomain<IntegerConstantPropagation>,SemanticEvaluator
public class IntegerConstantPropagation extends BaseNonRelationalValueDomain<IntegerConstantPropagation>
The basic integer constant propagation abstract domain, tracking if a certain integer value has constant value or not, implemented as aBaseNonRelationalValueDomain, handling top and bottom values for the expression evaluation and bottom values for the expression satisfiability. Top and bottom cases for least upper bounds, widening and less or equals operations are handled byBaseLatticeinBaseLattice.lub(L),BaseLattice.widening(L)andBaseLattice.lessOrEqual(L), respectively.
-
-
Field Summary
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_REPR, BOTTOM_STRING, TOP_REPR, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description IntegerConstantPropagation()Builds the top abstract value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ValueEnvironment<IntegerConstantPropagation>assumeBinaryExpression(ValueEnvironment<IntegerConstantPropagation> environment, BinaryOperator operator, ValueExpression left, ValueExpression right, ProgramPoint pp)Yields the environmentenvironmentassuming that a binary expression with operatoroperator, left argumentleft, and right argumentrightholds.IntegerConstantPropagationbottom()Yields the bottom element of this lattice.booleanequals(java.lang.Object obj)protected IntegerConstantPropagationevalBinaryExpression(BinaryOperator operator, IntegerConstantPropagation left, IntegerConstantPropagation right, ProgramPoint pp)Yields the evaluation of aBinaryExpressionapplyingoperatorto two expressions whose abstract value areleftandright, respectively.protected IntegerConstantPropagationevalNonNullConstant(Constant constant, ProgramPoint pp)Yields the evaluation of the given non-null constant.protected IntegerConstantPropagationevalNullConstant(ProgramPoint pp)Yields the evaluation of the null constantNullConstant.protected IntegerConstantPropagationevalTernaryExpression(TernaryOperator operator, IntegerConstantPropagation left, IntegerConstantPropagation middle, IntegerConstantPropagation right, ProgramPoint pp)Yields the evaluation of aTernaryExpressionapplyingoperatorto two expressions whose abstract value areleft,middleandright, respectively.protected IntegerConstantPropagationevalUnaryExpression(UnaryOperator operator, IntegerConstantPropagation arg, ProgramPoint pp)Yields the evaluation of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg.inthashCode()booleanisTop()Yieldstrueif and only if this object represents the top of the lattice.protected booleanlessOrEqualAux(IntegerConstantPropagation other)Yieldstrueif and only if this lattice element is in relation with (usually represented through ≤) the given one, assuming that base cases have already been handled.protected IntegerConstantPropagationlubAux(IntegerConstantPropagation other)Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled.DomainRepresentationrepresentation()Yields aDomainRepresentationof the information contained in this domain's instance.protected SemanticDomain.SatisfiabilitysatisfiesBinaryExpression(BinaryOperator operator, IntegerConstantPropagation left, IntegerConstantPropagation right, ProgramPoint pp)Yields the satisfiability of aBinaryExpressionapplyingoperatorto two expressions whose abstract values areleft, andright.IntegerConstantPropagationtop()Yields the top element of this lattice.protected IntegerConstantPropagationwideningAux(IntegerConstantPropagation other)Performs the widening operation between this lattice element and the given one, assuming that base cases have already been handled.-
Methods inherited from class it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain
assume, assumeTernaryExpression, assumeUnaryExpression, canProcess, eval, evalIdentifier, evalPushAny, evalTypeCast, evalTypeConv, glb, glbAux, satisfies, satisfiesAbstractValue, satisfiesNonNullConstant, satisfiesNullConstant, satisfiesTernaryExpression, satisfiesUnaryExpression, toString, tracksIdentifiers
-
Methods inherited from class it.unive.lisa.analysis.BaseLattice
lessOrEqual, lub, widening
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.Lattice
isBottom, lessOrEqual, lub, widening
-
Methods inherited from interface it.unive.lisa.analysis.nonrelational.NonRelationalElement
variable
-
-
-
-
Method Detail
-
top
public IntegerConstantPropagation top()
Description copied from interface:LatticeYields the top element of this lattice. The returned element should be unique across different calls to this method, sinceLattice.isTop()uses reference equality by default. If the value returned by this method is not a singleton, overrideLattice.isTop()accordingly to provide a coherent test.- Returns:
- the top element
-
isTop
public boolean isTop()
Description copied from interface:LatticeYieldstrueif and only if this object represents the top of the lattice. The default implementation of this method uses reference equality betweenthisand the value returned byLattice.top(), thus assuming that the top element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.- Returns:
trueif this is the top of the lattice
-
bottom
public IntegerConstantPropagation bottom()
Description copied from interface:LatticeYields the bottom element of this lattice. The returned element should be unique across different calls to this method, sinceLattice.isBottom()uses reference equality by default. If the value returned by this method is not a singleton, overrideLattice.isBottom()accordingly to provide a coherent test.- Returns:
- the bottom element
-
representation
public DomainRepresentation representation()
Description copied from interface:NonRelationalElementYields aDomainRepresentationof the information contained in this domain's instance.- Returns:
- the representation
-
evalNullConstant
protected IntegerConstantPropagation evalNullConstant(ProgramPoint pp)
Description copied from class:BaseNonRelationalValueDomainYields the evaluation of the null constantNullConstant.- Overrides:
evalNullConstantin classBaseNonRelationalValueDomain<IntegerConstantPropagation>- Parameters:
pp- the program point that where this operation is being evaluated- Returns:
- the evaluation of the constant
-
evalNonNullConstant
protected IntegerConstantPropagation evalNonNullConstant(Constant constant, ProgramPoint pp)
Description copied from class:BaseNonRelationalValueDomainYields the evaluation of the given non-null constant.- Overrides:
evalNonNullConstantin classBaseNonRelationalValueDomain<IntegerConstantPropagation>- Parameters:
constant- the constant to evaluatepp- the program point that where this operation is being evaluated- Returns:
- the evaluation of the constant
-
evalUnaryExpression
protected IntegerConstantPropagation evalUnaryExpression(UnaryOperator operator, IntegerConstantPropagation arg, ProgramPoint pp)
Description copied from class:BaseNonRelationalValueDomainYields the evaluation of aUnaryExpressionapplyingoperatorto an expression whose abstract value isarg. It is guaranteed thatargis notLattice.bottom().- Overrides:
evalUnaryExpressionin classBaseNonRelationalValueDomain<IntegerConstantPropagation>- 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 IntegerConstantPropagation evalBinaryExpression(BinaryOperator operator, IntegerConstantPropagation left, IntegerConstantPropagation right, ProgramPoint pp)
Description copied from class:BaseNonRelationalValueDomainYields the evaluation of aBinaryExpressionapplyingoperatorto two expressions whose abstract value areleftandright, respectively. It is guaranteed that bothleftandrightare notLattice.bottom()and thatoperatoris neitherBinaryOperator.TYPE_CASTnorBinaryOperator.TYPE_CONV.- Overrides:
evalBinaryExpressionin classBaseNonRelationalValueDomain<IntegerConstantPropagation>- 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 IntegerConstantPropagation evalTernaryExpression(TernaryOperator operator, IntegerConstantPropagation left, IntegerConstantPropagation middle, IntegerConstantPropagation right, ProgramPoint pp)
Description copied from class:BaseNonRelationalValueDomainYields the evaluation of aTernaryExpressionapplyingoperatorto two expressions whose abstract value areleft,middleandright, respectively. It is guaranteed that bothleftandrightare notLattice.bottom().- Overrides:
evalTernaryExpressionin classBaseNonRelationalValueDomain<IntegerConstantPropagation>- 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
-
lubAux
protected IntegerConstantPropagation lubAux(IntegerConstantPropagation other) throws SemanticException
Description copied from class:BaseLatticePerforms the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:otheris notnullotheris neither top nor bottomthisis neither top nor bottomthisandotherare not the same object (according both to==and toObject.equals(Object))
- Specified by:
lubAuxin classBaseLattice<IntegerConstantPropagation>- Parameters:
other- the other lattice element- Returns:
- the least upper bound between this and other
- Throws:
SemanticException- if an error occurs during the computation
-
wideningAux
protected IntegerConstantPropagation wideningAux(IntegerConstantPropagation other) throws SemanticException
Description copied from class:BaseLatticePerforms the widening operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:otheris notnullotheris neither top nor bottomthisis neither top nor bottomthisandotherare not the same object (according both to==and toObject.equals(Object))
- Specified by:
wideningAuxin classBaseLattice<IntegerConstantPropagation>- Parameters:
other- the other lattice element- Returns:
- the widening between this and other
- Throws:
SemanticException- if an error occurs during the computation
-
lessOrEqualAux
protected boolean lessOrEqualAux(IntegerConstantPropagation other) throws SemanticException
Description copied from class:BaseLatticeYieldstrueif and only if this lattice element is in relation with (usually represented through ≤) the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:otheris notnullotheris neither top nor bottomthisis neither top nor bottomthisandotherare not the same object (according both to==and toObject.equals(Object))
- Specified by:
lessOrEqualAuxin classBaseLattice<IntegerConstantPropagation>- Parameters:
other- the other lattice element- Returns:
trueif and only if that condition holds- Throws:
SemanticException- if an error occurs during the computation
-
hashCode
public int hashCode()
- Specified by:
hashCodein classBaseLattice<IntegerConstantPropagation>
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin classBaseLattice<IntegerConstantPropagation>
-
satisfiesBinaryExpression
protected SemanticDomain.Satisfiability satisfiesBinaryExpression(BinaryOperator operator, IntegerConstantPropagation left, IntegerConstantPropagation right, ProgramPoint pp)
Description copied from class:BaseNonRelationalValueDomainYields 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().- Overrides:
satisfiesBinaryExpressionin classBaseNonRelationalValueDomain<IntegerConstantPropagation>- 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)
-
assumeBinaryExpression
protected ValueEnvironment<IntegerConstantPropagation> assumeBinaryExpression(ValueEnvironment<IntegerConstantPropagation> environment, BinaryOperator operator, ValueExpression left, ValueExpression right, ProgramPoint pp) throws SemanticException
Description copied from class:BaseNonRelationalValueDomainYields the environmentenvironmentassuming that a binary expression with operatoroperator, left argumentleft, and right argumentrightholds. The binary expression with binary operatorBinaryOperator.LOGICAL_ANDandBinaryOperator.LOGICAL_ORare already handled byBaseNonRelationalValueDomain.assume(it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T>, it.unive.lisa.symbolic.value.ValueExpression, it.unive.lisa.program.cfg.ProgramPoint).- Overrides:
assumeBinaryExpressionin classBaseNonRelationalValueDomain<IntegerConstantPropagation>- Parameters:
environment- the environment on which the expression must be assumedoperator- the operator of the binary expressionleft- the left-hand side argument of the binary expressionright- the right-hand side argument of the binary expressionpp- the program point where the binary expression occurs- Returns:
- the environment
environmentassuming that a binary expression with operatoroperator, left argumentleft, and right argumentrightholds - Throws:
SemanticException- if something goes wrong during the assumption
-
-