Invokeinterface, among others

This commit is contained in:
Adam
2014-12-09 02:00:10 -05:00
parent 463b6df138
commit a998491133
17 changed files with 186 additions and 50 deletions

View File

@@ -18,7 +18,7 @@ public class Execution
public void run(Method method, Object... args)
{
Path p = new Path(this);
p.init(method, args);
p.invoke(method, args);
}
public void addPath(Path p)

View File

@@ -24,4 +24,9 @@ public class FieldInstance
{
return value;
}
public void setValue(Object obj)
{
value = obj;
}
}

View File

@@ -39,14 +39,6 @@ public class Frame
{
return variables;
}
public void init(Object[] args)
{
for (Object o : args)
stack.push(o);
execute();
}
public void execute()
{

View File

@@ -64,13 +64,6 @@ public class Path
{
return frames.peek();
}
public void init(Method method, Object[] args)
{
Frame f = new Frame(this, method);
frames.push(f);
f.init(args);
}
public Path dup()
{
@@ -78,4 +71,14 @@ public class Path
execution.addPath(other);
return other;
}
public void invoke(Method method, Object[] args)
{
Frame f = new Frame(this, method);
Variables vars = f.getVariables();
for (int i = 0; i < args.length; ++i)
vars.set(i, args[i]);
frames.push(f);
f.execute();
}
}

View File

@@ -7,13 +7,13 @@ public class StaticFieldInstance
{
private ClassInstance clazz;
private Field field;
private ConstantValue value;
private Object value;
public StaticFieldInstance(ClassInstance clazz, Field field, ConstantValue value)
{
this.clazz = clazz;
this.field = field;
this.value = value;
this.value = value.getValue().getObject();
}
public Field getField()
@@ -21,8 +21,13 @@ public class StaticFieldInstance
return field;
}
public ConstantValue getValue()
public Object getValue()
{
return value;
}
public void setField(Object obj)
{
value = obj;
}
}