diff --git a/src/core/org/luaj/vm2/Print.java b/src/core/org/luaj/vm2/Print.java index f8d9f490..d13a9b68 100644 --- a/src/core/org/luaj/vm2/Print.java +++ b/src/core/org/luaj/vm2/Print.java @@ -223,7 +223,7 @@ public class Print extends Lua { case OP_GETTABUP: case OP_SETTABUP: ps.print(" ; "); - printConstant( ps, f, bx ); + printConstant( ps, f, b ); break; case OP_GETTABLE: case OP_SELF: diff --git a/src/core/org/luaj/vm2/compiler/FuncState.java b/src/core/org/luaj/vm2/compiler/FuncState.java index 5a9ad4a0..3dbd73b8 100644 --- a/src/core/org/luaj/vm2/compiler/FuncState.java +++ b/src/core/org/luaj/vm2/compiler/FuncState.java @@ -1109,6 +1109,7 @@ public class FuncState extends LuaC { int codeABx(int o, int a, int bc) { _assert (getOpMode(o) == iABx || getOpMode(o) == iAsBx); _assert (getCMode(o) == OpArgN); + _assert (bc >= 0 && bc <= Lua.MAXARG_Bx); return this.code(CREATE_ABx(o, a, bc), this.ls.lastline); } diff --git a/src/core/org/luaj/vm2/compiler/LexState.java b/src/core/org/luaj/vm2/compiler/LexState.java index bad1d5b7..8c7e5c9c 100644 --- a/src/core/org/luaj/vm2/compiler/LexState.java +++ b/src/core/org/luaj/vm2/compiler/LexState.java @@ -1064,14 +1064,9 @@ public class LexState { } void open_func (FuncState fs, BlockCnt bl) { - LuaC L = this.L; Prototype f = new Prototype(); - if ( this.fs!=null ) - f.source = this.fs.f.source; - fs.f = f; fs.prev = this.fs; /* linked list of funcstates */ fs.ls = this; - fs.L = L; this.fs = fs; fs.pc = 0; fs.lasttarget = -1; @@ -1079,6 +1074,7 @@ public class LexState { fs.freereg = 0; fs.nk = 0; fs.np = 0; + fs.nups = 0; fs.nlocvars = 0; fs.nactvar = 0; fs.firstlocal = dyd.n_actvar; @@ -1266,9 +1262,9 @@ public class LexState { /* body -> `(' parlist `)' chunk END */ FuncState new_fs = new FuncState(); BlockCnt bl = new BlockCnt(); - open_func(new_fs, bl); new_fs.f = addprototype(); new_fs.f.linedefined = line; + open_func(new_fs, bl); this.checknext('('); if (needself) { new_localvarliteral("self");