Class AllocationSites
- java.lang.Object
-
- it.unive.lisa.analysis.BaseLattice<S>
-
- it.unive.lisa.analysis.lattices.SetLattice<AllocationSites,AllocationSite>
-
- it.unive.lisa.analysis.impl.heap.pointbased.AllocationSites
-
- All Implemented Interfaces:
HeapSemanticOperation,Lattice<AllocationSites>,NonRelationalHeapDomain<AllocationSites>,NonRelationalDomain<AllocationSites,SymbolicExpression,HeapEnvironment<AllocationSites>>,NonRelationalElement<AllocationSites,SymbolicExpression,HeapEnvironment<AllocationSites>>,SemanticEvaluator,java.lang.Iterable<AllocationSite>
public class AllocationSites extends SetLattice<AllocationSites,AllocationSite> implements NonRelationalHeapDomain<AllocationSites>
A heap domain tracking sets ofAllocationSite.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface it.unive.lisa.analysis.heap.HeapSemanticOperation
HeapSemanticOperation.HeapReplacement
-
-
Field Summary
-
Fields inherited from class it.unive.lisa.analysis.lattices.SetLattice
elements
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_REPR, BOTTOM_STRING, TOP_REPR, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description AllocationSites()Builds an instance of HeapIdentiferSetLattice, corresponding to the top element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HeapEnvironment<AllocationSites>assume(HeapEnvironment<AllocationSites> environment, SymbolicExpression expression, ProgramPoint pp)Yields the environmentenvironmenton which the expressionexpressionis assumed to hold by this domain.AllocationSitesbottom()Yields the bottom element of this lattice.booleancanProcess(SymbolicExpression expression)Yieldstrueif the domain can processexpression,falseotherwise.booleanequals(java.lang.Object obj)AllocationSiteseval(SymbolicExpression expression, HeapEnvironment<AllocationSites> environment, ProgramPoint pp)Evaluates aSymbolicExpression, assuming that the values of program variables are the ones stored inenvironment.java.util.List<HeapSemanticOperation.HeapReplacement>getSubstitution()Yields the substitution, in the form of a list ofHeapSemanticOperation.HeapReplacements that must be processed in their order of appearance, that the creation of this heap domain caused.inthashCode()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.java.util.Iterator<AllocationSite>iterator()protected AllocationSiteslubAux(AllocationSites other)Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled.protected AllocationSitesmk(java.util.Set<AllocationSite> set)Utility for creating a concrete instance ofSetLatticegiven a set.DomainRepresentationrepresentation()Yields aDomainRepresentationof the information contained in this domain's instance.ExpressionSet<ValueExpression>rewrite(SymbolicExpression expression, HeapEnvironment<AllocationSites> environment, ProgramPoint pp)Rewrites aSymbolicExpression, getting rid of the parts that access heap structures, substituting them with syntheticHeapLocations representing the accessed locations.SemanticDomain.Satisfiabilitysatisfies(SymbolicExpression expression, HeapEnvironment<AllocationSites> environment, ProgramPoint pp)Checks whetherexpressionis satisfied inenvironment, assuming that the values of program variables are the ones stored inenvironmentand returning an instance ofSemanticDomain.Satisfiability.AllocationSitestop()Yields the top element of this lattice.booleantracksIdentifiers(Identifier id)Yieldstrueif the domain tracks information on the identifierid,falseotherwise.-
Methods inherited from class it.unive.lisa.analysis.lattices.SetLattice
contains, elements, glb, isEmpty, lessOrEqualAux, size, toString, wideningAux
-
Methods inherited from class it.unive.lisa.analysis.BaseLattice
lessOrEqual, lub, widening
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.Lattice
lessOrEqual, lub, widening
-
Methods inherited from interface it.unive.lisa.analysis.nonrelational.NonRelationalElement
glb, variable
-
Methods inherited from interface it.unive.lisa.analysis.nonrelational.heap.NonRelationalHeapDomain
rewriteAll
-
-
-
-
Method Detail
-
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.- Specified by:
isTopin interfaceLattice<AllocationSites>- Returns:
trueif this is the top of the lattice
-
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.- Specified by:
isBottomin interfaceLattice<AllocationSites>- Returns:
trueif this is the bottom of the lattice
-
top
public AllocationSites 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.- Specified by:
topin interfaceLattice<AllocationSites>- Returns:
- the top element
-
bottom
public AllocationSites 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.- Specified by:
bottomin interfaceLattice<AllocationSites>- Returns:
- the bottom element
-
mk
protected AllocationSites mk(java.util.Set<AllocationSite> set)
Description copied from class:SetLatticeUtility for creating a concrete instance ofSetLatticegiven a set. This decouples the instance of set used during computation of the elements to put in the lattice from the actual type of set underlying the lattice.- Specified by:
mkin classSetLattice<AllocationSites,AllocationSite>- Parameters:
set- the set containing the elements that must be included in the lattice instance- Returns:
- a new concrete instance of
SetLatticecontaining the elements of the given set
-
iterator
public java.util.Iterator<AllocationSite> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<AllocationSite>- Overrides:
iteratorin classSetLattice<AllocationSites,AllocationSite>
-
eval
public AllocationSites eval(SymbolicExpression expression, HeapEnvironment<AllocationSites> environment, ProgramPoint pp)
Description copied from interface:NonRelationalDomainEvaluates aSymbolicExpression, assuming that the values of program variables are the ones stored inenvironment.- Specified by:
evalin interfaceNonRelationalDomain<AllocationSites,SymbolicExpression,HeapEnvironment<AllocationSites>>- Parameters:
expression- the expression to evaluateenvironment- the environment containing the values of program variables for the evaluationpp- the program point that where this operation is being evaluated- Returns:
- an new instance of this domain, representing the abstract result
of
expressionwhen evaluated onenvironment
-
satisfies
public SemanticDomain.Satisfiability satisfies(SymbolicExpression expression, HeapEnvironment<AllocationSites> environment, ProgramPoint pp)
Description copied from interface:NonRelationalElementChecks whetherexpressionis satisfied inenvironment, assuming that the values of program variables are the ones stored inenvironmentand returning an instance ofSemanticDomain.Satisfiability.- Specified by:
satisfiesin interfaceNonRelationalElement<AllocationSites,SymbolicExpression,HeapEnvironment<AllocationSites>>- Parameters:
expression- the expression whose satisfiability is to be evaluatedenvironment- the environment containing the values of program variables for the satisfiabilitypp- the program point that where this operation is being evaluated- Returns:
SemanticDomain.Satisfiability.SATISFIEDif the expression is satisfied by the environment,SemanticDomain.Satisfiability.NOT_SATISFIEDif it is not satisfied, orSemanticDomain.Satisfiability.UNKNOWNif it is either impossible to determine if it satisfied, or if it is satisfied by some values and not by some others (this is equivalent to a TOP boolean value)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classSetLattice<AllocationSites,AllocationSite>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classSetLattice<AllocationSites,AllocationSite>
-
representation
public DomainRepresentation representation()
Description copied from interface:NonRelationalElementYields aDomainRepresentationof the information contained in this domain's instance.- Specified by:
representationin interfaceNonRelationalElement<AllocationSites,SymbolicExpression,HeapEnvironment<AllocationSites>>- Returns:
- the representation
-
getSubstitution
public java.util.List<HeapSemanticOperation.HeapReplacement> getSubstitution()
Description copied from interface:HeapSemanticOperationYields the substitution, in the form of a list ofHeapSemanticOperation.HeapReplacements that must be processed in their order of appearance, that the creation of this heap domain caused. This substitution mapsIdentifiers in the pre-state toIdentifiers in the post state. If no substitution needs to be applied, this method should return an empty list.- Specified by:
getSubstitutionin interfaceHeapSemanticOperation- Returns:
- the list of replacements
-
lubAux
protected AllocationSites lubAux(AllocationSites other) throws SemanticException
Description copied from class:BaseLatticePerforms the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:otheris notnullotheris neither top nor bottomthisis neither top nor bottomthisandotherare not the same object (according both to==and toObject.equals(Object))
- Overrides:
lubAuxin classSetLattice<AllocationSites,AllocationSite>- Parameters:
other- the other lattice element- Returns:
- the least upper bound between this and other
- Throws:
SemanticException- if an error occurs during the computation
-
tracksIdentifiers
public boolean tracksIdentifiers(Identifier id)
Description copied from interface:SemanticEvaluatorYieldstrueif the domain tracks information on the identifierid,falseotherwise.- Specified by:
tracksIdentifiersin interfaceSemanticEvaluator- Parameters:
id- the identifier- Returns:
trueif the domain tracks information on the identifierid,falseotherwise
-
canProcess
public boolean canProcess(SymbolicExpression expression)
Description copied from interface:SemanticEvaluatorYieldstrueif the domain can processexpression,falseotherwise.- Specified by:
canProcessin interfaceSemanticEvaluator- Parameters:
expression- the expression- Returns:
trueif the domain can processexpression,falseotherwise.
-
assume
public HeapEnvironment<AllocationSites> assume(HeapEnvironment<AllocationSites> environment, SymbolicExpression expression, ProgramPoint pp) throws SemanticException
Description copied from interface:NonRelationalElementYields the environmentenvironmenton which the expressionexpressionis assumed to hold by this domain.- Specified by:
assumein interfaceNonRelationalElement<AllocationSites,SymbolicExpression,HeapEnvironment<AllocationSites>>- Parameters:
environment- the environmentexpression- the expression to be assumedpp- the program point whereexpressionoccurs.- Returns:
- the environment
environmentwhereexpressionis assumed to hold - Throws:
SemanticException- if an error occurs during the computation
-
rewrite
public ExpressionSet<ValueExpression> rewrite(SymbolicExpression expression, HeapEnvironment<AllocationSites> environment, ProgramPoint pp) throws SemanticException
Description copied from interface:NonRelationalHeapDomainRewrites aSymbolicExpression, getting rid of the parts that access heap structures, substituting them with syntheticHeapLocations representing the accessed locations. The expression(s) returned by this method should not containHeapExpressions.
Note that a single expression might be rewritten to more than one expression, depending on the individual reasoning of the domain.
If no rewriting is necessary, the input expression can be returned instead.- Specified by:
rewritein interfaceNonRelationalHeapDomain<AllocationSites>- Parameters:
expression- the expression to rewriteenvironment- the environment containing information about the program variablespp- the program point that where this expression is being rewritten- Returns:
- the rewritten expressions, or the original one
- Throws:
SemanticException- if something goes wrong during the rewriting
-
-