public class RapidTypeAnalysisAlgorithm extends AbstractCallGraphAlgorithm
Compared to the CHA algorithm, this algorithm is more precise because it only considers instantiated subclasses as call targets and CHA considers all subclasses.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
RapidTypeAnalysisAlgorithm.Call
This private class is used to save reachable calls.
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<ClassType,List<RapidTypeAnalysisAlgorithm.Call>> |
ignoredCalls |
protected Set<ClassType> |
instantiatedClasses |
view| Constructor and Description |
|---|
RapidTypeAnalysisAlgorithm(View view)
The constructor of the RTA algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
protected List<ClassType> |
collectInstantiatedClassesInMethod(SootMethod method)
This method is called to collect all instantiation of classes in a given method body.
|
protected void |
includeIgnoredCallsToClass(ClassType classType,
MutableCallGraph cg,
Deque<MethodSignature> workList)
This method will add all saved ignored calls from a given class to the call graph.
|
CallGraph |
initialize()
This method initializes and starts the call graph algorithm without given entry points.
|
CallGraph |
initialize(List<MethodSignature> entryPoints)
This method initializes and starts the call graph algorithm with given entry points.
|
protected void |
postProcessingMethod(View view,
MethodSignature sourceMethod,
Deque<MethodSignature> workList,
MutableCallGraph cg)
Postprocessing is not needed in RTA
|
protected void |
preProcessingMethod(View view,
MethodSignature sourceMethod,
Deque<MethodSignature> workList,
MutableCallGraph cg)
Preprocessing of a method in the RTA call graph algorithm
|
protected Stream<MethodSignature> |
resolveCall(SootMethod sourceMethod,
AbstractInvokeExpr invokeExpr)
In the RTA algorithm, every virtual call is resolved by using the hierarchy and a hashset
containing every instantiated class.
|
addClass, addImplicitEdgesOfEntryPoints, findConcreteMethod, findMainMethod, initializeCallGraph, resolveAllImplicitCallsFromSourceMethod, resolveAllStaticInitializerCallsFromSourceMethod, resolveConcreteDispatch@Nonnull protected Map<ClassType,List<RapidTypeAnalysisAlgorithm.Call>> ignoredCalls
@Nonnull public CallGraph initialize()
CallGraphAlgorithm@Nonnull public CallGraph initialize(@Nonnull List<MethodSignature> entryPoints)
CallGraphAlgorithmentryPoints - a list of entry points for the call graph algorithm. The algorithm starts at
these methods and inspects all reachable methods.protected List<ClassType> collectInstantiatedClassesInMethod(SootMethod method)
method - this object contains the method body which is inspected.@Nonnull protected Stream<MethodSignature> resolveCall(SootMethod sourceMethod, AbstractInvokeExpr invokeExpr)
resolveCall in class AbstractCallGraphAlgorithmsourceMethod - the method object that contains the given invoke expression in the body.invokeExpr - it contains the call which is resolved.protected void preProcessingMethod(View view, MethodSignature sourceMethod, @Nonnull Deque<MethodSignature> workList, @Nonnull MutableCallGraph cg)
Before processing the method, all instantiated types are collected inside the body of the sourceMethod. If a new instantiated class has previously ignored calls to this class, they are added to call graph
preProcessingMethod in class AbstractCallGraphAlgorithmview - viewsourceMethod - the processed methodworkList - the current work listcg - the current cgprotected void includeIgnoredCallsToClass(ClassType classType, MutableCallGraph cg, Deque<MethodSignature> workList)
classType - the class type which is the target of all ignored callscg - the call graph that will be extended by the ignored callsworkList - the work list that will be extended by the new targets of ignored calls.protected void postProcessingMethod(View view, MethodSignature sourceMethod, @Nonnull Deque<MethodSignature> workList, @Nonnull MutableCallGraph cg)
postProcessingMethod in class AbstractCallGraphAlgorithmview - viewsourceMethod - the processed methodworkList - the current worklist that is extended by methods that have to be analyzed.cg - the current cg is extended by new call targets and callsCopyright © 2024 Soot OSS. All rights reserved.