Remove unused parameters

This commit is contained in:
Adam
2015-06-13 11:01:46 -04:00
parent eb986ba708
commit a677e64aac
106 changed files with 1229 additions and 228 deletions

View File

@@ -7,7 +7,8 @@ import java.util.List;
public class Execution
{
private ClassGroup group;
public List<Frame> frames = new ArrayList<>();
public List<Frame> frames = new ArrayList<>(),
processedFrames = new ArrayList<>();
public Execution(ClassGroup group)
{
@@ -21,9 +22,9 @@ public class Execution
while (!frames.isEmpty())
{
Frame frame = frames.remove(0);
System.out.println("Executing frame " + frame);
++fcount;
frame.execute();
processedFrames.add(frame);
}
return fcount;

View File

@@ -103,6 +103,11 @@ public class Frame
instructions.add(i);
}
public List<InstructionContext> getInstructions()
{
return instructions;
}
public void execute()
{
Instructions ins = method.getCode().getInstructions();
@@ -121,7 +126,6 @@ public class Frame
try
{
i.execute(this);
System.out.println(i.getDesc(this));
}
catch (Throwable ex)
{
@@ -185,9 +189,4 @@ public class Frame
doJump(from, to);
this.pc = pc;
}
public Collection<Exception> getExceptionHandlers()
{
return method.getCode().getExceptions().getHandlersForPc(this.pc);
}
}

View File

@@ -39,4 +39,15 @@ public class InstructionContext
{
return pops;
}
public void removeStack(int idx)
{
// idx 0 is top of the stack, 1 is one under
// stack contexts are added to 'pops' in the order that they are popped from the stack,
// so just remove at index idx
StackContext ctx = pops.remove(idx);
// start recursively removing
ctx.removeStack();
}
}

View File

@@ -40,7 +40,6 @@ public class Stack
assert !i.getType().type.equals("V");
System.out.println("PUSH context " + i.getType().type + " from + " + i.getIns().getInstruction());
stack[size] = i;
++size;
}
@@ -50,9 +49,6 @@ public class Stack
if (size <= 0)
throw new RuntimeException("Stack underflow");
System.out.println("POP");
if (size == 1)
System.out.println("STACK SIZE IS NOW ZERO");
return stack[--size];
}

View File

@@ -32,4 +32,18 @@ public class StackContext
{
return type;
}
// remove this object from the stack
public void removeStack()
{
// remove the instruction which pushed this
if (!ic.getInstruction().removeStack())
// dup will return false as the other objects on the stack below this are necessary
// for the other branch.
return;
// remove from the stack things this instruction read
for (StackContext ctx : ic.getPops())
ctx.removeStack();
}
}

View File

@@ -13,11 +13,9 @@ public class Type
public Type(info.sigterm.deob.signature.Type t)
{
String before = t.getType();
type = asmTypeToClass(t.getType());
for (int i = 0; i < t.getArrayDims(); ++i)
type = type + "[]";
System.out.println(before + " -> " + type);
}
public Type toStackType()