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
Modifier and TypeClassDescriptionstatic class
static class
static class
Nested classes/interfaces inherited from class com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder
AstSSAPropagationCallGraphBuilder.AstConstraintVisitor, AstSSAPropagationCallGraphBuilder.AstInterestingVisitor, AstSSAPropagationCallGraphBuilder.AstPointerAnalysisImpl
Nested classes/interfaces inherited from class com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder
SSAPropagationCallGraphBuilder.ConstraintVisitor, SSAPropagationCallGraphBuilder.InterestingVisitor
Nested classes/interfaces inherited from class com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder
PropagationCallGraphBuilder.ArrayLoadOperator, PropagationCallGraphBuilder.ArrayStoreOperator, PropagationCallGraphBuilder.FilterOperator, PropagationCallGraphBuilder.GetFieldOperator, PropagationCallGraphBuilder.InstanceArrayStoreOperator, PropagationCallGraphBuilder.InstancePutFieldOperator, PropagationCallGraphBuilder.InverseFilterOperator, PropagationCallGraphBuilder.MutableBoolean, PropagationCallGraphBuilder.PutFieldOperator, PropagationCallGraphBuilder.TypedPointerKey
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
static final boolean
static final String
name to be used internally to pass around the global objectFields inherited from class com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder
DEBUG_PROPERTIES
Fields inherited from class com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder
monitor, PERIODIC_WIPE_SOFT_CACHES, SHORT_CIRCUIT_SINGLE_USES, WIPE_SOFT_CACHE_INTERVAL
Fields inherited from class com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder
assignOperator, callGraph, cha, contextSelector, DEBUG_GENERAL, entrypointCallSites, filterOperator, instanceKeyFactory, inverseFilterOperator, options, pointerKeyFactory, system
-
Constructor Summary
ModifierConstructorDescriptionprotected
JSSSAPropagationCallGraphBuilder
(AbstractRootMethod abstractRootMethod, AnalysisOptions options, IAnalysisCacheView cache, PointerKeyFactory pointerKeyFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAssignmentsForCatchPointerKey
(PointerKey exceptionVar, Set<IClass> catchClasses, PointerKey e) Generate a set of constraints to represent assignment to an exception variable in a catch clause.protected ExplicitCallGraph
createEmptyCallGraph
(IMethod fakeRootClass, AnalysisOptions options) protected AbstractFieldPointerKey
If 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 boolean
isConstantRef
(SymbolTable symbolTable, int valueNumber) protected boolean
isUncataloguedField
(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 PropagationSystem
makeSystem
(AnalysisOptions options) protected TypeInference
makeTypeInference
(IR ir, IClassHierarchy cha) makeVisitor
(CGNode node) protected void
processCallingConstraints
(CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) static void
processCallingConstraintsInternal
(AstSSAPropagationCallGraphBuilder builder, CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) protected boolean
sameMethod
(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 CGNodevoid
setBaseURL
(URL url) protected boolean
should we maintain an object catalog for each instance key, storing the names of all known properties of the instance key? required to handleEachElementGetInstruction
s.Methods inherited from class com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder
hasNoInterestingUses, makeDefaultContextInterpreters
Methods inherited from class com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder
addBlockInstructionConstraints, addConstraintsFromNode, addNodeInstructionConstraints, addNodePassthruExceptionConstraints, addNodeValueConstraints, contentsAreInvariant, contentsAreInvariant, getCaughtExceptionTypes, getCFAContextInterpreter, getIncomingPEIs, getInstanceKeyForPEI, getInstanceKeyForPEI, getInvariantContents, getInvariantContents, getTargetPointerKey, getTargetsForCall, getUniqueCatchKey, hasUniqueCatchBlock, iterateCrossProduct, iteratePointerKeys, makeSolver, unconditionallyAddConstraintsFromNode
Methods inherited from class com.ibm.wala.ipa.callgraph.propagation.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, wasChanged
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ibm.wala.ipa.callgraph.propagation.HeapModel
getClassHierarchy
Methods inherited from interface com.ibm.wala.ipa.callgraph.propagation.InstanceKeyFactory
getInstanceKeyForAllocation, getInstanceKeyForConstant, getInstanceKeyForMetadataObject, getInstanceKeyForMultiNewArray
Methods inherited from interface com.ibm.wala.ipa.callgraph.propagation.PointerKeyFactory
getFilteredPointerKeyForLocal, getPointerKeyForArrayContents, getPointerKeyForExceptionalReturnValue, getPointerKeyForInstanceField, getPointerKeyForLocal, getPointerKeyForReturnValue, getPointerKeyForStaticField
-
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:
getGlobalObject
in classAstSSAPropagationCallGraphBuilder
-
getBaseURL
-
setBaseURL
-
isConstantRef
- Overrides:
isConstantRef
in classSSAPropagationCallGraphBuilder
-
useObjectCatalog
protected boolean useObjectCatalog()Description copied from class:AstSSAPropagationCallGraphBuilder
should we maintain an object catalog for each instance key, storing the names of all known properties of the instance key? required to handleEachElementGetInstruction
s.- Specified by:
useObjectCatalog
in classAstSSAPropagationCallGraphBuilder
- See Also:
-
isUncataloguedField
Description copied from class:AstSSAPropagationCallGraphBuilder
each language can specify whether a particular field name should be stored in object catalogs or not. By default, always return false.- Overrides:
isUncataloguedField
in classAstSSAPropagationCallGraphBuilder
-
fieldKeyForUnknownWrites
Description copied from class:AstSSAPropagationCallGraphBuilder
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- Specified by:
fieldKeyForUnknownWrites
in classAstSSAPropagationCallGraphBuilder
-
getPointerKeyForGlobalVar
-
createEmptyCallGraph
- Overrides:
createEmptyCallGraph
in classAstSSAPropagationCallGraphBuilder
-
makeTypeInference
-
addAssignmentsForCatchPointerKey
protected void addAssignmentsForCatchPointerKey(PointerKey exceptionVar, Set<IClass> catchClasses, PointerKey e) Description copied from class:PropagationCallGraphBuilder
Generate 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:
addAssignmentsForCatchPointerKey
in 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:
makeInterestingVisitor
in classAstSSAPropagationCallGraphBuilder
-
makeSystem
- Overrides:
makeSystem
in classAstSSAPropagationCallGraphBuilder
-
makeVisitor
- Overrides:
makeVisitor
in 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:
processCallingConstraints
in classSSAPropagationCallGraphBuilder
-
processCallingConstraintsInternal
public static void processCallingConstraintsInternal(AstSSAPropagationCallGraphBuilder builder, CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) -
sameMethod
Description copied from class:AstSSAPropagationCallGraphBuilder
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 CGNode- Specified by:
sameMethod
in classAstSSAPropagationCallGraphBuilder
-