diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-11-18 14:54:06 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-11-18 14:54:06 -0300 |
| commit | 5f83fb658206d195e54d3574b989ce5285a5b18f (patch) | |
| tree | 2049d60a21ae33407c13c5e8452b539ae250b2f2 | |
| parent | 679dc72c08a7c563a0c3f463332d6f22d573a106 (diff) | |
| download | lua-5f83fb658206d195e54d3574b989ce5285a5b18f.tar.gz lua-5f83fb658206d195e54d3574b989ce5285a5b18f.tar.bz2 lua-5f83fb658206d195e54d3574b989ce5285a5b18f.zip | |
Details
| -rw-r--r-- | lfunc.c | 14 | ||||
| -rw-r--r-- | lfunc.h | 4 | ||||
| -rw-r--r-- | lopcodes.h | 4 | ||||
| -rw-r--r-- | lparser.h | 2 | ||||
| -rw-r--r-- | lvm.c | 2 | ||||
| -rw-r--r-- | manual/manual.of | 5 |
6 files changed, 16 insertions, 15 deletions
| @@ -24,20 +24,20 @@ | |||
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | CClosure *luaF_newCclosure (lua_State *L, int n) { | 27 | CClosure *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 | ||
| 35 | LClosure *luaF_newLclosure (lua_State *L, int n) { | 35 | LClosure *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 | ||
| @@ -54,8 +54,8 @@ | |||
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); | 56 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); |
| 57 | LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); | 57 | LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals); |
| 58 | LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); | 58 | LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals); |
| 59 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); | 59 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); |
| 60 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); | 60 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); |
| 61 | LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); | 61 | LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); |
| @@ -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 |
| 20 | iABC C(8) | B(8) |k| A(8) | Op(7) | | 20 | iABC C(8) | B(8) |k| A(8) | Op(7) | |
| 21 | iABx Bx(17) | A(8) | Op(7) | | 21 | iABx Bx(17) | A(8) | Op(7) | |
| 22 | iAsB sBx (signed)(17) | A(8) | Op(7) | | 22 | iAsBx sBx (signed)(17) | A(8) | Op(7) | |
| 23 | iAx Ax(25) | Op(7) | | 23 | iAx Ax(25) | Op(7) | |
| 24 | isJ sJ(25) | Op(7) | | 24 | isJ 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 | ||
| @@ -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' */ |
| @@ -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 | ||
| 8239 | Returns an approximation of the amount in seconds of CPU time | 8239 | Returns an approximation of the amount in seconds of CPU time |
| 8240 | used by the program. | 8240 | used by the program, |
| 8241 | as 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 | ||
| 8339 | Returns the value of the process environment variable @id{varname}, | 8340 | Returns the value of the process environment variable @id{varname} |
| 8340 | or @fail if the variable is not defined. | 8341 | or @fail if the variable is not defined. |
| 8341 | 8342 | ||
| 8342 | } | 8343 | } |
