diff --git a/src/main/java/info/sigterm/deob/attributes/code/Instructions.java b/src/main/java/info/sigterm/deob/attributes/code/Instructions.java index d88ec776a9..524b6bef12 100644 --- a/src/main/java/info/sigterm/deob/attributes/code/Instructions.java +++ b/src/main/java/info/sigterm/deob/attributes/code/Instructions.java @@ -148,14 +148,19 @@ public class Instructions out.writeInt(ba.length); out.write(ba); } - - public void buildJumpGraph() + + public void clearJumpGraph() { for (Instruction i : instructions) { i.jump.clear(); i.from.clear(); } + } + + public void buildJumpGraph() + { + clearJumpGraph(); for (Instruction i : instructions) if (i instanceof JumpingInstruction) diff --git a/src/main/java/info/sigterm/deob/deobfuscators/Jumps.java b/src/main/java/info/sigterm/deob/deobfuscators/Jumps.java index c4a1864bfd..5a31b5af99 100644 --- a/src/main/java/info/sigterm/deob/deobfuscators/Jumps.java +++ b/src/main/java/info/sigterm/deob/deobfuscators/Jumps.java @@ -19,6 +19,7 @@ public class Jumps int count = 0; for (ClassFile cf : group.getClasses()) { + methods: for (Method m : new ArrayList<>(cf.getMethods().getMethods())) { if (m.getCode() == null) @@ -50,40 +51,30 @@ public class Jumps List ilist = ins.getInstructions(); - // remove instructions - for (Instruction in : block.instructions) - ilist.remove(in); + // clear jump graph + //ins.clearBlocks(); + ins.clearJumpGraph(); - int index = ilist.indexOf(from); - - assert from.block != block; - from.block = null; - - // move instructions which jump here to jump to block.begin - for (Instruction in : from.from) - { - assert in.jump.contains(from); - assert !in.jump.contains(block.begin); - - in.jump.remove(from); - - in.jump.add(block.begin); - block.begin.from.add(in); - } - from.from.clear(); - - // .replace ins + // 'from' goes away and is replaced with block.begin for (Instruction in : ilist) in.replace(from, block.begin); - for (info.sigterm.deob.attributes.code.Exception e : m.getCode().getExceptions().getExceptions()) - e.replace(from, block.begin); + // remove instructions + for (Instruction in : block.instructions) + { + boolean b = ilist.remove(in); + assert b; + } - ins.remove(from); // remove jump + // store pos of from + int index = ilist.indexOf(from); + ilist.remove(from); - // insert instructions from block where jump was + // insert instructions where 'from' was for (Instruction in : block.instructions) ilist.add(index++, in); + + continue methods; } } }