Details
diff --git a/lfunc.c b/lfunc.c
index 1e61f03..0ef7328 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -24,20 +24,20 @@
-CClosure *luaF_newCclosure (lua_State *L, int n) {
- GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n));
+CClosure *luaF_newCclosure (lua_State *L, int nupvals) {
+ GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(nupvals));
CClosure *c = gco2ccl(o);
- c->nupvalues = cast_byte(n);
+ c->nupvalues = cast_byte(nupvals);
return c;
}
-LClosure *luaF_newLclosure (lua_State *L, int n) {
- GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n));
+LClosure *luaF_newLclosure (lua_State *L, int nupvals) {
+ GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(nupvals));
LClosure *c = gco2lcl(o);
c->p = NULL;
- c->nupvalues = cast_byte(n);
- while (n--) c->upvals[n] = NULL;
+ c->nupvalues = cast_byte(nupvals);
+ while (nupvals--) c->upvals[nupvals] = NULL;
return c;
}
diff --git a/lfunc.h b/lfunc.h
index 0ed79c4..8d6f965 100644
--- a/lfunc.h
+++ b/lfunc.h
@@ -54,8 +54,8 @@
LUAI_FUNC Proto *luaF_newproto (lua_State *L);
-LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems);
-LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems);
+LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals);
+LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals);
LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level);
diff --git a/lopcodes.h b/lopcodes.h
index dbef6a6..382dec0 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -19,7 +19,7 @@
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
iABC C(8) | B(8) |k| A(8) | Op(7) |
iABx Bx(17) | A(8) | Op(7) |
-iAsB sBx (signed)(17) | A(8) | Op(7) |
+iAsBx sBx (signed)(17) | A(8) | Op(7) |
iAx Ax(25) | Op(7) |
isJ sJ(25) | Op(7) |
@@ -133,7 +133,7 @@
#define GETARG_sC(i) sC2int(GETARG_C(i))
#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
-#define TESTARG_k(i) (cast_int(((i) & (1u << POS_k))))
+#define TESTARG_k(i) check_exp(checkopm(i, iABC), (cast_int(((i) & (1u << POS_k)))))
#define GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1))
#define SETARG_k(i,v) setarg(i, v, POS_k, 1)
diff --git a/lparser.h b/lparser.h
index f528f01..f544492 100644
--- a/lparser.h
+++ b/lparser.h
@@ -35,7 +35,7 @@
(string is fixed by the lexer) */
VNONRELOC, /* expression has its value in a fixed register;
info = result register */
- VLOCAL, /* local variable; var.ridx = local register;
+ VLOCAL, /* local variable; var.sidx = stack index (local register);
var.vidx = relative index in 'actvar.arr' */
VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */
VCONST, /* compile-time constant; info = absolute index in 'actvar.arr' */
diff --git a/lvm.c b/lvm.c
index 2c96c58..93cb8bc 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1082,7 +1082,7 @@
lua_assert(base == ci->func + 1);
lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
/* invalidate top for instructions not expecting it */
- lua_assert(isIT(i) || (L->top = base));
+ lua_assert(isIT(i) || (cast_void(L->top = base), 1));
vmdispatch (GET_OPCODE(i)) {
vmcase(OP_MOVE) {
setobjs2s(L, ra, RB(i));
diff --git a/manual/manual.of b/manual/manual.of
index 7b5b938..61d4afa 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -8237,7 +8237,8 @@
@LibEntry{os.clock ()|
Returns an approximation of the amount in seconds of CPU time
-used by the program.
+used by the program,
+as returned by the underlying @ANSI{clock}.
}
@@ -8336,7 +8337,7 @@
@LibEntry{os.getenv (varname)|
-Returns the value of the process environment variable @id{varname},
+Returns the value of the process environment variable @id{varname}
or @fail if the variable is not defined.
}