while(!nodeset.isEmpty()) {
FlatNode fn=nodeset.iterator().next();
+ nodeset.remove(fn);
if (fn.kind()==FKind.FlatCondBranch&&((FlatCondBranch)fn).isLoopBranch()) {
FlatCondBranch fcb=(FlatCondBranch)fn;
loopbranchset.add(fcb);
propagateset(nodeset, table, fcb, fcb.getNext(1), null);
loopbranchset.add(fcb);
} else if (fn.kind()==FKind.FlatReturnNode) {
- exitset.addAll(table.get(fn));
+ if (table.containsKey(fn))
+ exitset.addAll(table.get(fn));
} else {
for(int i=0;i<fn.numNext();i++)
propagateset(nodeset, table, fn, fn.getNext(i), null);
if (table.containsKey(fn)) {
if (!table.containsKey(fnnext))
table.put(fnnext, new HashSet<FlatCondBranch>());
- if(!table.get(fnnext).containsAll(table.get(fn))) {
- table.get(fnnext).addAll(table.get(fn));
+ HashSet<FlatCondBranch> toadd=new HashSet<FlatCondBranch>();
+ toadd.addAll(table.get(fn));
+ if (toadd.contains(fnnext)) //can't propagate back to node
+ toadd.remove(fnnext);
+ if(!table.get(fnnext).containsAll(toadd)) {
+ table.get(fnnext).addAll(toadd);
enqueuechange=true;
}
}