init field order fix
This commit is contained in:
@@ -9,5 +9,5 @@ public interface MappableInstruction
|
|||||||
|
|
||||||
boolean isSame(InstructionContext thisIc, InstructionContext otherIc);
|
boolean isSame(InstructionContext thisIc, InstructionContext otherIc);
|
||||||
|
|
||||||
boolean canMap();
|
boolean canMap(InstructionContext thisIc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public abstract class If extends Instruction implements JumpingInstruction, Comp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap(InstructionContext thisIc)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public abstract class If0 extends Instruction implements JumpingInstruction, Com
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap(InstructionContext thisIc)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class IfNe extends If0
|
|||||||
if (super.isSame(thisIc, otherIc))
|
if (super.isSame(thisIc, otherIc))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (otherIc.getInstruction() instanceof IfICmpNe)
|
if (otherIc.getInstruction() instanceof IfICmpNe || otherIc.getInstruction() instanceof IfICmpEq)
|
||||||
{
|
{
|
||||||
// check for one side being 0
|
// check for one side being 0
|
||||||
StackContext s1 = otherIc.getPops().get(0),
|
StackContext s1 = otherIc.getPops().get(0),
|
||||||
@@ -59,7 +59,7 @@ public class IfNe extends If0
|
|||||||
@Override
|
@Override
|
||||||
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
|
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
|
||||||
{
|
{
|
||||||
if (other.getInstruction() instanceof IfEq)
|
if (other.getInstruction() instanceof IfEq || other.getInstruction() instanceof IfICmpEq)
|
||||||
{
|
{
|
||||||
super.mapOtherBranch(mapping, ctx, other);
|
super.mapOtherBranch(mapping, ctx, other);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap(InstructionContext thisIc)
|
||||||
{
|
{
|
||||||
return MappingExecutorUtil.isMappable(this);
|
return MappingExecutorUtil.isMappable(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap(InstructionContext thisIc)
|
||||||
{
|
{
|
||||||
return MappingExecutorUtil.isMappable(this);
|
return MappingExecutorUtil.isMappable(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap(InstructionContext thisIc)
|
||||||
{
|
{
|
||||||
return MappingExecutorUtil.isMappable(this);
|
return MappingExecutorUtil.isMappable(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap(InstructionContext thisIc)
|
||||||
{
|
{
|
||||||
return MappingExecutorUtil.isMappable(this);
|
return MappingExecutorUtil.isMappable(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,8 +130,13 @@ public class PutField extends Instruction implements SetFieldInstruction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap(InstructionContext thisIc)
|
||||||
{
|
{
|
||||||
|
StackContext value = thisIc.getPops().get(0);
|
||||||
|
Instruction i = value.getPushed().getInstruction();
|
||||||
|
if (thisIc.getFrame().getMethod().getName().equals("<init>"))
|
||||||
|
if (i instanceof PushConstantInstruction || i instanceof AConstNull)
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap(InstructionContext thisIc)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package net.runelite.deob.deobfuscators.rename;
|
||||||
|
|
||||||
|
public class MappingException extends Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -59,7 +59,7 @@ public class MappingExecutorUtil
|
|||||||
return map1.equals(map2);
|
return map1.equals(map2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ParallelExecutorMapping map(Method m1, Method m2)
|
public static ParallelExecutorMapping map(Method m1, Method m2) throws MappingException
|
||||||
{
|
{
|
||||||
ClassGroup group1 = m1.getMethods().getClassFile().getGroup();
|
ClassGroup group1 = m1.getMethods().getClassFile().getGroup();
|
||||||
ClassGroup group2 = m2.getMethods().getClassFile().getGroup();
|
ClassGroup group2 = m2.getMethods().getClassFile().getGroup();
|
||||||
@@ -103,9 +103,8 @@ public class MappingExecutorUtil
|
|||||||
|
|
||||||
if (!mi1.isSame(p1, p2))
|
if (!mi1.isSame(p1, p2))
|
||||||
{
|
{
|
||||||
assert mi1.isSame(p1, p2);
|
throw new MappingException();
|
||||||
}
|
}
|
||||||
//assert p1.getInstruction().getClass().equals(p2.getInstruction().getClass());
|
|
||||||
|
|
||||||
mi1.map(mappings, p1, p2);
|
mi1.map(mappings, p1, p2);
|
||||||
|
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ public class Frame
|
|||||||
if (execution.step && oldCur instanceof MappableInstruction)
|
if (execution.step && oldCur instanceof MappableInstruction)
|
||||||
{
|
{
|
||||||
MappableInstruction mi = (MappableInstruction) oldCur;
|
MappableInstruction mi = (MappableInstruction) oldCur;
|
||||||
if (mi.canMap())
|
if (mi.canMap(ictx))
|
||||||
{
|
{
|
||||||
execution.paused = true;
|
execution.paused = true;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class MapStaticTest
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAll() throws IOException
|
public void testAll() throws IOException, MappingException
|
||||||
{
|
{
|
||||||
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
||||||
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
||||||
@@ -80,7 +80,7 @@ public class MapStaticTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() throws IOException
|
public void test() throws IOException, MappingException
|
||||||
{
|
{
|
||||||
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
||||||
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
||||||
@@ -103,7 +103,7 @@ public class MapStaticTest
|
|||||||
//Assert.assertNotNull(other);
|
//Assert.assertNotNull(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean test;
|
private static boolean test = true;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeep() throws IOException
|
public void testDeep() throws IOException
|
||||||
@@ -220,8 +220,8 @@ public class MapStaticTest
|
|||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
System.err.println("Error mapping " + m1 + " to " + m2);
|
System.err.println("Error mapping " + m1 + " to " + m2);
|
||||||
if (test)
|
//if (test)
|
||||||
throw ex;
|
// throw ex;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user