Class AllocationSiteBasedAnalysis<A extends AllocationSiteBasedAnalysis<A>>

  • Type Parameters:
    A - the concrete type of analysis that methods of this class return
    All Implemented Interfaces:
    it.unive.lisa.analysis.BaseLattice<A>, it.unive.lisa.analysis.heap.BaseHeapDomain<A>, it.unive.lisa.analysis.heap.HeapDomain<A>, it.unive.lisa.analysis.heap.HeapSemanticOperation, it.unive.lisa.analysis.heap.MemoryOracle, it.unive.lisa.analysis.Lattice<A>, it.unive.lisa.analysis.ScopedObject<A>, it.unive.lisa.analysis.SemanticDomain<A,​it.unive.lisa.symbolic.SymbolicExpression,​it.unive.lisa.symbolic.value.Identifier>, it.unive.lisa.util.representation.StructuredObject
    Direct Known Subclasses:
    FieldSensitivePointBasedHeap, PointBasedHeap

    public abstract class AllocationSiteBasedAnalysis<A extends AllocationSiteBasedAnalysis<A>>
    extends java.lang.Object
    implements it.unive.lisa.analysis.heap.BaseHeapDomain<A>
    A base class for heap analyses based on the allocation sites of the objects and arrays they track, namely the position of the code where heap locations are generated. All heap locations that are generated at the same allocation sites are abstracted into a single unique heap identifier. Concrete instances have control over their field-sensitivity.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  AllocationSiteBasedAnalysis.Rewriter
      A BaseHeapDomain.Rewriter for the AllocationSiteBasedAnalysis domain.
      • Nested classes/interfaces inherited from interface it.unive.lisa.analysis.heap.HeapSemanticOperation

        it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement
    • Field Summary

      Fields 
      Modifier and Type Field Description
      it.unive.lisa.analysis.nonrelational.heap.HeapEnvironment<AllocationSites> heapEnv
      An heap environment tracking which allocation sites are associated to each identifier.
      java.util.List<it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement> replacements
      The replacements to be applied after the generation of this domain instance.
      • Fields inherited from interface it.unive.lisa.analysis.Lattice

        BOTTOM_STRING, TOP_STRING
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AllocationSiteBasedAnalysis()
      Builds a new instance of allocation site-based heap.
        AllocationSiteBasedAnalysis​(it.unive.lisa.analysis.nonrelational.heap.HeapEnvironment<AllocationSites> heapEnv)
      Builds a new instance of allocation site-based heap from its heap environment.
        AllocationSiteBasedAnalysis​(it.unive.lisa.analysis.nonrelational.heap.HeapEnvironment<AllocationSites> heapEnv, java.util.List<it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement> replacements)
      Builds a new instance of allocation site-based heap from its heap environment and replacements.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      it.unive.lisa.analysis.lattices.Satisfiability alias​(it.unive.lisa.symbolic.SymbolicExpression x, it.unive.lisa.symbolic.SymbolicExpression y, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      A assign​(it.unive.lisa.symbolic.value.Identifier id, it.unive.lisa.symbolic.SymbolicExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      A assume​(it.unive.lisa.symbolic.SymbolicExpression expression, it.unive.lisa.program.cfg.ProgramPoint src, it.unive.lisa.program.cfg.ProgramPoint dest, it.unive.lisa.analysis.SemanticOracle oracle)  
      boolean equals​(java.lang.Object obj)  
      protected java.util.Set<AllocationSite> getAllocatedAt​(java.lang.String location)
      Yields an allocation site name id if it is tracked by this domain, null otherwise.
      java.util.List<it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement> getSubstitution()  
      int hashCode()  
      boolean isBottom()  
      it.unive.lisa.analysis.lattices.Satisfiability isReachableFrom​(it.unive.lisa.symbolic.SymbolicExpression x, it.unive.lisa.symbolic.SymbolicExpression y, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      boolean isTop()  
      boolean knowsIdentifier​(it.unive.lisa.symbolic.value.Identifier id)  
      boolean lessOrEqualAux​(A other)  
      protected abstract A mk​(A reference, it.unive.lisa.analysis.nonrelational.heap.HeapEnvironment<AllocationSites> heapEnv)
      Builds a new instance of this class by copying abstract information from reference and using the given environment for storing points-to information.
      it.unive.lisa.util.representation.StructuredRepresentation representation()  
      it.unive.lisa.analysis.lattices.ExpressionSet rewrite​(it.unive.lisa.symbolic.SymbolicExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      it.unive.lisa.analysis.lattices.Satisfiability satisfies​(it.unive.lisa.symbolic.SymbolicExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      A semanticsOf​(it.unive.lisa.symbolic.heap.HeapExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      A shallowCopy​(it.unive.lisa.symbolic.value.Identifier id, StackAllocationSite site, java.util.List<it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement> replacements, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
      Performs the assignment of site to the identifier id when site is a static allocation site, thus performing a shallow copy instead of aliasing handling the heap replacements.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface it.unive.lisa.analysis.heap.BaseHeapDomain

        mk, mk, popScope, pushScope, smallStepSemantics
      • Methods inherited from interface it.unive.lisa.analysis.BaseLattice

        glb, glbAux, lessOrEqual, lub, lubAux, narrowing, narrowingAux, toString, widening, wideningAux
      • Methods inherited from interface it.unive.lisa.analysis.Lattice

        bottom, top
      • Methods inherited from interface it.unive.lisa.analysis.heap.MemoryOracle

        areMutuallyReachable, reachableFrom, rewrite
      • Methods inherited from interface it.unive.lisa.analysis.SemanticDomain

        forgetIdentifier, forgetIdentifiers, forgetIdentifiersIf, getAllDomainInstances, getDomainInstance
    • Field Detail

      • heapEnv

        public final it.unive.lisa.analysis.nonrelational.heap.HeapEnvironment<AllocationSites> heapEnv
        An heap environment tracking which allocation sites are associated to each identifier.
      • replacements

        public final java.util.List<it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement> replacements
        The replacements to be applied after the generation of this domain instance.
    • Constructor Detail

      • AllocationSiteBasedAnalysis

        protected AllocationSiteBasedAnalysis()
        Builds a new instance of allocation site-based heap.
      • AllocationSiteBasedAnalysis

        public AllocationSiteBasedAnalysis​(it.unive.lisa.analysis.nonrelational.heap.HeapEnvironment<AllocationSites> heapEnv)
        Builds a new instance of allocation site-based heap from its heap environment.
        Parameters:
        heapEnv - the heap environment that this instance tracks
      • AllocationSiteBasedAnalysis

        public AllocationSiteBasedAnalysis​(it.unive.lisa.analysis.nonrelational.heap.HeapEnvironment<AllocationSites> heapEnv,
                                           java.util.List<it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement> replacements)
        Builds a new instance of allocation site-based heap from its heap environment and replacements.
        Parameters:
        heapEnv - the heap environment that this instance tracks
        replacements - the heap replacements of this instance
    • Method Detail

      • mk

        protected abstract A mk​(A reference,
                                it.unive.lisa.analysis.nonrelational.heap.HeapEnvironment<AllocationSites> heapEnv)
        Builds a new instance of this class by copying abstract information from reference and using the given environment for storing points-to information.
        Parameters:
        reference - the domain whose abstract information needs to be copied
        heapEnv - the heap environment that this instance tracks
        Returns:
        the new instance
      • assign

        public A assign​(it.unive.lisa.symbolic.value.Identifier id,
                        it.unive.lisa.symbolic.SymbolicExpression expression,
                        it.unive.lisa.program.cfg.ProgramPoint pp,
                        it.unive.lisa.analysis.SemanticOracle oracle)
                 throws it.unive.lisa.analysis.SemanticException
        Specified by:
        assign in interface it.unive.lisa.analysis.SemanticDomain<A extends AllocationSiteBasedAnalysis<A>,​it.unive.lisa.symbolic.SymbolicExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • getAllocatedAt

        protected java.util.Set<AllocationSite> getAllocatedAt​(java.lang.String location)
        Yields an allocation site name id if it is tracked by this domain, null otherwise.
        Parameters:
        location - allocation site's name to be searched
        Returns:
        an allocation site name id if it is tracked by this domain, null otherwise
      • shallowCopy

        public A shallowCopy​(it.unive.lisa.symbolic.value.Identifier id,
                             StackAllocationSite site,
                             java.util.List<it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement> replacements,
                             it.unive.lisa.program.cfg.ProgramPoint pp,
                             it.unive.lisa.analysis.SemanticOracle oracle)
                      throws it.unive.lisa.analysis.SemanticException
        Performs the assignment of site to the identifier id when site is a static allocation site, thus performing a shallow copy instead of aliasing handling the heap replacements.
        Parameters:
        id - the identifier to be updated
        site - the allocation site to be assigned
        replacements - the list of replacements to be updated
        pp - the program point where this operation occurs
        oracle - the oracle for inter-domain communication
        Returns:
        the point-based heap instance where id is updated with star_y and the needed heap replacements
        Throws:
        it.unive.lisa.analysis.SemanticException - if something goes wrong during the analysis
      • assume

        public A assume​(it.unive.lisa.symbolic.SymbolicExpression expression,
                        it.unive.lisa.program.cfg.ProgramPoint src,
                        it.unive.lisa.program.cfg.ProgramPoint dest,
                        it.unive.lisa.analysis.SemanticOracle oracle)
                 throws it.unive.lisa.analysis.SemanticException
        Specified by:
        assume in interface it.unive.lisa.analysis.SemanticDomain<A extends AllocationSiteBasedAnalysis<A>,​it.unive.lisa.symbolic.SymbolicExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • satisfies

        public it.unive.lisa.analysis.lattices.Satisfiability satisfies​(it.unive.lisa.symbolic.SymbolicExpression expression,
                                                                        it.unive.lisa.program.cfg.ProgramPoint pp,
                                                                        it.unive.lisa.analysis.SemanticOracle oracle)
                                                                 throws it.unive.lisa.analysis.SemanticException
        Specified by:
        satisfies in interface it.unive.lisa.analysis.SemanticDomain<A extends AllocationSiteBasedAnalysis<A>,​it.unive.lisa.symbolic.SymbolicExpression,​it.unive.lisa.symbolic.value.Identifier>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • representation

        public it.unive.lisa.util.representation.StructuredRepresentation representation()
        Specified by:
        representation in interface it.unive.lisa.util.representation.StructuredObject
      • isBottom

        public boolean isBottom()
        Specified by:
        isBottom in interface it.unive.lisa.analysis.Lattice<A extends AllocationSiteBasedAnalysis<A>>
      • getSubstitution

        public java.util.List<it.unive.lisa.analysis.heap.HeapSemanticOperation.HeapReplacement> getSubstitution()
        Specified by:
        getSubstitution in interface it.unive.lisa.analysis.heap.HeapSemanticOperation
      • lessOrEqualAux

        public boolean lessOrEqualAux​(A other)
                               throws it.unive.lisa.analysis.SemanticException
        Specified by:
        lessOrEqualAux in interface it.unive.lisa.analysis.BaseLattice<A extends AllocationSiteBasedAnalysis<A>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface it.unive.lisa.analysis.BaseLattice<A extends AllocationSiteBasedAnalysis<A>>
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface it.unive.lisa.analysis.BaseLattice<A extends AllocationSiteBasedAnalysis<A>>
        Overrides:
        equals in class java.lang.Object
      • semanticsOf

        public A semanticsOf​(it.unive.lisa.symbolic.heap.HeapExpression expression,
                             it.unive.lisa.program.cfg.ProgramPoint pp,
                             it.unive.lisa.analysis.SemanticOracle oracle)
                      throws it.unive.lisa.analysis.SemanticException
        Specified by:
        semanticsOf in interface it.unive.lisa.analysis.heap.BaseHeapDomain<A extends AllocationSiteBasedAnalysis<A>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • rewrite

        public it.unive.lisa.analysis.lattices.ExpressionSet rewrite​(it.unive.lisa.symbolic.SymbolicExpression expression,
                                                                     it.unive.lisa.program.cfg.ProgramPoint pp,
                                                                     it.unive.lisa.analysis.SemanticOracle oracle)
                                                              throws it.unive.lisa.analysis.SemanticException
        Specified by:
        rewrite in interface it.unive.lisa.analysis.heap.MemoryOracle
        Throws:
        it.unive.lisa.analysis.SemanticException
      • knowsIdentifier

        public boolean knowsIdentifier​(it.unive.lisa.symbolic.value.Identifier id)
        Specified by:
        knowsIdentifier in interface it.unive.lisa.analysis.SemanticDomain<A extends AllocationSiteBasedAnalysis<A>,​it.unive.lisa.symbolic.SymbolicExpression,​it.unive.lisa.symbolic.value.Identifier>
      • alias

        public it.unive.lisa.analysis.lattices.Satisfiability alias​(it.unive.lisa.symbolic.SymbolicExpression x,
                                                                    it.unive.lisa.symbolic.SymbolicExpression y,
                                                                    it.unive.lisa.program.cfg.ProgramPoint pp,
                                                                    it.unive.lisa.analysis.SemanticOracle oracle)
                                                             throws it.unive.lisa.analysis.SemanticException
        Specified by:
        alias in interface it.unive.lisa.analysis.heap.MemoryOracle
        Throws:
        it.unive.lisa.analysis.SemanticException
      • isReachableFrom

        public it.unive.lisa.analysis.lattices.Satisfiability isReachableFrom​(it.unive.lisa.symbolic.SymbolicExpression x,
                                                                              it.unive.lisa.symbolic.SymbolicExpression y,
                                                                              it.unive.lisa.program.cfg.ProgramPoint pp,
                                                                              it.unive.lisa.analysis.SemanticOracle oracle)
                                                                       throws it.unive.lisa.analysis.SemanticException
        Specified by:
        isReachableFrom in interface it.unive.lisa.analysis.heap.MemoryOracle
        Throws:
        it.unive.lisa.analysis.SemanticException