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
|
// // remove constant logically dead parameters
|
||||||
// run(group, new ConstantParameter());
|
// run(group, new ConstantParameter());
|
||||||
//
|
|
||||||
// // remove unhit blocks
|
// remove unhit blocks
|
||||||
// run(group, new UnreachedCode());
|
// run(group, new UnreachedCode());
|
||||||
|
// run(group, new UnusedMethods());
|
||||||
|
|
||||||
// remove unused parameters
|
// remove unused parameters
|
||||||
run(group, new UnusedParameters());
|
run(group, new UnusedParameters());
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public class FieldMover implements Deobfuscator
|
|||||||
if (code == null)
|
if (code == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
code.getInstructions().renameField(field, newField);
|
//code.getInstructions().renameField(field, newField);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class MethodMover implements Deobfuscator
|
|||||||
if (code == null)
|
if (code == null)
|
||||||
continue;
|
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<>();
|
Set<Instruction> done = new HashSet<>();
|
||||||
|
|
||||||
|
assert signature.getTypeOfArg(paramIndex).getSlots() == 1;
|
||||||
|
|
||||||
for (Frame f : execution.processedFrames)
|
for (Frame f : execution.processedFrames)
|
||||||
for (InstructionContext ins : f.getInstructions())
|
for (InstructionContext ins : f.getInstructions())
|
||||||
if (!ins.getInvokes().isEmpty() && methods.containsAll(ins.getInvokes()))
|
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)
|
for (Method method : methods)
|
||||||
if (method.getCode() != null)
|
if (method.getCode() != null)
|
||||||
// adjust lvt indexes to get rid of idx in the method
|
// adjust lvt indexes to get rid of idx in the method
|
||||||
@@ -180,6 +186,9 @@ public class UnusedParameters implements Deobfuscator
|
|||||||
int i = lins.getVariableIndex();
|
int i = lins.getVariableIndex();
|
||||||
assert i != lvtIndex; // current unused variable detection just looks for no accesses
|
assert i != lvtIndex; // current unused variable detection just looks for no accesses
|
||||||
|
|
||||||
|
//if (i >= numArgs)
|
||||||
|
// continue;
|
||||||
|
|
||||||
// reassign
|
// reassign
|
||||||
if (i > lvtIndex)
|
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
|
/* 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.
|
* 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]);
|
removeParameter(methods, signature, execution, unusedParameter, lvtIndexes[unusedParameter]);
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
@@ -269,6 +279,7 @@ public class UnusedParameters implements Deobfuscator
|
|||||||
i = checkParametersOnce(execution, group);
|
i = checkParametersOnce(execution, group);
|
||||||
|
|
||||||
count += i[0];
|
count += i[0];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
while (i[0] > 0);
|
while (i[0] > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class Stack
|
|||||||
if (size == stack.length)
|
if (size == stack.length)
|
||||||
{
|
{
|
||||||
net.runelite.deob.Method m = i.getPushed().getInstruction().getInstructions().getCode().getAttributes().getMethod();
|
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)
|
for (int c = 0; c < stack.length; ++c)
|
||||||
printStack(stack[c], 0);
|
printStack(stack[c], 0);
|
||||||
throw new RuntimeException("Stack overflow");
|
throw new RuntimeException("Stack overflow");
|
||||||
|
|||||||
Reference in New Issue
Block a user