Package it.unive.lisa.analysis
Class ExpressionStore<V extends Lattice<V>>
- java.lang.Object
-
- it.unive.lisa.analysis.BaseLattice<F>
-
- it.unive.lisa.analysis.FunctionalLattice<ExpressionStore<V>,Expression,V>
-
- it.unive.lisa.analysis.ExpressionStore<V>
-
- Type Parameters:
V- the type of lattice mapped from this store
- All Implemented Interfaces:
Lattice<ExpressionStore<V>>,java.lang.Iterable<java.util.Map.Entry<Expression,V>>
public class ExpressionStore<V extends Lattice<V>> extends FunctionalLattice<ExpressionStore<V>,Expression,V>
A functional lattice that stores instances ofLatticecomputed on intermediate expressions inside root statements. Storing states in such an object enables easy fixpoint computation thanks to the function lub and widening operations
-
-
Field Summary
-
Fields inherited from class it.unive.lisa.analysis.FunctionalLattice
function, lattice
-
-
Constructor Summary
Constructors Constructor Description ExpressionStore(V lattice)Builds the store.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressionStore<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.Vput(Expression expression, V state)Stores the given lattice element for the given expression.ExpressionStore<V>top()Yields the top element of this lattice.-
Methods inherited from class it.unive.lisa.analysis.FunctionalLattice
equals, getKeys, getState, hashCode, iterator, lessOrEqualAux, lubAux, toString, wideningAux
-
Methods inherited from class it.unive.lisa.analysis.BaseLattice
lessOrEqual, lub, widening
-
-
-
-
Constructor Detail
-
ExpressionStore
public ExpressionStore(V lattice)
Builds the store.- Parameters:
lattice- an instance of the concrete lattice that will be mapped in this store
-
-
Method Detail
-
put
public V put(Expression expression, V state)
Stores the given lattice element for the given expression. This is a "forced" update, without performing any lattice operation if a mapping for the given expression already exists.- Parameters:
expression- the expression whose state needs to be setstate- the state to set- Returns:
- the previous state mapped to
expression, ornull
-
top
public ExpressionStore<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 ExpressionStore<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
-
-