Class CFGResults<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<CFGResults<A,H,V>,ContextSensitivityToken,CFGWithAnalysisResults<A,H,V>>
-
- it.unive.lisa.interprocedural.impl.CFGResults<A,H,V>
-
- Type Parameters:
A- the type ofAbstractStatecontained into the analysis stateH- the type ofHeapDomaincontained into the computed abstract stateV- the type ofValueDomaincontained into the computed abstract state
- All Implemented Interfaces:
Lattice<CFGResults<A,H,V>>,java.lang.Iterable<java.util.Map.Entry<ContextSensitivityToken,CFGWithAnalysisResults<A,H,V>>>
public class CFGResults<A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>> extends FunctionalLattice<CFGResults<A,H,V>,ContextSensitivityToken,CFGWithAnalysisResults<A,H,V>>
AFunctionalLatticefromContextSensitivityTokens toCFGWithAnalysisResultss. This class is meant to store fixpoint results on each token generated during the interprocedural 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_REPR, BOTTOM_STRING, TOP_REPR, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description CFGResults(CFGWithAnalysisResults<A,H,V> lattice)Builds a new result.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CFGResults<A,H,V>bottom()Yields the bottom element of this lattice.booleancontains(ContextSensitivityToken token)Yieldstrueif a result exists for the giventoken.java.util.Collection<CFGWithAnalysisResults<A,H,V>>getAll()Yields all the results stored in this object, for any possibleContextSensitivityTokenused.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 CFGResults<A,H,V>mk(CFGWithAnalysisResults<A,H,V> lattice, java.util.Map<ContextSensitivityToken,CFGWithAnalysisResults<A,H,V>> 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,CFGWithAnalysisResults<A,H,V>>putResult(ContextSensitivityToken token, CFGWithAnalysisResults<A,H,V> result)Stores the result of a fixpoint computation on a cfg, if needed.CFGResults<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
-
CFGResults
public CFGResults(CFGWithAnalysisResults<A,H,V> 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,CFGWithAnalysisResults<A,H,V>> putResult(ContextSensitivityToken token, CFGWithAnalysisResults<A,H,V> result) throws SemanticException
Stores the result of a fixpoint computation on a cfg, if needed. This method returns a pair of a boolean and aCFGWithAnalysisResults, where (previs theCFGWithAnalysisResultsalready present for the giventoken):- if no
prevwas stored fortoken, than that token is mapped toresultand this method returns<false, result> - if
prev <= result, thentokenis mapped toresultand this method returns<true, result> - if
result <= prev, then the mapping is left untouched and this method returns<false, prev> - otherwise,
tokenis mapped tolub = prev.lub(result)and this method returns<true, lub>
- Parameters:
token- theContextSensitivityTokenthat identifying the resultresult- theCFGWithAnalysisResultsto store- Returns:
trueif the previous result has been updated, if any- Throws:
SemanticException- if something goes wrong during the update
- if no
-
contains
public boolean contains(ContextSensitivityToken token)
Yieldstrueif a result exists for the giventoken.- Parameters:
token- theContextSensitivityTokenthat identifying the result- Returns:
trueif that condition holds
-
getAll
public java.util.Collection<CFGWithAnalysisResults<A,H,V>> getAll()
Yields all the results stored in this object, for any possibleContextSensitivityTokenused.- Returns:
- the results
-
top
public CFGResults<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 CFGResults<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 CFGResults<A,H,V> mk(CFGWithAnalysisResults<A,H,V> lattice, java.util.Map<ContextSensitivityToken,CFGWithAnalysisResults<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<CFGResults<A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>>,ContextSensitivityToken,CFGWithAnalysisResults<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
-
-