Sort stuff isnt required for graph stuff anymore, it was causing order of classes to load to be different when comparing obfuscated jar vs rebuilt jar, which caused class children order to be different, which affects renamer searching for bases which broke the issame comparison in invokeinterface.

This commit is contained in:
Adam
2016-03-10 19:35:55 -05:00
parent d130a2fb4f
commit 575deaf992
4 changed files with 13 additions and 29 deletions

View File

@@ -48,7 +48,7 @@ public class ClassGroup
public void initialize()
{
sort();
//sort();
buildClassGraph();
lookup();
}

View File

@@ -19,12 +19,10 @@ import net.runelite.deob.signature.Signature;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.runelite.deob.Field;
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
import net.runelite.deob.deobfuscators.Renamer;
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
@@ -41,6 +39,12 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
{
super(instructions, type, pc);
}
@Override
public String toString()
{
return "invokeinterface " + method + " in " + this.getInstructions().getCode().getAttributes().getMethod() + " at pc 0x" + Integer.toHexString(this.getPc());
}
@Override
public void load(DataInputStream is) throws IOException

View File

@@ -19,9 +19,7 @@ import net.runelite.deob.signature.Signature;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.runelite.deob.Field;
@@ -108,36 +106,12 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
frame.addInstructionContext(ins);
}
// find the possible methods this instruction might be invoking. we can't know for sure
// which method is being invoked without tracking the types of objects in fields and when
// passed in parameters/return values.
@Override
public List<net.runelite.deob.Method> getMethods()
{
return myMethods != null ? myMethods : Arrays.asList();
}
private void findMethodFromClass(Set<ClassFile> visited, List<net.runelite.deob.Method> list, ClassFile clazz)
{
if (visited.contains(clazz))
return;
visited.add(clazz);
ClassFile parent = clazz.getParent();
if (parent != null)
findMethodFromClass(visited, list, parent);
for (ClassFile cf : clazz.getInterfaces().getMyInterfaces())
findMethodFromClass(visited, list, cf);
net.runelite.deob.Method m = clazz.findMethod(method.getNameAndType());
if (m != null && !list.contains(m))
list.add(m);
for (ClassFile cf : clazz.getChildren())
findMethodFromClass(visited, list, cf);
}
@Override
public void removeParameter(int idx)
{

View File

@@ -34,6 +34,12 @@ public class InterfaceMethod extends PoolEntry
{
return new InterfaceMethod(clazz.copy(), nat.copy());
}
@Override
public java.lang.String toString()
{
return clazz + "." + nat;
}
@Override
public void resolve(ConstantPool pool)