introduce tabulation factories
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1870 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
eb62fa4f77
commit
03ba73d164
|
@ -47,9 +47,13 @@ public class BackwardsSupergraph<T,P> implements ISupergraph<T,P> {
|
|||
* @param forwardGraph
|
||||
* the graph to ``reverse''
|
||||
*/
|
||||
public BackwardsSupergraph(ISupergraph<T,P> forwardGraph) {
|
||||
private BackwardsSupergraph(ISupergraph<T,P> forwardGraph) {
|
||||
this.delegate = forwardGraph;
|
||||
}
|
||||
|
||||
public static <T,P> BackwardsSupergraph<T, P> make(ISupergraph<T, P> forwardGraph) {
|
||||
return new BackwardsSupergraph<T, P>(forwardGraph);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see com.ibm.wala.dataflow.IFDS.ISupergraph#getMain()
|
||||
|
|
|
@ -53,6 +53,9 @@ import com.ibm.wala.util.perf.EngineTimings;
|
|||
* </ul>
|
||||
* <p>
|
||||
*
|
||||
* Type parameter T represents type of nodes in the supergraph. Type parameter P represents
|
||||
* the type of procedure (or box in RSM parlance)
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public class TabulationSolver<T, P> {
|
||||
|
@ -178,7 +181,7 @@ public class TabulationSolver<T, P> {
|
|||
* a description of the dataflow problem to solve
|
||||
* @throws IllegalArgumentException if p is null
|
||||
*/
|
||||
public TabulationSolver(TabulationProblem<T, P> p) {
|
||||
private TabulationSolver(TabulationProblem<T, P> p) {
|
||||
if (p == null) {
|
||||
throw new IllegalArgumentException("p is null");
|
||||
}
|
||||
|
@ -190,6 +193,15 @@ public class TabulationSolver<T, P> {
|
|||
}
|
||||
this.problem = p;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param p
|
||||
* a description of the dataflow problem to solve
|
||||
* @throws IllegalArgumentException if p is null
|
||||
*/
|
||||
public static <T,P> TabulationSolver<T,P> make(TabulationProblem<T, P> p) {
|
||||
return new TabulationSolver<T, P>(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Solve the dataflow problem.
|
||||
|
|
|
@ -226,7 +226,7 @@ public class Slicer {
|
|||
System.err.println("Tabulate for " + root);
|
||||
}
|
||||
|
||||
TabulationSolver<Statement, PDG> solver = new TabulationSolver<Statement, PDG>(p);
|
||||
TabulationSolver<Statement, PDG> solver = TabulationSolver.make(p);
|
||||
TabulationResult<Statement> tr = null;
|
||||
try {
|
||||
tr = solver.solve();
|
||||
|
@ -407,7 +407,7 @@ public class Slicer {
|
|||
public SliceProblem(Statement s, ISDG sdg, boolean backward) {
|
||||
this.src = s;
|
||||
SDGSupergraph forwards = new SDGSupergraph(sdg, src, backward);
|
||||
this.supergraph = backward ? new BackwardsSupergraph<Statement, PDG>(forwards) : forwards;
|
||||
this.supergraph = backward ? BackwardsSupergraph.make(forwards) : forwards;
|
||||
f = new SliceFunctions();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue