Class AstSSAPropagationCallGraphBuilder
java.lang.Object
com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder
com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder
com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder
- All Implemented Interfaces:
CallGraphBuilder<InstanceKey>, HeapModel, InstanceKeyFactory, PointerKeyFactory
- Direct Known Subclasses:
AstJavaSSAPropagationCallGraphBuilder, CrossLanguageSSAPropagationCallGraphBuilder, JSSSAPropagationCallGraphBuilder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classstatic classNested 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
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final booleanFields 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
ConstructorsModifierConstructorDescriptionprotectedAstSSAPropagationCallGraphBuilder(IMethod fakeRootClass, AnalysisOptions options, IAnalysisCacheView cache, PointerKeyFactory pointerKeyFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected ExplicitCallGraphcreateEmptyCallGraph(IMethod fakeRootClass, AnalysisOptions options) protected abstract AbstractFieldPointerKeyIf the given fieldKey represents a concrete field, return the corresponding field key that represents all writes to unknown fields that could potentially alias fieldKeyabstract GlobalObjectKeygetGlobalObject(Atom language) booleanhasNoInterestingUses(CGNode node, int vn, DefUse du) protected booleanisUncataloguedField(IClass type, String fieldName) each language can specify whether a particular field name should be stored in object catalogs or not.makeDefaultContextInterpreters(SSAContextInterpreter appContextInterpreter, AnalysisOptions options, IClassHierarchy cha) makeInterestingVisitor(CGNode node, int vn) protected PropagationSystemmakeSystem(AnalysisOptions options) makeVisitor(CGNode node) protected abstract booleansameMethod(CGNode opNode, String definingMethod) Is definingMethod the same as the method represented by opNode? We need this since the names for methods in some languages don't map in the straightforward way to the CGNodeprotected abstract booleanshould we maintain an object catalog for each instance key, storing the names of all known properties of the instance key? required to handleEachElementGetInstructions.Methods inherited from class SSAPropagationCallGraphBuilder
addBlockInstructionConstraints, addConstraintsFromNode, addNodeInstructionConstraints, addNodePassthruExceptionConstraints, addNodeValueConstraints, contentsAreInvariant, contentsAreInvariant, getCaughtExceptionTypes, getCFAContextInterpreter, getIncomingPEIs, getInstanceKeyForPEI, getInstanceKeyForPEI, getInvariantContents, getInvariantContents, getTargetPointerKey, getTargetsForCall, getUniqueCatchKey, hasUniqueCatchBlock, isConstantRef, iterateCrossProduct, iteratePointerKeys, makeSolver, 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)protected static booleanprotected booleanisConstantRef(SymbolTable symbolTable, int valueNumber) protected voiditerateCrossProduct(CGNode caller, SSAAbstractInvokeInstruction call, InstanceKey[][] invariants, Consumer<InstanceKey[]> f) protected IPointsToSolverprotected voidprocessCallingConstraints(CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) protected booleanMethods inherited from class PropagationCallGraphBuilder
addAssignmentsForCatchPointerKey, addConstraintsFromChangedNode, addConstraintsFromNewNodes, assignInstanceToCatch, catches, 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, 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 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 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)
-
Field Details
-
DEBUG_TYPE_INFERENCE
public static final boolean DEBUG_TYPE_INFERENCE- See Also:
-
DEBUG_PROPERTIES
public static final boolean DEBUG_PROPERTIES- See Also:
-
-
Constructor Details
-
AstSSAPropagationCallGraphBuilder
protected AstSSAPropagationCallGraphBuilder(IMethod fakeRootClass, AnalysisOptions options, IAnalysisCacheView cache, PointerKeyFactory pointerKeyFactory)
-
-
Method Details
-
useObjectCatalog
protected abstract boolean useObjectCatalog()should we maintain an object catalog for each instance key, storing the names of all known properties of the instance key? required to handleEachElementGetInstructions.- See Also:
-
isUncataloguedField
-
getGlobalObject
-
makeDefaultContextInterpreters
public SSAContextInterpreter makeDefaultContextInterpreters(SSAContextInterpreter appContextInterpreter, AnalysisOptions options, IClassHierarchy cha) -
makeSystem
- Overrides:
makeSystemin classPropagationCallGraphBuilder
-
createEmptyCallGraph
- Overrides:
createEmptyCallGraphin classPropagationCallGraphBuilder
-
makeInterestingVisitor
protected SSAPropagationCallGraphBuilder.InterestingVisitor makeInterestingVisitor(CGNode node, int vn) - Overrides:
makeInterestingVisitorin classSSAPropagationCallGraphBuilder
-
hasNoInterestingUses
- Overrides:
hasNoInterestingUsesin classSSAPropagationCallGraphBuilder
-
makeVisitor
- Overrides:
makeVisitorin classSSAPropagationCallGraphBuilder- Returns:
- a visitor to examine instructions in the ir
-
fieldKeyForUnknownWrites
protected abstract AbstractFieldPointerKey fieldKeyForUnknownWrites(AbstractFieldPointerKey fieldKey) If the given fieldKey represents a concrete field, return the corresponding field key that represents all writes to unknown fields that could potentially alias fieldKey -
sameMethod
-