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;
|
UpVal up;
|
||||||
int i;
|
int i;
|
||||||
for ( i = this.upvals.size() - 1; i >= 0; --i ) {
|
for ( i = this.upvals.size() - 1; i >= 0; --i ) {
|
||||||
@@ -895,7 +895,7 @@ public class LuaState extends Lua {
|
|||||||
return up;
|
return up;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeUpVals( int limit ) {
|
public void closeUpVals( int limit ) {
|
||||||
while ( !upvals.empty() && ( (UpVal) this.upvals.lastElement() ).close( limit ) ) {
|
while ( !upvals.empty() && ( (UpVal) this.upvals.lastElement() ).close( limit ) ) {
|
||||||
this.upvals.pop();
|
this.upvals.pop();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -663,14 +663,14 @@ public class LuaJit extends Lua implements LuaCompiler {
|
|||||||
//continue;
|
//continue;
|
||||||
b = LuaState.GETARG_Bx(i);
|
b = LuaState.GETARG_Bx(i);
|
||||||
ps.println("\t\ts"+a+" = newcl = p.p["+b+"].newClosure(env);");
|
ps.println("\t\ts"+a+" = newcl = p.p["+b+"].newClosure(env);");
|
||||||
for (int j = 0, nj=p.p[b].nups; j < nj; j++, pc++) {
|
for (int j = 0, nj=p.p[b].nups; j < nj; j++) {
|
||||||
i = code[pc];
|
i = code[++pc];
|
||||||
o = LuaState.GET_OPCODE(i);
|
o = LuaState.GET_OPCODE(i);
|
||||||
b = LuaState.GETARG_B(i);
|
b = LuaState.GETARG_B(i);
|
||||||
if (o == LuaState.OP_GETUPVAL) {
|
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) {
|
} 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 {
|
} else {
|
||||||
throw new java.lang.IllegalArgumentException("bad opcode: " + o);
|
throw new java.lang.IllegalArgumentException("bad opcode: " + o);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user