Refactor call stack and its use throughout. CallFrame now does all bytecode processing, and the callframe is reinitialized anytime something might have changed, like a function call.

This commit is contained in:
James Roseborough
2007-06-27 06:43:33 +00:00
parent 93fc4699a9
commit c8e1934916
20 changed files with 548 additions and 136 deletions

View File

@@ -1,5 +1,6 @@
package lua.io;
import lua.CallFrame;
import lua.StackState;
import lua.value.LFunction;
import lua.value.LValue;
@@ -9,7 +10,7 @@ public class Closure extends LFunction {
public Proto p;
public UpVal[] upVals;
public Closure(StackState state, Proto p) {
this.env = state.gt();
this.env = state._G;
this.p = p;
upVals = new UpVal[p.nups];
for ( int i=0; i<p.nups; i++ )
@@ -17,7 +18,7 @@ public class Closure extends LFunction {
}
// perform a lua call
public void luaStackCall(StackState state, int base, int top, int nresults) {
state.setupCall( this, base, top );
public void luaStackCall(CallFrame call, int base, int top, int nresults) {
call.state.stackCall( this, base, top, nresults );
}
}