thats weird, map static test passes on vmethod3054 vs vmethod2973
This commit is contained in:
@@ -121,12 +121,14 @@ import net.runelite.deob.attributes.code.instructions.IStore_3;
|
||||
import net.runelite.deob.attributes.code.instructions.ISub;
|
||||
import net.runelite.deob.attributes.code.instructions.IUShR;
|
||||
import net.runelite.deob.attributes.code.instructions.IXor;
|
||||
import net.runelite.deob.attributes.code.instructions.IfCmpEq;
|
||||
import net.runelite.deob.attributes.code.instructions.IfACmpEq;
|
||||
import net.runelite.deob.attributes.code.instructions.IfACmpNe;
|
||||
import net.runelite.deob.attributes.code.instructions.IfICmpEq;
|
||||
import net.runelite.deob.attributes.code.instructions.IfCmpGe;
|
||||
import net.runelite.deob.attributes.code.instructions.IfCmpGt;
|
||||
import net.runelite.deob.attributes.code.instructions.IfCmpLe;
|
||||
import net.runelite.deob.attributes.code.instructions.IfCmpLt;
|
||||
import net.runelite.deob.attributes.code.instructions.IfCmpNe;
|
||||
import net.runelite.deob.attributes.code.instructions.IfICmpNe;
|
||||
import net.runelite.deob.attributes.code.instructions.IfEq;
|
||||
import net.runelite.deob.attributes.code.instructions.IfGe;
|
||||
import net.runelite.deob.attributes.code.instructions.IfGt;
|
||||
@@ -353,14 +355,14 @@ public enum InstructionType
|
||||
IFGE(0x9c, "ifge", IfGe.class),
|
||||
IFGT(0x9d, "ifgt", IfGt.class),
|
||||
IFLE(0x9e, "ifle", IfLe.class),
|
||||
IF_ICMPEQ(0x9f, "if_icmpeq", IfCmpEq.class),
|
||||
IF_ICMPNE(0xa0, "if_icmpne", IfCmpNe.class),
|
||||
IF_ICMPEQ(0x9f, "if_icmpeq", IfICmpEq.class),
|
||||
IF_ICMPNE(0xa0, "if_icmpne", IfICmpNe.class),
|
||||
IF_ICMPLT(0xa1, "if_cmplt", IfCmpLt.class),
|
||||
IF_ICMPGE(0xa2, "if_icmpge", IfCmpGe.class),
|
||||
IF_ICMPGT(0xa3, "if_icmpgt", IfCmpGt.class),
|
||||
IF_ICMPLE(0xa4, "if_icmple", IfCmpLe.class),
|
||||
IF_ACMPEQ(0xa5, "if_acmpeq", IfCmpEq.class),
|
||||
IF_ACMPNE(0xa6, "if_acmpne", IfCmpNe.class),
|
||||
IF_ACMPEQ(0xa5, "if_acmpeq", IfACmpEq.class),
|
||||
IF_ACMPNE(0xa6, "if_acmpne", IfACmpNe.class),
|
||||
GOTO(0xa7, "goto", Goto.class),
|
||||
TABLESWITCH(0xaa, "tableswitch", TableSwitch.class),
|
||||
LOOKUPSWITCH(0xab, "lookupswitch", LookupSwitch.class),
|
||||
|
||||
@@ -99,13 +99,15 @@ public abstract class If extends Instruction implements JumpingInstruction, Comp
|
||||
@Override
|
||||
public final/*XXX tmp*/ void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
|
||||
{
|
||||
InstructionContext oneLhs = ctx.getPops().get(0).getPushed().resolve(ctx.getPops().get(0)),
|
||||
oneRhs = ctx.getPops().get(1).getPushed().resolve(ctx.getPops().get(1)),
|
||||
|
||||
twoLhs = other.getPops().get(0).getPushed().resolve(other.getPops().get(0)),
|
||||
twoRhs = other.getPops().get(1).getPushed().resolve(other.getPops().get(1));
|
||||
// InstructionContext oneLhs = ctx.getPops().get(0).getPushed().resolve(ctx.getPops().get(0)),
|
||||
// oneRhs = ctx.getPops().get(1).getPushed().resolve(ctx.getPops().get(1)),
|
||||
//
|
||||
// twoLhs = other.getPops().get(0).getPushed().resolve(other.getPops().get(0)),
|
||||
// twoRhs = other.getPops().get(1).getPushed().resolve(other.getPops().get(1));
|
||||
|
||||
assert ctx.getInstruction().getClass().equals(other.getInstruction().getClass());
|
||||
// if we get here weve assedted isSame(ctx, other). but they might not be the same instruction.
|
||||
// need to do something so branching can be always done right, eg ifeq vs ifne
|
||||
//assert ctx.getInstruction().getClass().equals(other.getInstruction().getClass());
|
||||
|
||||
Frame branch1 = ctx.getBranches().get(0),
|
||||
branch2 = other.getBranches().get(0);
|
||||
|
||||
@@ -2,11 +2,10 @@ package net.runelite.deob.attributes.code.instructions;
|
||||
|
||||
import net.runelite.deob.attributes.code.InstructionType;
|
||||
import net.runelite.deob.attributes.code.Instructions;
|
||||
import net.runelite.deob.execution.InstructionContext;
|
||||
|
||||
public class IfCmpEq extends If
|
||||
public class IfACmpEq extends If
|
||||
{
|
||||
public IfCmpEq(Instructions instructions, InstructionType type, int pc)
|
||||
public IfACmpEq(Instructions instructions, InstructionType type, int pc)
|
||||
{
|
||||
super(instructions, type, pc);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.runelite.deob.attributes.code.instructions;
|
||||
|
||||
import net.runelite.deob.attributes.code.InstructionType;
|
||||
import net.runelite.deob.attributes.code.Instructions;
|
||||
|
||||
public class IfACmpNe extends If
|
||||
{
|
||||
public IfACmpNe(Instructions instructions, InstructionType type, int pc)
|
||||
{
|
||||
super(instructions, type, pc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package net.runelite.deob.attributes.code.instructions;
|
||||
|
||||
import net.runelite.deob.attributes.code.InstructionType;
|
||||
import net.runelite.deob.attributes.code.Instructions;
|
||||
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||
import net.runelite.deob.execution.InstructionContext;
|
||||
import net.runelite.deob.execution.StackContext;
|
||||
|
||||
public class IfICmpEq extends If
|
||||
{
|
||||
public IfICmpEq(Instructions instructions, InstructionType type, int pc)
|
||||
{
|
||||
super(instructions, type, pc);
|
||||
}
|
||||
|
||||
private static boolean isZero(StackContext s)
|
||||
{
|
||||
if (s.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||
{
|
||||
PushConstantInstruction pc = (PushConstantInstruction) s.getPushed().getInstruction();
|
||||
Object o = pc.getConstant().getObject();
|
||||
|
||||
if (o instanceof Integer && (int) o == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
|
||||
{
|
||||
if (super.isSame(thisIc, otherIc))
|
||||
return true;
|
||||
|
||||
// check for other being ifeq and this has a constant 0
|
||||
if (otherIc.getInstruction() instanceof IfEq)
|
||||
{
|
||||
StackContext s1 = thisIc.getPops().get(0),
|
||||
s2 = thisIc.getPops().get(1);
|
||||
|
||||
if (isZero(s1) || isZero(s2))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@ package net.runelite.deob.attributes.code.instructions;
|
||||
import net.runelite.deob.attributes.code.InstructionType;
|
||||
import net.runelite.deob.attributes.code.Instructions;
|
||||
|
||||
public class IfCmpNe extends If
|
||||
public class IfICmpNe extends If
|
||||
{
|
||||
public IfCmpNe(Instructions instructions, InstructionType type, int pc)
|
||||
public IfICmpNe(Instructions instructions, InstructionType type, int pc)
|
||||
{
|
||||
super(instructions, type, pc);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class IfNe extends If0
|
||||
if (super.isSame(thisIc, otherIc))
|
||||
return true;
|
||||
|
||||
if (otherIc.getInstruction() instanceof IfCmpNe)
|
||||
if (otherIc.getInstruction() instanceof IfICmpNe)
|
||||
{
|
||||
// check for one side being 0
|
||||
StackContext s1 = otherIc.getPops().get(0),
|
||||
|
||||
@@ -18,7 +18,7 @@ public class IfNull extends If0
|
||||
if (super.isSame(thisIc, otherIc))
|
||||
return true;
|
||||
|
||||
if (otherIc.getInstruction() instanceof IfCmpEq)
|
||||
if (otherIc.getInstruction() instanceof IfACmpEq)
|
||||
{
|
||||
StackContext s1 = otherIc.getPops().get(0),
|
||||
s2 = otherIc.getPops().get(1);
|
||||
|
||||
@@ -13,8 +13,8 @@ public class MapStaticTest
|
||||
//@Test
|
||||
public void testMappable() throws IOException
|
||||
{
|
||||
ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar"));
|
||||
ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
||||
ClassGroup group1 = JarUtil.loadJar(new File("c:/rs/adamin1.jar"));
|
||||
ClassGroup group2 = JarUtil.loadJar(new File("c:/rs/adamin2.jar"));
|
||||
|
||||
// Assert.assertTrue(MappingExecutorUtil.isMappable(
|
||||
// group1.findClass("class99").findMethod("method2220"),
|
||||
@@ -25,8 +25,8 @@ public class MapStaticTest
|
||||
@Test
|
||||
public void test() throws IOException
|
||||
{
|
||||
ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar"));
|
||||
ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
||||
ClassGroup group1 = JarUtil.loadJar(new File("c:/rs/adamin1.jar"));
|
||||
ClassGroup group2 = JarUtil.loadJar(new File("c:/rs/adamin2.jar"));
|
||||
|
||||
Method m1 = group1.findClass("client").findMethod("vmethod3054");
|
||||
Method m2 = group2.findClass("client").findMethod("vmethod2973");
|
||||
|
||||
Reference in New Issue
Block a user