Class ZeroXContainerCFABuilder
java.lang.Object
com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder
com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder
com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXCFABuilder
com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXContainerCFABuilder
- All Implemented Interfaces:
CallGraphBuilder<InstanceKey>, HeapModel, InstanceKeyFactory, PointerKeyFactory
0-X-CFA Call graph builder which analyzes calls to "container methods" in a context which is
defined by the receiver instance.
-
Nested Class Summary
Nested classes/interfaces inherited from class SSAPropagationCallGraphBuilder
SSAPropagationCallGraphBuilder.ConstraintVisitor, SSAPropagationCallGraphBuilder.InterestingVisitorModifier and TypeClassDescriptionprotected static classA visitor that generates constraints based on statements in SSA form.protected static classsets bingo to true when it visits an interesting instructionNested classes/interfaces inherited from class PropagationCallGraphBuilder
PropagationCallGraphBuilder.ArrayLoadOperator, PropagationCallGraphBuilder.ArrayStoreOperator, PropagationCallGraphBuilder.FilterOperator, PropagationCallGraphBuilder.GetFieldOperator, PropagationCallGraphBuilder.InstanceArrayStoreOperator, PropagationCallGraphBuilder.InstancePutFieldOperator, PropagationCallGraphBuilder.InverseFilterOperator, PropagationCallGraphBuilder.MutableBoolean, PropagationCallGraphBuilder.PutFieldOperator, PropagationCallGraphBuilder.TypedPointerKeyModifier and TypeClassDescriptionfinal classBinary op: <dummy>:= ArrayLoad( <arrayref>) Side effect: Creates new equations.final classBinary op: <dummy>:= ArrayStore( <arrayref>) Side effect: Creates new equations.classThe FilterOperator is a filtered set-union.classBinary op: <dummy>:= GetField( <ref>) Side effect: Creates new equations.final classUpdate the points-to-set for an array contents to include a particular instance key.final classUpdate the points-to-set for a field to include a particular instance key.protected classprotected static classclassOperator that represents a putfieldstatic final classA pointer key that delegates to an untyped variant, but adds a type filter -
Field Summary
Fields inherited from class SSAPropagationCallGraphBuilder
monitor, PERIODIC_WIPE_SOFT_CACHES, SHORT_CIRCUIT_SINGLE_USES, WIPE_SOFT_CACHE_INTERVALModifier and TypeFieldDescriptionstatic final booleanShould we periodically clear out soft reference caches in an attempt to help the GC?protected static final booleanAn optimization: if we can locally determine that a particular pointer p has exactly one use, then we don't actually create the points-to-set for p, but instead short-circuit by propagating the final solution to the unique use.static final intInterval which defines the period to clear soft reference cachesFields inherited from class PropagationCallGraphBuilder
assignOperator, callGraph, cha, contextSelector, DEBUG_GENERAL, entrypointCallSites, filterOperator, instanceKeyFactory, inverseFilterOperator, options, pointerKeyFactory, systemModifier and TypeFieldDescriptionstatic final com.ibm.wala.ipa.callgraph.propagation.AssignOperatorSingleton operator for assignmentsprotected final ExplicitCallGraphThe call graph under constructionfinal IClassHierarchyGoverning class hierarchyprotected ContextSelectorA context selector which may use information derived from the propagation-based dataflow.protected static final booleanprotected final Set<CallSiteReference> Set of calls (CallSiteReferences) that are created by entrypointssingleton operator for filterprotected InstanceKeyFactoryAn object that abstracts how to model instances in the heap.protected final PropagationCallGraphBuilder.InverseFilterOperatorsingleton operator for inverse filterprotected final AnalysisOptionsSpecial rules for bypassing Java callsprotected PointerKeyFactoryMeta-data regarding how pointers are modeledprotected PropagationSystemThe system of constraints used to build this graph -
Constructor Summary
ConstructorsConstructorDescriptionZeroXContainerCFABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache, ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, int instancePolicy) -
Method Summary
Methods inherited from class ZeroXCFABuilder
make, make, makeInstanceKeysModifier and TypeMethodDescriptionstatic ZeroXCFABuildermake(Language l, IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache, ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, int instancePolicy) make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, ClassLoader cl, AnalysisScope scope, String[] xmlFiles, byte instancePolicy) protected ZeroXInstanceKeysmakeInstanceKeys(IClassHierarchy cha, AnalysisOptions options, SSAContextInterpreter contextInterpreter, int instancePolicy) subclasses can override as desiredMethods inherited from class SSAPropagationCallGraphBuilder
addBlockInstructionConstraints, addConstraintsFromNode, addNodeInstructionConstraints, addNodePassthruExceptionConstraints, addNodeValueConstraints, contentsAreInvariant, contentsAreInvariant, getCaughtExceptionTypes, getCFAContextInterpreter, getIncomingPEIs, getInstanceKeyForPEI, getInstanceKeyForPEI, getInvariantContents, getInvariantContents, getTargetPointerKey, getTargetsForCall, getUniqueCatchKey, hasNoInterestingUses, hasUniqueCatchBlock, isConstantRef, iterateCrossProduct, iteratePointerKeys, makeInterestingVisitor, makeSolver, makeVisitor, processCallingConstraints, unconditionallyAddConstraintsFromNodeModifier and TypeMethodDescriptionprotected voidaddBlockInstructionConstraints(CGNode node, IRView ir, SSACFG.BasicBlock b, SSAPropagationCallGraphBuilder.ConstraintVisitor v, MonitorUtil.IProgressMonitor monitor) Add constraints for a particular basic block.protected booleanaddConstraintsFromNode(CGNode node, MonitorUtil.IProgressMonitor monitor) Visit all instructions in a node, and add dataflow constraints induced by each statement in the SSA form.protected voidaddNodeInstructionConstraints(CGNode node, MonitorUtil.IProgressMonitor monitor) Add pointer flow constraints based on instructions in a given nodeprotected voidaddNodePassthruExceptionConstraints(CGNode node, IRView ir, DefUse du) Add constraints to represent the flow of exceptions to the exceptional return value for this nodeprotected voidaddNodeValueConstraints(CGNode node, MonitorUtil.IProgressMonitor monitor) Hook for subclasses to add pointer flow constraints based on values in a given nodebooleancontentsAreInvariant(SymbolTable symbolTable, DefUse du, int valueNumber) A value is "invariant" if we can figure out the instances it can ever point to locally, without resorting to propagation.protected booleancontentsAreInvariant(SymbolTable symbolTable, DefUse du, int[] valueNumbers) getCaughtExceptionTypes(SSAGetCaughtExceptionInstruction instruction, IRView ir) static List<ProgramCounter> getIncomingPEIs(IRView ir, ISSABasicBlock bb) getInstanceKeyForPEI(CGNode node, ProgramCounter instr, TypeReference type) static InstanceKeygetInstanceKeyForPEI(CGNode node, ProgramCounter x, TypeReference type, InstanceKeyFactory ikFactory) getInvariantContents(SymbolTable symbolTable, DefUse du, CGNode node, int valueNumber, HeapModel hm) precondition:contentsAreInvariant(valueNumber)protected InstanceKey[]getInvariantContents(SymbolTable symbolTable, DefUse du, CGNode node, int valueNumber, HeapModel hm, boolean ensureIndexes) getTargetPointerKey(CGNode target, int index) TODO: enhance this logic using type inference TODO!!!: enhance filtering to consider concrete types, not just cones.getTargetsForCall(CGNode caller, SSAAbstractInvokeInstruction instruction, InstanceKey[][] invs) getUniqueCatchKey(SSAAbstractInvokeInstruction call, IRView ir, CGNode node) precondition: hasUniqueCatchBlock(call,node,cg)booleanhasNoInterestingUses(CGNode node, int vn, DefUse du) protected static booleanprotected booleanisConstantRef(SymbolTable symbolTable, int valueNumber) protected voiditerateCrossProduct(CGNode caller, SSAAbstractInvokeInstruction call, InstanceKey[][] invariants, Consumer<InstanceKey[]> f) makeInterestingVisitor(CGNode node, int vn) protected IPointsToSolvermakeVisitor(CGNode node) protected voidprocessCallingConstraints(CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) protected booleanMethods inherited from class PropagationCallGraphBuilder
addAssignmentsForCatchPointerKey, addConstraintsFromChangedNode, addConstraintsFromNewNodes, assignInstanceToCatch, catches, createEmptyCallGraph, customInit, filterForClass, getAnalysisCache, getCallGraph, getClassHierarchy, getContextInterpreter, getContextSelector, getFilteredPointerKeyForLocal, getFilteredPointerKeyForLocal, getFilteredPointerKeyForLocal, getInstanceKeyForAllocation, getInstanceKeyForConstant, getInstanceKeyForMetadataObject, getInstanceKeyForMultiNewArray, getInstanceKeys, getInstanceKeysForClass, getJavaLangObject, getMutableInstanceKeysForClass, getOptions, getPointerAnalysis, getPointerKeyFactory, getPointerKeyForArrayContents, getPointerKeyForExceptionalReturnValue, getPointerKeyForInstanceField, getPointerKeyForLocal, getPointerKeyForReturnValue, getPointerKeyForStaticField, getPropagationSystem, getSolver, getSystem, getTargetForCall, haveAlreadyVisited, isJavaLangObject, makeCallGraph, makeCallGraph, makeSystem, markAlreadyVisited, markChanged, markDiscovered, representsNullType, setContextInterpreter, setContextSelector, setInstanceKeys, setPointerKeyFactory, wasChangedModifier and TypeMethodDescriptionprotected voidaddAssignmentsForCatchPointerKey(PointerKey exceptionVar, Set<IClass> catchClasses, PointerKey e) Generate a set of constraints to represent assignment to an exception variable in a catch clause.voidaddConstraintsFromChangedNode(CGNode node, MonitorUtil.IProgressMonitor monitor) Add constraints when the interpretation of a node changes (e.g.protected booleanAdd constraints from newly discovered nodes.protected voidassignInstanceToCatch(PointerKey exceptionVar, Set<IClass> catchClasses, InstanceKey e) Handle assign of a particular exception instance into an exception variablestatic booleancatches(Set<IClass> catchClasses, IClass klass, IClassHierarchy cha) protected ExplicitCallGraphcreateEmptyCallGraph(IMethod abstractRootMethod, AnalysisOptions options) protected voidprotected IntSetfilterForClass(IntSet S, IClass klass) getFilteredPointerKeyForLocal(CGNode node, int valueNumber, IClass filter) getFilteredPointerKeyForLocal(CGNode node, int valueNumber, FilteredPointerKey.TypeFilter filter) getFilteredPointerKeyForLocal(CGNode node, int valueNumber, InstanceKey filter) getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation) <T> InstanceKeygetInstanceKeyForConstant(TypeReference type, T S) getInstanceKeyForMetadataObject(Object obj, TypeReference objType) getInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim) protected IntSetgetInstanceKeysForClass(IClass klass) protected MutableIntSetTODO: expand this API to differentiate between different array indicesgetPointerKeyForInstanceField(InstanceKey I, IField field) getPointerKeyForLocal(CGNode node, int valueNumber) protected IPointsToSolverprotected CGNodegetTargetForCall(CGNode caller, CallSiteReference site, IClass recv, InstanceKey[] iKey) booleanhaveAlreadyVisited(CGNode node) protected booleanisJavaLangObject(IClass klass) makeCallGraph(AnalysisOptions options) makeCallGraph(AnalysisOptions options, MonitorUtil.IProgressMonitor monitor) Build a call graph.protected PropagationSystemmakeSystem(AnalysisOptions options) protected voidmarkAlreadyVisited(CGNode node) protected voidmarkChanged(CGNode node) voidmarkDiscovered(CGNode node) record that we've discovered a nodestatic booleanvoidsetContextInterpreter(SSAContextInterpreter interpreter) Subclasses must register the context interpreter before building a call graph.voidsetContextSelector(ContextSelector selector) voidvoidprotected booleanwasChanged(CGNode node) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HeapModel
getClassHierarchyMethods inherited from interface InstanceKeyFactory
getInstanceKeyForAllocation, getInstanceKeyForConstant, getInstanceKeyForMetadataObject, getInstanceKeyForMultiNewArrayModifier and TypeMethodDescriptiongetInstanceKeyForAllocation(CGNode node, NewSiteReference allocation) <T> InstanceKeygetInstanceKeyForConstant(TypeReference type, T S) getInstanceKeyForMetadataObject(Object obj, TypeReference objType) getInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim) Methods inherited from interface PointerKeyFactory
getFilteredPointerKeyForLocal, getPointerKeyForArrayContents, getPointerKeyForExceptionalReturnValue, getPointerKeyForInstanceField, getPointerKeyForLocal, getPointerKeyForReturnValue, getPointerKeyForStaticFieldModifier and TypeMethodDescriptiongetFilteredPointerKeyForLocal(CGNode node, int valueNumber, FilteredPointerKey.TypeFilter filter) TODO: expand this API to differentiate between different array indicesgetPointerKeyForInstanceField(InstanceKey I, IField field) getPointerKeyForLocal(CGNode node, int valueNumber)
-
Constructor Details
-
ZeroXContainerCFABuilder
public ZeroXContainerCFABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache, ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, int instancePolicy) - Parameters:
cha- governing class hierarchyoptions- call graph construction optionsappContextSelector- application-specific logic to choose contextsappContextInterpreter- application-specific logic to interpret a method in context- Throws:
IllegalArgumentException- if options is null
-
-
Method Details
-
makeContainerContextSelector
- Returns:
- an object which creates contexts for call graph nodes based on the container disambiguation policy
-