Only re-generate pool info for get/put/invoke instructions if something changes, otherwise it uses the pool info of the resolved field which isn't always the same
This commit is contained in:
@@ -106,6 +106,10 @@ public class GetField extends Instruction implements GetFieldInstruction
|
|||||||
public void regeneratePool()
|
public void regeneratePool()
|
||||||
{
|
{
|
||||||
if (myField != null)
|
if (myField != null)
|
||||||
field = myField.getPoolField();
|
// only rebuild field info if the field has changed.
|
||||||
|
// otherwise it will rewrite the pool field into to something
|
||||||
|
// different if the field was deep
|
||||||
|
if (getMyField() != myField)
|
||||||
|
field = myField.getPoolField();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ public class GetStatic extends Instruction implements GetFieldInstruction
|
|||||||
public void regeneratePool()
|
public void regeneratePool()
|
||||||
{
|
{
|
||||||
if (myField != null)
|
if (myField != null)
|
||||||
field = myField.getPoolField();
|
if (getMyField() != myField)
|
||||||
|
field = myField.getPoolField();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,26 +146,29 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
|
|||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private List<net.runelite.deob.Method> lookupMethods()
|
||||||
public void lookup()
|
|
||||||
{
|
{
|
||||||
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
|
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
|
||||||
|
|
||||||
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
|
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
|
||||||
if (otherClass == null)
|
if (otherClass == null)
|
||||||
return; // not our class
|
return null; // not our class
|
||||||
|
|
||||||
// look up this method in this class and anything that inherits from it
|
return Renamer.getVirutalMethods(otherClass.findMethod(method.getNameAndType()));
|
||||||
//List<net.runelite.deob.Method> list = new ArrayList<>();
|
}
|
||||||
//findMethodFromClass(list, otherClass);
|
|
||||||
myMethods = Renamer.getVirutalMethods(otherClass.findMethod(method.getNameAndType()));
|
@Override
|
||||||
|
public void lookup()
|
||||||
|
{
|
||||||
|
myMethods = lookupMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void regeneratePool()
|
public void regeneratePool()
|
||||||
{
|
{
|
||||||
if (myMethods != null && !myMethods.isEmpty())
|
if (myMethods != null && !myMethods.isEmpty())
|
||||||
method = myMethods.get(0).getPoolInterfaceMethod(); // is this right?
|
if (!myMethods.equals(lookupMethods()))
|
||||||
|
method = myMethods.get(0).getPoolInterfaceMethod(); // is this right?
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import net.runelite.deob.execution.Value;
|
|||||||
public class InvokeStatic extends Instruction implements InvokeInstruction
|
public class InvokeStatic extends Instruction implements InvokeInstruction
|
||||||
{
|
{
|
||||||
private Method method;
|
private Method method;
|
||||||
private List<net.runelite.deob.Method> myMethods;
|
private net.runelite.deob.Method myMethod;
|
||||||
|
|
||||||
public InvokeStatic(Instructions instructions, InstructionType type, int pc)
|
public InvokeStatic(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
@@ -69,7 +69,7 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
|||||||
@Override
|
@Override
|
||||||
public List<net.runelite.deob.Method> getMethods()
|
public List<net.runelite.deob.Method> getMethods()
|
||||||
{
|
{
|
||||||
return myMethods != null ? myMethods : Arrays.asList();
|
return myMethod != null ? Arrays.asList(myMethod) : Arrays.asList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -141,28 +141,32 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
|||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private net.runelite.deob.Method lookupMethod()
|
||||||
public void lookup()
|
|
||||||
{
|
{
|
||||||
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
|
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
|
||||||
|
|
||||||
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
|
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
|
||||||
if (otherClass == null)
|
if (otherClass == null)
|
||||||
return; // not our class
|
return null; // not our class
|
||||||
|
|
||||||
net.runelite.deob.Method other = otherClass.findMethodDeepStatic(method.getNameAndType());
|
net.runelite.deob.Method other = otherClass.findMethodDeepStatic(method.getNameAndType());
|
||||||
assert other != null;
|
assert other != null;
|
||||||
|
|
||||||
List<net.runelite.deob.Method> list = new ArrayList<>();
|
return other;
|
||||||
list.add(other);
|
}
|
||||||
myMethods = list;
|
|
||||||
|
@Override
|
||||||
|
public void lookup()
|
||||||
|
{
|
||||||
|
myMethod = lookupMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void regeneratePool()
|
public void regeneratePool()
|
||||||
{
|
{
|
||||||
if (myMethods != null && !myMethods.isEmpty())
|
if (myMethod != null)
|
||||||
method = myMethods.get(0).getPoolMethod();
|
if (myMethod != lookupMethod())
|
||||||
|
method = myMethod.getPoolMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import net.runelite.deob.Field;
|
import net.runelite.deob.Field;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
||||||
import net.runelite.deob.deobfuscators.Renamer;
|
import net.runelite.deob.deobfuscators.Renamer;
|
||||||
@@ -140,33 +139,37 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
|
|||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private List<net.runelite.deob.Method> lookupMethods()
|
||||||
public void lookup()
|
|
||||||
{
|
{
|
||||||
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
|
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
|
||||||
|
|
||||||
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
|
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
|
||||||
if (otherClass == null)
|
if (otherClass == null)
|
||||||
return; // not our class
|
return null; // not our class
|
||||||
|
|
||||||
// when I recompile classes I can see the class of invokevirtuals methods change, get all methods
|
// when I recompile classes I can see the class of invokevirtuals methods change, get all methods
|
||||||
|
|
||||||
//List<net.runelite.deob.Method> list = new ArrayList<>();
|
|
||||||
//findMethodFromClass(new HashSet<>(), list, otherClass);
|
|
||||||
net.runelite.deob.Method m = otherClass.findMethodDeep(method.getNameAndType());
|
net.runelite.deob.Method m = otherClass.findMethodDeep(method.getNameAndType());
|
||||||
if (m == null)
|
if (m == null)
|
||||||
{
|
{
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
myMethods = Renamer.getVirutalMethods(m);
|
return Renamer.getVirutalMethods(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lookup()
|
||||||
|
{
|
||||||
|
myMethods = lookupMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void regeneratePool()
|
public void regeneratePool()
|
||||||
{
|
{
|
||||||
if (myMethods != null && !myMethods.isEmpty())
|
if (myMethods != null && !myMethods.isEmpty())
|
||||||
method = myMethods.get(0).getPoolMethod(); // is this right?
|
if (!myMethods.equals(lookupMethods()))
|
||||||
|
method = myMethods.get(0).getPoolMethod(); // is this right?
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import net.runelite.deob.Method;
|
import net.runelite.deob.Method;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
|
||||||
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
||||||
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
||||||
@@ -97,7 +96,8 @@ public class PutField extends Instruction implements SetFieldInstruction
|
|||||||
public void regeneratePool()
|
public void regeneratePool()
|
||||||
{
|
{
|
||||||
if (myField != null)
|
if (myField != null)
|
||||||
field = myField.getPoolField();
|
if (getMyField() != myField)
|
||||||
|
field = myField.getPoolField();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import net.runelite.deob.Method;
|
import net.runelite.deob.Method;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
|
||||||
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
||||||
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
||||||
|
|
||||||
@@ -95,7 +94,8 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
|||||||
public void regeneratePool()
|
public void regeneratePool()
|
||||||
{
|
{
|
||||||
if (myField != null)
|
if (myField != null)
|
||||||
field = myField.getPoolField();
|
if (getMyField() != myField)
|
||||||
|
field = myField.getPoolField();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user