Unused params test, this is very slow.

This commit is contained in:
Adam
2016-03-24 18:38:58 -04:00
parent b16fbd712e
commit bcbc87994a
4 changed files with 59 additions and 9 deletions

View File

@@ -153,8 +153,12 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
if (otherClass == null)
return null; // not our class
net.runelite.asm.Method m = otherClass.findMethod(method.getNameAndType());
if (m == null)
return null;
return Renamer.getVirutalMethods(otherClass.findMethod(method.getNameAndType()));
return Renamer.getVirutalMethods(m);
}
@Override

View File

@@ -151,9 +151,7 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
net.runelite.asm.Method m = otherClass.findMethodDeep(method.getNameAndType());
if (m == null)
{
return null;
}
return Renamer.getVirutalMethods(m);
}

View File

@@ -206,7 +206,7 @@ public class UnusedParameters implements Deobfuscator
method.arguments.remove(paramIndex);
}
private int[] checkParametersOnce(Execution execution, ClassGroup group)
private int checkParametersOnce(Execution execution, ClassGroup group)
{
// removing parameters shifts the others around which is annoying.
// if more than one is unused, we'll just remove the one
@@ -263,14 +263,15 @@ public class UnusedParameters implements Deobfuscator
break;
}
}
return new int[] { count };
return count;
}
private int count;
@Override
public void run(ClassGroup group)
{
int count = 0;
int[] i;
int i;
do
{
group.buildClassGraph();
@@ -281,10 +282,15 @@ public class UnusedParameters implements Deobfuscator
i = checkParametersOnce(execution, group);
count += i[0];
count += i;
}
while (i[0] > 0);
while (i > 0);
System.out.println("Removed " + count + " unused parameters");
}
public int getCount()
{
return count;
}
}