Package soot.jimple.spark.geom.geomPA
Class GeomPointsTo
- java.lang.Object
-
- soot.jimple.spark.pag.PAG
-
- soot.jimple.spark.geom.geomPA.GeomPointsTo
-
- All Implemented Interfaces:
PointsToAnalysis
public class GeomPointsTo extends PAG
The main interface for the points-to analysis with geometric encodings. Since we need SPARK to bootstrap our analysis, thus, we identify ourself to be a subclass of SPARK.- Author:
- xiao
-
-
Field Summary
-
Fields inherited from class soot.jimple.spark.pag.PAG
accessibilityOracle, alloc, allocInv, allocNodeNumberer, assign2edges, assignInstance, assignInstanceInv, callAssigns, callToMethod, cgOpts, edgeQueue, EMPTY_NODE_ARRAY, load, loadInv, localToNodeMap, maxFinishNumber, nativeMethodDriver, newInstance, newInstanceInv, opts, setFactory, simple, simpleInv, somethingMerged, store, storeInv, virtualCallsToReceivers
-
Fields inherited from interface soot.PointsToAnalysis
ARRAY_ELEMENTS_NODE, CANONICAL_PATH, CANONICAL_PATH_LOCAL, CAST_NODE, DEFAULT_CLASS_LOADER, DEFAULT_CLASS_LOADER_LOCAL, EXCEPTION_NODE, FINALIZE_QUEUE, MAIN_CLASS_NAME_STRING, MAIN_CLASS_NAME_STRING_LOCAL, MAIN_THREAD_GROUP_NODE, MAIN_THREAD_GROUP_NODE_LOCAL, MAIN_THREAD_NODE, MAIN_THREAD_NODE_LOCAL, PHI_NODE, PRIVILEGED_ACTION_EXCEPTION, PRIVILEGED_ACTION_EXCEPTION_LOCAL, RETURN_NODE, RETURN_STRING_CONSTANT_NODE, STRING_ARRAY_NODE, STRING_ARRAY_NODE_LOCAL, STRING_NODE, STRING_NODE_LOCAL, THIS_NODE, THROW_NODE
-
-
Constructor Summary
Constructors Constructor Description GeomPointsTo(SparkOptions opts)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancastNeverFails(Type src, Type dst)Type compatibility test.voidcleanResult()We thoroughly delete the geometric points-to result for space saving.FileOutputStreamcreateOutputFile(String file_name)Create all output files under the uniform location.voidddSolve(Set<Node> qryNodes)The demand-driven mode for precisely computing points-to information for given pointers.IVarAbstractionfindAndInsertInstanceField(AllocNode obj, SparkField field)Obtain or create an internal representation of an object field.IVarAbstractionfindInstanceField(AllocNode obj, SparkField field)Obtain the internal representation of an object field.IVarAbstractionfindInternalNode(Node v)Find our representation for the SPARK node @param v.Set<SootMethod>getAllReachableMethods()A replacement of the Scene.v().getReachableMethods.LinkedList<CgEdge>getCallEdgesInto(int fid)Get the call edges calling into the method @param fid.CgEdgegetCallEgesOutFrom(int fid)Get the call edges calling from the method @param fid.intgetIDFromSootMethod(SootMethod sm)Get Internal ID for soot method @param smCgEdgegetInternalEdgeFromSootEdge(Edge e)Obtain the edge representation internal to geomPTA.intgetMethodIDFromPtr(IVarAbstraction pn)Get the index of the enclosing function of the specified node.intgetNumberOfMethods()Return the number of functions that are reachable after the geometric points-to analysis.intgetNumberOfObjects()Get the number of valid objects current in the container.intgetNumberOfPointers()Get the number of valid pointers currently reachable by geomPTA.intgetNumberOfSparkMethods()Return the number of functions that are reachable by SPARK.SootMethodgetSootMethodFromID(int fid)Get soot method from given internal ID @param fidIWorklistgetWorklist()booleanhasGeomExecuted()Is this a Spark or Geom?booleanisExceptionPointer(Node v)booleanisReachableMethod(int fid)Deciding if the given method represented by @param fid is reachable.booleanisReachableMethod(SootMethod sm)Deciding if the given method represented by @param sm is reachable.booleanisValidGeometricNode(Node sparkNode)Given a valid SPARK node, we test if it is still valid after the geometric analysis.booleanisValidMethod(SootMethod sm)Telling if the given method is in the file given by the option "cg.spark geom-verify-name".voidkeepOnly(Set<IVarAbstraction> usefulPointers)Keep only the pointers the users are interested in.IVarAbstractionmakeInternalNode(Node v)Transform the SPARK node @param v representation to our representation.voidoutputNotEvaluatedMethods()voidparametrize(double spark_run_time)Using the user specified arguments to parameterize the geometric points-to solver.PointsToSetreachingObjects(Context c, Local l)Returns the set of objects pointed to by variable l in context c.PointsToSetreachingObjects(Context c, Local l, SootField f)Returns the set of objects pointed to by instance field f of the objects pointed to by l in context c.PointsToSetreachingObjects(AllocNode an, SootField f)PointsToSetreachingObjects(Local l)Returns the set of objects pointed to by variable l.PointsToSetreachingObjects(Local l, SootField f)Returns the set of objects pointed to by instance field f of the objects pointed to by l.PointsToSetreachingObjects(PointsToSet s, SootField f)Returns the set of objects pointed to by instance field f of the objects in the PointsToSet s.PointsToSetreachingObjects(SootField f)Returns the set of objects pointed to by static field f.PointsToSetreachingObjectsOfArrayElement(PointsToSet s)Returns the set of objects pointed to by elements of the arrays in the PointsToSet s.voidsolve()The starting point of the geometric points-to analysis engine.StringtoString()voidtransformToCIResult()For many applications, they only need the context insensitive points-to result.-
Methods inherited from class soot.jimple.spark.pag.PAG
addAllocEdge, addAssignInstanceEdge, addCallTarget, addCallTarget, addCallTarget, addDereference, addEdge, addInterproceduralAssignment, addLoadEdge, addNewInstanceEdge, addSimpleEdge, addStoreEdge, addToMap, allocInvLookup, allocInvSources, allocInvSourcesIterator, allocLookup, allocNodeListener, allocSources, allocSourcesIterator, assignInstanceLookup, assignInstanceSources, cleanPAG, cleanUpMerges, doAddAllocEdge, doAddAssignInstanceEdge, doAddLoadEdge, doAddNewInstanceEdge, doAddSimpleEdge, doAddStoreEdge, edgeReader, findAllocDotField, findContextVarNode, findGlobalFieldRefNode, findGlobalVarNode, findLocalFieldRefNode, findLocalVarNode, getAllocDotFieldNodeNumberer, getAllocNodeNumberer, getCGOpts, getDereferences, getFieldRefNodeNumberer, getNodeTags, getNumAllocNodes, getOnFlyCallGraph, getOpts, getSetFactory, getTypeManager, getVarNodeNumberer, loadInvLookup, loadInvSources, loadInvSourcesIterator, loadLookup, loadSources, loadSourcesIterator, lookup, lookupEdgesForAssignment, makeAllocDotField, makeAllocNode, makeClassConstantNode, makeContextVarNode, makeContextVarNode, makeFieldRefNode, makeGlobalFieldRefNode, makeGlobalVarNode, makeLocalFieldRefNode, makeLocalVarNode, makeNewInstanceNode, makeStringConstantNode, newInstanceLookup, newInstanceSources, nodeFactory, ofcg, setOnFlyCallGraph, simpleInvLookup, simpleInvSources, simpleInvSourcesIterator, simpleLookup, simpleSources, simpleSourcesIterator, storeInvLookup, storeInvSources, storeInvSourcesIterator, storeLookup, storeSources, storeSourcesIterator
-
-
-
-
Field Detail
-
worklist
protected IWorklist worklist
-
nodeGenerator
protected IEncodingBroker nodeGenerator
-
typeManager
protected TypeManager typeManager
-
offlineProcessor
protected OfflineProcessor offlineProcessor
-
consG
public Map<Node,IVarAbstraction> consG
-
pointers
public ZArrayNumberer<IVarAbstraction> pointers
-
allocations
public ZArrayNumberer<IVarAbstraction> allocations
-
constraints
public ZArrayNumberer<PlainConstraint> constraints
-
context_size
public long[] context_size
-
max_context_size_block
public long[] max_context_size_block
-
block_num
public int[] block_num
-
max_scc_size
public int max_scc_size
-
max_scc_id
public int max_scc_id
-
n_func
public int n_func
-
n_calls
public int n_calls
-
n_reach_methods
public int n_reach_methods
-
n_reach_user_methods
public int n_reach_user_methods
-
n_reach_spark_user_methods
public int n_reach_spark_user_methods
-
n_init_constraints
public int n_init_constraints
-
dump_dir
public String dump_dir
-
ps
public PrintStream ps
-
call_graph
protected CgEdge[] call_graph
-
rev_call_graph
protected Map<Integer,LinkedList<CgEdge>> rev_call_graph
-
vis_cg
protected int[] vis_cg
-
low_cg
protected int[] low_cg
-
rep_cg
protected int[] rep_cg
-
indeg_cg
protected int[] indeg_cg
-
scc_size
protected int[] scc_size
-
pre_cnt
protected int pre_cnt
-
func2int
protected Map<SootMethod,Integer> func2int
-
int2func
protected Map<Integer,SootMethod> int2func
-
-
Constructor Detail
-
GeomPointsTo
public GeomPointsTo(SparkOptions opts)
-
-
Method Detail
-
parametrize
public void parametrize(double spark_run_time)
Using the user specified arguments to parameterize the geometric points-to solver.- Parameters:
spark_run_time-
-
transformToCIResult
public void transformToCIResult()
For many applications, they only need the context insensitive points-to result. We provide a way to transfer our result back to SPARK. After the transformation, we discard the context sensitive points-to information. Therefore, if context sensitive queries are needed in future, please call ddSolve() for queried pointers first.
-
solve
public void solve()
The starting point of the geometric points-to analysis engine. This function computes the whole program points-to information.
-
ddSolve
public void ddSolve(Set<Node> qryNodes)
The demand-driven mode for precisely computing points-to information for given pointers. Call graph will not be updated in this mode.- Parameters:
qryNodes- : the set of nodes that would be refined by geomPA.
-
cleanResult
public void cleanResult()
We thoroughly delete the geometric points-to result for space saving. Some applications such as those needing the call graph only may want to clean the points-to result.
-
keepOnly
public void keepOnly(Set<IVarAbstraction> usefulPointers)
Keep only the pointers the users are interested in. Just used for reducing memory occupation.
-
getIDFromSootMethod
public int getIDFromSootMethod(SootMethod sm)
Get Internal ID for soot method @param sm- Returns:
- -1 if the given method is unreachable
-
getSootMethodFromID
public SootMethod getSootMethodFromID(int fid)
Get soot method from given internal ID @param fid- Returns:
- null if such ID is illegal.
-
isReachableMethod
public boolean isReachableMethod(int fid)
Deciding if the given method represented by @param fid is reachable.
-
isReachableMethod
public boolean isReachableMethod(SootMethod sm)
Deciding if the given method represented by @param sm is reachable.
-
isValidMethod
public boolean isValidMethod(SootMethod sm)
Telling if the given method is in the file given by the option "cg.spark geom-verify-name".
-
outputNotEvaluatedMethods
public void outputNotEvaluatedMethods()
-
getAllReachableMethods
public Set<SootMethod> getAllReachableMethods()
A replacement of the Scene.v().getReachableMethods.- Returns:
-
getCallEgesOutFrom
public CgEdge getCallEgesOutFrom(int fid)
Get the call edges calling from the method @param fid.
-
getCallEdgesInto
public LinkedList<CgEdge> getCallEdgesInto(int fid)
Get the call edges calling into the method @param fid.
-
getMethodIDFromPtr
public int getMethodIDFromPtr(IVarAbstraction pn)
Get the index of the enclosing function of the specified node.
-
makeInternalNode
public IVarAbstraction makeInternalNode(Node v)
Transform the SPARK node @param v representation to our representation.
-
findInternalNode
public IVarAbstraction findInternalNode(Node v)
Find our representation for the SPARK node @param v. We don't create a new node if nothing found.
-
castNeverFails
public boolean castNeverFails(Type src, Type dst)
Type compatibility test.- Parameters:
src-dst-
-
getNumberOfPointers
public int getNumberOfPointers()
Get the number of valid pointers currently reachable by geomPTA.
-
getNumberOfObjects
public int getNumberOfObjects()
Get the number of valid objects current in the container.- Returns:
-
getNumberOfSparkMethods
public int getNumberOfSparkMethods()
Return the number of functions that are reachable by SPARK.
-
getNumberOfMethods
public int getNumberOfMethods()
Return the number of functions that are reachable after the geometric points-to analysis.
-
getWorklist
public IWorklist getWorklist()
-
findInstanceField
public IVarAbstraction findInstanceField(AllocNode obj, SparkField field)
Obtain the internal representation of an object field.
-
findAndInsertInstanceField
public IVarAbstraction findAndInsertInstanceField(AllocNode obj, SparkField field)
Obtain or create an internal representation of an object field.
-
getInternalEdgeFromSootEdge
public CgEdge getInternalEdgeFromSootEdge(Edge e)
Obtain the edge representation internal to geomPTA.
-
isExceptionPointer
public boolean isExceptionPointer(Node v)
-
isValidGeometricNode
public boolean isValidGeometricNode(Node sparkNode)
Given a valid SPARK node, we test if it is still valid after the geometric analysis.
-
hasGeomExecuted
public boolean hasGeomExecuted()
Is this a Spark or Geom?- Returns:
-
createOutputFile
public FileOutputStream createOutputFile(String file_name) throws FileNotFoundException
Create all output files under the uniform location.- Parameters:
file_name-- Returns:
- Throws:
FileNotFoundException
-
reachingObjects
public PointsToSet reachingObjects(Local l)
Description copied from class:PAGReturns the set of objects pointed to by variable l.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Overrides:
reachingObjectsin classPAG
-
reachingObjects
public PointsToSet reachingObjects(Context c, Local l)
Description copied from class:PAGReturns the set of objects pointed to by variable l in context c.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Overrides:
reachingObjectsin classPAG
-
reachingObjects
public PointsToSet reachingObjects(SootField f)
Description copied from class:PAGReturns the set of objects pointed to by static field f.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Overrides:
reachingObjectsin classPAG
-
reachingObjects
public PointsToSet reachingObjects(PointsToSet s, SootField f)
Description copied from class:PAGReturns the set of objects pointed to by instance field f of the objects in the PointsToSet s.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Overrides:
reachingObjectsin classPAG
-
reachingObjects
public PointsToSet reachingObjects(Local l, SootField f)
Description copied from class:PAGReturns the set of objects pointed to by instance field f of the objects pointed to by l.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Overrides:
reachingObjectsin classPAG
-
reachingObjects
public PointsToSet reachingObjects(Context c, Local l, SootField f)
Description copied from class:PAGReturns the set of objects pointed to by instance field f of the objects pointed to by l in context c.- Specified by:
reachingObjectsin interfacePointsToAnalysis- Overrides:
reachingObjectsin classPAG
-
reachingObjectsOfArrayElement
public PointsToSet reachingObjectsOfArrayElement(PointsToSet s)
Description copied from class:PAGReturns the set of objects pointed to by elements of the arrays in the PointsToSet s.- Specified by:
reachingObjectsOfArrayElementin interfacePointsToAnalysis- Overrides:
reachingObjectsOfArrayElementin classPAG
-
reachingObjects
public PointsToSet reachingObjects(AllocNode an, SootField f)
-
-