Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:soot-oss/soot into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenArzt committed Sep 23, 2024
2 parents af416a4 + 9616935 commit 9ef80fd
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
- name: Stylecheck
if: always()
run: |
mvn -B clean checkstyle:check -Dcheckstyle.failOnViolation=true
mvn -B --no-transfer-progress clean checkstyle:check -Dcheckstyle.failOnViolation=true
- name: Licensecheck
if: always()
run: |
mvn -B clean license:check-file-header -Dlicence-check.failOnMissingHeader=true
mvn -B --no-transfer-progress clean license:check-file-header -Dlicence-check.failOnMissingHeader=true
BuildAndTest:
name: Build and Test with java ${{ matrix.java_version }}
Expand All @@ -42,7 +42,7 @@ jobs:
java-version: ${{ matrix.java_version }}
- name: Build and test Java ${{ matrix.java_version }}
run: |
mvn -B clean test -PJava${{ matrix.java_version }}
mvn -B --no-transfer-progress clean test -PJava${{ matrix.java_version }}
DeployArtifacts:
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
<excludedGroups>${testcase.groups.excluded}</excludedGroups>
<argLine>
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.regex=ALL-UNNAMED
--add-opens=java.base/java.util.stream=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
</argLine>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* @author Marc Miltenberger
*/
public class ByReferenceWrapperGenerator {
public static final String WRAPPER_FIELD_NAME = "r";
public static final String WRAPPER_CLASS_NAME = "ByReferenceWrappers.Wrapper";

public synchronized static SootClass getWrapperClass(Type t) {
Expand All @@ -61,7 +62,7 @@ public synchronized static SootClass getWrapperClass(Type t) {
}
SootClass sc = scene.makeSootClass(name, Modifier.FINAL | Modifier.STATIC);
sc.setApplicationClass();
SootField r = scene.makeSootField("r", RefType.v("System.Object"));
SootField r = scene.makeSootField(WRAPPER_FIELD_NAME, RefType.v("System.Object"));
r.setModifiers(Modifier.PUBLIC);
sc.addField(r);

Expand Down Expand Up @@ -120,7 +121,7 @@ public static Unit getUnwrapCall(SootClass wrapperClass, Value argToUnwrap, Valu
}

public static SootField getWrapperField(SootClass wrapperClass) {
return wrapperClass.getFieldByName("r");
return wrapperClass.getFieldByName(WRAPPER_FIELD_NAME);
}

/**
Expand All @@ -134,7 +135,7 @@ public static SootField getWrapperField(SootClass wrapperClass) {
*/
public static Unit getUpdateWrappedValueCall(Local wrapped, Local unwrapped) {
RefType rt = (RefType) wrapped.getType();
SootField f = rt.getSootClass().getFieldByName("r");
SootField f = rt.getSootClass().getFieldByName(WRAPPER_FIELD_NAME);
Jimple j = Jimple.v();
return j.newAssignStmt(j.newInstanceFieldRef(wrapped, f.makeRef()), unwrapped);

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/soot/jimple/spark/solver/PropWorklist.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

public class PropWorklist extends Propagator {
private static final Logger logger = LoggerFactory.getLogger(PropWorklist.class);
protected final Set<VarNode> varNodeWorkList = new TreeSet<VarNode>();
protected final TreeSet<VarNode> varNodeWorkList = new TreeSet<VarNode>();

public PropWorklist(PAG pag) {
this.pag = pag;
Expand All @@ -75,10 +75,9 @@ public void propagate() {
if (verbose) {
logger.debug("Worklist has " + varNodeWorkList.size() + " nodes.");
}
while (!varNodeWorkList.isEmpty()) {
VarNode src = varNodeWorkList.iterator().next();
varNodeWorkList.remove(src);
handleVarNode(src);
VarNode vsrc;
while ((vsrc = varNodeWorkList.pollFirst()) != null) {
handleVarNode(vsrc);
}
if (verbose) {
logger.debug("Now handling field references");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package soot.jimple.toolkits.callgraph;

import java.lang.reflect.Constructor;

/*-
* #%L
* Soot - a J*va Optimization Framework
Expand Down Expand Up @@ -96,7 +94,6 @@
import soot.jimple.StringConstant;
import soot.jimple.VirtualInvokeExpr;
import soot.jimple.spark.pag.AllocDotField;
import soot.jimple.spark.pag.PAG;
import soot.jimple.toolkits.annotation.nullcheck.NullnessAnalysis;
import soot.jimple.toolkits.callgraph.ConstantArrayAnalysis.ArrayTypes;
import soot.jimple.toolkits.callgraph.VirtualEdgesSummaries.DeferredVirtualEdgeTarget;
Expand Down Expand Up @@ -810,17 +807,21 @@ protected void findReceivers(SootMethod m, Body b) {
if (ie instanceof InstanceInvokeExpr) {
InstanceInvokeExpr iie = (InstanceInvokeExpr) ie;
Local receiver = (Local) iie.getBase();
MethodSubSignature subSig = new MethodSubSignature(iie.getMethodRef());

VirtualEdge virtualEdge = virtualEdgeSummaries.getVirtualEdgesMatchingSubSig(subSig);
if (virtualEdge != null) {
for (VirtualEdgeTarget t : virtualEdge.targets) {
if (t instanceof InvocationVirtualEdgeTarget) {
processVirtualEdgeSummary(m, s, receiver, (InvocationVirtualEdgeTarget) t, virtualEdge.edgeType);
} else if (t instanceof DeferredVirtualEdgeTarget) {
addVirtualCallSite(s, m, receiver, iie, new MethodSubSignature(iie.getMethodRef()), Kind.GENERIC_FAKE);
if (!(iie instanceof SpecialInvokeExpr)) {
MethodSubSignature subSig = new MethodSubSignature(iie.getMethodRef());

VirtualEdge virtualEdge = virtualEdgeSummaries.getVirtualEdgesMatchingSubSig(subSig);
if (virtualEdge != null) {
for (VirtualEdgeTarget t : virtualEdge.targets) {
if (t instanceof InvocationVirtualEdgeTarget) {
processVirtualEdgeSummary(m, s, receiver, (InvocationVirtualEdgeTarget) t, virtualEdge.edgeType);
} else if (t instanceof DeferredVirtualEdgeTarget) {
addVirtualCallSite(s, m, receiver, iie, new MethodSubSignature(iie.getMethodRef()), Kind.GENERIC_FAKE);
}
}
}
} else {
addEdge(m, s, ie.getMethod(), Kind.SPECIAL);
}

// if (!hasVirtualEdge || !iie.getMethod().isPhantom())
Expand Down Expand Up @@ -970,7 +971,7 @@ private void getImplicitTargets(SootMethod source) {
if (!source.isConcrete()) {
return;
}
if (source.getSubSignature().contains("<init>")) {
if (source.isConstructor()) {
handleInit(source, scl);
}
for (Unit u : source.retrieveActiveBody().getUnits()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Set;

import soot.MethodOrMethodContext;
Expand Down Expand Up @@ -91,13 +90,15 @@ public void update() {
while (unprocessedMethods.hasNext()) {
MethodOrMethodContext m = unprocessedMethods.next();
if (m == null) {
continue;
continue;
}
Iterator<Edge> targets = cg.edgesOutOf(m);
if (filter != null) {
targets = filter.wrap(targets);
}
addMethods(new Targets(targets));
if (targets.hasNext()) {
addMethods(new Targets(targets));
}
}
}

Expand Down

0 comments on commit 9ef80fd

Please sign in to comment.