Allow jit to find upvalues.
This commit is contained in:
@@ -878,7 +878,7 @@ public class LuaState extends Lua {
|
||||
}
|
||||
}
|
||||
|
||||
private UpVal findUpVal( int target ) {
|
||||
public UpVal findUpVal( int target ) {
|
||||
UpVal up;
|
||||
int i;
|
||||
for ( i = this.upvals.size() - 1; i >= 0; --i ) {
|
||||
@@ -895,7 +895,7 @@ public class LuaState extends Lua {
|
||||
return up;
|
||||
}
|
||||
|
||||
private void closeUpVals( int limit ) {
|
||||
public void closeUpVals( int limit ) {
|
||||
while ( !upvals.empty() && ( (UpVal) this.upvals.lastElement() ).close( limit ) ) {
|
||||
this.upvals.pop();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user