Merge branch 'master+rename5' into HEAD
This commit is contained in:
@@ -17,7 +17,7 @@ import net.runelite.deob.execution.ParallellMappingExecutor;
|
||||
|
||||
public class MappingExecutorUtil
|
||||
{
|
||||
// won't work with static funcs etc
|
||||
// won't work with static funcs etc. this is all wrong. XXX
|
||||
public static boolean isMappable(Method m1, Method m2)
|
||||
{
|
||||
assert (m1.getCode() == null) == (m2.getCode() == null);
|
||||
@@ -101,7 +101,10 @@ public class MappingExecutorUtil
|
||||
MappableInstruction mi1 = (MappableInstruction) p1.getInstruction(),
|
||||
mi2 = (MappableInstruction) p2.getInstruction();
|
||||
|
||||
assert mi1.isSame(p1, p2);
|
||||
if (!mi1.isSame(p1, p2))
|
||||
{
|
||||
assert mi1.isSame(p1, p2);
|
||||
}
|
||||
//assert p1.getInstruction().getClass().equals(p2.getInstruction().getClass());
|
||||
|
||||
mi1.map(mappings, p1, p2);
|
||||
|
||||
@@ -150,15 +150,6 @@ public class Execution
|
||||
System.out.println("Processed " + fcount + " frames");
|
||||
}
|
||||
|
||||
// public InstructionContext getPaused()
|
||||
// {
|
||||
// if (frames.isEmpty())
|
||||
// return null;
|
||||
//
|
||||
// Frame f = frames.get(0);
|
||||
// return f.getInstructions().get(f.getInstructions().size() - 1);
|
||||
// }
|
||||
|
||||
public Collection<InstructionContext> getInstructonContexts(Instruction i)
|
||||
{
|
||||
return contexts.getCollection(i);
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.runelite.deob.execution;
|
||||
import java.util.List;
|
||||
import net.runelite.deob.Method;
|
||||
import net.runelite.deob.attributes.code.instruction.types.ReturnInstruction;
|
||||
import net.runelite.deob.attributes.code.instructions.InvokeSpecial;
|
||||
import net.runelite.deob.attributes.code.instructions.InvokeStatic;
|
||||
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
||||
|
||||
@@ -17,6 +18,7 @@ public class ParallellMappingExecutor
|
||||
this.e2 = two;
|
||||
}
|
||||
|
||||
boolean step1 = true, step2 = true;
|
||||
public boolean step()
|
||||
{
|
||||
assert e.frames.size() == e2.frames.size();
|
||||
@@ -48,8 +50,10 @@ public class ParallellMappingExecutor
|
||||
}
|
||||
|
||||
// step frame
|
||||
f1.execute();
|
||||
f2.execute();
|
||||
if (step1)
|
||||
f1.execute();
|
||||
if (step2)
|
||||
f2.execute();
|
||||
|
||||
f1 = popStack(f1);
|
||||
f2 = popStack(f2);
|
||||
@@ -83,17 +87,57 @@ public class ParallellMappingExecutor
|
||||
return step();
|
||||
}
|
||||
|
||||
Frame oldf1 = f1, oldf2 = f2;
|
||||
if (MappingExecutorUtil.isInlineable(p1.getInstruction()) && !MappingExecutorUtil.isInlineable(p2.getInstruction()))
|
||||
{
|
||||
f1 = stepInto(f1);
|
||||
f1 = popStack(f1);
|
||||
p1 = f1.getInstructions().get(f1.getInstructions().size() - 1);
|
||||
try
|
||||
{
|
||||
step2 = false;
|
||||
return step();
|
||||
}
|
||||
finally
|
||||
{
|
||||
step2 = true;
|
||||
}
|
||||
//f1 = popStack(f1);
|
||||
//p1 = f1.getInstructions().get(f1.getInstructions().size() - 1);
|
||||
}
|
||||
else if (MappingExecutorUtil.isInlineable(p2.getInstruction()) && !MappingExecutorUtil.isInlineable(p1.getInstruction()))
|
||||
{
|
||||
f2 = stepInto(f2);
|
||||
f2 = popStack(f2);
|
||||
p2 = f2.getInstructions().get(f2.getInstructions().size() - 1);
|
||||
//f2 = popStack(f2);
|
||||
//p2 = f2.getInstructions().get(f2.getInstructions().size() - 1);
|
||||
try
|
||||
{
|
||||
step1 = false;
|
||||
return step();
|
||||
}
|
||||
finally
|
||||
{
|
||||
step1 = true;
|
||||
}
|
||||
}
|
||||
else if (MappingExecutorUtil.isInlineable(p1.getInstruction()) && MappingExecutorUtil.isInlineable(p2.getInstruction()))
|
||||
{
|
||||
// p1s func might equal p2s func
|
||||
|
||||
// step into both at once, and insert to beginning of e.frames
|
||||
|
||||
// when two funcs exit at once, map them then (if static?)
|
||||
|
||||
// f1 = stepInto(f1);
|
||||
// f1 = popStack(f1);
|
||||
// p1 = f1.getInstructions().get(f1.getInstructions().size() - 1);
|
||||
//
|
||||
// f2 = stepInto(f2);
|
||||
// f2 = popStack(f2);
|
||||
// p2 = f2.getInstructions().get(f2.getInstructions().size() - 1);
|
||||
}
|
||||
|
||||
if (p1.getInstruction() instanceof InvokeSpecial && p2.getInstruction() instanceof InvokeStatic)
|
||||
{
|
||||
int i = 5;
|
||||
}
|
||||
|
||||
assert e.paused;
|
||||
@@ -124,8 +168,10 @@ public class ParallellMappingExecutor
|
||||
|
||||
InvokeStatic is = (InvokeStatic) i.getInstruction();
|
||||
List<Method> methods = is.getMethods();
|
||||
if (methods.isEmpty()) // not my method
|
||||
return null;
|
||||
|
||||
assert methods.size() == 1;
|
||||
//if (methods.isEmpty()) // not my method
|
||||
// return null;
|
||||
|
||||
Method to = is.getMethods().get(0);
|
||||
|
||||
@@ -145,7 +191,7 @@ public class ParallellMappingExecutor
|
||||
f2.returnTo = new Frame(f); // where to go when we're done
|
||||
|
||||
// step new frame
|
||||
f2.execute();
|
||||
//f2.execute();
|
||||
|
||||
return f2;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MapStaticTest
|
||||
{ "client.init", "client.init" },
|
||||
{ "class162.method3270", "class86.method2020" },
|
||||
{ "class29.method711", "class36.method742" },
|
||||
{ "class72.run", "class72.run" },
|
||||
//{ "class72.run", "class72.run" },
|
||||
};
|
||||
|
||||
// @Test
|
||||
@@ -57,30 +57,30 @@ public class MapStaticTest
|
||||
// }
|
||||
|
||||
//@Test
|
||||
// public void testAll() throws IOException
|
||||
// {
|
||||
// ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar"));
|
||||
// ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
||||
//
|
||||
// for (String[] s : methods)
|
||||
// {
|
||||
// String[] one = s[0].split("\\."), two = s[1].split("\\.");
|
||||
//
|
||||
// Method m1 = group1.findClass(one[0]).findMethod(one[1]);
|
||||
// Method m2 = group2.findClass(two[0]).findMethod(two[1]);
|
||||
//
|
||||
// ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2);
|
||||
// }
|
||||
// }
|
||||
|
||||
//@Test
|
||||
public void test() throws IOException
|
||||
public void testAll() throws IOException
|
||||
{
|
||||
ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar"));
|
||||
ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
||||
|
||||
Method m1 = group1.findClass("class72").findMethod("run");
|
||||
Method m2 = group2.findClass("class72").findMethod("run");
|
||||
for (String[] s : methods)
|
||||
{
|
||||
String[] one = s[0].split("\\."), two = s[1].split("\\.");
|
||||
|
||||
Method m1 = group1.findClass(one[0]).findMethod(one[1]);
|
||||
Method m2 = group2.findClass(two[0]).findMethod(two[1]);
|
||||
|
||||
ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2);
|
||||
}
|
||||
}
|
||||
|
||||
@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"));
|
||||
|
||||
Method m1 = group1.findClass("client").findMethod("vmethod3054");
|
||||
Method m2 = group2.findClass("client").findMethod("vmethod2973");
|
||||
|
||||
ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class MapStaticTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void testDeep() throws IOException
|
||||
{
|
||||
ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar"));
|
||||
|
||||
Reference in New Issue
Block a user