Skip to content

Commit e9f6b0b

Browse files
authored
Merge branch 'develop' into insertBefore_After
2 parents 9de327e + 96e022e commit e9f6b0b

File tree

46 files changed

+832
-497
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+832
-497
lines changed

docs/callgraphs.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ You can construct a call graph with Qilin as follows:
184184

185185
==="SootUp"
186186

187-
```java
188-
String MAINCLASS = "dacapo.antlr.Main"; // just an example
189-
PTAPattern ptaPattern = new PTAPattern("insens"); // "2o"=>2OBJ, "1c"=>1CFA, etc.
190-
PTA pta = PTAFactory.createPTA(ptaPattern, view, MAINCLASS);
191-
pta.run();
192-
CallGraph cg = pta.getCallGraph();
193-
```
187+
```java
188+
String MAINCLASS = "dacapo.antlr.Main"; // just an example
189+
PTAPattern ptaPattern = new PTAPattern("insens"); // "2o"=>2OBJ, "1c"=>1CFA, etc.
190+
PTA pta = PTAFactory.createPTA(ptaPattern, view, MAINCLASS);
191+
pta.run();
192+
CallGraph cg = pta.getCallGraph();
193+
```

docs/docguide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
this enables that tutorial code can be tested and will fail if its not up to date anymore :)
1212

1313
```
14-
{{ include('basicSetup/BasicSetup.java')}}
14+
{{ include('basicSetup/BasicSetupTest.java')}}
1515
```

pom.xml

+10-4
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,12 @@
405405
<dependency>
406406
<groupId>org.ow2.asm</groupId>
407407
<artifactId>asm-util</artifactId>
408-
<version>9.6</version>
408+
<version>9.7.1</version>
409409
</dependency>
410410
<dependency>
411411
<groupId>org.ow2.asm</groupId>
412412
<artifactId>asm-commons</artifactId>
413-
<version>9.7</version>
413+
<version>9.7.1</version>
414414
</dependency>
415415
<dependency>
416416
<groupId>org.smali</groupId>
@@ -441,16 +441,22 @@
441441
</dependency>
442442

443443
<!-- testing -->
444+
<dependency>
445+
<groupId>org.junit.jupiter</groupId>
446+
<artifactId>junit-jupiter</artifactId>
447+
<version>5.10.3</version>
448+
<scope>test</scope>
449+
</dependency>
444450
<dependency>
445451
<groupId>org.junit.jupiter</groupId>
446452
<artifactId>junit-jupiter-api</artifactId>
447-
<version>5.10.2</version>
453+
<version>5.10.3</version>
448454
<scope>test</scope>
449455
</dependency>
450456
<dependency>
451457
<groupId>org.junit.jupiter</groupId>
452458
<artifactId>junit-jupiter-engine</artifactId>
453-
<version>5.10.2</version>
459+
<version>5.10.3</version>
454460
<scope>test</scope>
455461
</dependency>
456462
<dependency>

sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java

