remove stack of ifs in illegal state ex deob, get rid of using pcs in

frame to execute, need to remove more of this later, make jumps jump to
instructions, doesn't yet work
This commit is contained in:
Adam
2015-06-20 17:56:46 -04:00
parent 98d85c646b
commit 713db7777f
17 changed files with 116 additions and 45 deletions
@@ -99,12 +99,19 @@ public class Instructions
public void buildBlocks()
{
clearBlockGraph();
buildJumpGraph();
Block current = null;
for (Instruction i : instructions)
{
if (current == null)
if (current == null || !i.from.isEmpty())
{
// this caused exception errors?
if (current != null)
{
current.end = current.instructions.get(current.instructions.size() - 1);
blocks.add(current);
}
current = new Block();
current.begin = i;
findExceptionInfo(current, i);
@@ -50,7 +50,7 @@ public class AThrow extends Instruction
if (this.getPc() >= start.getPc() && this.getPc() < end.getPc())
{
Frame f = frame.dup();
f.jumpAbsolute(e.getHandler().getPc());
f.jump(e.getHandler());
}
}
@@ -63,7 +63,7 @@ public class CheckCast extends Instruction
f.addInstructionContext(ins);
f.jumpAbsolute(e.getHandler().getPc());
f.jump(e.getHandler());
}
}
}
@@ -56,7 +56,7 @@ public class Goto extends Instruction implements JumpingInstruction
@Override
public void execute(Frame e)
{
e.jump(offset);
e.jump(to);
}
@Override
@@ -46,7 +46,7 @@ public class GotoW extends Instruction implements JumpingInstruction
@Override
public void execute(Frame e)
{
e.jump(offset);
e.jump(to);
}
@Override
@@ -57,8 +57,10 @@ public class If extends Instruction implements JumpingInstruction
ins.pop(one, two);
frame.addInstructionContext(ins);
Frame other = frame.dup();
other.jump(offset);
other.jump(to);
}
@Override
@@ -59,7 +59,7 @@ public class If0 extends Instruction implements JumpingInstruction
frame.addInstructionContext(ins);
Frame other = frame.dup();
other.jump(offset);
other.jump(to);
}
@Override
@@ -110,7 +110,7 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
StackContext ctx = new StackContext(ins, new Type("java/lang/Exception"));
stack.push(ctx);
f.jumpAbsolute(e.getHandler().getPc());
f.jump(e.getHandler());
}
}
}
@@ -105,7 +105,7 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
StackContext ctx = new StackContext(ins, new Type("java/lang/Exception"));
stack.push(ctx);
f.jumpAbsolute(e.getHandler().getPc());
f.jump(e.getHandler());
}
}
}
@@ -102,7 +102,7 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
StackContext ctx = new StackContext(ins, new Type("java/lang/Exception"));
stack.push(ctx);
f.jumpAbsolute(e.getHandler().getPc());
f.jump(e.getHandler());
}
}
}
@@ -106,7 +106,7 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
StackContext ctx = new StackContext(ins, new Type("java/lang/Exception"));
stack.push(ctx);
f.jumpAbsolute(e.getHandler().getPc());
f.jump(e.getHandler());
}
}
}
@@ -107,13 +107,13 @@ public class LookupSwitch extends Instruction implements JumpingInstruction
frame.addInstructionContext(ins);
for (int i : branch)
for (Instruction i : branchi)
{
Frame other = frame.dup();
other.jump(i);
}
frame.jump(def);
frame.jump(defi);
}
@Override
@@ -104,13 +104,13 @@ public class TableSwitch extends Instruction implements JumpingInstruction
frame.addInstructionContext(ins);
for (int i : jumps)
for (Instruction i : branchi)
{
Frame other = frame.dup();
other.jump(i);
}
frame.jump(def);
frame.jump(defi);
}
@Override