Fix bug in compiler affecting functions with many locals.

This commit is contained in:
Ian Farmer
2010-07-25 20:47:54 +00:00
parent ea931c1438
commit 97b4162423
5 changed files with 47 additions and 8 deletions

View File

@@ -52,7 +52,7 @@ public class LuaThread extends LuaValue implements Runnable {
public LuaValue err;
public static final int MAX_CALLSTACK = 64;
public static final int MAX_CALLSTACK = 256;
public final LuaFunction[] callstack = new LuaFunction[MAX_CALLSTACK];
public int calls = 0;

View File

@@ -68,10 +68,10 @@ public class LuaValue extends Varargs {
public static final LuaString METATABLE = valueOf("__metatable");
public static final LuaString EMPTYSTRING = valueOf("");
private static int MAXLOCALS = 200;
public static final LuaValue[] NILS = new LuaValue[MAXLOCALS];
private static int MAXSTACK = 250;
public static final LuaValue[] NILS = new LuaValue[MAXSTACK];
static {
for ( int i=0; i<MAXLOCALS; i++ )
for ( int i=0; i<MAXSTACK; i++ )
NILS[i] = NIL;
}

View File

@@ -38,8 +38,8 @@ import org.luaj.vm2.compiler.LexState.expdesc;
public class FuncState extends LuaC {
class upvaldesc {
byte k;
byte info;
short k;
short info;
};
static class BlockCnt {
@@ -129,8 +129,8 @@ public class FuncState extends LuaC {
f.upvalues[f.nups] = name;
_assert (v.k == LexState.VLOCAL || v.k == LexState.VUPVAL);
upvalues[f.nups] = new upvaldesc();
upvalues[f.nups].k = (byte) (v.k);
upvalues[f.nups].info = (byte) (v.u.s.info);
upvalues[f.nups].k = (short) (v.k);
upvalues[f.nups].info = (short) (v.u.s.info);
return f.nups++;
}