Package it.unive.lisa.analysis
Class StatementStore<A extends AbstractState<A>>
- java.lang.Object
-
- it.unive.lisa.analysis.lattices.FunctionalLattice<StatementStore<A>,Statement,AnalysisState<A>>
-
- it.unive.lisa.analysis.StatementStore<A>
-
- Type Parameters:
A
- the type ofAbstractState
- All Implemented Interfaces:
BaseLattice<StatementStore<A>>
,Lattice<StatementStore<A>>
,StructuredObject
,java.lang.Iterable<java.util.Map.Entry<Statement,AnalysisState<A>>>
public class StatementStore<A extends AbstractState<A>> extends FunctionalLattice<StatementStore<A>,Statement,AnalysisState<A>>
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> state)
Builds the store.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StatementStore<A>
bottom()
Yields the bottom element of this lattice.void
forget(Statement st)
Removes the stored state for the given statement.StatementStore<A>
mk(AnalysisState<A> lattice, java.util.Map<Statement,AnalysisState<A>> function)
Builds a instance of this class from the given lattice instance and the given mapping.AnalysisState<A>
put(Statement st, AnalysisState<A> state)
Stores the given state for the given statement.AnalysisState<A>
stateOfUnknown(Statement key)
Yields the value that should be returned byFunctionalLattice.getState(Object)
whenever the given key is not present in this map.StatementStore<A>
top()
Yields the top element of this lattice.-
Methods inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
equals, functionalLift, getKeys, getMap, getOtDefault, getState, getValues, glbAux, glbKeys, hashCode, isBottom, isTop, iterator, lessOrEqualAux, lubAux, lubKeys, mkNewFunction, narrowingAux, putState, representation, toString, wideningAux
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.BaseLattice
glb, lessOrEqual, lub, narrowing, widening
-
-
-
-
Constructor Detail
-
StatementStore
public StatementStore(AnalysisState<A> state)
Builds the store.- Parameters:
state
- an instance of the underlying lattice
-
-
Method Detail
-
put
public AnalysisState<A> put(Statement st, AnalysisState<A> 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> 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
-
bottom
public StatementStore<A> 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
-
mk
public StatementStore<A> mk(AnalysisState<A> lattice, java.util.Map<Statement,AnalysisState<A>> 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>>,Statement,AnalysisState<A extends AbstractState<A>>>
- 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
-
stateOfUnknown
public AnalysisState<A> stateOfUnknown(Statement key)
Description copied from class:FunctionalLattice
Yields the value that should be returned byFunctionalLattice.getState(Object)
whenever the given key is not present in this map.- Specified by:
stateOfUnknown
in classFunctionalLattice<StatementStore<A extends AbstractState<A>>,Statement,AnalysisState<A extends AbstractState<A>>>
- Parameters:
key
- the key that is missing- Returns:
- the lattice element for keys not in the mapping
-
-