Package it.unive.lisa.analysis.traces
Class TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>
- java.lang.Object
-
- it.unive.lisa.analysis.lattices.FunctionalLattice<TracePartitioning<A>,ExecutionTrace,A>
-
- it.unive.lisa.analysis.traces.TracePartitioning<A>
-
- Type Parameters:
A- the type ofAbstractStatethat this is being partitioned
- All Implemented Interfaces:
it.unive.lisa.analysis.AbstractState<TracePartitioning<A>>,it.unive.lisa.analysis.BaseLattice<TracePartitioning<A>>,it.unive.lisa.analysis.heap.MemoryOracle,it.unive.lisa.analysis.Lattice<TracePartitioning<A>>,it.unive.lisa.analysis.ScopedObject<TracePartitioning<A>>,it.unive.lisa.analysis.SemanticDomain<TracePartitioning<A>,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,java.lang.Iterable<java.util.Map.Entry<ExecutionTrace,A>>
public class TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>> extends it.unive.lisa.analysis.lattices.FunctionalLattice<TracePartitioning<A>,ExecutionTrace,A> implements it.unive.lisa.analysis.AbstractState<TracePartitioning<A>>
The trace partitioning abstract domain that splits execution traces to increase precision of the analysis. Individual traces are identified byExecutionTraces composed of tokens representing the conditions traversed during the analysis. Note that allTraceTokens represent intraprocedural control-flow constructs, as calls are abstracted away before reaching this domain.
Traces are never merged: instead, we limit the size of the traces we can track, and we leave the choice of when and where to compact traces to other analysis components. Specifically, anExecutionTracewill contain at mostMAX_CONDITIONSBranchingtokens, and will track at mostMAX_LOOP_ITERATIONSiterations for each loop (throughLoopIterationtokens) before summarizing the next ones with aLoopSummarytoken. Both values are editable and customizable before the analysis starts.
As this class extendsFunctionalLattice, one access individual traces and their approximations usingFunctionalLattice.getKeys(),FunctionalLattice.getValues(),FunctionalLattice.getMap()or by iterating over the instance itself. Approximations of different traces can instead be collapsed and accessed by queryingcollapse().- See Also:
- https://doi.org/10.1145/1275497.1275501
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
it.unive.lisa.analysis.lattices.FunctionalLattice.FunctionalLift<V extends it.unive.lisa.analysis.Lattice<V>>, it.unive.lisa.analysis.lattices.FunctionalLattice.KeyFunctionalLift<K extends java.lang.Object>
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_CONDITIONSThe maximum number ofBranchingtokens that a trace can contain.static intMAX_LOOP_ITERATIONSThe maximum number ofLoopIterationtokens that a trace can contain for each loop appearing in it, before collapsing the next ones in a singleLoopSummarytoken.
-
Constructor Summary
Constructors Constructor Description TracePartitioning(A lattice)Builds a new instance of this domain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description it.unive.lisa.analysis.lattices.Satisfiabilityalias(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)TracePartitioning<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)TracePartitioning<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)TracePartitioning<A>bottom()Acollapse()Collapses all of the traces contained in this domain, returning a unique abstract state that over-approximates all of them.TracePartitioning<A>forgetIdentifier(it.unive.lisa.symbolic.value.Identifier id)TracePartitioning<A>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.TypegetDynamicTypeOf(it.unive.lisa.symbolic.SymbolicExpression e, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)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)it.unive.lisa.analysis.lattices.SatisfiabilityisReachableFrom(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)booleanknowsIdentifier(it.unive.lisa.symbolic.value.Identifier id)TracePartitioning<A>mk(A lattice, java.util.Map<ExecutionTrace,A> function)TracePartitioning<A>popScope(it.unive.lisa.analysis.ScopeToken token)TracePartitioning<A>pushScope(it.unive.lisa.analysis.ScopeToken token)it.unive.lisa.util.representation.StructuredRepresentationrepresentation()it.unive.lisa.analysis.lattices.ExpressionSetrewrite(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.ExpressionSetrewrite(it.unive.lisa.symbolic.SymbolicExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)it.unive.lisa.analysis.lattices.Satisfiabilitysatisfies(it.unive.lisa.symbolic.SymbolicExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)TracePartitioning<A>smallStepSemantics(it.unive.lisa.symbolic.SymbolicExpression expression, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)AstateOfUnknown(ExecutionTrace key)TracePartitioning<A>top()java.lang.StringtoString()TracePartitioning<A>withTopMemory()TracePartitioning<A>withTopTypes()TracePartitioning<A>withTopValues()-
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, 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
-
-
-
-
Field Detail
-
MAX_LOOP_ITERATIONS
public static int MAX_LOOP_ITERATIONS
The maximum number ofLoopIterationtokens that a trace can contain for each loop appearing in it, before collapsing the next ones in a singleLoopSummarytoken.
-
MAX_CONDITIONS
public static int MAX_CONDITIONS
The maximum number ofBranchingtokens that a trace can contain.
-
-
Constructor Detail
-
TracePartitioning
public TracePartitioning(A lattice)
Builds a new instance of this domain.- Parameters:
lattice- a singleton of the underlying abstract states
-
-
Method Detail
-
getAllDomainInstances
public <D extends it.unive.lisa.analysis.SemanticDomain<?,?,?>> java.util.Collection<D> getAllDomainInstances(java.lang.Class<D> domain)
- Specified by:
getAllDomainInstancesin interfaceit.unive.lisa.analysis.SemanticDomain<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,it.unive.lisa.symbolic.SymbolicExpression,it.unive.lisa.symbolic.value.Identifier>
-
top
public TracePartitioning<A> top()
-
bottom
public TracePartitioning<A> bottom()
-
assign
public TracePartitioning<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:
assignin interfaceit.unive.lisa.analysis.SemanticDomain<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,it.unive.lisa.symbolic.SymbolicExpression,it.unive.lisa.symbolic.value.Identifier>- Throws:
it.unive.lisa.analysis.SemanticException
-
smallStepSemantics
public TracePartitioning<A> 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:
smallStepSemanticsin interfaceit.unive.lisa.analysis.SemanticDomain<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,it.unive.lisa.symbolic.SymbolicExpression,it.unive.lisa.symbolic.value.Identifier>- Throws:
it.unive.lisa.analysis.SemanticException
-
assume
public TracePartitioning<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:
assumein interfaceit.unive.lisa.analysis.SemanticDomain<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,it.unive.lisa.symbolic.SymbolicExpression,it.unive.lisa.symbolic.value.Identifier>- Throws:
it.unive.lisa.analysis.SemanticException
-
forgetIdentifier
public TracePartitioning<A> forgetIdentifier(it.unive.lisa.symbolic.value.Identifier id) throws it.unive.lisa.analysis.SemanticException
- Specified by:
forgetIdentifierin interfaceit.unive.lisa.analysis.SemanticDomain<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,it.unive.lisa.symbolic.SymbolicExpression,it.unive.lisa.symbolic.value.Identifier>- Throws:
it.unive.lisa.analysis.SemanticException
-
forgetIdentifiersIf
public TracePartitioning<A> forgetIdentifiersIf(java.util.function.Predicate<it.unive.lisa.symbolic.value.Identifier> test) throws it.unive.lisa.analysis.SemanticException
- Specified by:
forgetIdentifiersIfin interfaceit.unive.lisa.analysis.SemanticDomain<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<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:
satisfiesin interfaceit.unive.lisa.analysis.SemanticDomain<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,it.unive.lisa.symbolic.SymbolicExpression,it.unive.lisa.symbolic.value.Identifier>- Throws:
it.unive.lisa.analysis.SemanticException
-
pushScope
public TracePartitioning<A> pushScope(it.unive.lisa.analysis.ScopeToken token) throws it.unive.lisa.analysis.SemanticException
-
popScope
public TracePartitioning<A> popScope(it.unive.lisa.analysis.ScopeToken token) throws it.unive.lisa.analysis.SemanticException
-
representation
public it.unive.lisa.util.representation.StructuredRepresentation representation()
- Specified by:
representationin interfaceit.unive.lisa.util.representation.StructuredObject- Overrides:
representationin classit.unive.lisa.analysis.lattices.FunctionalLattice<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,ExecutionTrace,A extends it.unive.lisa.analysis.AbstractState<A>>
-
mk
public TracePartitioning<A> mk(A lattice, java.util.Map<ExecutionTrace,A> function)
- Specified by:
mkin classit.unive.lisa.analysis.lattices.FunctionalLattice<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,ExecutionTrace,A extends it.unive.lisa.analysis.AbstractState<A>>
-
collapse
public A collapse()
Collapses all of the traces contained in this domain, returning a unique abstract state that over-approximates all of them.- Returns:
- the collapsed state
-
toString
public java.lang.String toString()
- Specified by:
toStringin interfaceit.unive.lisa.analysis.BaseLattice<A extends it.unive.lisa.analysis.AbstractState<A>>- Overrides:
toStringin classit.unive.lisa.analysis.lattices.FunctionalLattice<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,ExecutionTrace,A extends it.unive.lisa.analysis.AbstractState<A>>
-
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:
rewritein interfaceit.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:
rewritein interfaceit.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:
getRuntimeTypesOfin interfaceit.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:
getDynamicTypeOfin interfaceit.unive.lisa.analysis.type.TypeOracle- Throws:
it.unive.lisa.analysis.SemanticException
-
stateOfUnknown
public A stateOfUnknown(ExecutionTrace key)
- Specified by:
stateOfUnknownin classit.unive.lisa.analysis.lattices.FunctionalLattice<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,ExecutionTrace,A extends it.unive.lisa.analysis.AbstractState<A>>
-
knowsIdentifier
public boolean knowsIdentifier(it.unive.lisa.symbolic.value.Identifier id)
- Specified by:
knowsIdentifierin interfaceit.unive.lisa.analysis.SemanticDomain<TracePartitioning<A extends it.unive.lisa.analysis.AbstractState<A>>,it.unive.lisa.symbolic.SymbolicExpression,it.unive.lisa.symbolic.value.Identifier>
-
withTopMemory
public TracePartitioning<A> withTopMemory()
-
withTopValues
public TracePartitioning<A> withTopValues()
-
withTopTypes
public TracePartitioning<A> withTopTypes()
-
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:
aliasin interfaceit.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:
isReachableFromin interfaceit.unive.lisa.analysis.heap.MemoryOracle- Throws:
it.unive.lisa.analysis.SemanticException
-
-