Package com.ibm.wala.demandpa.alg
Class DemandRefinementPointsTo
- java.lang.Object
-
- com.ibm.wala.demandpa.alg.AbstractDemandPointsTo
-
- com.ibm.wala.demandpa.alg.DemandRefinementPointsTo
-
- All Implemented Interfaces:
IDemandPointerAnalysis
public class DemandRefinementPointsTo extends AbstractDemandPointsTo
Demand-driven refinement-based points-to analysis.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DemandRefinementPointsTo.FlowsToComputer
used to compute "flows-to sets," i.e., all the pointers that can point to some instance keyprotected class
DemandRefinementPointsTo.PointsToComputer
Points-to analysis algorithm code.static class
DemandRefinementPointsTo.PointsToResult
Possible results of a query.
-
Field Summary
Fields Modifier and Type Field Description protected IFlowGraph
g
long
lastQueryMemoryUse
to measure memory usageprotected RefinementPolicy
refinementPolicy
-
Fields inherited from class com.ibm.wala.demandpa.alg.AbstractDemandPointsTo
cg, cha, heapModel, mam, numNodesTraversed, options
-
-
Method Summary
-
Methods inherited from class com.ibm.wala.demandpa.alg.AbstractDemandPointsTo
getBaseCallGraph, getClassHierarchy, getHeapModel, getNumNodesTraversed, getTraversalBudget, incrementNumNodesTraversed, setNumNodesTraversed, setTraversalBudget
-
-
-
-
Field Detail
-
g
protected final IFlowGraph g
-
refinementPolicy
protected RefinementPolicy refinementPolicy
-
lastQueryMemoryUse
public long lastQueryMemoryUse
to measure memory usage
-
-
Method Detail
-
getRefinementPolicy
public RefinementPolicy getRefinementPolicy()
-
startNewQuery
protected void startNewQuery()
re-initialize state for a new query
-
getPointsTo
public Pair<DemandRefinementPointsTo.PointsToResult,Collection<InstanceKey>> getPointsTo(PointerKey pk, Predicate<InstanceKey> ikeyPred) throws IllegalArgumentException
compute a points-to set for a pointer key, aiming to satisfy some predicate- Parameters:
pk
- the pointer keyikeyPred
- the desired predicate that each instance key in the points-to set should ideally satisfy- Returns:
- a pair consisting of (1) a
DemandRefinementPointsTo.PointsToResult
indicating whether a points-to set satisfying the predicate was computed, and (2) the last computed points-to set for the variable (possiblynull
if no points-to set could be computed in the budget) - Throws:
IllegalArgumentException
- ifpk
is not aLocalPointerKey
; to eventually be fixed
-
makeWithDefaultFlowGraph
public static DemandRefinementPointsTo makeWithDefaultFlowGraph(CallGraph cg, HeapModel model, MemoryAccessMap mam, IClassHierarchy cha, AnalysisOptions options, StateMachineFactory<IFlowLabel> stateMachineFactory)
create a demand points-to analysis runner- Parameters:
cg
- the underlying call graph for the analysismodel
- the heap model to be used for the analysismam
- indicates what code reads or writes each fieldcha
-options
-stateMachineFactory
- factory for state machines to track additional properties like calling context
-
pointsToPassesPred
public DemandRefinementPointsTo.PointsToResult pointsToPassesPred(PointerKey pk, Predicate<InstanceKey> ikeyPred, PointerAnalysis<InstanceKey> pa) throws IllegalArgumentException
check if the points-to set of a variable passes some predicate, without necessarily computing the whole points-to set- Parameters:
pk
- the pointer keyikeyPred
- the desired predicate that each instance key in the points-to set should ideally satisfypa
- a pre-computed points-to analysis- Returns:
- a
DemandRefinementPointsTo.PointsToResult
indicating whether a points-to set satisfying the predicate was computed - Throws:
IllegalArgumentException
- ifpk
is not aLocalPointerKey
; to eventually be fixed
-
getPointsTo
public Collection<InstanceKey> getPointsTo(PointerKey pk)
- Returns:
- the points-to set of
pk
, ornull
if the points-to set can't be computed in the allocated budget
-
getPointsToWithStates
public Collection<InstanceKeyAndState> getPointsToWithStates(PointerKey pk)
- Returns:
- the points-to set of
pk
, including theStateMachine.State
s attached to theInstanceKey
s, ornull
if the points-to set can't be computed in the allocated budget
-
getFlowsTo
public Pair<DemandRefinementPointsTo.PointsToResult,Collection<PointerKey>> getFlowsTo(InstanceKey ik)
get all the pointer keys that some instance key can flow to- Returns:
- a pair consisting of (1) a
DemandRefinementPointsTo.PointsToResult
indicating whether a flows-to set was computed, and (2) the last computed flows-to set for the instance key (possiblynull
if no flows-to set could be computed in the budget)
-
getFlowsTo
public Pair<DemandRefinementPointsTo.PointsToResult,Collection<PointerKey>> getFlowsTo(InstanceKeyAndState ikAndState)
get all the pointer keys that some instance key with state can flow to- Returns:
- a pair consisting of (1) a
DemandRefinementPointsTo.PointsToResult
indicating whether a flows-to set was computed, and (2) the last computed flows-to set for the instance key (possiblynull
if no flows-to set could be computed in the budget)
-
getStateMachineFactory
public StateMachineFactory<IFlowLabel> getStateMachineFactory()
-
setStateMachineFactory
public void setStateMachineFactory(StateMachineFactory<IFlowLabel> stateMachineFactory)
-
getRefinementPolicyFactory
public RefinementPolicyFactory getRefinementPolicyFactory()
-
setRefinementPolicyFactory
public void setRefinementPolicyFactory(RefinementPolicyFactory refinementPolicyFactory)
-
-