Package sootup.callgraph
Class RapidTypeAnalysisAlgorithm
java.lang.Object
sootup.callgraph.AbstractCallGraphAlgorithm
sootup.callgraph.RapidTypeAnalysisAlgorithm
- All Implemented Interfaces:
CallGraphAlgorithm
This class implements the Rapid Type Analysis call graph algorithm. In this algorithm, every
virtual call is resolved to the all implemented overwritten methods of subclasses in the entire
class path which have been instantiated by a new expression.
Compared to the CHA algorithm, this algorithm is more precise because it only considers instantiated subclasses as call targets and CHA considers all subclasses.
-
Field Summary
Fields inherited from class sootup.callgraph.AbstractCallGraphAlgorithm
view
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThis 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.This method initializes and starts the call graph algorithm without given entry points.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 RTAprotected void
preProcessingMethod
(View view, MethodSignature sourceMethod, Deque<MethodSignature> workList, MutableCallGraph cg) Preprocessing of a method in the RTA call graph algorithmprotected Stream<MethodSignature>
resolveCall
(SootMethod sourceMethod, InvokableStmt invokableStmt) In the RTA algorithm, every virtual call is resolved by using the hierarchy and a hashset containing every instantiated class.Methods inherited from class sootup.callgraph.AbstractCallGraphAlgorithm
addCallToCG, addClass, findConcreteMethod, findMainMethod, getClinitFromEntryPoints, initializeCallGraph, resolveAllCallsFromSourceMethod, resolveAllImplicitCallsFromSourceMethod, resolveAllStaticInitializerCalls, resolveConcreteDispatch
-
Field Details
-
instantiatedClasses
-
ignoredCalls
-
-
Constructor Details
-
RapidTypeAnalysisAlgorithm
The constructor of the RTA algorithm.- Parameters:
view
- it contains the data of the classes and methods
-
-
Method Details
-
initialize
Description copied from interface:CallGraphAlgorithm
This method initializes and starts the call graph algorithm without given entry points. Before the algorithm is started, all main methods are searched and set as entry points.- Returns:
- a generated call graph with every main class as starting point.
-
initialize
Description copied from interface:CallGraphAlgorithm
This method initializes and starts the call graph algorithm with given entry points. The entry points define the start methods in the call graph algorithm.- Parameters:
entryPoints
- a list of entry points for the call graph algorithm. The algorithm starts at these methods and inspects all reachable methods.- Returns:
- a generated call graph with every entry point as starting point.
-
collectInstantiatedClassesInMethod
This method is called to collect all instantiation of classes in a given method body. This is important since the RTA algorithm resolves virtual calls only to instantiated classes- Parameters:
method
- this object contains the method body which is inspected.
-
resolveCall
@Nonnull protected Stream<MethodSignature> resolveCall(SootMethod sourceMethod, InvokableStmt invokableStmt) In the RTA algorithm, every virtual call is resolved by using the hierarchy and a hashset containing every instantiated class. Every subclass of the class is considered as target if it is instantiated and if it contains an implementation of the methods called in the invoke expression.- Specified by:
resolveCall
in classAbstractCallGraphAlgorithm
- Parameters:
sourceMethod
- the method object that contains the given invoke expression in the body.invokableStmt
- the statement containing the call which is resolved.- Returns:
- a stream containing all reachable method signatures after applying the RTA call graph algorithm
-
preProcessingMethod
protected void preProcessingMethod(View view, MethodSignature sourceMethod, @Nonnull Deque<MethodSignature> workList, @Nonnull MutableCallGraph cg) Preprocessing of a method in the RTA call graph algorithmBefore 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
- Specified by:
preProcessingMethod
in classAbstractCallGraphAlgorithm
- Parameters:
view
- viewsourceMethod
- the processed methodworkList
- the current work listcg
- the current cg
-
includeIgnoredCallsToClass
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. All new targets will be added to the worklist- Parameters:
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.
-
postProcessingMethod
protected void postProcessingMethod(View view, MethodSignature sourceMethod, @Nonnull Deque<MethodSignature> workList, @Nonnull MutableCallGraph cg) Postprocessing is not needed in RTA- Specified by:
postProcessingMethod
in classAbstractCallGraphAlgorithm
- Parameters:
view
- 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 calls
-