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 classDemandRefinementPointsTo.FlowsToComputerused to compute "flows-to sets," i.e., all the pointers that can point to some instance keyprotected classDemandRefinementPointsTo.PointsToComputerPoints-to analysis algorithm code.static classDemandRefinementPointsTo.PointsToResultPossible results of a query.
-
Field Summary
Fields Modifier and Type Field Description protected IFlowGraphglonglastQueryMemoryUseto measure memory usageprotected RefinementPolicyrefinementPolicy-
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.PointsToResultindicating whether a points-to set satisfying the predicate was computed, and (2) the last computed points-to set for the variable (possiblynullif no points-to set could be computed in the budget) - Throws:
IllegalArgumentException- ifpkis 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.PointsToResultindicating whether a points-to set satisfying the predicate was computed - Throws:
IllegalArgumentException- ifpkis not aLocalPointerKey; to eventually be fixed
-
getPointsTo
public Collection<InstanceKey> getPointsTo(PointerKey pk)
- Returns:
- the points-to set of
pk, ornullif 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.States attached to theInstanceKeys, ornullif 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.PointsToResultindicating whether a flows-to set was computed, and (2) the last computed flows-to set for the instance key (possiblynullif 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.PointsToResultindicating whether a flows-to set was computed, and (2) the last computed flows-to set for the instance key (possiblynullif 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)
-
-