Doesn't work and I don't know why

This commit is contained in:
Adam
2015-02-01 22:19:28 -05:00
parent 027dc6eff9
commit d00e5b03e1
5 changed files with 12 additions and 8 deletions

View File

@@ -39,7 +39,7 @@ public abstract class Instruction
public String getDesc(Frame frame) public String getDesc(Frame frame)
{ {
return null; return type.getName();
} }
protected void addJump(int offset) protected void addJump(int offset)

View File

@@ -17,7 +17,6 @@ public class Return extends Instruction
@Override @Override
public void execute(Frame e) public void execute(Frame e)
{ {
// XXX exceptions?
Object ret = e.getStack().pop(); Object ret = e.getStack().pop();
e.getPath().returnFrame(this, ret); e.getPath().returnFrame(this, ret);
} }

View File

@@ -23,6 +23,8 @@ public class Execution
ObjectInstance object = p.createObject(instance); ObjectInstance object = p.createObject(instance);
p.invoke(method, object); p.invoke(method, object);
//process();
} }
public void addPath(Path p) public void addPath(Path p)

View File

@@ -67,17 +67,14 @@ public class Frame
Instruction i = ins.findInstruction(pc); Instruction i = ins.findInstruction(pc);
String desc = i.getDesc(this);
if (desc != null)
System.out.println(desc);
try try
{ {
i.execute(this); i.execute(this);
System.out.println(i.getDesc(this));
} }
catch (Throwable ex) catch (Throwable ex)
{ {
System.err.println("Error executing instruction in " + method.getName() + " " + method.getDescriptor() + " in class " + method.getMethods().getClassFile().getName() + " at pc " + pc); System.err.println("Error executing instruction " + i.getDesc(this) + " in " + method.getName() + " " + method.getDescriptor() + " in class " + method.getMethods().getClassFile().getName() + " at pc " + pc);
System.err.println("Frame stack (grows downward):"); System.err.println("Frame stack (grows downward):");
while (stack.getSize() > 0) while (stack.getSize() > 0)
{ {

View File

@@ -97,7 +97,13 @@ public class Path
for (int i = 0; i < args.length; ++i) for (int i = 0; i < args.length; ++i)
vars.set(i, args[i]); vars.set(i, args[i]);
frames.push(f); frames.push(f);
f.execute();
while (!frames.isEmpty())
{
f = frames.peek();
f.execute();
frames.pop();
}
} }
public void returnFrame(Instruction i, Object value) public void returnFrame(Instruction i, Object value)