remove output if resolved

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@377 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 8ea042a516
commit 1b3ed2af2b
  1. 25
      jode/jode/flow/SpecialBlock.java

@ -29,6 +29,7 @@ public class SpecialBlock extends StructuredBlock {
public static int SWAP = 1; public static int SWAP = 1;
public static int POP = 2; public static int POP = 2;
private static String[] output = { "DUP", "SWAP", "POP" }; private static String[] output = { "DUP", "SWAP", "POP" };
private boolean resolved = false;
/** /**
* The type, one of DUP or SWAP * The type, one of DUP or SWAP
@ -64,13 +65,21 @@ public class SpecialBlock extends StructuredBlock {
return super.mapStackToLocal(after); return super.mapStackToLocal(after);
} }
public void removePush() {
resolved = true;
super.removePush();
}
public void dumpInstruction(TabbedPrintWriter writer) public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException throws java.io.IOException
{ {
writer.println(output[type] if (!resolved)
+ ((count == 1) ? "" : "2") writer.println(output[type]
+ ((depth == 0) ? "" : "_X"+depth)); + ((count == 1) ? "" : "2")
+ ((depth == 0) ? "" : "_X"+depth));
else
writer.println("/* warning: unusual code */");
} }
public boolean doTransformations() { public boolean doTransformations() {
@ -184,7 +193,9 @@ public class SpecialBlock extends StructuredBlock {
newIfThen.setThenBlock(new EmptyBlock()); newIfThen.setThenBlock(new EmptyBlock());
newBlock = newIfThen; newBlock = newIfThen;
} }
newBlock.moveDefinitions(last.outer, newBlock); // We don't move the definitions of the special block, but
// it shouldn't have any.
newBlock.moveDefinitions(last.outer, last);
newBlock.moveJump(jump); newBlock.moveJump(jump);
if (this == last) { if (this == last) {
newBlock.replace(last.outer); newBlock.replace(last.outer);
@ -202,6 +213,8 @@ public class SpecialBlock extends StructuredBlock {
Expression previnstr = prevprev.getInstruction(); Expression previnstr = prevprev.getInstruction();
if (previnstr.getType().stackSize() == 1 if (previnstr.getType().stackSize() == 1
&& instr.getType().stackSize() == 1 && instr.getType().stackSize() == 1
&& (previnstr.getType().getSuperType()
.isOfType(instr.getType().getSuperType()))
&& count == 2) { && count == 2) {
/* compare two objects */ /* compare two objects */
@ -226,7 +239,3 @@ public class SpecialBlock extends StructuredBlock {
return false; return false;
} }
} }

Loading…
Cancel
Save