Fix for loop (jit), make jist test use jit closures.

This commit is contained in:
James Roseborough
2008-05-18 19:24:09 +00:00
parent 039d79fe5f
commit d9c3f0ae15
2 changed files with 4 additions and 5 deletions

View File

@@ -547,15 +547,13 @@ public class LuaJit extends Lua {
String step = "s"+(a+2); String step = "s"+(a+2);
String idx = "s"+(a+3); String idx = "s"+(a+3);
String back = "back"+(forlevel++); String back = "back"+(forlevel++);
ps.println( "\t\t"+back+"="+step+".luaBinCmpInteger(Lua.OP_LT,0);"); ps.println( "\t\tfor ( "+idx+"="+init+", "+back+"="+step+".luaBinCmpInteger(Lua.OP_LT,0);\n" +
ps.println( "\t\tfor ( "+idx+"="+init+";\n" +
"\t\t\t"+back+"? "+idx+".luaBinCmpUnknown(Lua.OP_LE, "+limit+"): "+limit+".luaBinCmpUnknown(Lua.OP_LE, "+idx+");\n" + "\t\t\t"+back+"? "+idx+".luaBinCmpUnknown(Lua.OP_LE, "+limit+"): "+limit+".luaBinCmpUnknown(Lua.OP_LE, "+idx+");\n" +
"\t\t\t"+idx+"="+idx+".luaBinOpUnknown(Lua.OP_ADD,"+step+") ) {"); "\t\t\t"+idx+"="+idx+".luaBinOpUnknown(Lua.OP_ADD,"+step+") ) {");
forlevel++;
break; break;
} }
case LuaState.OP_FORLOOP: { case LuaState.OP_FORLOOP: {
forlevel--; --forlevel;
ps.println( "\t\t}"); ps.println( "\t\t}");
//i0 = this.stack[base + a]; //i0 = this.stack[base + a];
//step = this.stack[base + a + 2]; //step = this.stack[base + a + 2];

View File

@@ -195,7 +195,8 @@ public class LuaJTest extends TestCase {
try { try {
// create closure and execute // create closure and execute
LClosure c = p.newClosure( state._G ); LClosure c = p.newClosure( state._G );
state.doCall(c, new LValue[0]); state.pushlvalue(c);
state.call(0,0);
final String actualOutput = new String( outputStream.toByteArray() ); final String actualOutput = new String( outputStream.toByteArray() );
final String expectedOutput = getExpectedOutput( testName ); final String expectedOutput = getExpectedOutput( testName );