Instruction clone wasnt creating new jump lists...

This commit is contained in:
Adam
2015-11-10 20:39:17 -05:00
parent 782fa9f70a
commit be1d5ed010
4 changed files with 12 additions and 4 deletions

View File

@@ -33,14 +33,21 @@ public abstract class Instruction implements Cloneable
@Override @Override
public Instruction clone() public Instruction clone()
{ {
Instruction i;
try try
{ {
return (Instruction) super.clone(); i = (Instruction) super.clone();
} }
catch (CloneNotSupportedException ex) catch (CloneNotSupportedException ex)
{ {
throw new RuntimeException(); throw new RuntimeException();
} }
i.block = null;
i.from = new ArrayList<>();
i.jump = new ArrayList<>();
return i;
} }
public void load(DataInputStream is) throws IOException public void load(DataInputStream is) throws IOException

View File

@@ -15,6 +15,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class LookupSwitch extends Instruction implements JumpingInstruction public class LookupSwitch extends Instruction implements JumpingInstruction
{ {
@@ -144,6 +145,6 @@ public class LookupSwitch extends Instruction implements JumpingInstruction
for (Instruction i : branchi) for (Instruction i : branchi)
list.add(i); list.add(i);
list.add(defi); list.add(defi);
return list; return list.stream().distinct().collect(Collectors.toList());
} }
} }

View File

@@ -14,6 +14,7 @@ import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class TableSwitch extends Instruction implements JumpingInstruction public class TableSwitch extends Instruction implements JumpingInstruction
{ {
@@ -140,6 +141,6 @@ public class TableSwitch extends Instruction implements JumpingInstruction
for (Instruction i : branchi) for (Instruction i : branchi)
list.add(i); list.add(i);
list.add(defi); list.add(defi);
return list; return list.stream().distinct().collect(Collectors.toList());
} }
} }

View File

@@ -99,7 +99,6 @@ public class MethodInliner implements Deobfuscator
assert ins.getInstructions().get(invokeIdx).getInstructions() == ins; assert ins.getInstructions().get(invokeIdx).getInstructions() == ins;
int lvtIndex = code.getMaxLocals(), int lvtIndex = code.getMaxLocals(),
//startLvtIndex = lvtIndex,
theirLocals = invokedMethod.getCode().getMaxLocals(); theirLocals = invokedMethod.getCode().getMaxLocals();
if (lvtIndex + theirLocals > 127) if (lvtIndex + theirLocals > 127)