Package it.unive.lisa.analysis
Class StatementStore<A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>>
- java.lang.Object
-
- it.unive.lisa.analysis.BaseLattice<F>
-
- it.unive.lisa.analysis.lattices.FunctionalLattice<StatementStore<A,H,V,T>,Statement,AnalysisState<A,H,V,T>>
-
- it.unive.lisa.analysis.StatementStore<A,H,V,T>
-
- Type Parameters:
A
- the type ofAbstractState
H
- the type of theHeapDomain
V
- the type of theValueDomain
T
- the type ofTypeDomain
- All Implemented Interfaces:
Lattice<StatementStore<A,H,V,T>>
,java.lang.Iterable<java.util.Map.Entry<Statement,AnalysisState<A,H,V,T>>>
public class StatementStore<A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>> extends FunctionalLattice<StatementStore<A,H,V,T>,Statement,AnalysisState<A,H,V,T>>
A functional lattice that stores instances ofAnalysisState
computed 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_STRING, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description StatementStore(AnalysisState<A,H,V,T> state)
Builds the store.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StatementStore<A,H,V,T>
bottom()
Yields the bottom element of this lattice.void
forget(Statement st)
Removes the stored state for the given statement.boolean
isBottom()
Yieldstrue
if and only if this object represents the bottom of the lattice.boolean
isTop()
Yieldstrue
if and only if this object represents the top of the lattice.StatementStore<A,H,V,T>
mk(AnalysisState<A,H,V,T> lattice, java.util.Map<Statement,AnalysisState<A,H,V,T>> function)
Builds a instance of this class from the given lattice instance and the given mapping.AnalysisState<A,H,V,T>
put(Statement st, AnalysisState<A,H,V,T> state)
Stores the given state for the given statement.StatementStore<A,H,V,T>
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,T> state)
Builds the store.- Parameters:
state
- an instance of the underlying lattice
-
-
Method Detail
-
put
public AnalysisState<A,H,V,T> put(Statement st, AnalysisState<A,H,V,T> 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
-
forget
public void forget(Statement st)
Removes the stored state for the given statement.- Parameters:
st
- the statement whose state needs to be forgotten
-
top
public StatementStore<A,H,V,T> top()
Description copied from interface:Lattice
Yields 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 class:FunctionalLattice
Yieldstrue
if and only if this object represents the top of the lattice. The default implementation of this method uses reference equality betweenthis
and 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.
By default, a functional lattice is the top lattice if the underlying lattice'sisTop()
holds and its function isnull
.- Specified by:
isTop
in interfaceLattice<A extends AbstractState<A,H,V,T>>
- Overrides:
isTop
in classFunctionalLattice<StatementStore<A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>>,Statement,AnalysisState<A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>>>
- Returns:
true
if this is the top of the lattice
-
bottom
public StatementStore<A,H,V,T> bottom()
Description copied from interface:Lattice
Yields 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 class:FunctionalLattice
Yieldstrue
if and only if this object represents the bottom of the lattice. The default implementation of this method uses reference equality betweenthis
and 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.
By default, a functional lattice is the top lattice if the underlying lattice'sisBottom()
holds and its function isnull
.- Specified by:
isBottom
in interfaceLattice<A extends AbstractState<A,H,V,T>>
- Overrides:
isBottom
in classFunctionalLattice<StatementStore<A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>>,Statement,AnalysisState<A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>>>
- Returns:
true
if this is the bottom of the lattice
-
mk
public StatementStore<A,H,V,T> mk(AnalysisState<A,H,V,T> lattice, java.util.Map<Statement,AnalysisState<A,H,V,T>> function)
Description copied from class:FunctionalLattice
Builds a instance of this class from the given lattice instance and the given mapping.- Specified by:
mk
in classFunctionalLattice<StatementStore<A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>>,Statement,AnalysisState<A extends AbstractState<A,H,V,T>,H extends HeapDomain<H>,V extends ValueDomain<V>,T extends TypeDomain<T>>>
- 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
-
-