Allow jit to find upvalues.

This commit is contained in:
James Roseborough
2008-05-21 00:37:10 +00:00
parent 3582b97d8b
commit 539b0ea57f
2 changed files with 6 additions and 6 deletions

View File

@@ -663,14 +663,14 @@ public class LuaJit extends Lua implements LuaCompiler {
//continue;
b = LuaState.GETARG_Bx(i);
ps.println("\t\ts"+a+" = newcl = p.p["+b+"].newClosure(env);");
for (int j = 0, nj=p.p[b].nups; j < nj; j++, pc++) {
i = code[pc];
for (int j = 0, nj=p.p[b].nups; j < nj; j++) {
i = code[++pc];
o = LuaState.GET_OPCODE(i);
b = LuaState.GETARG_B(i);
if (o == LuaState.OP_GETUPVAL) {
ps.println("\t\tnewcl.upVals[j] = newcl.upVals["+b+"];");
ps.println("\t\tnewcl.upVals["+j+"] = newcl.upVals["+b+"];");
} else if (o == LuaState.OP_MOVE) {
ps.println("\t\tnewcl.upVals[j] = vm.findUpVal(base+"+b+");");
ps.println("\t\tnewcl.upVals["+j+"] = vm.findUpVal(base+"+b+");");
} else {
throw new java.lang.IllegalArgumentException("bad opcode: " + o);
}