this is all wrong

This commit is contained in:
Adam
2016-01-31 22:18:57 -05:00
parent 9d3ba7e1cf
commit 3faa876ff7
4 changed files with 41 additions and 19 deletions

View File

@@ -77,6 +77,7 @@ public abstract class If extends Instruction implements JumpingInstruction, Comp
ins.pop(one, two); ins.pop(one, two);
Frame other = frame.dup(); Frame other = frame.dup();
other.created = this;
other.jump(ins, to); other.jump(ins, to);
ins.branch(other); ins.branch(other);

View File

@@ -78,6 +78,7 @@ public abstract class If0 extends Instruction implements JumpingInstruction, Com
ins.pop(one); ins.pop(one);
Frame other = frame.dup(); Frame other = frame.dup();
other.created = this;
other.jump(ins, to); other.jump(ins, to);
ins.branch(other); ins.branch(other);

View File

@@ -32,6 +32,7 @@ public class Frame
public Frame other; // in the other execution for mapping public Frame other; // in the other execution for mapping
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 Frame(Execution execution, Method method) public Frame(Execution execution, Method method)
{ {

View File

@@ -31,6 +31,9 @@ public class ParallellMappingExecutor
Frame f1 = e.frames.get(0), f2 = e2.frames.get(0); 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 f1.other == f2;
assert f2.other == f1; assert f2.other == f1;
@@ -45,25 +48,25 @@ public class ParallellMappingExecutor
assert f2.returnTo == null || !e2.frames.contains(f2.returnTo); assert f2.returnTo == null || !e2.frames.contains(f2.returnTo);
// I dont know if this is necessary. // I dont know if this is necessary.
if (f1.getInstructions().size() > 0) // if (f1.getInstructions().size() > 0)
{ // {
p1 = f1.getInstructions().get(f1.getInstructions().size() - 1); // p1 = f1.getInstructions().get(f1.getInstructions().size() - 1);
//
for (Frame branch : p1.getBranches()) // for (Frame branch : p1.getBranches())
{ // {
e.frames.remove(branch); // e.frames.remove(branch);
} // }
} // }
//
if (f2.getInstructions().size() > 0) // if (f2.getInstructions().size() > 0)
{ // {
p2 = f2.getInstructions().get(f2.getInstructions().size() - 1); // p2 = f2.getInstructions().get(f2.getInstructions().size() - 1);
//
for (Frame branch : p2.getBranches()) // for (Frame branch : p2.getBranches())
{ // {
e2.frames.remove(branch); // e2.frames.remove(branch);
} // }
} // }
assert e.frames.get(0) == f1; assert e.frames.get(0) == f1;
assert e2.frames.get(0) == f2; assert e2.frames.get(0) == f2;
@@ -93,9 +96,20 @@ public class ParallellMappingExecutor
// assert false; // 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(); return step();
} }
Frame old1 = new Frame(f1), old2 = new Frame(f2);
int s1 = e.frames.size(), s2 = e.frames.size();
// step frame // step frame
if (step1) if (step1)
f1.execute(); f1.execute();
@@ -107,6 +121,11 @@ public class ParallellMappingExecutor
else else
step2 = true; step2 = true;
if (e.frames.size() - s1 != e2.frames.size() - s2)
{
System.out.println("fr mismatch");
}
Frame oldf1 = f1, oldf2 = f2; Frame oldf1 = f1, oldf2 = f2;
f1 = popStack(f1); f1 = popStack(f1);