Package soot.jimple.spark.ondemand
Class DemandCSPointsTo
- java.lang.Object
-
- soot.jimple.spark.ondemand.DemandCSPointsTo
-
- All Implemented Interfaces:
PointsToAnalysis
public final class DemandCSPointsTo extends Object implements PointsToAnalysis
Tries to find imprecision in points-to sets from a previously run analysis. Requires that all sub-results of previous analysis were cached.- Author:
- Manu Sridharan
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDemandCSPointsTo.AllocAndContextCacheprotected static classDemandCSPointsTo.CallingContextSetprotected static classDemandCSPointsTo.CallSiteAndContextprotected static classDemandCSPointsTo.CallSiteToTargetsMapprotected static classDemandCSPointsTo.IncomingEdgeHandlerprotected static classDemandCSPointsTo.VarAndContextprotected static classDemandCSPointsTo.VarContextAndUp
-
Field Summary
-
Fields inherited from interface soot.PointsToAnalysis
ARRAY_ELEMENTS_NODE, CANONICAL_PATH, CANONICAL_PATH_LOCAL, CAST_NODE, DEFAULT_CLASS_LOADER, DEFAULT_CLASS_LOADER_LOCAL, EXCEPTION_NODE, FINALIZE_QUEUE, MAIN_CLASS_NAME_STRING, MAIN_CLASS_NAME_STRING_LOCAL, MAIN_THREAD_GROUP_NODE, MAIN_THREAD_GROUP_NODE_LOCAL, MAIN_THREAD_NODE, MAIN_THREAD_NODE_LOCAL, PHI_NODE, PRIVILEGED_ACTION_EXCEPTION, PRIVILEGED_ACTION_EXCEPTION_LOCAL, RETURN_NODE, RETURN_STRING_CONSTANT_NODE, STRING_ARRAY_NODE, STRING_ARRAY_NODE_LOCAL, STRING_NODE, STRING_NODE_LOCAL, THIS_NODE, THROW_NODE
-
-
Constructor Summary
Constructors Constructor Description DemandCSPointsTo(ContextSensitiveInfo csInfo, PAG pag)DemandCSPointsTo(ContextSensitiveInfo csInfo, PAG pag, int maxTraversal, int maxPasses, boolean lazy)
-
Method Summary
-
-
-
Field Detail
-
DEBUG
public static boolean DEBUG
-
DEBUG_NESTING
protected static final int DEBUG_NESTING
- See Also:
- Constant Field Values
-
DEBUG_PASS
protected static final int DEBUG_PASS
- See Also:
- Constant Field Values
-
DEBUG_VIRT
protected static final boolean DEBUG_VIRT
-
DEFAULT_MAX_PASSES
protected static final int DEFAULT_MAX_PASSES
- See Also:
- Constant Field Values
-
DEFAULT_MAX_TRAVERSAL
protected static final int DEFAULT_MAX_TRAVERSAL
- See Also:
- Constant Field Values
-
DEFAULT_LAZY
protected static final boolean DEFAULT_LAZY
- See Also:
- Constant Field Values
-
EMPTY_CALLSTACK
protected static final ImmutableStack<Integer> EMPTY_CALLSTACK
-
allocAndContextCache
protected final DemandCSPointsTo.AllocAndContextCache allocAndContextCache
-
callGraphStack
protected Stack<Pair<Integer,ImmutableStack<Integer>>> callGraphStack
-
callSiteToResolvedTargets
protected final DemandCSPointsTo.CallSiteToTargetsMap callSiteToResolvedTargets
-
callTargetsArgCache
protected HashMap<List<Object>,Set<SootMethod>> callTargetsArgCache
-
contextForAllocsStack
protected final Stack<DemandCSPointsTo.VarAndContext> contextForAllocsStack
-
contextsForAllocsCache
protected Map<DemandCSPointsTo.VarAndContext,Pair<PointsToSetInternal,AllocAndContextSet>> contextsForAllocsCache
-
csInfo
protected final ContextSensitiveInfo csInfo
-
doPointsTo
protected boolean doPointsTo
iftrue, compute full points-to set for queried variable
-
fieldCheckHeuristic
protected FieldCheckHeuristic fieldCheckHeuristic
-
heuristicType
protected HeuristicType heuristicType
-
fieldToLoads
protected SootUtil.FieldToEdgesMap fieldToLoads
-
fieldToStores
protected SootUtil.FieldToEdgesMap fieldToStores
-
maxNodesPerPass
protected final int maxNodesPerPass
-
maxPasses
protected final int maxPasses
-
nesting
protected int nesting
-
numNodesTraversed
protected int numNodesTraversed
-
numPasses
protected int numPasses
-
pag
protected final PAG pag
-
pointsTo
protected AllocAndContextSet pointsTo
-
queriedCallSites
protected final Set<DemandCSPointsTo.CallSiteAndContext> queriedCallSites
-
recursionDepth
protected int recursionDepth
-
refiningCallSite
protected boolean refiningCallSite
-
sccManager
protected OTFMethodSCCManager sccManager
-
upContextCache
protected Map<DemandCSPointsTo.VarContextAndUp,Map<AllocAndContext,DemandCSPointsTo.CallingContextSet>> upContextCache
-
vMatches
protected ValidMatches vMatches
-
reachingObjectsCache
protected Map<Local,PointsToSet> reachingObjectsCache
-
reachingObjectsCacheNoCGRefinement
protected Map<Local,PointsToSet> reachingObjectsCacheNoCGRefinement
-
useCache
protected boolean useCache
-
-
Constructor Detail
-
DemandCSPointsTo
public DemandCSPointsTo(ContextSensitiveInfo csInfo, PAG pag)
-
DemandCSPointsTo
public DemandCSPointsTo(ContextSensitiveInfo csInfo, PAG pag, int maxTraversal, int maxPasses, boolean lazy)
-
-
Method Detail
-
makeDefault
public static DemandCSPointsTo makeDefault()
Make a default analysis. Assumes Spark has already run.- Returns:
-
makeWithBudget
public static DemandCSPointsTo makeWithBudget(int maxTraversal, int maxPasses, boolean lazy)
-
reachingObjects
public PointsToSet reachingObjects(Local l)
Description copied from interface:PointsToAnalysisReturns the set of objects pointed to by variable l.- Specified by:
reachingObjectsin interfacePointsToAnalysis
-
doReachingObjects
public PointsToSet doReachingObjects(Local l)
-
computeReachingObjects
protected PointsToSet computeReachingObjects(Local l)
Computes the possibly refined set of reaching objects for l.
-
computeRefinedReachingObjects
protected PointsToSet computeRefinedReachingObjects(VarNode v)
Computes the refined set of reaching objects for l. Returnsnullif refinement failed.
-
callEdgeInSCC
protected boolean callEdgeInSCC(AssignEdge assignEdge)
-
checkAllocAndContextCache
protected DemandCSPointsTo.CallingContextSet checkAllocAndContextCache(AllocAndContext allocAndContext, VarNode targetVar)
-
checkContextsForAllocsCache
protected PointsToSetInternal checkContextsForAllocsCache(DemandCSPointsTo.VarAndContext varAndContext, AllocAndContextSet ret, PointsToSetInternal locs)
-
checkP2Set
protected boolean checkP2Set(VarNode v, HeuristicType heuristic, Predicate<Set<AllocAndContext>> p2setPred)
check the computed points-to set of a variable against some predicate- Parameters:
v- the variableheuristic- how to refine match edgesp2setPred- the predicate on the points-to set- Returns:
- true if the p2setPred holds for the computed points-to set, or if a points-to set cannot be computed in the budget; false otherwise
-
checkUpContextCache
protected DemandCSPointsTo.CallingContextSet checkUpContextCache(DemandCSPointsTo.VarContextAndUp varContextAndUp, AllocAndContext allocAndContext)
-
clearState
protected void clearState()
-
computeFlowsTo
protected Set<VarNode> computeFlowsTo(AllocNode alloc, HeuristicType heuristic)
compute a flows-to set for an allocation site. for now, we use a simple refinement strategy; just refine as much as possible, maintaining the smallest set of flows-to vars- Parameters:
alloc-heuristic-- Returns:
-
debugPrint
protected void debugPrint(String str)
-
filterAssigns
protected Collection<AssignEdge> filterAssigns(VarNode v, ImmutableStack<Integer> callingContext, boolean forward, boolean refineVirtCalls)
-
findContextsForAllocs
protected AllocAndContextSet findContextsForAllocs(DemandCSPointsTo.VarAndContext varAndContext, PointsToSetInternal locs)
-
findUpContextsForVar
protected DemandCSPointsTo.CallingContextSet findUpContextsForVar(AllocAndContext allocAndContext, DemandCSPointsTo.VarContextAndUp varContextAndUp)
-
findVarContextsFromAlloc
protected DemandCSPointsTo.CallingContextSet findVarContextsFromAlloc(AllocAndContext allocAndContext, VarNode targetVar)
-
getCallTargets
protected Set<SootMethod> getCallTargets(PointsToSetInternal p2Set, SootMethod callee, Type receiverType, Set<SootMethod> possibleTargets)
-
getCallTargetsForType
protected Set<SootMethod> getCallTargetsForType(Type type, SootMethod callee, Type receiverType, Set<SootMethod> possibleTargets)
-
getFlowsToHelper
protected Set<VarNode> getFlowsToHelper(AllocAndContext allocAndContext)
-
getMaxPasses
protected int getMaxPasses()
-
incrementNodesTraversed
protected void incrementNodesTraversed()
-
isRecursive
protected boolean isRecursive(ImmutableStack<Integer> context, AssignEdge assignEdge)
-
isRecursiveCallSite
protected boolean isRecursiveCallSite(Integer callSite)
-
nodesPropagatedThrough
protected Set<VarNode> nodesPropagatedThrough(VarNode source, PointsToSetInternal allocs)
-
popRecursiveCallSites
protected ImmutableStack<Integer> popRecursiveCallSites(ImmutableStack<Integer> context)
-
processIncomingEdges
protected void processIncomingEdges(DemandCSPointsTo.IncomingEdgeHandler h, Stack<DemandCSPointsTo.VarAndContext> worklist)
-
pushWithRecursionCheck
protected ImmutableStack<Integer> pushWithRecursionCheck(ImmutableStack<Integer> context, AssignEdge assignEdge)
-
refineAlias
protected boolean refineAlias(VarNode v1, VarNode v2, PointsToSetInternal intersection, HeuristicType heuristic)
-
refineAliasInternal
protected boolean refineAliasInternal(VarNode v1, VarNode v2, PointsToSetInternal intersection, HeuristicType heuristic)
-
refineCallSite
protected Set<SootMethod> refineCallSite(Integer callSite, ImmutableStack<Integer> origContext)
-
refineP2Set
protected boolean refineP2Set(DemandCSPointsTo.VarAndContext varAndContext, PointsToSetInternal badLocs)
-
refineP2Set
protected boolean refineP2Set(VarNode v, PointsToSetInternal badLocs, HeuristicType heuristic)
-
weirdCall
protected boolean weirdCall(Integer callSite)
-
reachingObjects
public PointsToSet reachingObjects(Context c, Local l)
Currently not implemented.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Throws:
UnsupportedOperationException- always
-
reachingObjects
public PointsToSet reachingObjects(Context c, Local l, SootField f)
Currently not implemented.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Throws:
UnsupportedOperationException- always
-
reachingObjects
public PointsToSet reachingObjects(Local l, SootField f)
Currently not implemented.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Throws:
UnsupportedOperationException- always
-
reachingObjects
public PointsToSet reachingObjects(PointsToSet s, SootField f)
Currently not implemented.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Throws:
UnsupportedOperationException- always
-
reachingObjects
public PointsToSet reachingObjects(SootField f)
Currently not implemented.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Throws:
UnsupportedOperationException- always
-
reachingObjectsOfArrayElement
public PointsToSet reachingObjectsOfArrayElement(PointsToSet s)
Currently not implemented.- Specified by:
reachingObjectsOfArrayElementin interfacePointsToAnalysis- Throws:
UnsupportedOperationException- always
-
getPAG
public PAG getPAG()
- Returns:
- returns the (SPARK) pointer assignment graph
-
usesCache
public boolean usesCache()
- Returns:
trueis caching is enabled
-
enableCache
public void enableCache()
enables caching
-
disableCache
public void disableCache()
disables caching
-
clearCache
public void clearCache()
clears the cache
-
isRefineCallGraph
public boolean isRefineCallGraph()
-
setRefineCallGraph
public void setRefineCallGraph(boolean refineCallGraph)
-
getHeuristicType
public HeuristicType getHeuristicType()
-
setHeuristicType
public void setHeuristicType(HeuristicType heuristicType)
-
-