Package soot.jimple.toolkits.pointer
Class LocalMustNotAliasAnalysis
- java.lang.Object
-
public class LocalMustNotAliasAnalysis extends ForwardFlowAnalysis<Unit,HashMap<Local,Set<NewExpr>>>
LocalNotMayAliasAnalysis attempts to determine if two local variables (at two potentially different program points) definitely point to different objects. The underlying abstraction is that of definition expressions. When a local variable gets assigned a new object (unlike LocalMust, only NewExprs), the analysis tracks the source of the value. If two variables have different sources, then they are different. See Sable TR 2007-8 for details.- Author:
- Patrick Lam
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class soot.toolkits.scalar.FlowAnalysis
FlowAnalysis.Flow
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<Local>localsprotected static NewExprUNKNOWN-
Fields inherited from class soot.toolkits.scalar.FlowAnalysis
filterUnitToAfterFlow, unitToAfterFlow
-
Fields inherited from class soot.toolkits.scalar.AbstractFlowAnalysis
filterUnitToBeforeFlow, graph, unitToBeforeFlow
-
-
Constructor Summary
Constructors Constructor Description LocalMustNotAliasAnalysis(DirectedGraph<Unit> directedGraph, Body b)LocalMustNotAliasAnalysis(UnitGraph g)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RefTypeconcreteType(Local l, Stmt s)If the given local at the given statement was initialized with a single, concrete new-expression then the type of this expression is returned.protected voidcopy(HashMap<Local,Set<NewExpr>> source, HashMap<Local,Set<NewExpr>> dest)Creates a copy of thesourceflow object indest.protected HashMap<Local,Set<NewExpr>>entryInitialFlow()Returns the initial flow value for entry/exit graph nodes.protected voidflowThrough(HashMap<Local,Set<NewExpr>> in, Unit unit, HashMap<Local,Set<NewExpr>> out)Given the merge of theoutsets, compute theinset fors(or in to out, depending on direction).booleanhasInfoOn(Local l, Stmt s)Returns true if this analysis has any information about local l at statement s (i.e.protected voidmerge(HashMap<Local,Set<NewExpr>> in1, HashMap<Local,Set<NewExpr>> in2, HashMap<Local,Set<NewExpr>> o)Compute the merge of thein1andin2sets, putting the result intoout.protected HashMap<Local,Set<NewExpr>>newInitialFlow()Returns the flow object corresponding to the initial values for each graph node.booleannotMayAlias(Local l1, Stmt s1, Local l2, Stmt s2)-
Methods inherited from class soot.toolkits.scalar.ForwardFlowAnalysis
doAnalysis, isForward
-
Methods inherited from class soot.toolkits.scalar.FlowAnalysis
copyFreshToExisting, getFlow, getFlowAfter, getFlowBefore, omissible
-
Methods inherited from class soot.toolkits.scalar.AbstractFlowAnalysis
merge, mergeInto, treatTrapHandlersAsEntries
-
-
-
-
Constructor Detail
-
LocalMustNotAliasAnalysis
public LocalMustNotAliasAnalysis(UnitGraph g)
-
LocalMustNotAliasAnalysis
public LocalMustNotAliasAnalysis(DirectedGraph<Unit> directedGraph, Body b)
-
-
Method Detail
-
merge
protected void merge(HashMap<Local,Set<NewExpr>> in1, HashMap<Local,Set<NewExpr>> in2, HashMap<Local,Set<NewExpr>> o)
Description copied from class:AbstractFlowAnalysisCompute the merge of thein1andin2sets, putting the result intoout. The behavior of this function depends on the implementation ( it may be necessary to check whetherin1andin2are equal or aliased ). Used by the doAnalysis method.
-
flowThrough
protected void flowThrough(HashMap<Local,Set<NewExpr>> in, Unit unit, HashMap<Local,Set<NewExpr>> out)
Description copied from class:FlowAnalysisGiven the merge of theoutsets, compute theinset fors(or in to out, depending on direction). This function often causes confusion, because the same interface is used for both forward and backward flow analyses. The first parameter is always the argument to the flow function (i.e. it is the "in" set in a forward analysis and the "out" set in a backward analysis), and the third parameter is always the result of the flow function (i.e. it is the "out" set in a forward analysis and the "in" set in a backward analysis).- Specified by:
flowThroughin classFlowAnalysis<Unit,HashMap<Local,Set<NewExpr>>>- Parameters:
in- the input flowunit- the current nodeout- the returned flow
-
copy
protected void copy(HashMap<Local,Set<NewExpr>> source, HashMap<Local,Set<NewExpr>> dest)
Description copied from class:AbstractFlowAnalysisCreates a copy of thesourceflow object indest.
-
entryInitialFlow
protected HashMap<Local,Set<NewExpr>> entryInitialFlow()
Description copied from class:AbstractFlowAnalysisReturns the initial flow value for entry/exit graph nodes. This is equal toAbstractFlowAnalysis.newInitialFlow()- Overrides:
entryInitialFlowin classAbstractFlowAnalysis<Unit,HashMap<Local,Set<NewExpr>>>
-
newInitialFlow
protected HashMap<Local,Set<NewExpr>> newInitialFlow()
Description copied from class:AbstractFlowAnalysisReturns the flow object corresponding to the initial values for each graph node.- Specified by:
newInitialFlowin classAbstractFlowAnalysis<Unit,HashMap<Local,Set<NewExpr>>>
-
hasInfoOn
public boolean hasInfoOn(Local l, Stmt s)
Returns true if this analysis has any information about local l at statement s (i.e. it is notUNKNOWN). In particular, it is safe to pass in locals/statements that are not even part of the right method. In those casesfalsewill be returned. Permits s to benull, in which casefalsewill be returned.
-
notMayAlias
public boolean notMayAlias(Local l1, Stmt s1, Local l2, Stmt s2)
- Returns:
- true if values of l1 (at s1) and l2 (at s2) are known to point to different objects
-
-