Package it.unive.lisa.analysis
Class SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>
- java.lang.Object
-
- it.unive.lisa.analysis.SimpleAbstractState<H,V>
-
- Type Parameters:
H- the type ofHeapDomainembedded in this stateV- the type ofValueDomainembedded in this state
- All Implemented Interfaces:
AbstractState<SimpleAbstractState<H,V>,H,V>,Lattice<SimpleAbstractState<H,V>>,SemanticDomain<SimpleAbstractState<H,V>,SymbolicExpression,Identifier>
public class SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>> extends java.lang.Object implements AbstractState<SimpleAbstractState<H,V>,H,V>
An abstract state of the analysis, composed by a heap state modeling the memory layout and a value state modeling values of program variables and memory locations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface it.unive.lisa.analysis.SemanticDomain
SemanticDomain.Satisfiability
-
-
Field Summary
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_STRING, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description SimpleAbstractState(H heapState, V valueState)Builds a new abstract state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleAbstractState<H,V>assign(Identifier id, SymbolicExpression expression, ProgramPoint pp)Yields a copy of this domain, whereidhas been assigned tovalue.SimpleAbstractState<H,V>assume(SymbolicExpression expression, ProgramPoint pp)Yields a copy of this domain, modified by assuming that the given expression holds.SimpleAbstractState<H,V>bottom()Yields the bottom element of this lattice.booleanequals(java.lang.Object obj)SimpleAbstractState<H,V>forgetIdentifier(Identifier id)Forgets anIdentifier.HgetHeapState()Yields the instance ofHeapDomainthat contains the information on heap structures contained in this abstract state.VgetValueState()Yields the instance ofValueDomainthat contains the information on values of program variables and concretized memory locations.inthashCode()booleanisBottom()Yieldstrueif and only if this object represents the bottom of the lattice.booleanisTop()Yieldstrueif and only if this object represents the top of the lattice.booleanlessOrEqual(SimpleAbstractState<H,V> other)Yieldstrueif and only if this lattice element is in relation with (usually represented through ≤) the given one.SimpleAbstractState<H,V>lub(SimpleAbstractState<H,V> other)Performs the least upper bound operation between this lattice element and the given one.java.lang.Stringrepresentation()Yields a textual representation of the content of this domain's instance.SemanticDomain.Satisfiabilitysatisfies(SymbolicExpression expression, ProgramPoint pp)Checks if the given expression is satisfied by the abstract values of this domain, returning an instance ofSemanticDomain.Satisfiability.SimpleAbstractState<H,V>smallStepSemantics(SymbolicExpression expression, ProgramPoint pp)Yields a copy of this domain, that has been modified accordingly to the semantics of the givenexpression.SimpleAbstractState<H,V>top()Yields the top element of this lattice.java.lang.StringtoString()SimpleAbstractState<H,V>widening(SimpleAbstractState<H,V> other)Performs the widening operation between this lattice element and the given one.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.SemanticDomain
forgetIdentifiers
-
-
-
-
Constructor Detail
-
SimpleAbstractState
public SimpleAbstractState(H heapState, V valueState)
Builds a new abstract state.- Parameters:
heapState- the domain containing information regarding heap structuresvalueState- the domain containing information regarding values of program variables and concretized memory locations
-
-
Method Detail
-
getHeapState
public H getHeapState()
Description copied from interface:AbstractStateYields the instance ofHeapDomainthat contains the information on heap structures contained in this abstract state.- Specified by:
getHeapStatein interfaceAbstractState<SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>,H extends HeapDomain<H>,V extends ValueDomain<V>>- Returns:
- the heap domain
-
getValueState
public V getValueState()
Description copied from interface:AbstractStateYields the instance ofValueDomainthat contains the information on values of program variables and concretized memory locations.- Specified by:
getValueStatein interfaceAbstractState<SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>,H extends HeapDomain<H>,V extends ValueDomain<V>>- Returns:
- the value domain
-
assign
public SimpleAbstractState<H,V> assign(Identifier id, SymbolicExpression expression, ProgramPoint pp) throws SemanticException
Description copied from interface:SemanticDomainYields a copy of this domain, whereidhas been assigned tovalue.- Specified by:
assignin interfaceSemanticDomain<SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>,SymbolicExpression,Identifier>- Parameters:
id- the identifier to assign the value toexpression- the expression to assignpp- the program point that where this operation is being evaluated- Returns:
- a copy of this domain, modified by the assignment
- Throws:
SemanticException- if an error occurs during the computation
-
smallStepSemantics
public SimpleAbstractState<H,V> smallStepSemantics(SymbolicExpression expression, ProgramPoint pp) throws SemanticException
Description copied from interface:SemanticDomainYields a copy of this domain, that has been modified accordingly to the semantics of the givenexpression.- Specified by:
smallStepSemanticsin interfaceSemanticDomain<SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>,SymbolicExpression,Identifier>- Parameters:
expression- the expression whose semantics need to be computedpp- the program point that where this operation is being evaluated- Returns:
- a copy of this domain, modified accordingly to the semantics of
expression - Throws:
SemanticException- if an error occurs during the computation
-
assume
public SimpleAbstractState<H,V> assume(SymbolicExpression expression, ProgramPoint pp) throws SemanticException
Description copied from interface:SemanticDomainYields 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.- Specified by:
assumein interfaceSemanticDomain<SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>,SymbolicExpression,Identifier>- Parameters:
expression- the expression to assume to hold.pp- the program point that where this operation is being evaluated- Returns:
- the (optionally) modified copy of this domain
- Throws:
SemanticException- if an error occurs during the computation
-
satisfies
public SemanticDomain.Satisfiability satisfies(SymbolicExpression expression, ProgramPoint pp) throws SemanticException
Description copied from interface:SemanticDomainChecks if the given expression is satisfied by the abstract values of this domain, returning an instance ofSemanticDomain.Satisfiability.- Specified by:
satisfiesin interfaceSemanticDomain<SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>,SymbolicExpression,Identifier>- Parameters:
expression- the expression whose satisfiability is to be evaluatedpp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDis the expression is satisfied by the values of 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)- Throws:
SemanticException- if an error occurs during the computation
-
lub
public SimpleAbstractState<H,V> lub(SimpleAbstractState<H,V> other) throws SemanticException
Description copied from interface:LatticePerforms the least upper bound operation between this lattice element and the given one. This operation is commutative.- Specified by:
lubin interfaceLattice<H extends HeapDomain<H>>- Parameters:
other- the other lattice element- Returns:
- the least upper bound
- Throws:
SemanticException- if an error occurs during the computation
-
widening
public SimpleAbstractState<H,V> widening(SimpleAbstractState<H,V> other) throws SemanticException
Description copied from interface:LatticePerforms the widening operation between this lattice element and the given one. This operation is not commutative.- Specified by:
wideningin interfaceLattice<H extends HeapDomain<H>>- Parameters:
other- the other lattice element- Returns:
- the widening between this and other
- Throws:
SemanticException- if an error occurs during the computation
-
lessOrEqual
public boolean lessOrEqual(SimpleAbstractState<H,V> other) throws SemanticException
Description copied from interface:LatticeYieldstrueif and only if this lattice element is in relation with (usually represented through ≤) the given one. This operation is not commutative.- Specified by:
lessOrEqualin interfaceLattice<H extends HeapDomain<H>>- Parameters:
other- the other lattice element- Returns:
trueif and only if that condition holds- Throws:
SemanticException- if an error occurs during the computation
-
top
public SimpleAbstractState<H,V> 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.- Specified by:
topin interfaceLattice<H extends HeapDomain<H>>- Returns:
- the top element
-
bottom
public SimpleAbstractState<H,V> 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.- Specified by:
bottomin interfaceLattice<H extends HeapDomain<H>>- Returns:
- the bottom 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.- Specified by:
isTopin interfaceLattice<H extends HeapDomain<H>>- Returns:
trueif this is the top of the lattice
-
isBottom
public boolean isBottom()
Description copied from interface:LatticeYieldstrueif and only if this object represents the bottom of the lattice. The default implementation of this method uses reference equality betweenthisand the value returned byLattice.bottom(), thus assuming that the bottom element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.- Specified by:
isBottomin interfaceLattice<H extends HeapDomain<H>>- Returns:
trueif this is the bottom of the lattice
-
forgetIdentifier
public SimpleAbstractState<H,V> forgetIdentifier(Identifier id) throws SemanticException
Description copied from interface:SemanticDomainForgets anIdentifier. This means that all information regarding the givenidwill be lost. This method should be invoked whenever an identifier gets out of scope.- Specified by:
forgetIdentifierin interfaceSemanticDomain<SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>,SymbolicExpression,Identifier>- 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
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
representation
public java.lang.String representation()
Description copied from interface:SemanticDomainYields a textual representation of the content of this domain's instance.- Specified by:
representationin interfaceSemanticDomain<SimpleAbstractState<H extends HeapDomain<H>,V extends ValueDomain<V>>,SymbolicExpression,Identifier>- Returns:
- the textual representation
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-