Unused params is causing problems after being run a few times :(
This commit is contained in:
@@ -54,9 +54,10 @@ public class Deob
|
||||
//
|
||||
// // remove constant logically dead parameters
|
||||
// run(group, new ConstantParameter());
|
||||
//
|
||||
// // remove unhit blocks
|
||||
|
||||
// remove unhit blocks
|
||||
// run(group, new UnreachedCode());
|
||||
// run(group, new UnusedMethods());
|
||||
|
||||
// remove unused parameters
|
||||
run(group, new UnusedParameters());
|
||||
|
||||
@@ -168,7 +168,7 @@ public class FieldMover implements Deobfuscator
|
||||
if (code == null)
|
||||
continue;
|
||||
|
||||
code.getInstructions().renameField(field, newField);
|
||||
//code.getInstructions().renameField(field, newField);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public class MethodMover implements Deobfuscator
|
||||
if (code == null)
|
||||
continue;
|
||||
|
||||
code.getInstructions().renameMethod(method, newMethod);
|
||||
//code.getInstructions().renameMethod(method, newMethod);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ public class UnusedParameters implements Deobfuscator
|
||||
{
|
||||
Set<Instruction> done = new HashSet<>();
|
||||
|
||||
assert signature.getTypeOfArg(paramIndex).getSlots() == 1;
|
||||
|
||||
for (Frame f : execution.processedFrames)
|
||||
for (InstructionContext ins : f.getInstructions())
|
||||
if (!ins.getInvokes().isEmpty() && methods.containsAll(ins.getInvokes()))
|
||||
@@ -168,6 +170,10 @@ public class UnusedParameters implements Deobfuscator
|
||||
}
|
||||
}
|
||||
|
||||
int numArgs = signature.size();
|
||||
if (methods.size() > 1 || !methods.get(0).isStatic())
|
||||
++numArgs;
|
||||
|
||||
for (Method method : methods)
|
||||
if (method.getCode() != null)
|
||||
// adjust lvt indexes to get rid of idx in the method
|
||||
@@ -180,6 +186,9 @@ public class UnusedParameters implements Deobfuscator
|
||||
int i = lins.getVariableIndex();
|
||||
assert i != lvtIndex; // current unused variable detection just looks for no accesses
|
||||
|
||||
//if (i >= numArgs)
|
||||
// continue;
|
||||
|
||||
// reassign
|
||||
if (i > lvtIndex)
|
||||
{
|
||||
@@ -243,6 +252,7 @@ public class UnusedParameters implements Deobfuscator
|
||||
/* removing the parameter can't cause collisions on other (overloaded) methods because prior to this we rename
|
||||
* all classes/fields/methods to have unique names.
|
||||
*/
|
||||
System.out.println("Removing parameter " + unusedParameter + " from " + methods.get(0).getName());
|
||||
removeParameter(methods, signature, execution, unusedParameter, lvtIndexes[unusedParameter]);
|
||||
|
||||
++count;
|
||||
@@ -269,6 +279,7 @@ public class UnusedParameters implements Deobfuscator
|
||||
i = checkParametersOnce(execution, group);
|
||||
|
||||
count += i[0];
|
||||
break;
|
||||
}
|
||||
while (i[0] > 0);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Stack
|
||||
if (size == stack.length)
|
||||
{
|
||||
net.runelite.deob.Method m = i.getPushed().getInstruction().getInstructions().getCode().getAttributes().getMethod();
|
||||
System.err.println("in " + m.getMethods().getClassFile().getName() + " method " + m.getNameAndType().getName());
|
||||
System.err.println("stack overflow in " + m.getMethods().getClassFile().getName() + " method " + m.getNameAndType().getName());
|
||||
for (int c = 0; c < stack.length; ++c)
|
||||
printStack(stack[c], 0);
|
||||
throw new RuntimeException("Stack overflow");
|
||||
|
||||
Reference in New Issue
Block a user