+9-19
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,12 @@ protected AbstractCallGraphAlgorithm(@Nonnull View view) {
6767
* This method starts the construction of the call graph algorithm. It initializes the needed
6868
* objects for the call graph generation and calls processWorkList method.
6969
*
70-
* @param view the view contains all needed class files.
7170
* @param entryPoints a list of method signatures that will be added to the work list in the call
7271
* graph generation.
7372
* @return the complete constructed call graph starting from the entry methods.
7473
*/
7574
@Nonnull
76-
final CallGraph constructCompleteCallGraph(View view, List<MethodSignature> entryPoints) {
75+
final CallGraph constructCompleteCallGraph(List<MethodSignature> entryPoints) {
7776
Deque<MethodSignature> workList = new ArrayDeque<>(entryPoints);
7877
Set<MethodSignature> processed = new HashSet<>();
7978

@@ -83,7 +82,7 @@ final CallGraph constructCompleteCallGraph(View view, List<MethodSignature> entr
8382
workList.addAll(clinits);
8483
MutableCallGraph cg = initializeCallGraph(entryPoints, clinits);
8584

86-
processWorkList(view, workList, processed, cg);
85+
processWorkList(workList, processed, cg);
8786
return cg;
8887
}
8988

@@ -124,21 +123,17 @@ private Optional<MethodSignature> getSignatureOfImplementedStaticInitializer(
124123

125124
/**
126125
* Processes all entries in the <code>workList</code>, skipping those present in <code>processed
127-
* </code>, adding call edges to the graph. Newly discovered methods are added to the <code>
128-
* workList</code> and processed as well. <code>cg</code> is updated accordingly. The method
126+
* </code>, adding call edges to the graph. Newly discovered methods are added to the <code>
127+
* workList</code> and processed as well. <code>cg</code> is updated accordingly. The method
129128
* postProcessingMethod is called after a method is processed in the <code>workList</code>.
130129
*
131-
* @param view it contains the classes.
132130
* @param workList it contains all method that have to be processed in the call graph generation.
133131
* This list is filled in the execution with found call targets in the call graph algorithm.
134132
* @param processed the list of processed method to only process the method once.
135133
* @param cg the call graph object that is filled with the found methods and call edges.
136134
*/
137135
final void processWorkList(
138-
View view,
139-
Deque<MethodSignature> workList,
140-
Set<MethodSignature> processed,
141-
MutableCallGraph cg) {
136+
Deque<MethodSignature> workList, Set<MethodSignature> processed, MutableCallGraph cg) {
142137
while (!workList.isEmpty()) {
143138
MethodSignature currentMethodSignature = workList.pop();
144139
// skip if already processed
@@ -154,7 +149,7 @@ final void processWorkList(
154149
}
155150

156151
// perform pre-processing if needed
157-
preProcessingMethod(view, currentMethodSignature, workList, cg);
152+
preProcessingMethod(currentMethodSignature, workList, cg);
158153

159154
// process the method
160155
if (!cg.containsMethod(currentMethodSignature)) {
@@ -175,7 +170,7 @@ final void processWorkList(
175170
processed.add(currentMethodSignature);
176171

177172
// perform post-processing if needed
178-
postProcessingMethod(view, currentMethodSignature, workList, cg);
173+
postProcessingMethod(currentMethodSignature, workList, cg);
179174
}
180175
}
181176

@@ -351,27 +346,23 @@ private void addStaticInitializerCalls(
351346
/**
352347
* This method enables optional pre-processing of a method in the call graph algorithm
353348
*
354-
* @param view view
355349
* @param sourceMethod the processed method
356350
* @param workList the current work list that might be extended
357351
* @param cg the current cg that might be extended
358352
*/
359353
protected abstract void preProcessingMethod(
360-
View view,
361354
MethodSignature sourceMethod,
362355
@Nonnull Deque<MethodSignature> workList,
363356
@Nonnull MutableCallGraph cg);
364357

365358
/**
366359
* This method enables optional post-processing of a method in the call graph algorithm
367360
*
368-
* @param view it contains classes and the type hierarchy.
369361
* @param sourceMethod the processed method
370362
* @param workList the current work list that might be extended
371363
* @param cg the current cg that might be extended
372364
*/
373365
protected abstract void postProcessingMethod(
374-
View view,
375366
MethodSignature sourceMethod,
376367
@Nonnull Deque<MethodSignature> workList,
377368
@Nonnull MutableCallGraph cg);
@@ -397,7 +388,7 @@ public CallGraph addClass(@Nonnull CallGraph oldCallGraph, @Nonnull ClassType cl
397388
// Step 1: Add edges from the new methods to other methods
398389
Deque<MethodSignature> workList = new ArrayDeque<>(newMethodSignatures);
399390
Set<MethodSignature> processed = new HashSet<>(oldCallGraph.getMethodSignatures());
400-
processWorkList(view, workList, processed, updated);
391+
processWorkList(workList, processed, updated);
401392

402393
// Step 2: Add edges from old methods to methods overridden in the new class
403394
Stream<ClassType> superClasses = view.getTypeHierarchy().superClassesOf(classType);
@@ -445,10 +436,9 @@ public CallGraph addClass(@Nonnull CallGraph oldCallGraph, @Nonnull ClassType cl
445436
* <p>The method throws an exception if there is no main method in any of the classes or if there
446437
* are more than one main method.
447438
*
448-
* @param view to get the view specific main method.
449439
* @return - MethodSignature of main method.
450440
*/
451-
public MethodSignature findMainMethod(View view) {
441+
public MethodSignature findMainMethod() {
452442
Collection<SootMethod> mainMethods =
453443
view.getClasses()
454444
.filter(aClass -> !aClass.isLibraryClass())

sootup.callgraph/src/main/java/sootup/callgraph/ClassHierarchyAnalysisAlgorithm.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ public ClassHierarchyAnalysisAlgorithm(@Nonnull View view) {
5757
@Nonnull
5858
@Override
5959
public CallGraph initialize() {
60-
return constructCompleteCallGraph(view, Collections.singletonList(findMainMethod(view)));
60+
return constructCompleteCallGraph(Collections.singletonList(findMainMethod()));
6161
}
6262

6363
@Nonnull
6464
@Override
6565
public CallGraph initialize(@Nonnull List<MethodSignature> entryPoints) {
66-
return constructCompleteCallGraph(view, entryPoints);
66+
return constructCompleteCallGraph(entryPoints);
6767
}
6868

6969
/**
@@ -162,7 +162,6 @@ private List<MethodSignature> resolveAllCallTargets(
162162

163163
@Override
164164
protected void postProcessingMethod(
165-
View view,
166165
MethodSignature sourceMethod,
167166
@Nonnull Deque<MethodSignature> workList,
168167
@Nonnull MutableCallGraph cg) {
@@ -171,7 +170,6 @@ protected void postProcessingMethod(
171170

172171
@Override
173172
protected void preProcessingMethod(
174-
View view,
175173
MethodSignature sourceMethod,
176174
@Nonnull Deque<MethodSignature> workList,
177175
@Nonnull MutableCallGraph cg) {

sootup.callgraph/src/main/java/sootup/callgraph/RapidTypeAnalysisAlgorithm.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public RapidTypeAnalysisAlgorithm(@Nonnull View view) {
6363
@Nonnull
6464
@Override
6565
public CallGraph initialize() {
66-
List<MethodSignature> entryPoints = Collections.singletonList(findMainMethod(view));
66+
List<MethodSignature> entryPoints = Collections.singletonList(findMainMethod());
6767
return initialize(entryPoints);
6868
}
6969

@@ -74,7 +74,7 @@ public CallGraph initialize(@Nonnull List<MethodSignature> entryPoints) {
7474
instantiatedClasses = new HashSet<>();
7575
ignoredCalls = new HashMap<>();
7676

77-
CallGraph cg = constructCompleteCallGraph(view, entryPoints);
77+
CallGraph cg = constructCompleteCallGraph(entryPoints);
7878

7979
// delete the data structures
8080
instantiatedClasses = Collections.emptySet();
@@ -214,14 +214,12 @@ private void saveIgnoredCall(
214214
* sourceMethod. If a new instantiated class has previously ignored calls to this class, they are
215215
* added to call graph
216216
*
217-
* @param view view
218217
* @param sourceMethod the processed method
219218
* @param workList the current work list
220219
* @param cg the current cg
221220
*/
222221
@Override
223222
protected void preProcessingMethod(
224-
View view,
225223
MethodSignature sourceMethod,
226224
@Nonnull Deque<MethodSignature> workList,
227225
@Nonnull MutableCallGraph cg) {
@@ -272,14 +270,12 @@ protected void includeIgnoredCallsToClass(
272270
/**
273271
* Postprocessing is not needed in RTA
274272
*
275-
* @param view view
276273
* @param sourceMethod the processed method
277274
* @param workList the current worklist that is extended by methods that have to be analyzed.
278275
* @param cg the current cg is extended by new call targets and calls
279276
*/
280277
@Override
281278
protected void postProcessingMethod(
282-
View view,
283279
MethodSignature sourceMethod,
284280
@Nonnull Deque<MethodSignature> workList,
285281
@Nonnull MutableCallGraph cg) {

0 commit comments

Comments
 (0)