Skip to content

Implementation of Opal-Scope #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 70 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
4d26b47
Add license and gitignore
smeyer198 Aug 28, 2024
c10931c
Add first version of Opal Scope
smeyer198 Sep 27, 2024
465e42b
Remove semicola to avoid wrong formatting
smeyer198 Sep 27, 2024
5865b7e
Merge branch 'feature/sootup-support' into feature/opal
smeyer198 Sep 27, 2024
12bc45b
Add missing functions
smeyer198 Sep 29, 2024
72e0114
Merge branch 'develop' into feature/opal
smeyer198 Sep 29, 2024
c3021f5
Merge branch 'master' into feature/opal
smeyer198 Sep 30, 2024
1cb2d83
First complete version of Opal scope
smeyer198 Oct 25, 2024
db362bd
Split Val into Local and ArrayRef
smeyer198 Nov 1, 2024
2b1d6bc
Merge branch 'develop' into feature/opal
smeyer198 Mar 7, 2025
f47df3f
Consistent renaming
smeyer198 Mar 7, 2025
c31d83b
Clean up Opal scope
smeyer198 Mar 8, 2025
8ff6fce
First version of OpalTestSetup
smeyer198 Mar 10, 2025
e173033
Merge pull request #111 from smeyer198/feature/opal
smeyer198 Mar 10, 2025
8df3fcb
Small fix
smeyer198 Mar 11, 2025
4a1878b
Merge branch 'explicit-dependencies' into feature/opal
smeyer198 Mar 11, 2025
0e2c627
Some pom updates
smeyer198 Mar 11, 2025
945f736
Use explicit parameter local
smeyer198 Mar 11, 2025
061ce5c
Create test setup for scopes
smeyer198 Mar 11, 2025
3ab0238
Merge branch 'feature/scope-testing' into feature/opal
smeyer198 Mar 11, 2025
5ec7bd7
Add test setup for Opal scope
smeyer198 Mar 11, 2025
691b8bd
Style
smeyer198 Mar 11, 2025
46af946
Add correct logic and tests for locals
smeyer198 Mar 12, 2025
28cf3ab
Merge branch 'develop' into feature/opal
smeyer198 Mar 18, 2025
cf4c1a5
Extend equals method for OpalMethod
smeyer198 Mar 18, 2025
3ea64e8
Add correct logic for fields
smeyer198 Mar 19, 2025
53e138e
Fix array handling
smeyer198 Mar 20, 2025
4b62f6e
WIP: Prepare for TacTransformer
smeyer198 Mar 21, 2025
a7419a9
Add transformer for TACode
smeyer198 Mar 21, 2025
5457941
Prepare for type propagation
smeyer198 Mar 24, 2025
da9c729
Add type information to locals
smeyer198 Mar 25, 2025
79fb045
Add basic propagation optimizer
smeyer198 Mar 25, 2025
476bda9
Update opal test setup
smeyer198 Mar 26, 2025
c568b3f
Various small fixes
smeyer198 Mar 28, 2025
cadd657
Prepare for StmtGraph
smeyer198 Mar 29, 2025
a09e04f
Add StmtGraph for TAC
smeyer198 Mar 31, 2025
164e752
Add simulation for operand stack
smeyer198 Apr 1, 2025
11d4eaf
Improve operand stack
smeyer198 Apr 2, 2025
9e58e2a
Make this local consistent
smeyer198 Apr 2, 2025
d08f607
Make StmtGraph main data structure
smeyer198 Apr 3, 2025
6e8b319
Include exception flows
smeyer198 Apr 4, 2025
57b1f24
Fix handling of identity statements
smeyer198 Apr 4, 2025
1eebc2f
Fix exception flows in StmtGraph
smeyer198 Apr 5, 2025
1fb11be
Rework of operand stack
smeyer198 Apr 12, 2025
a1cecfc
Switch completely to new operand stack handling
smeyer198 Apr 12, 2025
c5efc91
Replace sets.newHashSet with LinkedHashSet
smeyer198 Apr 15, 2025
53251ae
Update inlining of locals
smeyer198 Apr 16, 2025
8cfa423
Generalize method parsing in DemandDrivenAnalysis
smeyer198 Apr 16, 2025
d05f55d
Final fixes for opal scope
smeyer198 Apr 17, 2025
7304037
Fix branching for switch statements
smeyer198 Apr 17, 2025
36586e8
Fix equals and hashcode for OpalField
smeyer198 Apr 17, 2025
b9a0aec
Add logic for including JDK classes
smeyer198 Apr 17, 2025
11429ab
Generalize handling of Maps
smeyer198 Apr 18, 2025
c490823
Create alloc classes for each package
smeyer198 Apr 19, 2025
fe4fc26
Final fixes for static field refs
smeyer198 Apr 19, 2025
9850e77
Clean up opal tests and transformers
smeyer198 Apr 21, 2025
be4d01e
Clean up tac locals and add their original names
smeyer198 Apr 22, 2025
b2194c8
Clean up identity statements
smeyer198 Apr 22, 2025
2fe8491
Merge branch 'develop' into feature/opal
smeyer198 Apr 23, 2025
aa6b518
Clean up
smeyer198 Apr 23, 2025
967120b
Fix backward static field handling
smeyer198 Apr 23, 2025
7d1cc12
Parameterize test setup
smeyer198 Apr 23, 2025
28be871
Add job to create GitHub release automatically
smeyer198 Apr 23, 2025
af5a6db
(MINOR) version update and update README
smeyer198 Apr 23, 2025
59d5d83
Rename statements
smeyer198 Apr 23, 2025
19be7ed
Style
smeyer198 Apr 23, 2025
4154e03
Add test for TAC body builder
smeyer198 Apr 24, 2025
620303d
Add style guide for Scala code
smeyer198 Apr 24, 2025
5b654a0
Update license headers to correct format
smeyer198 Apr 24, 2025
b474082
Fix formatting
smeyer198 Apr 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 19 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,22 @@ jobs:
gh pr create --draft -B develop -H ${{ env.BRANCH_NAME }} -t "Update to next SNAPSHOT version" -b "Update to next SNAPSHOT version"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
runs-on: ubuntu-latest
needs: deployment
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get latest tag
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT

