simplify also successing flow blocks on simplify()

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1033 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 26 years ago
parent 81cac56337
commit 4eac3b281e
  1. 25
      jode/jode/flow/FlowBlock.java

@ -32,9 +32,13 @@ import jode.util.SimpleSet;
///#ifdef JDK12 ///#ifdef JDK12
///import java.util.Map; ///import java.util.Map;
///import java.util.Iterator; ///import java.util.Iterator;
///import java.util.Set;
///import java.util.SimpleSet;
///#else ///#else
import jode.util.Map; import jode.util.Map;
import jode.util.Iterator; import jode.util.Iterator;
import jode.util.Set;
import jode.util.SimpleSet;
///#endif ///#endif
@ -1520,8 +1524,29 @@ public class FlowBlock {
block.makeDeclaration(declared); block.makeDeclaration(declared);
} }
/**
* Simplify all reachable flowblocks, that are not already
* simplified, i.e. that don't occur in doneSet.
*/
private void simplify(Set doneSet) {
if (doneSet.contains(this))
return;
doneSet.add(this);
block.simplify();
Iterator iter = successors.keySet().iterator();
while (iter.hasNext()) {
FlowBlock succ = (FlowBlock)iter.next();
succ.simplify(doneSet);
}
}
public void simplify() { public void simplify() {
if (successors.size() == 0) {
// optimize default path.
block.simplify(); block.simplify();
return;
}
simplify(new SimpleSet());
} }
/** /**

Loading…
Cancel
Save