refactoring of relations

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@783 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2007-02-23 17:07:21 +00:00
parent 4755779801
commit d60734d54b
16 changed files with 106 additions and 106 deletions

View File

@ -36,8 +36,8 @@ import com.ibm.wala.util.graph.NodeManager;
import com.ibm.wala.util.graph.NumberedGraph;
import com.ibm.wala.util.graph.NumberedNodeManager;
import com.ibm.wala.util.graph.impl.NumberedNodeIterator;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.MutableMapping;
import com.ibm.wala.util.intset.MutableSparseIntSet;
@ -131,7 +131,7 @@ public class BasicHeapGraph extends HeapGraph {
}
};
final IBinaryNonNegativeIntRelation pred = computePredecessors(nodeMgr);
final IBinaryNaturalRelation pred = computePredecessors(nodeMgr);
final IntFunction<Object> toNode = new IntFunction<Object>() {
public Object apply(int i) {
return nodeMgr.getNode(i);
@ -281,9 +281,9 @@ public class BasicHeapGraph extends HeapGraph {
/**
* @return R, y \in R(x,y) if the node y is a predecessor of node x
*/
private IBinaryNonNegativeIntRelation computePredecessors(NumberedNodeManager<Object> nodeManager) {
BasicNonNegativeIntRelation R = new BasicNonNegativeIntRelation(new byte[] { BasicNonNegativeIntRelation.SIMPLE },
BasicNonNegativeIntRelation.SIMPLE);
private IBinaryNaturalRelation computePredecessors(NumberedNodeManager<Object> nodeManager) {
BasicNaturalRelation R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE },
BasicNaturalRelation.SIMPLE);
// we split the following loops to improve temporal locality,
// particularly for locals
@ -293,7 +293,7 @@ public class BasicHeapGraph extends HeapGraph {
return R;
}
private void computePredecessorsForNonLocals(NumberedNodeManager<Object> nodeManager, BasicNonNegativeIntRelation R) {
private void computePredecessorsForNonLocals(NumberedNodeManager<Object> nodeManager, BasicNaturalRelation R) {
// Note: we run this loop backwards on purpose, to avoid lots of resizing of
// bitvectors
// in the backing relation. i.e., we will add the biggest bits first.
@ -321,7 +321,7 @@ public class BasicHeapGraph extends HeapGraph {
* traverse locals in order, first by node, then by value number: attempt to
* improve locality
*/
private void computePredecessorsForLocals(NumberedNodeManager<Object> nodeManager, BasicNonNegativeIntRelation R) {
private void computePredecessorsForLocals(NumberedNodeManager<Object> nodeManager, BasicNaturalRelation R) {
ArrayList<LocalPointerKey> list = new ArrayList<LocalPointerKey>();
for (Iterator it = nodeManager.iterateNodes(); it.hasNext();) {

View File

@ -28,7 +28,7 @@ import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.impl.DelegatingNumberedNodeManager;
import com.ibm.wala.util.graph.impl.NumberedNodeIterator;
import com.ibm.wala.util.graph.impl.SparseNumberedEdgeManager;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.BitVector;
import com.ibm.wala.util.intset.FixedSizeBitVector;
import com.ibm.wala.util.intset.IntSet;
@ -56,13 +56,13 @@ public abstract class AbstractCFG implements ControlFlowGraph, Constants {
* An object to track most normal edges in this cfg
*/
private SparseNumberedEdgeManager<IBasicBlock> normalEdgeManager = new SparseNumberedEdgeManager<IBasicBlock>(nodeManager, 2,
BasicNonNegativeIntRelation.SIMPLE);
BasicNaturalRelation.SIMPLE);
/**
* An object to track not-to-exit exceptional edges in this cfg
*/
private SparseNumberedEdgeManager<IBasicBlock> exceptionalEdgeManager = new SparseNumberedEdgeManager<IBasicBlock>(nodeManager,
0, BasicNonNegativeIntRelation.SIMPLE);
0, BasicNaturalRelation.SIMPLE);
/**
* Which basic blocks have a normal edge to exit()?

View File

@ -11,9 +11,9 @@
package com.ibm.wala.dataflow.IFDS;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.BitVectorIntSet;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.MutableSparseIntSet;
import com.ibm.wala.util.intset.SparseIntSet;
@ -39,7 +39,7 @@ public class CallFlowEdges {
* TODO: more representation optimization. A special represention for triples?
* sparse representations for CFG? exploit shorts for ints?
*/
private final SparseVector<IBinaryNonNegativeIntRelation> edges = new SparseVector<IBinaryNonNegativeIntRelation>(1, 1.1f);
private final SparseVector<IBinaryNaturalRelation> edges = new SparseVector<IBinaryNaturalRelation>(1, 1.1f);
/**
* a map from integer d1 -> int set.
@ -74,11 +74,11 @@ public class CallFlowEdges {
}
s.add(c);
} else {
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) edges.get(c);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) edges.get(c);
if (R == null) {
// we expect the first dimention of R to be dense, the second sparse
R = new BasicNonNegativeIntRelation(new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY },
BasicNonNegativeIntRelation.TWO_LEVEL);
R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY },
BasicNaturalRelation.TWO_LEVEL);
edges.set(c, R);
}
R.add(d2, d1);
@ -93,7 +93,7 @@ public class CallFlowEdges {
*/
public IntSet getCallFlowSources(int c, int d2) {
BitVectorIntSet s = (BitVectorIntSet) identityEdges.get(d2);
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) edges.get(c);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) edges.get(c);
IntSet result = null;
if (R == null) {
if (s != null) {

View File

@ -14,9 +14,9 @@ import java.util.Iterator;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.BitVectorIntSet;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntIterator;
import com.ibm.wala.util.intset.IntPair;
import com.ibm.wala.util.intset.IntSet;
@ -58,7 +58,7 @@ public class LocalPathEdges {
* TODO: more representation optimization. A special represention for triples?
* sparse representations for CFG? exploit shorts for ints?
*/
private final SparseVector<IBinaryNonNegativeIntRelation> paths = new SparseVector<IBinaryNonNegativeIntRelation>(1, 1.1f);
private final SparseVector<IBinaryNaturalRelation> paths = new SparseVector<IBinaryNaturalRelation>(1, 1.1f);
/**
* If this is non-null, it holds a redundant representation of the paths
@ -81,7 +81,7 @@ public class LocalPathEdges {
* to be dense in the first dimension 2) we need to support getReachable(), so
* we design lookup to get the d2's for an (n,d1) pair.
*/
private final SparseVector<IBinaryNonNegativeIntRelation> altPaths;
private final SparseVector<IBinaryNaturalRelation> altPaths;
/**
* a map from integer d1 -> int set.
@ -105,7 +105,7 @@ public class LocalPathEdges {
* faster merge operations
*/
public LocalPathEdges(boolean fastMerge) {
altPaths = fastMerge ? new SparseVector<IBinaryNonNegativeIntRelation>(1, 1.1f) : null;
altPaths = fastMerge ? new SparseVector<IBinaryNaturalRelation>(1, 1.1f) : null;
}
/**
@ -126,21 +126,21 @@ public class LocalPathEdges {
if (i == j) {
addIdentityPathEdge(i, n);
} else {
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) paths.get(j);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) paths.get(j);
if (R == null) {
// we expect the first dimention of R to be dense, the second sparse
R = new BasicNonNegativeIntRelation(new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY },
BasicNonNegativeIntRelation.TWO_LEVEL);
R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY },
BasicNaturalRelation.TWO_LEVEL);
paths.set(j, R);
}
R.add(n, i);
if (altPaths != null) {
IBinaryNonNegativeIntRelation R2 = (IBinaryNonNegativeIntRelation) altPaths.get(i);
IBinaryNaturalRelation R2 = (IBinaryNaturalRelation) altPaths.get(i);
if (R2 == null) {
// we expect the first dimention of R to be dense, the second sparse
R2 = new BasicNonNegativeIntRelation(new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY },
BasicNonNegativeIntRelation.TWO_LEVEL);
R2 = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY },
BasicNaturalRelation.TWO_LEVEL);
altPaths.set(i, R2);
}
R2.add(n, j);
@ -169,11 +169,11 @@ public class LocalPathEdges {
s.add(n);
if (altPaths != null) {
IBinaryNonNegativeIntRelation R2 = (IBinaryNonNegativeIntRelation) altPaths.get(i);
IBinaryNaturalRelation R2 = (IBinaryNaturalRelation) altPaths.get(i);
if (R2 == null) {
// we expect the first dimention of R to be dense, the second sparse
R2 = new BasicNonNegativeIntRelation(new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY },
BasicNonNegativeIntRelation.TWO_LEVEL);
R2 = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY },
BasicNaturalRelation.TWO_LEVEL);
altPaths.set(i, R2);
}
R2.add(n, i);
@ -202,11 +202,11 @@ public class LocalPathEdges {
}
z.add(n);
if (altPaths != null) {
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) altPaths.get(0);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) altPaths.get(0);
if (R == null) {
// we expect the first dimention of R to be dense, the second sparse
R = new BasicNonNegativeIntRelation(new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY },
BasicNonNegativeIntRelation.TWO_LEVEL);
R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY },
BasicNaturalRelation.TWO_LEVEL);
altPaths.set(0, R);
}
R.add(n, j);
@ -235,7 +235,7 @@ public class LocalPathEdges {
* path edges. null if none found
*/
public IntSet getInverse(int n, int d2) {
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) paths.get(d2);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) paths.get(d2);
BitVectorIntSet s = (BitVectorIntSet) identityPaths.get(d2);
BitVectorIntSet z = (BitVectorIntSet) zeroPaths.get(d2);
if (R == null) {
@ -334,7 +334,7 @@ public class LocalPathEdges {
return false;
}
} else {
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) paths.get(j);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) paths.get(j);
if (R == null) {
return false;
}
@ -369,7 +369,7 @@ public class LocalPathEdges {
Iterator contents = paths.iterator();
for (IntIterator it = paths.iterateIndices(); it.hasNext();) {
int d2 = it.next();
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) contents.next();
IBinaryNaturalRelation R = (IBinaryNaturalRelation) contents.next();
if (R != null && R.contains(n, d1)) {
result.add(d2);
}
@ -402,7 +402,7 @@ public class LocalPathEdges {
*/
private IntSet getReachableFast(int n, int d1) {
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) altPaths.get(d1);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) altPaths.get(d1);
if (R != null) {
return R.getRelated(n);
}
@ -424,7 +424,7 @@ public class LocalPathEdges {
Iterator contents = paths.iterator();
for (IntIterator it = paths.iterateIndices(); it.hasNext();) {
int d2 = it.next();
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) contents.next();
IBinaryNaturalRelation R = (IBinaryNaturalRelation) contents.next();
if (R != null && R.getRelatedCount(n) > 0) {
result.add(d2);
}
@ -466,7 +466,7 @@ public class LocalPathEdges {
public IntSet getReachedNodeNumbers() {
MutableSparseIntSet result = new MutableSparseIntSet();
if (paths.size() > 0) {
for (IBinaryNonNegativeIntRelation R : paths) {
for (IBinaryNaturalRelation R : paths) {
for (IntPair p : R) {
result.add(p.getX());
}

View File

@ -13,8 +13,8 @@ package com.ibm.wala.dataflow.IFDS;
import java.util.Iterator;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntPair;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.MutableSparseIntSet;
@ -49,7 +49,7 @@ public class LocalSummaryEdges {
*
* TODO: more representation optimization.
*/
private final SparseVector<IBinaryNonNegativeIntRelation> summaries = new SparseVector<IBinaryNonNegativeIntRelation>(1, 1.1f);
private final SparseVector<IBinaryNaturalRelation> summaries = new SparseVector<IBinaryNaturalRelation>(1, 1.1f);
/**
* Let (s_p,x) be an entry-exit pair, and let l := the long whose high word is
@ -85,11 +85,11 @@ public class LocalSummaryEdges {
*/
public void insertSummaryEdge(int s_p, int x, int d1, int d2) {
int n = getIndexForEntryExitPair(s_p, x);
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) summaries.get(n);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) summaries.get(n);
if (R == null) {
// we expect R to usually be sparse
R = new BasicNonNegativeIntRelation(new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY },
BasicNonNegativeIntRelation.SIMPLE);
R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY },
BasicNaturalRelation.SIMPLE);
summaries.set(n, R);
}
R.add(d1, d2);
@ -112,7 +112,7 @@ public class LocalSummaryEdges {
*/
public boolean contains(int s_p, int x, int d1, int d2) {
int n = getIndexForEntryExitPair(s_p, x);
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) summaries.get(n);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) summaries.get(n);
if (R == null) {
return false;
} else {
@ -132,7 +132,7 @@ public class LocalSummaryEdges {
*/
public IntSet getSummaryEdges(int s_p, int x, int d1) {
int n = getIndexForEntryExitPair(s_p, x);
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) summaries.get(n);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) summaries.get(n);
if (R == null) {
return null;
} else {
@ -154,7 +154,7 @@ public class LocalSummaryEdges {
*/
public IntSet getInvertedSummaryEdgesForTarget(int s_p, int x, int d2) {
int n = getIndexForEntryExitPair(s_p, x);
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) summaries.get(n);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) summaries.get(n);
if (R == null) {
return null;
} else {

View File

@ -41,7 +41,7 @@ import com.ibm.wala.ecore.java.ETypeHierarchy;
import com.ibm.wala.ecore.java.JavaFactory;
import com.ibm.wala.ecore.java.JavaPackage;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.IntIterator;
import com.ibm.wala.util.intset.IntPair;
import com.ibm.wala.util.intset.IntSet;
@ -57,7 +57,7 @@ import com.ibm.wala.util.intset.IntSet;
public class ETypeHierarchyWrapper {
private final EClassHierarchyWrapper cha;
private final EInterfaceHierarchyWrapper iface;
private final BasicNonNegativeIntRelation implementR = new BasicNonNegativeIntRelation();
private final BasicNaturalRelation implementR = new BasicNaturalRelation();
/**
* @param t

View File

@ -34,8 +34,8 @@ import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.graph.EdgeManager;
import com.ibm.wala.util.graph.NumberedEdgeManager;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntIterator;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.MutableIntSet;
@ -358,8 +358,8 @@ public class ExplicitCallGraph extends BasicCallGraph implements BytecodeConstan
/**
* for each y, the {x | (x,y) is an edge)
*/
final IBinaryNonNegativeIntRelation predecessors = new BasicNonNegativeIntRelation(
new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY }, BasicNonNegativeIntRelation.SIMPLE);
final IBinaryNaturalRelation predecessors = new BasicNaturalRelation(
new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY }, BasicNaturalRelation.SIMPLE);
public IntSet getSuccNodeNumbers(CGNode node) {
ExplicitNode n = (ExplicitNode) node;

View File

@ -43,8 +43,8 @@ import com.ibm.wala.util.graph.impl.GraphInverter;
import com.ibm.wala.util.graph.impl.SparseNumberedEdgeManager;
import com.ibm.wala.util.graph.traverse.DFS;
import com.ibm.wala.util.heapTrace.HeapTracer;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntIterator;
import com.ibm.wala.util.intset.IntPair;
import com.ibm.wala.util.intset.IntSet;
@ -70,7 +70,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
/**
* Track edges (equations) that are not represented implicitly
*/
private final EdgeManager<INodeWithNumber> edgeManager = new SparseNumberedEdgeManager<INodeWithNumber>(nodeManager, 2, BasicNonNegativeIntRelation.SIMPLE);
private final EdgeManager<INodeWithNumber> edgeManager = new SparseNumberedEdgeManager<INodeWithNumber>(nodeManager, 2, BasicNaturalRelation.SIMPLE);
private final DelegateGraph delegateGraph = new DelegateGraph();
@ -84,7 +84,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
* i op j is an equation in the graph
*
*/
private final SmallMap<UnaryOperator,IBinaryNonNegativeIntRelation> implicitUnaryMap = new SmallMap<UnaryOperator,IBinaryNonNegativeIntRelation>();
private final SmallMap<UnaryOperator,IBinaryNaturalRelation> implicitUnaryMap = new SmallMap<UnaryOperator,IBinaryNaturalRelation>();
/**
* The inverse of relations in the implicit map
@ -92,7 +92,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
* for UnaryOperator op, let R be invImplicitMap.get(op) then (i,j) \in R
* implies j op i is an equation in the graph
*/
private final SmallMap<UnaryOperator, IBinaryNonNegativeIntRelation> invImplicitUnaryMap = new SmallMap<UnaryOperator,IBinaryNonNegativeIntRelation>();
private final SmallMap<UnaryOperator, IBinaryNaturalRelation> invImplicitUnaryMap = new SmallMap<UnaryOperator,IBinaryNaturalRelation>();
/**
* Number of implicit unary equations registered
@ -104,8 +104,8 @@ public class PropagationGraph extends AbstractFixedPointSystem {
* @param key
* @return a relation in map m corresponding to a key
*/
private IBinaryNonNegativeIntRelation findOrCreateRelation(Map<UnaryOperator, IBinaryNonNegativeIntRelation> m, UnaryOperator key) {
IBinaryNonNegativeIntRelation result = m.get(key);
private IBinaryNaturalRelation findOrCreateRelation(Map<UnaryOperator, IBinaryNaturalRelation> m, UnaryOperator key) {
IBinaryNaturalRelation result = m.get(key);
if (result == null) {
result = makeRelation((AbstractOperator) key);
m.put(key, result);
@ -116,17 +116,17 @@ public class PropagationGraph extends AbstractFixedPointSystem {
/**
* @return a Relation object to track implicit equations using the operator
*/
private IBinaryNonNegativeIntRelation makeRelation(AbstractOperator op) {
private IBinaryNaturalRelation makeRelation(AbstractOperator op) {
byte[] implementation = null;
if (op instanceof AssignOperator) {
// lots of assignments.
implementation = new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY,
BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY };
implementation = new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY,
BasicNaturalRelation.SIMPLE_SPACE_STINGY };
} else {
// assume sparse assignments with any other operator.
implementation = new byte[] { BasicNonNegativeIntRelation.SIMPLE_SPACE_STINGY };
implementation = new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY };
}
return new BasicNonNegativeIntRelation(implementation, BasicNonNegativeIntRelation.SIMPLE);
return new BasicNaturalRelation(implementation, BasicNaturalRelation.SIMPLE);
}
/**
@ -266,11 +266,11 @@ public class PropagationGraph extends AbstractFixedPointSystem {
if (DEBUG) {
Trace.println("lhs rhs " + lhs + " " + rhs);
}
IBinaryNonNegativeIntRelation R = findOrCreateRelation(implicitUnaryMap, (UnaryOperator) eq.getOperator());
IBinaryNaturalRelation R = findOrCreateRelation(implicitUnaryMap, (UnaryOperator) eq.getOperator());
boolean b = R.add(lhs, rhs);
if (b) {
implicitUnaryCount++;
IBinaryNonNegativeIntRelation iR = findOrCreateRelation(invImplicitUnaryMap, (UnaryOperator) eq.getOperator());
IBinaryNaturalRelation iR = findOrCreateRelation(invImplicitUnaryMap, (UnaryOperator) eq.getOperator());
iR.add(rhs, lhs);
}
}
@ -284,9 +284,9 @@ public class PropagationGraph extends AbstractFixedPointSystem {
if (DEBUG) {
Trace.println("lhs rhs " + lhs + " " + rhs);
}
IBinaryNonNegativeIntRelation R = findOrCreateRelation(implicitUnaryMap, (UnaryOperator) eq.getOperator());
IBinaryNaturalRelation R = findOrCreateRelation(implicitUnaryMap, (UnaryOperator) eq.getOperator());
R.remove(lhs,rhs);
IBinaryNonNegativeIntRelation iR = findOrCreateRelation(invImplicitUnaryMap, (UnaryOperator) eq.getOperator());
IBinaryNaturalRelation iR = findOrCreateRelation(invImplicitUnaryMap, (UnaryOperator) eq.getOperator());
iR.remove(rhs,lhs);
implicitUnaryCount--;
}
@ -435,7 +435,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
innerDelegate = null;
while (outerKeyDelegate.hasNext()) {
currentOperator = (UnaryOperator) outerKeyDelegate.next();
IBinaryNonNegativeIntRelation R = implicitUnaryMap.get(currentOperator);
IBinaryNaturalRelation R = implicitUnaryMap.get(currentOperator);
Iterator it = R.iterator();
if (it.hasNext()) {
innerDelegate = it;
@ -756,7 +756,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
Iterator<AbstractStatement> result = (Iterator<AbstractStatement>) delegateGraph.getSuccNodes(v);
for (int i = 0; i < invImplicitUnaryMap.size(); i++) {
UnaryOperator op = (UnaryOperator) invImplicitUnaryMap.getKey(i);
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) invImplicitUnaryMap.getValue(i);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) invImplicitUnaryMap.getValue(i);
IntSet s = R.getRelated(number);
if (s != null) {
result = new CompoundIterator<AbstractStatement>(new ImplicitUseIterator(op, v, s), result);
@ -779,7 +779,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
Iterator<AbstractStatement> result = (Iterator<AbstractStatement>) delegateGraph.getPredNodes(v);
for (int i = 0; i < implicitUnaryMap.size(); i++) {
UnaryOperator op = (UnaryOperator) implicitUnaryMap.getKey(i);
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) implicitUnaryMap.getValue(i);
IBinaryNaturalRelation R = (IBinaryNaturalRelation) implicitUnaryMap.getValue(i);
IntSet s = R.getRelated(number);
if (s != null) {
result = new CompoundIterator<AbstractStatement>(new ImplicitDefIterator(op, s, v), result);
@ -803,7 +803,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
int result = delegateGraph.getSuccNodeCount(v);
for (Iterator it = invImplicitUnaryMap.keySet().iterator(); it.hasNext();) {
UnaryOperator op = (UnaryOperator) it.next();
IBinaryNonNegativeIntRelation R = invImplicitUnaryMap.get(op);
IBinaryNaturalRelation R = invImplicitUnaryMap.get(op);
IntSet s = R.getRelated(number);
if (s != null) {
result += s.size();
@ -825,7 +825,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
int result = delegateGraph.getPredNodeCount(v);
for (Iterator it = implicitUnaryMap.keySet().iterator(); it.hasNext();) {
UnaryOperator op = (UnaryOperator) it.next();
IBinaryNonNegativeIntRelation R = implicitUnaryMap.get(op);
IBinaryNaturalRelation R = implicitUnaryMap.get(op);
IntSet s = R.getRelated(number);
if (s != null) {
result += s.size();
@ -866,7 +866,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
for (Iterator it = implicitUnaryMap.entrySet().iterator(); it.hasNext();) {
count++;
Map.Entry e = (Map.Entry) it.next();
IBinaryNonNegativeIntRelation R = (IBinaryNonNegativeIntRelation) e.getValue();
IBinaryNaturalRelation R = (IBinaryNaturalRelation) e.getValue();
Trace.println("entry " + count);
R.performVerboseAction();
HeapTracer.Result result = HeapTracer.traceHeap(Collections.singleton(R), false);
@ -904,7 +904,7 @@ public class PropagationGraph extends AbstractFixedPointSystem {
int lhs = eq.getLHS().getGraphNodeId();
int rhs = eq.getRightHandSide().getGraphNodeId();
UnaryOperator op = (UnaryOperator) eq.getOperator();
IBinaryNonNegativeIntRelation R = implicitUnaryMap.get(op);
IBinaryNaturalRelation R = implicitUnaryMap.get(op);
if (R != null) {
return R.contains(lhs, rhs);
} else {

View File

@ -21,9 +21,9 @@ import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.impl.ExplicitCallGraph;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.BitVectorIntSet;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntIterator;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.MutableSharedBitVectorIntSet;
@ -42,7 +42,7 @@ public class DelegatingExplicitCallGraph extends ExplicitCallGraph {
* delegateR(x,y) means that for at least one site, node number y delegates to
* node number x.
*/
private final IBinaryNonNegativeIntRelation delegateR = new BasicNonNegativeIntRelation();
private final IBinaryNaturalRelation delegateR = new BasicNaturalRelation();
/**
* @param cha

View File

@ -47,10 +47,10 @@ import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.collections.Iterator2Collection;
import com.ibm.wala.util.collections.ObjectArrayMapping;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.BitVector;
import com.ibm.wala.util.intset.BitVectorIntSet;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.MutableIntSet;
import com.ibm.wala.util.intset.MutableSparseIntSet;
@ -444,7 +444,7 @@ public class HeapReachingDefs {
* HeapStatement.ReturnCaller for statement i, a NormalStatement
* representing an invoke
*/
private final IBinaryNonNegativeIntRelation heapReturnCaller = new BasicNonNegativeIntRelation();
private final IBinaryNaturalRelation heapReturnCaller = new BasicNaturalRelation();
public RD(CGNode node, ExpandedControlFlowGraph cfg, PointerAnalysis pa, OrdinalSetMapping<Statement> domain,
Map<SSAInstruction, NormalStatement> ssaInstruction2Statement, HeapExclusions exclusions) {

View File

@ -25,7 +25,7 @@ import com.ibm.wala.util.CompoundIterator;
import com.ibm.wala.util.StringStuff;
import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.IntIterator;
import com.ibm.wala.util.intset.IntSet;
@ -65,7 +65,7 @@ public abstract class IR {
/**
* Mapping from CallSiteReference program counters to instruction[] indices
*/
private final BasicNonNegativeIntRelation callSiteMapping = new BasicNonNegativeIntRelation();
private final BasicNaturalRelation callSiteMapping = new BasicNaturalRelation();
/**
* Mapping from NewSiteReference program counters to instruction[] indices

View File

@ -16,7 +16,7 @@ import com.ibm.wala.util.graph.AbstractNumberedGraph;
import com.ibm.wala.util.graph.EdgeManager;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.NodeManager;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
/**
*
@ -43,7 +43,7 @@ public class SlowSparseNumberedGraph<T> extends AbstractNumberedGraph<T> {
* what is the "normal" number of out edges for a node?
*/
public SlowSparseNumberedGraph(int normalOutCount) {
edgeManager = new SparseNumberedEdgeManager<T>(nodeManager, normalOutCount, BasicNonNegativeIntRelation.TWO_LEVEL);
edgeManager = new SparseNumberedEdgeManager<T>(nodeManager, normalOutCount, BasicNaturalRelation.TWO_LEVEL);
}
/*

View File

@ -16,9 +16,9 @@ import java.util.Iterator;
import com.ibm.wala.util.collections.EmptyIterator;
import com.ibm.wala.util.graph.NumberedEdgeManager;
import com.ibm.wala.util.graph.NumberedNodeManager;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
import com.ibm.wala.util.intset.BitVector;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNaturalRelation;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.IntSetAction;
@ -41,7 +41,7 @@ public final class SparseNumberedEdgeManager<T> implements NumberedEdgeManager<T
* an object to track nodes
*/
public SparseNumberedEdgeManager(NumberedNodeManager<T> nodeManager) {
this(nodeManager, 0, BasicNonNegativeIntRelation.TWO_LEVEL);
this(nodeManager, 0, BasicNaturalRelation.TWO_LEVEL);
}
/**
@ -56,13 +56,13 @@ public final class SparseNumberedEdgeManager<T> implements NumberedEdgeManager<T
public SparseNumberedEdgeManager(NumberedNodeManager<T> nodeManager, int normalCase, byte delegateImpl) {
this.nodeManager = nodeManager;
if (normalCase == 0) {
successors = new BasicNonNegativeIntRelation(defaultImpl, delegateImpl);
predecessors = new BasicNonNegativeIntRelation(defaultImpl, delegateImpl);
successors = new BasicNaturalRelation(defaultImpl, delegateImpl);
predecessors = new BasicNaturalRelation(defaultImpl, delegateImpl);
} else {
byte[] impl = new byte[normalCase];
Arrays.fill(impl, BasicNonNegativeIntRelation.SIMPLE);
successors = new BasicNonNegativeIntRelation(impl, delegateImpl);
predecessors = new BasicNonNegativeIntRelation(impl, delegateImpl);
Arrays.fill(impl, BasicNaturalRelation.SIMPLE);
successors = new BasicNaturalRelation(impl, delegateImpl);
predecessors = new BasicNaturalRelation(impl, delegateImpl);
}
}
@ -70,11 +70,11 @@ public final class SparseNumberedEdgeManager<T> implements NumberedEdgeManager<T
* The default implementation policy conservatively uses 2-level vectors, in
* an attempt to somewhat optimize for space.
*/
private final static byte[] defaultImpl = new byte[] { BasicNonNegativeIntRelation.TWO_LEVEL };
private final static byte[] defaultImpl = new byte[] { BasicNaturalRelation.TWO_LEVEL };
private final IBinaryNonNegativeIntRelation successors;
private final IBinaryNaturalRelation successors;
private final IBinaryNonNegativeIntRelation predecessors;
private final IBinaryNaturalRelation predecessors;
/*
* (non-Javadoc)

View File

@ -14,7 +14,7 @@ import com.ibm.wala.util.graph.AbstractNumberedGraph;
import com.ibm.wala.util.graph.EdgeManager;
import com.ibm.wala.util.graph.INodeWithNumber;
import com.ibm.wala.util.graph.NodeManager;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BasicNaturalRelation;
/**
A graph of numbered nodes, expected to have a fairly sparse edge structure.
@ -42,7 +42,7 @@ public class SparseNumberedGraph<T extends INodeWithNumber> extends AbstractNumb
*/
public SparseNumberedGraph(int normalCase) {
nodeManager = new DelegatingNumberedNodeManager<T>();
edgeManager = new SparseNumberedEdgeManager<T>(nodeManager, normalCase, BasicNonNegativeIntRelation.TWO_LEVEL);
edgeManager = new SparseNumberedEdgeManager<T>(nodeManager, normalCase, BasicNaturalRelation.TWO_LEVEL);
}
/**

View File

@ -25,7 +25,7 @@ import com.ibm.wala.util.debug.Trace;
*
* @author sfink
*/
public final class BasicNonNegativeIntRelation implements IBinaryNonNegativeIntRelation {
public final class BasicNaturalRelation implements IBinaryNaturalRelation {
private final static boolean VERBOSE = false;
@ -74,7 +74,7 @@ public final class BasicNonNegativeIntRelation implements IBinaryNonNegativeIntR
* implemented with a SimpleIntVector, and the 2nd and 3rd are implemented
* with TwoLevelIntVector
*/
public BasicNonNegativeIntRelation(byte[] implementation, byte vectorImpl) {
public BasicNaturalRelation(byte[] implementation, byte vectorImpl) {
smallStore = new IntVector[implementation.length];
for (int i = 0; i < implementation.length; i++) {
switch (implementation[i]) {
@ -109,7 +109,7 @@ public final class BasicNonNegativeIntRelation implements IBinaryNonNegativeIntR
/**
* a Default contructor
*/
public BasicNonNegativeIntRelation() {
public BasicNaturalRelation() {
this(new byte[] { SIMPLE }, TWO_LEVEL);
}

View File

@ -17,7 +17,7 @@ import com.ibm.wala.util.debug.VerboseAction;
*
* @author sfink
*/
public interface IBinaryNonNegativeIntRelation extends VerboseAction, Iterable<IntPair> {
public interface IBinaryNaturalRelation extends VerboseAction, Iterable<IntPair> {
/**
* Add (x,y) to the relation
*