- name: Create GitHub release
run: |
gh release create "$TAG"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.get_tag.outputs.tag }}
5 changes: 4 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:

jobs:
BuildAndTest:
strategy:
matrix:
framework: [Soot, Opal] # TODO Add SootUp when available
runs-on: ubuntu-latest
steps:
- name: Checkout source code
Expand All @@ -22,4 +25,4 @@ jobs:
java-package: jdk
java-version: 11
- name: Build with Maven
run: mvn -B clean verify
run: mvn -B clean verify -DtestSetup=${{ matrix.framework }}
17 changes: 10 additions & 7 deletions PDS/src/main/java/de/fraunhofer/iem/Empty.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package de.fraunhofer.iem;
Expand Down
17 changes: 10 additions & 7 deletions PDS/src/main/java/de/fraunhofer/iem/Location.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package de.fraunhofer.iem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package de.fraunhofer.iem.wildcard;
Expand Down
17 changes: 10 additions & 7 deletions PDS/src/main/java/de/fraunhofer/iem/wildcard/Wildcard.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package de.fraunhofer.iem.wildcard;
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This repository contains:
- a Java implementation of [Synchronized Pushdown Systems](https://digital.ub.uni-paderborn.de/hs/content/titleinfo/3030984).
- [Boomerang](boomerangPDS) to calculate on-demand points-to and dataflow information using a Synchronized Pushdown System.
- [IDEal](idealPDS), an IDE solver based on a [Weighted Pushdown System](https://www.bodden.de/pubs/sab19context.pdf) that uses Boomerang to compute alias information only when required (i.e. on-demand).
- Implementation of scopes that allows you to run Boomerang and IDEal with the static analysis frameworks Soot.
- Implementation of scopes that allows you to run Boomerang and IDEal with the static analysis frameworks Soot and Opal.

## Examples

Expand Down Expand Up @@ -38,6 +38,14 @@ The projects are released on [Maven Central](https://central.sonatype.com/artifa
</dependency>
```

## Build and Installation
If you plan to install Boomerang and IDEal locally, you can use the following commands to build the project:

- `mvn clean install -DskipTests` Install the projects and skip all tests
- `mvn clean install -DtestSetup=Soot` Install the projects and run the tests with Soot as the underlying framework
- `mvn clean install -DtestSetup=SootUp` Install the projects and run the tests with SootUp as the underlying framework
- `mvn clean install -DtestSetup=Opal` Install the projects and run the tests with Opal as the underlying framework

## Contributing

We hare happy for every contribution from the community! You can simply create a fork and open a pull request. Note that we use the Google style sheet to keep the code clean. To format the code, run the command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import boomerang.Boomerang;
import boomerang.DefaultBoomerangOptions;
import boomerang.results.BackwardBoomerangResults;
import boomerang.scene.*;
import boomerang.scene.jimple.*;
import boomerang.scope.*;
import boomerang.scope.jimple.*;
import boomerang.sparse.SparsificationStrategy;
import boomerang.util.AccessPath;
import com.google.common.base.Stopwatch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static org.junit.Assert.assertTrue;

import aliasing.SparseAliasManager;
import boomerang.scene.jimple.BoomerangPretransformer;
import boomerang.scope.jimple.BoomerangPretransformer;
import boomerang.util.AccessPath;
import com.google.common.base.Predicate;
import java.io.File;
Expand Down
17 changes: 10 additions & 7 deletions SynchronizedPDS/src/main/java/sync/pds/solver/CastNormalRule.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package sync.pds.solver;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package sync.pds.solver;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package sync.pds.solver;
Expand Down
37 changes: 20 additions & 17 deletions SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSSolver.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package sync.pds.solver;
Expand All @@ -16,11 +19,11 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import de.fraunhofer.iem.Location;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
Expand Down Expand Up @@ -70,10 +73,10 @@ public String toString() {
return "Field " + SyncPDSSolver.this;
}
};
private final Set<Node<Stmt, Fact>> reachedStates = Sets.newHashSet();
private final Set<Node<Stmt, Fact>> callingContextReachable = Sets.newHashSet();
private final Set<Node<Stmt, Fact>> fieldContextReachable = Sets.newHashSet();
private final Set<SyncPDSUpdateListener<Stmt, Fact>> updateListeners = Sets.newHashSet();
private final Set<Node<Stmt, Fact>> reachedStates = new LinkedHashSet<>();
private final Set<Node<Stmt, Fact>> callingContextReachable = new LinkedHashSet<>();
private final Set<Node<Stmt, Fact>> fieldContextReachable = new LinkedHashSet<>();
private final Set<SyncPDSUpdateListener<Stmt, Fact>> updateListeners = new LinkedHashSet<>();
private final Multimap<Node<Stmt, Fact>, SyncStatePDSUpdateListener<Stmt, Fact>>
reachedStateUpdateListeners = HashMultimap.create();
protected final WeightedPAutomaton<Field, INode<Node<Stmt, Fact>>, W> fieldAutomaton;
Expand Down Expand Up @@ -594,8 +597,8 @@ private void applyCallSummary(Stmt callSite, Fact factInCallee, Stmt spInCallee)
});
}

Set<Summary> summaries = Sets.newHashSet();
Set<OnAddedSummaryListener> summaryListeners = Sets.newHashSet();
Set<Summary> summaries = new LinkedHashSet<>();
Set<OnAddedSummaryListener> summaryListeners = new LinkedHashSet<>();

public void addApplySummaryListener(OnAddedSummaryListener l) {
if (summaryListeners.add(l)) {
Expand Down Expand Up @@ -794,17 +797,17 @@ public void addGeneratedFieldState(GeneratedState<Node<Stmt, Fact>, Field> state
public abstract Field fieldWildCard();

public Set<Node<Stmt, Fact>> getReachedStates() {
return Sets.newHashSet(reachedStates);
return new LinkedHashSet(reachedStates);
}

public void debugOutput() {
logger.debug(this.getClass().toString());
logger.debug("All reachable states");
prettyPrintSet(getReachedStates());

HashSet<Node<Stmt, Fact>> notFieldReachable = Sets.newHashSet(callingContextReachable);
HashSet<Node<Stmt, Fact>> notFieldReachable = new LinkedHashSet(callingContextReachable);
notFieldReachable.removeAll(getReachedStates());
HashSet<Node<Stmt, Fact>> notCallingContextReachable = Sets.newHashSet(fieldContextReachable);
HashSet<Node<Stmt, Fact>> notCallingContextReachable = new LinkedHashSet(fieldContextReachable);
notCallingContextReachable.removeAll(getReachedStates());
if (!notFieldReachable.isEmpty()) {
logger.debug("Calling context reachable");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package sync.pds.solver;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package sync.pds.solver;
Expand Down
17 changes: 10 additions & 7 deletions SynchronizedPDS/src/main/java/sync/pds/solver/WeightFunctions.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* *****************************************************************************
* Copyright (c) 2025 Fraunhofer IEM, Paderborn, Germany. This program and the
* accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
*
* <p>SPDX-License-Identifier: EPL-2.0
*
* <p>Contributors: Johannes Spaeth - initial API and implementation
* Copyright (c) 2018 Fraunhofer IEM, Paderborn, Germany
* <p>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
* <p>
* SPDX-License-Identifier: EPL-2.0
* <p>
* Contributors:
* Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
package sync.pds.solver;
Expand Down
Loading