Skip to content

Commit

Permalink
Merge branch 'develop' into feature/sootup-support-refactor
Browse files Browse the repository at this point in the history
# Conflicts:
#	SparseBoomerangCorrectness/pom.xml
#	SynchronizedPDS/pom.xml
#	SynchronizedPDS/src/main/java/sync/pds/solver/OneWeightFunctions.java
#	SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSSolver.java
#	WPDS/pom.xml
#	WPDS/src/main/java/wpds/impl/WeightedPAutomaton.java
#	WPDS/src/main/java/wpds/impl/WeightedPushdownSystem.java
#	boomerangPDS/pom.xml
#	boomerangPDS/src/main/java/boomerang/WeightedBoomerang.java
#	boomerangPDS/src/main/java/boomerang/WeightedForwardQuery.java
#	boomerangPDS/src/main/java/boomerang/callgraph/BoomerangResolver.java
#	boomerangPDS/src/main/java/boomerang/debugger/ConsoleDebugger.java
#	boomerangPDS/src/test/java/test/cases/fields/ReadPOITest.java
#	boomerangPDS/src/test/java/test/cases/fields/WritePOITest.java
#	boomerangScope-Soot/src/main/java/boomerang/framework/soot/jimple/JimpleDeclaredMethod.java
#	boomerangScope-Soot/src/main/java/boomerang/framework/soot/jimple/JimpleMethod.java
#	boomerangScope-Soot/src/main/java/boomerang/framework/soot/jimple/JimpleStaticFieldVal.java
#	boomerangScope-WALA/pom.xml
#	boomerangScope-WALA/src/main/java/boomerang/framework/wala/WALADeclaredMethod.java
#	boomerangScope-WALA/src/main/java/boomerang/framework/wala/WALAMethod.java
#	boomerangScope/pom.xml
#	idealPDS/pom.xml
#	idealPDS/src/main/java/typestate/TransitionFunction.java
#	idealPDS/src/main/java/typestate/impl/statemachines/OutputStreamStateMachine.java
#	idealPDS/src/test/java/typestate/test/helper/File.java
#	pom.xml
#	testCore/pom.xml
  • Loading branch information
swissiety committed Dec 17, 2024
2 parents b0a5ba5 + d742006 commit a5c0057
Show file tree
Hide file tree
Showing 39 changed files with 209 additions and 83 deletions.
4 changes: 2 additions & 2 deletions SparseBoomerangCorrectness/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>SPDS</artifactId>
<groupId>de.fraunhofer.iem</groupId>
<version>3.1.2-SNAPSHOT</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -20,7 +20,7 @@
<dependency>
<groupId>de.fraunhofer.iem</groupId>
<artifactId>boomerangPDS</artifactId>
<version>3.1.2-SNAPSHOT</version>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down
4 changes: 2 additions & 2 deletions SynchronizedPDS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.fraunhofer.iem</groupId>
<artifactId>SPDS</artifactId>
<version>3.1.2-SNAPSHOT</version>
<version>3.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -12,7 +12,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.1</version>
<version>3.5.2</version>
<configuration>
<argLine>-Xmx8G -Xss128m</argLine>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ public W getOne() {
return one;
}
}
;
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,12 @@ public enum PDSSystem {
public String toString() {
return "Call " + SyncPDSSolver.this.toString();
}
;
};
protected final WeightedPushdownSystem<Field, INode<Node<Stmt, Fact>>, W> fieldPDS =
new WeightedPushdownSystem<Field, INode<Node<Stmt, Fact>>, W>() {
public String toString() {
return "Field " + SyncPDSSolver.this.toString();
}
;
};
private final Set<Node<Stmt, Fact>> reachedStates = Sets.newHashSet();
private final Set<Node<Stmt, Fact>> callingContextReachable = Sets.newHashSet();
Expand Down Expand Up @@ -115,7 +113,6 @@ public Field epsilon() {
public boolean nested() {
return useFieldSummaries;
}
;

@Override
public W getOne() {
Expand All @@ -133,7 +130,6 @@ public boolean addWeightForTransition(
logger.trace("Adding field transition {} with weight {}", trans, weight);
return super.addWeightForTransition(trans, weight);
}
;

@Override
public boolean isGeneratedState(INode<Node<Stmt, Fact>> d) {
Expand All @@ -157,7 +153,6 @@ public Stmt epsilon() {
public boolean nested() {
return useCallSummaries;
}
;

@Override
public W getOne() {
Expand All @@ -169,7 +164,6 @@ public boolean addWeightForTransition(Transition<Stmt, INode<Fact>> trans, W wei
logger.trace("Adding call transition {} with weight {}", trans, weight);
return super.addWeightForTransition(trans, weight);
}
;

@Override
public boolean isGeneratedState(INode<Fact> d) {
Expand Down
2 changes: 1 addition & 1 deletion WPDS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.fraunhofer.iem</groupId>
<artifactId>SPDS</artifactId>
<version>3.1.2-SNAPSHOT</version>
<version>3.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 0 additions & 2 deletions WPDS/src/main/java/wpds/impl/WeightedPAutomaton.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,10 @@ public Set<Edge<D, N>> getEdges() {
}
return trans;
}
;

public Set<D> getNodes() {
return getStates();
}
;

public boolean addWeightForTransition(Transition<N, D> trans, W weight) {
if (weight == null) throw new IllegalArgumentException("Weight must not be null!");
Expand Down
1 change: 0 additions & 1 deletion WPDS/src/main/java/wpds/impl/WeightedPushdownSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public void putSummaryAutomaton(D target, WeightedPAutomaton<N, D, W> aut) {
public WeightedPAutomaton<N, D, W> getSummaryAutomaton(D target) {
return summaries.getSummaryAutomaton(target);
}
;
}.poststar(this, initialAutomaton);
}

Expand Down
6 changes: 3 additions & 3 deletions boomerangPDS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>de.fraunhofer.iem</groupId>
<artifactId>SPDS</artifactId>
<version>3.1.2-SNAPSHOT</version>
<version>3.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -13,7 +13,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.1</version>
<version>3.5.2</version>
<configuration>
<argLine>-Xmx8G -Xss128m</argLine>
</configuration>
Expand Down Expand Up @@ -67,7 +67,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.1</version>
<version>3.5.2</version>
<executions>
<execution>
<phase>integration-test</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,6 @@ public void execute(final ForwardQuery baseAllocation, final Query flowAllocatio
public void activate(INode<Node<Edge, Val>> start) {
activateAllPois(new SolverPair(flowSolver, baseSolver), start);
}
;
};
registerActivationListener(new SolverPair(flowSolver, baseSolver), exec);
exec.solve();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ public WeightedForwardQuery(Edge stmt, Val variable, W weight) {
public W weight() {
return weight;
}
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class BoomerangResolver implements ICallerCalleeResolutionStrategy {
public enum NoCalleeFoundFallbackOptions {
PRECOMPUTED,
BYPASS
};
}

private static final String THREAD_CLASS = "java.lang.Thread";
private static final String THREAD_START_SIGNATURE = "<java.lang.Thread: void start()>";
Expand All @@ -46,7 +46,6 @@ public enum NoCalleeFoundFallbackOptions {
private WeightedBoomerang<? extends Weight> solver;
private Set<Statement> queriedInvokeExprAndAllocationSitesFound = Sets.newHashSet();
private Set<Statement> queriedInvokeExpr = Sets.newHashSet();
;

public BoomerangResolver(CallGraph cg, DataFlowScope scope, FrameworkScope scopeFactory) {
this.solver = new Boomerang(cg, scope, scopeFactory);
Expand Down Expand Up @@ -235,7 +234,6 @@ protected void allocationSiteFound(
}
}
}
;
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ public void done(
queryToSolvers.get(q).debugOutput();
}
}
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public boolean aliases(Query el) {
return false;
}

@Deprecated
public Set<AccessPath> getAllAliases(Edge stmt) {
final Set<AccessPath> results = Sets.newHashSet();
for (final ForwardQuery fw : getAllocationSites().keySet()) {
Expand All @@ -117,7 +116,11 @@ public Set<AccessPath> getAllAliases(Edge stmt) {
return results;
}

@Deprecated
/**
* Return an {@link AccessPath} for each aliasing object of the original query.
*
* @return all access paths aliasing with the query variable
*/
public Set<AccessPath> getAllAliases() {
return getAllAliases(query.cfgEdge());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ protected Collection<? extends State> computeReturnFlow(
}

protected void callFlow(Method caller, Node<Edge, Val> curr, Statement callSite) {
icfg.addCalleeListener(new CallSiteCalleeListener(curr, caller));
InvokeExpr invokeExpr = callSite.getInvokeExpr();
if (dataFlowScope.isExcluded(invokeExpr.getMethod())) {
byPassFlowAtCallsite(caller, curr);
return;
}
icfg.addCalleeListener(new CallSiteCalleeListener(curr, caller));
}

private void byPassFlowAtCallsite(Method caller, Node<Edge, Val> curr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ public void callFlow(
assert icfg.isCallStmt(callSiteEdge.getStart());
if (dataFlowScope.isExcluded(invokeExpr.getMethod())) {
byPassFlowAtCallSite(caller, currNode, callSiteEdge.getStart());
return;
}

icfg.addCalleeListener(new CallSiteCalleeListener(caller, callSiteEdge, currNode, invokeExpr));
Expand Down
14 changes: 14 additions & 0 deletions boomerangPDS/src/main/java/boomerang/util/AccessPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.common.collect.Lists;
import java.util.Collection;
import java.util.Set;
import java.util.StringJoiner;

public class AccessPath {
private final Val val;
Expand Down Expand Up @@ -45,6 +46,19 @@ public Collection<Field> getFields() {
return fieldChain;
}

/**
* Return the AccessPath as a compact representation. For example, a path with a base 'x' and no
* fields becomes 'x', a base 'y' and the fields [f,g] becomes 'y.f.g'
*
* @return the formatted AccessPath
*/
public String toCompactString() {
StringJoiner fieldJoiner = new StringJoiner(".");
fieldChain.forEach(field -> fieldJoiner.add(field.toString()));

return val.getVariableName() + (fieldJoiner.toString().isEmpty() ? "" : ".") + fieldJoiner;
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,4 @@ private static class Node {
private static class AllocNode extends Node implements AllocatedObject {}

private static class Alloc implements AllocatedObject {}
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ public static class ObjectWithField {
}

public static class Alloc implements AllocatedObject {}
;

private static class A1 {
B1 b = new B1();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import boomerang.scene.DeclaredMethod;
import boomerang.scene.InvokeExpr;
import boomerang.scene.Method;
import boomerang.scene.Type;
import boomerang.scene.WrappedClass;
import java.util.ArrayList;
import java.util.List;
import soot.SootMethod;

public class JimpleDeclaredMethod extends DeclaredMethod {
Expand Down Expand Up @@ -80,6 +83,21 @@ public WrappedClass getDeclaringClass() {
return new JimpleWrappedClass(delegate.getDeclaringClass());
}

@Override
public List<Type> getParameterTypes() {
List<Type> types = new ArrayList<>();

for (soot.Type type : delegate.getParameterTypes()) {
types.add(new JimpleType(type));
}
return types;
}

@Override
public Type getParameterType(int index) {
return new JimpleType(delegate.getParameterType(index));
}

public Object getDelegate() {
return delegate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public String toString() {
public Field field() {
return field;
}
;

@Override
public Val asUnbalanced(Edge stmt) {
Expand Down Expand Up @@ -76,6 +75,11 @@ public boolean isArrayAllocationVal() {
return false;
}

@Override
public Val getArrayAllocationSize() {
throw new RuntimeException("Static Val is not an array allocation val");
}

@Override
public boolean isNull() {
return false;
Expand Down
Loading

0 comments on commit a5c0057

Please sign in to comment.