Map field of invoked object too

This commit is contained in:
Adam
2016-02-13 18:02:20 -05:00
parent 66e9960596
commit bcc74c6256
4 changed files with 108 additions and 19 deletions

View File

@@ -166,8 +166,10 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
InvokeInterface otherIv = (InvokeInterface) other.getInstruction();
List<net.runelite.deob.Method> myMethods = this.getMethods(),
otherMethods = ((InvokeInterface) other.getInstruction()).getMethods();
otherMethods = otherIv.getMethods();
assert myMethods.size() == otherMethods.size();
@@ -196,6 +198,28 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
}
}
}
/* map field that was invoked on */
StackContext object1 = ctx.getPops().get(method.getNameAndType().getNumberOfArgs()),
object2 = other.getPops().get(otherIv.method.getNameAndType().getNumberOfArgs());
InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
{
GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
gf2 = (GetFieldInstruction) base2.getInstruction();
Field f1 = gf1.getMyField(),
f2 = gf2.getMyField();
if (f1 != null && f2 != null)
{
mapping.map(f1, f2);
}
}
}
@Override

View File

@@ -164,8 +164,10 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
InvokeSpecial otherIv = (InvokeSpecial) other.getInstruction();
List<net.runelite.deob.Method> myMethods = this.getMethods(),
otherMethods = ((InvokeSpecial) other.getInstruction()).getMethods();
otherMethods = otherIv.getMethods();
List<net.runelite.deob.Method> m1 = this.myMethods;
List<net.runelite.deob.Method> m2 = ((InvokeSpecial) other.getInstruction()).myMethods;
@@ -196,6 +198,28 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
}
}
}
/* map field that was invoked on */
StackContext object1 = ctx.getPops().get(method.getNameAndType().getNumberOfArgs()),
object2 = other.getPops().get(otherIv.method.getNameAndType().getNumberOfArgs());
InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
{
GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
gf2 = (GetFieldInstruction) base2.getInstruction();
Field f1 = gf1.getMyField(),
f2 = gf2.getMyField();
if (f1 != null && f2 != null)
{
mapping.map(f1, f2);
}
}
}
@Override

View File

@@ -183,9 +183,12 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
List<net.runelite.deob.Method> myMethods = this.getMethods(),
otherMethods = ((InvokeVirtual) other.getInstruction()).getMethods();
InvokeVirtual otherIv = (InvokeVirtual) other.getInstruction();
List<net.runelite.deob.Method> myMethods = this.getMethods(),
otherMethods = otherIv.getMethods();
assert method.getNameAndType().getDescriptor().equals(otherIv.method.getNameAndType().getDescriptor());
assert myMethods.size() == otherMethods.size();
for (int i = 0; i < myMethods.size(); ++i)
@@ -222,6 +225,28 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
}
}
}
/* map field that was invoked on */
StackContext object1 = ctx.getPops().get(method.getNameAndType().getNumberOfArgs()),
object2 = other.getPops().get(otherIv.method.getNameAndType().getNumberOfArgs());
InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
{
GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
gf2 = (GetFieldInstruction) base2.getInstruction();
Field f1 = gf1.getMyField(),
f2 = gf2.getMyField();
if (f1 != null && f2 != null)
{
mapping.map(f1, f2);
}
}
}
@Override