small cleanups

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2893 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2008-06-18 21:06:24 +00:00
parent fd26dd0327
commit 60bff330b9
1 changed files with 19 additions and 38 deletions

View File

@ -36,7 +36,6 @@ import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.collections.IntMapIterator;
import com.ibm.wala.util.collections.SparseVector;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.functions.IntFunction;
import com.ibm.wala.util.graph.EdgeManager;
import com.ibm.wala.util.graph.NumberedEdgeManager;
@ -49,16 +48,12 @@ import com.ibm.wala.util.intset.MutableSharedBitVectorIntSet;
import com.ibm.wala.util.intset.SparseIntSet;
/**
* A call graph which explicitly holds the target for each call site in each
* node.
*
* A call graph which explicitly holds the target for each call site in each node.
*
* @author sfink
*/
public class ExplicitCallGraph extends BasicCallGraph implements BytecodeConstants {
private static final boolean DEBUG = false;
protected final IClassHierarchy cha;
protected final AnalysisOptions options;
@ -107,27 +102,16 @@ public class ExplicitCallGraph extends BasicCallGraph implements BytecodeConstan
}
/**
* Method findOrCreateNode.
*
* @param method
* @return NodeImpl
*/
@Override
public CGNode findOrCreateNode(IMethod method, Context C) throws CancelException {
if (Assertions.verifyAssertions) {
if (method == null || C == null) {
Assertions._assert(method != null, "null method");
Assertions._assert(C != null, "null context for method " + method);
}
}
assert method != null : "null method";
assert C != null : "null context for method " + method;
Key k = new Key(method, C);
NodeImpl result = getNode(k);
if (result == null) {
if (maxNumberOfNodes == -1 || getNumberOfNodes() <= maxNumberOfNodes) {
result = makeNode(method, C);
if (DEBUG) {
Trace.println("Create node for " + method + "hash code " + method.hashCode());
}
registerNode(k, result);
} else {
throw CancelException.make("Too many nodes");
@ -139,10 +123,8 @@ public class ExplicitCallGraph extends BasicCallGraph implements BytecodeConstan
public class ExplicitNode extends NodeImpl {
/**
* A Mapping from call site program counter (int) -> Object, where Object is
* a CGNode if we've discovered exactly one target for the site, or an
* IntSet of node numbers if we've discovered more than one target for the
* site.
* A Mapping from call site program counter (int) -> Object, where Object is a CGNode if we've discovered exactly
* one target for the site, or an IntSet of node numbers if we've discovered more than one target for the site.
*/
protected final SparseVector<Object> targets = new SparseVector<Object>();
@ -198,7 +180,6 @@ public class ExplicitCallGraph extends BasicCallGraph implements BytecodeConstan
});
}
protected int getNumberOfTargets(CallSiteReference site) {
Object result = targets.get(site.getProgramCounter());
@ -350,8 +331,8 @@ public class ExplicitCallGraph extends BasicCallGraph implements BytecodeConstan
/**
* for each y, the {x | (x,y) is an edge)
*/
final IBinaryNaturalRelation predecessors = new BasicNaturalRelation(
new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY }, BasicNaturalRelation.SIMPLE);
final IBinaryNaturalRelation predecessors = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY },
BasicNaturalRelation.SIMPLE);
public IntSet getSuccNodeNumbers(CGNode node) {
ExplicitNode n = (ExplicitNode) node;