Package it.unive.lisa.interprocedural
Class FixpointResults<A extends AbstractState<A>>
- java.lang.Object
-
- it.unive.lisa.analysis.lattices.FunctionalLattice<FixpointResults<A>,CFG,CFGResults<A>>
-
- it.unive.lisa.interprocedural.FixpointResults<A>
-
- Type Parameters:
A
- the type ofAbstractState
contained into the analysis state
- All Implemented Interfaces:
BaseLattice<FixpointResults<A>>
,Lattice<FixpointResults<A>>
,StructuredObject
,java.lang.Iterable<java.util.Map.Entry<CFG,CFGResults<A>>>
public class FixpointResults<A extends AbstractState<A>> extends FunctionalLattice<FixpointResults<A>,CFG,CFGResults<A>>
AFunctionalLattice
fromCFG
s toCFGResults
s. This class is meant to store all fixpoint results on all token generated during the interprocedural analysis for each cfg under analysis.
-
-
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 FixpointResults(CFGResults<A> lattice)
Builds a new result.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FixpointResults<A>
bottom()
Yields the bottom element of this lattice.boolean
contains(CFG cfg)
Yieldstrue
if a result exists for the givencfg
.void
forget(CFG cfg)
Forgets all results about the givenCFG
.CFGResults<A>
get(CFG cfg)
Yields the recorded result for the givencfg
.FixpointResults<A>
mk(CFGResults<A> lattice, java.util.Map<CFG,CFGResults<A>> function)
Builds a instance of this class from the given lattice instance and the given mapping.org.apache.commons.lang3.tuple.Pair<java.lang.Boolean,AnalyzedCFG<A>>
putResult(CFG cfg, ScopeId token, AnalyzedCFG<A> result)
Stores the result of a fixpoint computation on a cfg.CFGResults<A>
stateOfUnknown(CFG key)
Yields the value that should be returned byFunctionalLattice.getState(Object)
whenever the given key is not present in this map.FixpointResults<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
-
FixpointResults
public FixpointResults(CFGResults<A> lattice)
Builds a new result.- Parameters:
lattice
- a singleton instance used for retrieving top and bottom values
-
-
Method Detail
-
putResult
public org.apache.commons.lang3.tuple.Pair<java.lang.Boolean,AnalyzedCFG<A>> putResult(CFG cfg, ScopeId token, AnalyzedCFG<A> result) throws SemanticException
Stores the result of a fixpoint computation on a cfg. This method returns the result of callingCFGResults.putResult(ScopeId, AnalyzedCFG)
with the giventoken
andresult
on theCFGResults
instance corresponding tocfg
.- Parameters:
cfg
- theCFG
on which the result has been computedtoken
- theScopeId
that identifying the resultresult
- theAnalyzedCFG
to store- Returns:
- the result of the update operation on the individual cfg result
- Throws:
SemanticException
- if something goes wrong during the update
-
contains
public boolean contains(CFG cfg)
Yieldstrue
if a result exists for the givencfg
.- Parameters:
cfg
- theCFG
whose result is to be checked- Returns:
true
if that condition holds
-
get
public CFGResults<A> get(CFG cfg)
Yields the recorded result for the givencfg
. This differs fromFunctionalLattice.getState(Object)
as it returnsnull
instead ofLattice.bottom()
if there is no recorded result for the given cfg.- Parameters:
cfg
- theCFG
whose result is to be checked- Returns:
- the result, or
null
-
top
public FixpointResults<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 FixpointResults<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
-
forget
public void forget(CFG cfg)
Forgets all results about the givenCFG
.- Parameters:
cfg
- the cfg to forget
-
mk
public FixpointResults<A> mk(CFGResults<A> lattice, java.util.Map<CFG,CFGResults<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<FixpointResults<A extends AbstractState<A>>,CFG,CFGResults<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 CFGResults<A> stateOfUnknown(CFG 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<FixpointResults<A extends AbstractState<A>>,CFG,CFGResults<A extends AbstractState<A>>>
- Parameters:
key
- the key that is missing- Returns:
- the lattice element for keys not in the mapping
-
-