bug workaround for troubling control dependence case
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1403 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
2ec2101644
commit
56cda5a9e2
|
@ -164,7 +164,7 @@ public class PDG extends SlowSparseNumberedGraph<Statement> {
|
||||||
} else {
|
} else {
|
||||||
SSAInstruction s = ir.getInstructions()[bb.getLastInstructionIndex()];
|
SSAInstruction s = ir.getInstructions()[bb.getLastInstructionIndex()];
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
// should have no control dependence successors.
|
// should have no control dependent successors.
|
||||||
// leave src null.
|
// leave src null.
|
||||||
} else {
|
} else {
|
||||||
src = ssaInstruction2Statement(s);
|
src = ssaInstruction2Statement(s);
|
||||||
|
@ -180,15 +180,19 @@ public class PDG extends SlowSparseNumberedGraph<Statement> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add edges for every control-dependent statement in the IR
|
// add edges for every control-dependent statement in the IR, if there are
|
||||||
for (Iterator<? extends IBasicBlock> succ = cdg.getSuccNodes(bb); succ.hasNext();) {
|
// any
|
||||||
IBasicBlock bb2 = succ.next();
|
// control-dependent successors
|
||||||
for (Iterator<? extends IInstruction> it2 = bb2.iterator(); it2.hasNext();) {
|
if (src != null) {
|
||||||
SSAInstruction st = (SSAInstruction) it2.next();
|
for (Iterator<? extends IBasicBlock> succ = cdg.getSuccNodes(bb); succ.hasNext();) {
|
||||||
if (st != null) {
|
IBasicBlock bb2 = succ.next();
|
||||||
Statement dest = ssaInstruction2Statement(st);
|
for (Iterator<? extends IInstruction> it2 = bb2.iterator(); it2.hasNext();) {
|
||||||
assert src != null;
|
SSAInstruction st = (SSAInstruction) it2.next();
|
||||||
addEdge(src, dest);
|
if (st != null) {
|
||||||
|
Statement dest = ssaInstruction2Statement(st);
|
||||||
|
assert src != null;
|
||||||
|
addEdge(src, dest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +206,7 @@ public class PDG extends SlowSparseNumberedGraph<Statement> {
|
||||||
if (cdg.getPredNodeCount(bb) == 0) {
|
if (cdg.getPredNodeCount(bb) == 0) {
|
||||||
// this is control dependent on the method entry.
|
// this is control dependent on the method entry.
|
||||||
for (IInstruction s : bb) {
|
for (IInstruction s : bb) {
|
||||||
SSAInstruction st = (SSAInstruction)s;
|
SSAInstruction st = (SSAInstruction) s;
|
||||||
Statement dest = ssaInstruction2Statement(st);
|
Statement dest = ssaInstruction2Statement(st);
|
||||||
addEdge(methodEntry, dest);
|
addEdge(methodEntry, dest);
|
||||||
}
|
}
|
||||||
|
@ -603,9 +607,6 @@ public class PDG extends SlowSparseNumberedGraph<Statement> {
|
||||||
* Wrap an SSAInstruction in a Statement
|
* Wrap an SSAInstruction in a Statement
|
||||||
*/
|
*/
|
||||||
Statement ssaInstruction2Statement(SSAInstruction s) {
|
Statement ssaInstruction2Statement(SSAInstruction s) {
|
||||||
if (s == null) {
|
|
||||||
System.err.println("XXX");
|
|
||||||
}
|
|
||||||
assert s != null;
|
assert s != null;
|
||||||
if (s instanceof SSAPhiInstruction) {
|
if (s instanceof SSAPhiInstruction) {
|
||||||
SSAPhiInstruction phi = (SSAPhiInstruction) s;
|
SSAPhiInstruction phi = (SSAPhiInstruction) s;
|
||||||
|
@ -806,7 +807,7 @@ public class PDG extends SlowSparseNumberedGraph<Statement> {
|
||||||
*/
|
*/
|
||||||
private void addParamPassingStatements(int callIndex, Map<CGNode, OrdinalSet<PointerKey>> ref) {
|
private void addParamPassingStatements(int callIndex, Map<CGNode, OrdinalSet<PointerKey>> ref) {
|
||||||
|
|
||||||
SSAAbstractInvokeInstruction call = (SSAAbstractInvokeInstruction)node.getIR().getInstructions()[callIndex];
|
SSAAbstractInvokeInstruction call = (SSAAbstractInvokeInstruction) node.getIR().getInstructions()[callIndex];
|
||||||
Collection<Statement> params = MapUtil.findOrCreateSet(callerParamStatements, call.getCallSite());
|
Collection<Statement> params = MapUtil.findOrCreateSet(callerParamStatements, call.getCallSite());
|
||||||
Collection<Statement> rets = MapUtil.findOrCreateSet(callerReturnStatements, call.getCallSite());
|
Collection<Statement> rets = MapUtil.findOrCreateSet(callerReturnStatements, call.getCallSite());
|
||||||
for (int j = 0; j < call.getNumberOfUses(); j++) {
|
for (int j = 0; j < call.getNumberOfUses(); j++) {
|
||||||
|
|
Loading…
Reference in New Issue