From 3faa876ff7b947efdcde880e7a6ab1443e7def65 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 31 Jan 2016 22:18:57 -0500 Subject: [PATCH] this is all wrong --- .../deob/attributes/code/instructions/If.java | 1 + .../attributes/code/instructions/If0.java | 1 + .../net/runelite/deob/execution/Frame.java | 1 + .../execution/ParallellMappingExecutor.java | 57 ++++++++++++------- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/If.java b/src/main/java/net/runelite/deob/attributes/code/instructions/If.java index 7941d1f14e..8184596b3b 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/If.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/If.java @@ -77,6 +77,7 @@ public abstract class If extends Instruction implements JumpingInstruction, Comp ins.pop(one, two); Frame other = frame.dup(); + other.created = this; other.jump(ins, to); ins.branch(other); diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/If0.java b/src/main/java/net/runelite/deob/attributes/code/instructions/If0.java index 3adc73fcc1..a7cdf417f9 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/If0.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/If0.java @@ -78,6 +78,7 @@ public abstract class If0 extends Instruction implements JumpingInstruction, Com ins.pop(one); Frame other = frame.dup(); + other.created = this; other.jump(ins, to); ins.branch(other); diff --git a/src/main/java/net/runelite/deob/execution/Frame.java b/src/main/java/net/runelite/deob/execution/Frame.java index de2817d7ac..f0a7e6a405 100644 --- a/src/main/java/net/runelite/deob/execution/Frame.java +++ b/src/main/java/net/runelite/deob/execution/Frame.java @@ -32,6 +32,7 @@ public class Frame public Frame other; // in the other execution for mapping public Frame returnTo; // is this the same as caller? public Frame otherStatic; + public Instruction created; public Frame(Execution execution, Method method) { diff --git a/src/main/java/net/runelite/deob/execution/ParallellMappingExecutor.java b/src/main/java/net/runelite/deob/execution/ParallellMappingExecutor.java index 58bece2312..38167e0ef0 100644 --- a/src/main/java/net/runelite/deob/execution/ParallellMappingExecutor.java +++ b/src/main/java/net/runelite/deob/execution/ParallellMappingExecutor.java @@ -30,6 +30,9 @@ public class ParallellMappingExecutor return false; Frame f1 = e.frames.get(0), f2 = e2.frames.get(0); + +// assert f1.other.other == f1; +// assert f2.other.other == f2; assert f1.other == f2; assert f2.other == f1; @@ -45,25 +48,25 @@ public class ParallellMappingExecutor assert f2.returnTo == null || !e2.frames.contains(f2.returnTo); // I dont know if this is necessary. - if (f1.getInstructions().size() > 0) - { - p1 = f1.getInstructions().get(f1.getInstructions().size() - 1); - - for (Frame branch : p1.getBranches()) - { - e.frames.remove(branch); - } - } - - if (f2.getInstructions().size() > 0) - { - p2 = f2.getInstructions().get(f2.getInstructions().size() - 1); - - for (Frame branch : p2.getBranches()) - { - e2.frames.remove(branch); - } - } +// if (f1.getInstructions().size() > 0) +// { +// p1 = f1.getInstructions().get(f1.getInstructions().size() - 1); +// +// for (Frame branch : p1.getBranches()) +// { +// e.frames.remove(branch); +// } +// } +// +// if (f2.getInstructions().size() > 0) +// { +// p2 = f2.getInstructions().get(f2.getInstructions().size() - 1); +// +// for (Frame branch : p2.getBranches()) +// { +// e2.frames.remove(branch); +// } +// } assert e.frames.get(0) == f1; assert e2.frames.get(0) == f2; @@ -92,9 +95,20 @@ public class ParallellMappingExecutor // { // assert false; // } + + Frame f1wtf = e.frames.get(0), f2wtf = e2.frames.get(0); + + // assert f1wtf.other.other == f1wtf; + // assert f2wtf.other.other == f2wtf; + + assert f1wtf.other == f2wtf; + assert f2wtf.other == f1wtf; return step(); } + + Frame old1 = new Frame(f1), old2 = new Frame(f2); + int s1 = e.frames.size(), s2 = e.frames.size(); // step frame if (step1) @@ -107,6 +121,11 @@ public class ParallellMappingExecutor else step2 = true; + if (e.frames.size() - s1 != e2.frames.size() - s2) + { + System.out.println("fr mismatch"); + } + Frame oldf1 = f1, oldf2 = f2; f1 = popStack(f1);