Skip to content

Commit 0acacbc

Browse files
Modify CSCallSite, check existence of Edge via Edge.equals(Object) instead of just callee (CSMethod)
1 parent ba90716 commit 0acacbc

2 files changed

Lines changed: 8 additions & 13 deletions

File tree

src/main/java/pascal/taie/analysis/pta/core/cs/element/CSCallSite.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525
import pascal.taie.analysis.graph.callgraph.Edge;
2626
import pascal.taie.analysis.pta.core.cs.context.Context;
2727
import pascal.taie.ir.stmt.Invoke;
28-
import pascal.taie.util.collection.ArraySet;
29-
import pascal.taie.util.collection.HybridIndexableSet;
28+
import pascal.taie.util.collection.Sets;
3029

31-
import java.util.ArrayList;
3230
import java.util.Collections;
3331
import java.util.Set;
3432

@@ -44,12 +42,10 @@ public class CSCallSite extends AbstractCSElement {
4442
*/
4543
private final CSMethod container;
4644

47-
private final Set<CSMethod> callees = new HybridIndexableSet<>(true);
48-
4945
/**
5046
* Call edges from this call site.
5147
*/
52-
private final ArrayList<Edge<CSCallSite, CSMethod>> edges = new ArrayList<>(4);
48+
private final Set<Edge<CSCallSite, CSMethod>> edges = Sets.newHybridSet();
5349

5450
CSCallSite(Invoke callSite, Context context, CSMethod container) {
5551
super(context);
@@ -69,14 +65,11 @@ public CSMethod getContainer() {
6965
}
7066

7167
public boolean addEdge(Edge<CSCallSite, CSMethod> edge) {
72-
if (callees.add(edge.getCallee())) {
73-
return edges.add(edge);
74-
}
75-
return false;
68+
return edges.add(edge);
7669
}
7770

7871
public Set<Edge<CSCallSite, CSMethod>> getEdges() {
79-
return Collections.unmodifiableSet(new ArraySet<>(edges, true));
72+
return Collections.unmodifiableSet(edges);
8073
}
8174

8275
@Override

src/main/java/pascal/taie/analysis/pta/plugin/invokedynamic/LambdaCallEdge.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import pascal.taie.analysis.pta.core.cs.element.CSMethod;
3030
import pascal.taie.ir.exp.InvokeDynamic;
3131
import pascal.taie.ir.exp.Var;
32-
import pascal.taie.util.Hashes;
3332

3433
import java.util.List;
3534

@@ -77,6 +76,9 @@ public boolean equals(Object o) {
7776

7877
@Override
7978
public int hashCode() {
80-
return Hashes.hash(super.hashCode(), lambdaIndy, lambdaContext);
79+
int result = super.hashCode();
80+
result = 31 * result + lambdaIndy.hashCode();
81+
result = 31 * result + lambdaContext.hashCode();
82+
return result;
8183
}
8284
}

0 commit comments

Comments
 (0)