summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-11-18 14:54:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-11-18 14:54:06 -0300
commit5f83fb658206d195e54d3574b989ce5285a5b18f (patch)
tree2049d60a21ae33407c13c5e8452b539ae250b2f2
parent679dc72c08a7c563a0c3f463332d6f22d573a106 (diff)
downloadlua-5f83fb658206d195e54d3574b989ce5285a5b18f.tar.gz
lua-5f83fb658206d195e54d3574b989ce5285a5b18f.tar.bz2
lua-5f83fb658206d195e54d3574b989ce5285a5b18f.zip
Details
-rw-r--r--lfunc.c14
-rw-r--r--lfunc.h4
-rw-r--r--lopcodes.h4
-rw-r--r--lparser.h2
-rw-r--r--lvm.c2
-rw-r--r--manual/manual.of5
6 files changed, 16 insertions, 15 deletions
diff --git a/lfunc.c b/lfunc.c
index 1e61f03f..0ef73284 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -24,20 +24,20 @@
24 24
25 25
26 26
27CClosure *luaF_newCclosure (lua_State *L, int n) { 27CClosure *luaF_newCclosure (lua_State *L, int nupvals) {
28 GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n)); 28 GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(nupvals));
29 CClosure *c = gco2ccl(o); 29 CClosure *c = gco2ccl(o);
30 c->nupvalues = cast_byte(n); 30 c->nupvalues = cast_byte(nupvals);
31 return c; 31 return c;
32} 32}
33 33
34 34
35LClosure *luaF_newLclosure (lua_State *L, int n) { 35LClosure *luaF_newLclosure (lua_State *L, int nupvals) {
36 GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n)); 36 GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(nupvals));
37 LClosure *c = gco2lcl(o); 37 LClosure *c = gco2lcl(o);
38 c->p = NULL; 38 c->p = NULL;
39 c->nupvalues = cast_byte(n); 39 c->nupvalues = cast_byte(nupvals);
40 while (n--) c->upvals[n] = NULL; 40 while (nupvals--) c->upvals[nupvals] = NULL;
41 return c; 41 return c;
42} 42}
43 43
diff --git a/lfunc.h b/lfunc.h
index 0ed79c48..8d6f965c 100644
--- a/lfunc.h
+++ b/lfunc.h
@@ -54,8 +54,8 @@
54 54
55 55
56LUAI_FUNC Proto *luaF_newproto (lua_State *L); 56LUAI_FUNC Proto *luaF_newproto (lua_State *L);
57LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); 57LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals);
58LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); 58LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals);
59LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); 59LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
60LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 60LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
61LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); 61LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level);
diff --git a/lopcodes.h b/lopcodes.h
index dbef6a65..382dec05 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -19,7 +19,7 @@
19 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 19 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
20iABC C(8) | B(8) |k| A(8) | Op(7) | 20iABC C(8) | B(8) |k| A(8) | Op(7) |
21iABx Bx(17) | A(8) | Op(7) | 21iABx Bx(17) | A(8) | Op(7) |
22iAsB sBx (signed)(17) | A(8) | Op(7) | 22iAsBx sBx (signed)(17) | A(8) | Op(7) |
23iAx Ax(25) | Op(7) | 23iAx Ax(25) | Op(7) |
24isJ sJ(25) | Op(7) | 24isJ sJ(25) | Op(7) |
25 25
@@ -133,7 +133,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
133#define GETARG_sC(i) sC2int(GETARG_C(i)) 133#define GETARG_sC(i) sC2int(GETARG_C(i))
134#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) 134#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
135 135
136#define TESTARG_k(i) (cast_int(((i) & (1u << POS_k)))) 136#define TESTARG_k(i) check_exp(checkopm(i, iABC), (cast_int(((i) & (1u << POS_k)))))
137#define GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1)) 137#define GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1))
138#define SETARG_k(i,v) setarg(i, v, POS_k, 1) 138#define SETARG_k(i,v) setarg(i, v, POS_k, 1)
139 139
diff --git a/lparser.h b/lparser.h
index f528f013..f544492e 100644
--- a/lparser.h
+++ b/lparser.h
@@ -35,7 +35,7 @@ typedef enum {
35 (string is fixed by the lexer) */ 35 (string is fixed by the lexer) */
36 VNONRELOC, /* expression has its value in a fixed register; 36 VNONRELOC, /* expression has its value in a fixed register;
37 info = result register */ 37 info = result register */
38 VLOCAL, /* local variable; var.ridx = local register; 38 VLOCAL, /* local variable; var.sidx = stack index (local register);
39 var.vidx = relative index in 'actvar.arr' */ 39 var.vidx = relative index in 'actvar.arr' */
40 VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ 40 VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */
41 VCONST, /* compile-time constant; info = absolute index in 'actvar.arr' */ 41 VCONST, /* compile-time constant; info = absolute index in 'actvar.arr' */
diff --git a/lvm.c b/lvm.c
index 2c96c58d..93cb8bc8 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1082,7 +1082,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
1082 lua_assert(base == ci->func + 1); 1082 lua_assert(base == ci->func + 1);
1083 lua_assert(base <= L->top && L->top < L->stack + L->stacksize); 1083 lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
1084 /* invalidate top for instructions not expecting it */ 1084 /* invalidate top for instructions not expecting it */
1085 lua_assert(isIT(i) || (L->top = base)); 1085 lua_assert(isIT(i) || (cast_void(L->top = base), 1));
1086 vmdispatch (GET_OPCODE(i)) { 1086 vmdispatch (GET_OPCODE(i)) {
1087 vmcase(OP_MOVE) { 1087 vmcase(OP_MOVE) {
1088 setobjs2s(L, ra, RB(i)); 1088 setobjs2s(L, ra, RB(i));
diff --git a/manual/manual.of b/manual/manual.of
index 7b5b9385..61d4afac 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -8237,7 +8237,8 @@ This library is implemented through table @defid{os}.
8237@LibEntry{os.clock ()| 8237@LibEntry{os.clock ()|
8238 8238
8239Returns an approximation of the amount in seconds of CPU time 8239Returns an approximation of the amount in seconds of CPU time
8240used by the program. 8240used by the program,
8241as returned by the underlying @ANSI{clock}.
8241 8242
8242} 8243}
8243 8244
@@ -8336,7 +8337,7 @@ closes the Lua state before exiting.
8336 8337
8337@LibEntry{os.getenv (varname)| 8338@LibEntry{os.getenv (varname)|
8338 8339
8339Returns the value of the process environment variable @id{varname}, 8340Returns the value of the process environment variable @id{varname}
8340or @fail if the variable is not defined. 8341or @fail if the variable is not defined.
8341 8342
8342} 8343}