Class JSSSAPropagationCallGraphBuilder
java.lang.Object
com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder
com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder
com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder
com.ibm.wala.cast.js.ipa.callgraph.JSSSAPropagationCallGraphBuilder
- All Implemented Interfaces:
CallGraphBuilder<InstanceKey>, HeapModel, InstanceKeyFactory, PointerKeyFactory
- Direct Known Subclasses:
JSCFABuilder
Specialized pointer analysis constraint generation for JavaScript.
Global object handling
The global object is represented by aGlobalObjectKey stored in globalObject.
AstGlobalRead and AstGlobalWrite instructions are treated as accessing properties
of the global object; see JSSSAPropagationCallGraphBuilder.JSConstraintVisitor.visitAstGlobalRead(AstGlobalRead), JSSSAPropagationCallGraphBuilder.JSConstraintVisitor.visitAstGlobalWrite(AstGlobalWrite), and JSSSAPropagationCallGraphBuilder.JSPointerAnalysisImpl.JSImplicitPointsToSetVisitor.visitAstGlobalRead(AstGlobalRead). Finally, we need to represent
direct flow of the global object to handle receiver argument semantics (see RhinoToAstTranslator). To do so, we create a reference to a
global named GLOBAL_OBJ_VAR_NAME, which is handled specially in JSSSAPropagationCallGraphBuilder.JSConstraintVisitor.visitAstGlobalRead(AstGlobalRead).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classNested classes/interfaces inherited from class AstSSAPropagationCallGraphBuilder
AstSSAPropagationCallGraphBuilder.AstConstraintVisitor, AstSSAPropagationCallGraphBuilder.AstInterestingVisitor, AstSSAPropagationCallGraphBuilder.AstPointerAnalysisImplNested classes/interfaces inherited from class SSAPropagationCallGraphBuilder
SSAPropagationCallGraphBuilder.ConstraintVisitor, SSAPropagationCallGraphBuilder.InterestingVisitorNested 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.TypedPointerKey -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final booleanstatic final Stringname to be used internally to pass around the global objectFields inherited from class AstSSAPropagationCallGraphBuilder
DEBUG_PROPERTIESFields inherited from class SSAPropagationCallGraphBuilder
monitor, PERIODIC_WIPE_SOFT_CACHES, SHORT_CIRCUIT_SINGLE_USES, WIPE_SOFT_CACHE_INTERVALFields inherited from class PropagationCallGraphBuilder
assignOperator, callGraph, cha, contextSelector, DEBUG_GENERAL, entrypointCallSites, filterOperator, instanceKeyFactory, inverseFilterOperator, options, pointerKeyFactory, system -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJSSSAPropagationCallGraphBuilder(AbstractRootMethod abstractRootMethod, AnalysisOptions options, IAnalysisCacheView cache, PointerKeyFactory pointerKeyFactory) -
Method Summary
Modifier 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.protected ExplicitCallGraphcreateEmptyCallGraph(IMethod fakeRootClass, AnalysisOptions options) protected AbstractFieldPointerKeyIf the given fieldKey represents a concrete field, return the corresponding field key that represents all writes to unknown fields that could potentially alias fieldKeygetGlobalObject(Atom language) getPointerKeyForGlobalVar(String varName) getSomePositionForMethod(IR ir, AstMethod method) protected booleanisConstantRef(SymbolTable symbolTable, int valueNumber) protected booleanisUncataloguedField(IClass type, String fieldName) each language can specify whether a particular field name should be stored in object catalogs or not.makeInterestingVisitor(CGNode node, int vn) protected PropagationSystemmakeSystem(AnalysisOptions options) protected TypeInferencemakeTypeInference(IR ir, IClassHierarchy cha) makeVisitor(CGNode node) protected voidprocessCallingConstraints(CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) static voidprocessCallingConstraintsInternal(AstSSAPropagationCallGraphBuilder builder, CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) protected 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 CGNodevoidsetBaseURL(URL url) protected 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 AstSSAPropagationCallGraphBuilder
hasNoInterestingUses, makeDefaultContextInterpretersMethods inherited from class SSAPropagationCallGraphBuilder
addBlockInstructionConstraints, addConstraintsFromNode, addNodeInstructionConstraints, addNodePassthruExceptionConstraints, addNodeValueConstraints, contentsAreInvariant, contentsAreInvariant, getCaughtExceptionTypes, getCFAContextInterpreter, getIncomingPEIs, getInstanceKeyForPEI, getInstanceKeyForPEI, getInvariantContents, getInvariantContents, getTargetPointerKey, getTargetsForCall, getUniqueCatchKey, hasUniqueCatchBlock, iterateCrossProduct, iteratePointerKeys, makeSolver, unconditionallyAddConstraintsFromNodeMethods inherited from class PropagationCallGraphBuilder
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, wasChangedMethods 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, getInstanceKeyForMultiNewArray
-
Field Details
-
DEBUG_LEXICAL
public static final boolean DEBUG_LEXICAL- See Also:
-
DEBUG_TYPE_INFERENCE
public static final boolean DEBUG_TYPE_INFERENCE- See Also:
-
GLOBAL_OBJ_VAR_NAME
name to be used internally to pass around the global object- See Also:
-
-
Constructor Details
-
JSSSAPropagationCallGraphBuilder
protected JSSSAPropagationCallGraphBuilder(AbstractRootMethod abstractRootMethod, AnalysisOptions options, IAnalysisCacheView cache, PointerKeyFactory pointerKeyFactory)
-
-
Method Details
-
getGlobalObject
- Specified by:
getGlobalObjectin classAstSSAPropagationCallGraphBuilder
-
getBaseURL
-
setBaseURL
-
isConstantRef
- Overrides:
isConstantRefin classSSAPropagationCallGraphBuilder
-
useObjectCatalog
protected boolean useObjectCatalog()Description copied from class:AstSSAPropagationCallGraphBuildershould we maintain an object catalog for each instance key, storing the names of all known properties of the instance key? required to handleEachElementGetInstructions.- Specified by:
useObjectCatalogin classAstSSAPropagationCallGraphBuilder- See Also:
-
isUncataloguedField
Description copied from class:AstSSAPropagationCallGraphBuildereach language can specify whether a particular field name should be stored in object catalogs or not. By default, always return false.- Overrides:
isUncataloguedFieldin classAstSSAPropagationCallGraphBuilder
-
fieldKeyForUnknownWrites
Description copied from class:AstSSAPropagationCallGraphBuilderIf the given fieldKey represents a concrete field, return the corresponding field key that represents all writes to unknown fields that could potentially alias fieldKey- Specified by:
fieldKeyForUnknownWritesin classAstSSAPropagationCallGraphBuilder
-
getPointerKeyForGlobalVar
-
createEmptyCallGraph
- Overrides:
createEmptyCallGraphin classAstSSAPropagationCallGraphBuilder
-
makeTypeInference
-
addAssignmentsForCatchPointerKey
protected void addAssignmentsForCatchPointerKey(PointerKey exceptionVar, Set<IClass> catchClasses, PointerKey e) Description copied from class:PropagationCallGraphBuilderGenerate a set of constraints to represent assignment to an exception variable in a catch clause. Note that we use FilterOperator to filter out types that the exception handler doesn't catch.- Overrides:
addAssignmentsForCatchPointerKeyin classPropagationCallGraphBuilder- Parameters:
exceptionVar- points-to set for a variable representing a caught exceptioncatchClasses- set of TypeReferences that the exceptionVar may catche- points-to-set representing a thrown exception that might be caught.
-
makeInterestingVisitor
protected SSAPropagationCallGraphBuilder.InterestingVisitor makeInterestingVisitor(CGNode node, int vn) - Overrides:
makeInterestingVisitorin classAstSSAPropagationCallGraphBuilder
-
makeSystem
- Overrides:
makeSystemin classAstSSAPropagationCallGraphBuilder
-
makeVisitor
- Overrides:
makeVisitorin classAstSSAPropagationCallGraphBuilder- Returns:
- a visitor to examine instructions in the ir
-
getSomePositionForMethod
-
processCallingConstraints
protected void processCallingConstraints(CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) - Overrides:
processCallingConstraintsin classSSAPropagationCallGraphBuilder
-
processCallingConstraintsInternal
public static void processCallingConstraintsInternal(AstSSAPropagationCallGraphBuilder builder, CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) -
sameMethod
Description copied from class:AstSSAPropagationCallGraphBuilderIs 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 CGNode- Specified by:
sameMethodin classAstSSAPropagationCallGraphBuilder
-