Package it.unive.lisa.analysis
Class StatementStore<A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>>
- java.lang.Object
-
- it.unive.lisa.analysis.BaseLattice<F>
-
- it.unive.lisa.analysis.lattices.FunctionalLattice<StatementStore<A,H,V>,Statement,AnalysisState<A,H,V>>
-
- it.unive.lisa.analysis.StatementStore<A,H,V>
-
- Type Parameters:
A- the type ofAbstractStateH- the type of theHeapDomainV- the type of theValueDomain
- All Implemented Interfaces:
Lattice<StatementStore<A,H,V>>,java.lang.Iterable<java.util.Map.Entry<Statement,AnalysisState<A,H,V>>>
public class StatementStore<A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>> extends FunctionalLattice<StatementStore<A,H,V>,Statement,AnalysisState<A,H,V>>
A functional lattice that stores instances ofAnalysisStatecomputed on statements. Storing states in such an object enables easy fixpoint computation thanks to the function lub and widening operations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
FunctionalLattice.FunctionalLift<V extends Lattice<V>>, FunctionalLattice.KeyFunctionalLift<K>
-
-
Field Summary
-
Fields inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
function, lattice
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_REPR, BOTTOM_STRING, TOP_REPR, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description StatementStore(AnalysisState<A,H,V> state)Builds the store.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StatementStore<A,H,V>bottom()Yields the bottom element of this lattice.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.protected StatementStore<A,H,V>mk(AnalysisState<A,H,V> lattice, java.util.Map<Statement,AnalysisState<A,H,V>> function)Builds a instance of this class from the given lattice instance and the given mapping.AnalysisState<A,H,V>put(Statement st, AnalysisState<A,H,V> state)Stores the given state for the given statement.StatementStore<A,H,V>top()Yields the top element of this lattice.-
Methods inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
equals, functionalLift, getKeys, getMap, getState, getValues, glbKeys, hashCode, iterator, lessOrEqualAux, lubAux, lubKeys, mkNewFunction, putState, toString, wideningAux
-
Methods inherited from class it.unive.lisa.analysis.BaseLattice
lessOrEqual, lub, widening
-
-
-
-
Constructor Detail
-
StatementStore
public StatementStore(AnalysisState<A,H,V> state)
Builds the store.- Parameters:
state- an instance of the underlying lattice
-
-
Method Detail
-
put
public AnalysisState<A,H,V> put(Statement st, AnalysisState<A,H,V> state)
Stores the given state for the given statement. This is a "forced" update, without performing any lattice operation if a mapping for the given expression already exists.- Parameters:
st- the statement whose state needs to be setstate- the state to set- Returns:
- the previous state mapped to
expression, ornull
-
top
public StatementStore<A,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.- 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 StatementStore<A,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.- Returns:
- the bottom element
-
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.- Returns:
trueif this is the bottom of the lattice
-
mk
protected StatementStore<A,H,V> mk(AnalysisState<A,H,V> lattice, java.util.Map<Statement,AnalysisState<A,H,V>> function)
Description copied from class:FunctionalLatticeBuilds a instance of this class from the given lattice instance and the given mapping.- Specified by:
mkin classFunctionalLattice<StatementStore<A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>>,Statement,AnalysisState<A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>>>- Parameters:
lattice- an instance of lattice to be used during semantic operations to retrieve top and bottom valuesfunction- the function representing the mapping contained in the new environment; can benull- Returns:
- a new instance of this class
-
-