well this gets further
This commit is contained in:
@@ -78,6 +78,7 @@ public abstract class If extends Instruction implements JumpingInstruction, Comp
|
|||||||
|
|
||||||
Frame other = frame.dup();
|
Frame other = frame.dup();
|
||||||
other.created = this;
|
other.created = this;
|
||||||
|
other.forking = ins;
|
||||||
other.jump(ins, to);
|
other.jump(ins, to);
|
||||||
|
|
||||||
ins.branch(other);
|
ins.branch(other);
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public abstract class If0 extends Instruction implements JumpingInstruction, Com
|
|||||||
|
|
||||||
Frame other = frame.dup();
|
Frame other = frame.dup();
|
||||||
other.created = this;
|
other.created = this;
|
||||||
|
other.forking = ins;
|
||||||
other.jump(ins, to);
|
other.jump(ins, to);
|
||||||
|
|
||||||
ins.branch(other);
|
ins.branch(other);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
||||||
|
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
||||||
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
||||||
import net.runelite.deob.execution.Execution;
|
import net.runelite.deob.execution.Execution;
|
||||||
import net.runelite.deob.execution.Value;
|
import net.runelite.deob.execution.Value;
|
||||||
@@ -181,6 +182,6 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
|
|||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap()
|
||||||
{
|
{
|
||||||
return true;
|
return MappingExecutorUtil.isMappable(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
||||||
|
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
||||||
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
||||||
import net.runelite.deob.execution.Execution;
|
import net.runelite.deob.execution.Execution;
|
||||||
import net.runelite.deob.execution.Value;
|
import net.runelite.deob.execution.Value;
|
||||||
@@ -182,6 +183,6 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
|
|||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap()
|
||||||
{
|
{
|
||||||
return true;
|
return MappingExecutorUtil.isMappable(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
||||||
|
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
||||||
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
|
||||||
import net.runelite.deob.execution.Execution;
|
import net.runelite.deob.execution.Execution;
|
||||||
import net.runelite.deob.execution.Value;
|
import net.runelite.deob.execution.Value;
|
||||||
@@ -184,6 +185,6 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
|||||||
@Override
|
@Override
|
||||||
public boolean canMap()
|
public boolean canMap()
|
||||||
{
|
{
|
||||||
return true;
|
return MappingExecutorUtil.isMappable(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,12 +118,16 @@ public class LookupSwitch extends Instruction implements JumpingInstruction
|
|||||||
StackContext value = stack.pop();
|
StackContext value = stack.pop();
|
||||||
ins.pop(value);
|
ins.pop(value);
|
||||||
|
|
||||||
for (Instruction i : branchi)
|
if (!frame.getExecution().step)
|
||||||
{
|
{
|
||||||
Frame other = frame.dup();
|
for (Instruction i : branchi)
|
||||||
other.jump(ins, i);
|
{
|
||||||
|
Frame other = frame.dup();
|
||||||
ins.branch(other);
|
other.forking = ins;
|
||||||
|
other.jump(ins, i);
|
||||||
|
|
||||||
|
ins.branch(other);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.jump(ins, defi);
|
frame.jump(ins, defi);
|
||||||
|
|||||||
@@ -113,13 +113,16 @@ public class TableSwitch extends Instruction implements JumpingInstruction
|
|||||||
|
|
||||||
StackContext value = stack.pop();
|
StackContext value = stack.pop();
|
||||||
ins.pop(value);
|
ins.pop(value);
|
||||||
|
|
||||||
for (Instruction i : branchi)
|
if (!frame.getExecution().step)
|
||||||
{
|
{
|
||||||
Frame other = frame.dup();
|
for (Instruction i : branchi)
|
||||||
other.jump(ins, i);
|
{
|
||||||
|
Frame other = frame.dup();
|
||||||
ins.branch(other);
|
other.jump(ins, i);
|
||||||
|
|
||||||
|
ins.branch(other);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.jump(ins, defi);
|
frame.jump(ins, defi);
|
||||||
|
|||||||
@@ -120,8 +120,23 @@ public class MappingExecutorUtil
|
|||||||
|
|
||||||
public static boolean isMappable(InvokeInstruction ii)
|
public static boolean isMappable(InvokeInstruction ii)
|
||||||
{
|
{
|
||||||
net.runelite.deob.pool.Method m = (net.runelite.deob.pool.Method) ii.getMethod();
|
String className;
|
||||||
String className = m.getClassEntry().getName();
|
|
||||||
|
if (ii.getMethod() instanceof net.runelite.deob.pool.Method)
|
||||||
|
{
|
||||||
|
net.runelite.deob.pool.Method m = (net.runelite.deob.pool.Method) ii.getMethod();
|
||||||
|
className = m.getClassEntry().getName();
|
||||||
|
}
|
||||||
|
else if (ii.getMethod() instanceof net.runelite.deob.pool.InterfaceMethod)
|
||||||
|
{
|
||||||
|
net.runelite.deob.pool.InterfaceMethod m = (net.runelite.deob.pool.InterfaceMethod) ii.getMethod();
|
||||||
|
className = m.getClassEntry().getName();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (className.startsWith("java/") || className.startsWith("netscape/"))
|
if (className.startsWith("java/") || className.startsWith("netscape/"))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public class Frame
|
|||||||
public Frame returnTo; // is this the same as caller?
|
public Frame returnTo; // is this the same as caller?
|
||||||
public Frame otherStatic;
|
public Frame otherStatic;
|
||||||
public Instruction created;
|
public Instruction created;
|
||||||
|
public InstructionContext forking;
|
||||||
|
public boolean initial;
|
||||||
|
public boolean isdup,iscopy;
|
||||||
|
|
||||||
public Frame(Execution execution, Method method)
|
public Frame(Execution execution, Method method)
|
||||||
{
|
{
|
||||||
@@ -57,7 +60,8 @@ public class Frame
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initialize()
|
public void initialize()
|
||||||
{
|
{
|
||||||
|
initial = true;
|
||||||
// initialize LVT
|
// initialize LVT
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
if (!method.isStatic())
|
if (!method.isStatic())
|
||||||
@@ -76,6 +80,7 @@ public class Frame
|
|||||||
|
|
||||||
public void initialize(InstructionContext ctx)
|
public void initialize(InstructionContext ctx)
|
||||||
{
|
{
|
||||||
|
created = ctx.getInstruction();
|
||||||
// initialize frame from invoking context
|
// initialize frame from invoking context
|
||||||
assert ctx.getInstruction() instanceof InvokeInstruction;
|
assert ctx.getInstruction() instanceof InvokeInstruction;
|
||||||
|
|
||||||
@@ -111,6 +116,7 @@ public class Frame
|
|||||||
|
|
||||||
protected Frame(Frame other)
|
protected Frame(Frame other)
|
||||||
{
|
{
|
||||||
|
iscopy=true;
|
||||||
this.execution = other.execution;
|
this.execution = other.execution;
|
||||||
this.method = other.method;
|
this.method = other.method;
|
||||||
this.executing = other.executing;
|
this.executing = other.executing;
|
||||||
@@ -121,12 +127,18 @@ public class Frame
|
|||||||
this.nonStatic = other.nonStatic;
|
this.nonStatic = other.nonStatic;
|
||||||
this.caller = other.caller;
|
this.caller = other.caller;
|
||||||
if (other.returnTo != null)
|
if (other.returnTo != null)
|
||||||
|
{
|
||||||
this.returnTo = new Frame(other.returnTo);
|
this.returnTo = new Frame(other.returnTo);
|
||||||
|
this.returnTo.instructions.addAll(other.returnTo.instructions);
|
||||||
|
}
|
||||||
|
this.created = other.created;
|
||||||
|
this.forking = other.forking;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Frame dup()
|
public Frame dup()
|
||||||
{
|
{
|
||||||
Frame other = new Frame(this);
|
Frame other = new Frame(this);
|
||||||
|
other.isdup=true;
|
||||||
execution.frames.add(other);
|
execution.frames.add(other);
|
||||||
return other;
|
return other;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ParallellMappingExecutor
|
|||||||
++count;
|
++count;
|
||||||
|
|
||||||
|
|
||||||
if (count == 685)
|
if (count == 18223)
|
||||||
{
|
{
|
||||||
int i = 5;
|
int i = 5;
|
||||||
}
|
}
|
||||||
@@ -55,12 +55,36 @@ public class ParallellMappingExecutor
|
|||||||
assert f1.returnTo == null || !e.frames.contains(f1.returnTo);
|
assert f1.returnTo == null || !e.frames.contains(f1.returnTo);
|
||||||
assert f2.returnTo == null || !e2.frames.contains(f2.returnTo);
|
assert f2.returnTo == null || !e2.frames.contains(f2.returnTo);
|
||||||
|
|
||||||
// Due to jump ob one side can stop while the other side jumps
|
InstructionContext fork1 = f1.getInstructions().isEmpty() ? f1.forking : f1.getInstructions().get(f1.getInstructions().size() - 1);
|
||||||
if (f1.getInstructions().size() > 0)
|
InstructionContext fork2 = f2.getInstructions().isEmpty() ? f2.forking : f2.getInstructions().get(f2.getInstructions().size() - 1);
|
||||||
|
|
||||||
|
assert fork1 != null;
|
||||||
|
assert fork2 != null;
|
||||||
|
|
||||||
|
if (!(f1.getInstructions().isEmpty() == f2.getInstructions().isEmpty()))
|
||||||
{
|
{
|
||||||
p1 = f1.getInstructions().get(f1.getInstructions().size() - 1);
|
int i = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Due to jump ob one side can stop while the other side jumps
|
||||||
|
//if (f1.getInstructions().size() > 0)
|
||||||
|
if (fork1 == f1.forking)
|
||||||
|
{
|
||||||
|
assert fork1.getBranches().size() == 1;
|
||||||
|
//assert fork1.getBranches().get(0) == f1;
|
||||||
|
|
||||||
|
int i1 = e.frames.indexOf(fork1.getFrame());
|
||||||
|
int i2 = e.frames.indexOf(fork1.getBranches().get(0));
|
||||||
|
|
||||||
|
// remove fork1.frame
|
||||||
|
e.frames.remove(fork1.getFrame());
|
||||||
|
//e.frames.remove(fork1.getBranches().get(0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//p1 = f1.getInstructions().get(f1.getInstructions().size() - 1);
|
||||||
|
|
||||||
for (Frame branch : p1.getBranches())
|
for (Frame branch : fork1.getBranches())
|
||||||
{
|
{
|
||||||
e.frames.remove(branch);
|
e.frames.remove(branch);
|
||||||
}
|
}
|
||||||
@@ -68,11 +92,23 @@ public class ParallellMappingExecutor
|
|||||||
|
|
||||||
// this is empty but should be removing a branch, because of the map other, theres no prev instruction.
|
// this is empty but should be removing a branch, because of the map other, theres no prev instruction.
|
||||||
// should always populate prev instruction
|
// should always populate prev instruction
|
||||||
if (f2.getInstructions().size() > 0)
|
//if (f2.getInstructions().size() > 0)
|
||||||
|
if (fork2 == f2.forking)
|
||||||
{
|
{
|
||||||
p2 = f2.getInstructions().get(f2.getInstructions().size() - 1);
|
assert fork2.getBranches().size() == 1;
|
||||||
|
//assert fork2.getBranches().get(0) == f2;
|
||||||
|
|
||||||
for (Frame branch : p2.getBranches())
|
int i1 = e2.frames.indexOf(fork2.getFrame());
|
||||||
|
int i2 = e2.frames.indexOf(fork2.getBranches().get(0));
|
||||||
|
|
||||||
|
e2.frames.remove(fork2.getFrame());
|
||||||
|
//e.frames.remove(fork2.getBranches().get(0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//p2 = f2.getInstructions().get(f2.getInstructions().size() - 1);
|
||||||
|
|
||||||
|
for (Frame branch : fork2.getBranches())
|
||||||
{
|
{
|
||||||
e2.frames.remove(branch);
|
e2.frames.remove(branch);
|
||||||
}
|
}
|
||||||
@@ -267,6 +303,7 @@ public class ParallellMappingExecutor
|
|||||||
Method to = methods.get(0);
|
Method to = methods.get(0);
|
||||||
|
|
||||||
Frame f2 = new Frame(e, to);
|
Frame f2 = new Frame(e, to);
|
||||||
|
f2.created = is;
|
||||||
f2.initialize(i);
|
f2.initialize(i);
|
||||||
|
|
||||||
e.frames.remove(0); // old frame goes away
|
e.frames.remove(0); // old frame goes away
|
||||||
@@ -280,6 +317,8 @@ public class ParallellMappingExecutor
|
|||||||
f.other = null;
|
f.other = null;
|
||||||
|
|
||||||
f2.returnTo = new Frame(f); // where to go when we're done
|
f2.returnTo = new Frame(f); // where to go when we're done
|
||||||
|
assert f.getInstructions().isEmpty() == false;
|
||||||
|
f2.returnTo.getInstructions().addAll(f.getInstructions());
|
||||||
|
|
||||||
return f2;
|
return f2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user