Class SimpleAbstractState<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>

  • Type Parameters:
    H - the type of HeapDomain embedded in this state
    V - the type of ValueDomain embedded in this state
    T - the type of TypeDomain embedded in this state
    All Implemented Interfaces:
    it.unive.lisa.analysis.AbstractState<SimpleAbstractState<H,​V,​T>>, it.unive.lisa.analysis.BaseLattice<SimpleAbstractState<H,​V,​T>>, it.unive.lisa.analysis.heap.MemoryOracle, it.unive.lisa.analysis.Lattice<SimpleAbstractState<H,​V,​T>>, it.unive.lisa.analysis.ScopedObject<SimpleAbstractState<H,​V,​T>>, it.unive.lisa.analysis.SemanticDomain<SimpleAbstractState<H,​V,​T>,​it.unive.lisa.symbolic.SymbolicExpression,​it.unive.lisa.symbolic.value.Identifier>, it.unive.lisa.analysis.SemanticOracle, it.unive.lisa.analysis.type.TypeOracle, it.unive.lisa.analysis.value.ValueOracle, it.unive.lisa.util.representation.StructuredObject

    public class SimpleAbstractState<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
    extends java.lang.Object
    implements it.unive.lisa.analysis.BaseLattice<SimpleAbstractState<H,​V,​T>>, it.unive.lisa.analysis.AbstractState<SimpleAbstractState<H,​V,​T>>
    An abstract state of the analysis, composed by a heap state modeling the memory layout, a value state modeling values of program variables and memory locations, and a type state that can give types to expressions knowing the ones of variables.

    The interaction between heap and value/type domains follows the one defined in this paper.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String HEAP_REPRESENTATION_KEY
      The key that should be used to store the instance of HeapDomain inside the StructuredRepresentation returned by representation().
      static java.lang.String TYPE_REPRESENTATION_KEY
      The key that should be used to store the instance of TypeDomain inside the StructuredRepresentation returned by representation().
      static java.lang.String VALUE_REPRESENTATION_KEY
      The key that should be used to store the instance of ValueDomain inside the StructuredRepresentation returned by representation().
      • Fields inherited from interface it.unive.lisa.analysis.Lattice

        BOTTOM_STRING, TOP_STRING
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleAbstractState​(H heapState, V valueState, T typeState)
      Builds a new abstract state.
    • Method Summary

      All Methods Instance 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)  
      SimpleAbstractState<H,​V,​T> 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)  
      SimpleAbstractState<H,​V,​T> 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)  
      SimpleAbstractState<H,​V,​T> bottom()  
      boolean equals​(java.lang.Object obj)  
      SimpleAbstractState<H,​V,​T> forgetIdentifier​(it.unive.lisa.symbolic.value.Identifier id)  
      SimpleAbstractState<H,​V,​T> forgetIdentifiersIf​(java.util.function.Predicate<it.unive.lisa.symbolic.value.Identifier> test)  
      <D extends it.unive.lisa.analysis.SemanticDomain<?,​?,​?>>
      java.util.Collection<D>
      getAllDomainInstances​(java.lang.Class<D> domain)  
      it.unive.lisa.type.Type getDynamicTypeOf​(it.unive.lisa.symbolic.SymbolicExpression e, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      H getHeapState()
      Yields the HeapDomain contained in this state.
      java.util.Set<it.unive.lisa.type.Type> getRuntimeTypesOf​(it.unive.lisa.symbolic.SymbolicExpression e, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      T getTypeState()
      Yields the TypeDomain contained in this state.
      V getValueState()
      Yields the ValueDomain contained in this state.
      SimpleAbstractState<H,​V,​T> glbAux​(SimpleAbstractState<H,​V,​T> other)  
      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​(SimpleAbstractState<H,​V,​T> other)  
      SimpleAbstractState<H,​V,​T> lubAux​(SimpleAbstractState<H,​V,​T> other)  
      SimpleAbstractState<H,​V,​T> narrowingAux​(SimpleAbstractState<H,​V,​T> other)  
      SimpleAbstractState<H,​V,​T> popScope​(it.unive.lisa.analysis.ScopeToken scope)  
      SimpleAbstractState<H,​V,​T> pushScope​(it.unive.lisa.analysis.ScopeToken scope)  
      it.unive.lisa.util.representation.StructuredRepresentation representation()  
      it.unive.lisa.analysis.lattices.ExpressionSet rewrite​(it.unive.lisa.analysis.lattices.ExpressionSet expressions, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      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)  
      SimpleAbstractState<H,​V,​T> smallStepSemantics​(it.unive.lisa.symbolic.SymbolicExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      SimpleAbstractState<H,​V,​T> top()  
      java.lang.String toString()  
      SimpleAbstractState<H,​V,​T> wideningAux​(SimpleAbstractState<H,​V,​T> other)  
      SimpleAbstractState<H,​V,​T> withTopMemory()  
      SimpleAbstractState<H,​V,​T> withTopTypes()  
      SimpleAbstractState<H,​V,​T> withTopValues()  
      • 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
      • Methods inherited from interface it.unive.lisa.analysis.heap.MemoryOracle

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

        forgetIdentifiers, getDomainInstance
    • Field Detail

      • HEAP_REPRESENTATION_KEY

        public static final java.lang.String HEAP_REPRESENTATION_KEY
        The key that should be used to store the instance of HeapDomain inside the StructuredRepresentation returned by representation().
        See Also:
        Constant Field Values
      • TYPE_REPRESENTATION_KEY

        public static final java.lang.String TYPE_REPRESENTATION_KEY
        The key that should be used to store the instance of TypeDomain inside the StructuredRepresentation returned by representation().
        See Also:
        Constant Field Values
      • VALUE_REPRESENTATION_KEY

        public static final java.lang.String VALUE_REPRESENTATION_KEY
        The key that should be used to store the instance of ValueDomain inside the StructuredRepresentation returned by representation().
        See Also:
        Constant Field Values
    • Constructor Detail

      • SimpleAbstractState

        public SimpleAbstractState​(H heapState,
                                   V valueState,
                                   T typeState)
        Builds a new abstract state.
        Parameters:
        heapState - the domain containing information regarding heap structures
        valueState - the domain containing information regarding values of program variables and concretized memory locations
        typeState - the domain containing information regarding runtime types of program variables and concretized memory locations
    • Method Detail

      • getHeapState

        public H getHeapState()
        Yields the HeapDomain contained in this state.
        Returns:
        the heap domain
      • getValueState

        public V getValueState()
        Yields the ValueDomain contained in this state.
        Returns:
        the value domain
      • getTypeState

        public T getTypeState()
        Yields the TypeDomain contained in this state.
        Returns:
        the type domain
      • assign

        public SimpleAbstractState<H,​V,​T> 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<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • smallStepSemantics

        public SimpleAbstractState<H,​V,​T> smallStepSemantics​(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:
        smallStepSemantics in interface it.unive.lisa.analysis.SemanticDomain<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • assume

        public SimpleAbstractState<H,​V,​T> 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<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
        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<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • pushScope

        public SimpleAbstractState<H,​V,​T> pushScope​(it.unive.lisa.analysis.ScopeToken scope)
                                                         throws it.unive.lisa.analysis.SemanticException
        Specified by:
        pushScope in interface it.unive.lisa.analysis.ScopedObject<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • popScope

        public SimpleAbstractState<H,​V,​T> popScope​(it.unive.lisa.analysis.ScopeToken scope)
                                                        throws it.unive.lisa.analysis.SemanticException
        Specified by:
        popScope in interface it.unive.lisa.analysis.ScopedObject<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • lubAux

        public SimpleAbstractState<H,​V,​T> lubAux​(SimpleAbstractState<H,​V,​T> other)
                                                      throws it.unive.lisa.analysis.SemanticException
        Specified by:
        lubAux in interface it.unive.lisa.analysis.BaseLattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • glbAux

        public SimpleAbstractState<H,​V,​T> glbAux​(SimpleAbstractState<H,​V,​T> other)
                                                      throws it.unive.lisa.analysis.SemanticException
        Specified by:
        glbAux in interface it.unive.lisa.analysis.BaseLattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • wideningAux

        public SimpleAbstractState<H,​V,​T> wideningAux​(SimpleAbstractState<H,​V,​T> other)
                                                           throws it.unive.lisa.analysis.SemanticException
        Specified by:
        wideningAux in interface it.unive.lisa.analysis.BaseLattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • narrowingAux

        public SimpleAbstractState<H,​V,​T> narrowingAux​(SimpleAbstractState<H,​V,​T> other)
                                                            throws it.unive.lisa.analysis.SemanticException
        Specified by:
        narrowingAux in interface it.unive.lisa.analysis.BaseLattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • lessOrEqualAux

        public boolean lessOrEqualAux​(SimpleAbstractState<H,​V,​T> other)
                               throws it.unive.lisa.analysis.SemanticException
        Specified by:
        lessOrEqualAux in interface it.unive.lisa.analysis.BaseLattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • top

        public SimpleAbstractState<H,​V,​T> top()
        Specified by:
        top in interface it.unive.lisa.analysis.Lattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
      • bottom

        public SimpleAbstractState<H,​V,​T> bottom()
        Specified by:
        bottom in interface it.unive.lisa.analysis.Lattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
      • isTop

        public boolean isTop()
        Specified by:
        isTop in interface it.unive.lisa.analysis.Lattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
      • isBottom

        public boolean isBottom()
        Specified by:
        isBottom in interface it.unive.lisa.analysis.Lattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
      • forgetIdentifier

        public SimpleAbstractState<H,​V,​T> forgetIdentifier​(it.unive.lisa.symbolic.value.Identifier id)
                                                                throws it.unive.lisa.analysis.SemanticException
        Specified by:
        forgetIdentifier in interface it.unive.lisa.analysis.SemanticDomain<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • forgetIdentifiersIf

        public SimpleAbstractState<H,​V,​T> forgetIdentifiersIf​(java.util.function.Predicate<it.unive.lisa.symbolic.value.Identifier> test)
                                                                   throws it.unive.lisa.analysis.SemanticException
        Specified by:
        forgetIdentifiersIf in interface it.unive.lisa.analysis.SemanticDomain<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface it.unive.lisa.analysis.BaseLattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        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<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Overrides:
        equals in class java.lang.Object
      • representation

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

        public java.lang.String toString()
        Specified by:
        toString in interface it.unive.lisa.analysis.BaseLattice<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
        Overrides:
        toString in class java.lang.Object
      • getAllDomainInstances

        public <D extends it.unive.lisa.analysis.SemanticDomain<?,​?,​?>> java.util.Collection<D> getAllDomainInstances​(java.lang.Class<D> domain)
        Specified by:
        getAllDomainInstances in interface it.unive.lisa.analysis.SemanticDomain<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
      • 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
      • rewrite

        public it.unive.lisa.analysis.lattices.ExpressionSet rewrite​(it.unive.lisa.analysis.lattices.ExpressionSet expressions,
                                                                     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
      • getRuntimeTypesOf

        public java.util.Set<it.unive.lisa.type.Type> getRuntimeTypesOf​(it.unive.lisa.symbolic.SymbolicExpression e,
                                                                        it.unive.lisa.program.cfg.ProgramPoint pp,
                                                                        it.unive.lisa.analysis.SemanticOracle oracle)
                                                                 throws it.unive.lisa.analysis.SemanticException
        Specified by:
        getRuntimeTypesOf in interface it.unive.lisa.analysis.type.TypeOracle
        Throws:
        it.unive.lisa.analysis.SemanticException
      • getDynamicTypeOf

        public it.unive.lisa.type.Type getDynamicTypeOf​(it.unive.lisa.symbolic.SymbolicExpression e,
                                                        it.unive.lisa.program.cfg.ProgramPoint pp,
                                                        it.unive.lisa.analysis.SemanticOracle oracle)
                                                 throws it.unive.lisa.analysis.SemanticException
        Specified by:
        getDynamicTypeOf in interface it.unive.lisa.analysis.type.TypeOracle
        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<H extends it.unive.lisa.analysis.heap.HeapDomain<H>,​V extends it.unive.lisa.analysis.value.ValueDomain<V>,​T extends it.unive.lisa.analysis.type.TypeDomain<T>>
      • withTopMemory

        public SimpleAbstractState<H,​V,​T> withTopMemory()
        Specified by:
        withTopMemory in interface it.unive.lisa.analysis.AbstractState<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
      • withTopValues

        public SimpleAbstractState<H,​V,​T> withTopValues()
        Specified by:
        withTopValues in interface it.unive.lisa.analysis.AbstractState<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
      • withTopTypes

        public SimpleAbstractState<H,​V,​T> withTopTypes()
        Specified by:
        withTopTypes in interface it.unive.lisa.analysis.AbstractState<H extends it.unive.lisa.analysis.heap.HeapDomain<H>>
      • 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