Browse Source

Details

pull/23/head
Roberto Ierusalimschy 5 years ago
parent
commit
5f83fb6582
  1. 14
      lfunc.c
  2. 4
      lfunc.h
  3. 4
      lopcodes.h
  4. 2
      lparser.h
  5. 2
      lvm.c
  6. 5
      manual/manual.of

14
lfunc.c

@ -24,20 +24,20 @@
CClosure *luaF_newCclosure (lua_State *L, int n) { CClosure *luaF_newCclosure (lua_State *L, int nupvals) {
GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n)); GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(nupvals));
CClosure *c = gco2ccl(o); CClosure *c = gco2ccl(o);
c->nupvalues = cast_byte(n); c->nupvalues = cast_byte(nupvals);
return c; return c;
} }
LClosure *luaF_newLclosure (lua_State *L, int n) { LClosure *luaF_newLclosure (lua_State *L, int nupvals) {
GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n)); GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(nupvals));
LClosure *c = gco2lcl(o); LClosure *c = gco2lcl(o);
c->p = NULL; c->p = NULL;
c->nupvalues = cast_byte(n); c->nupvalues = cast_byte(nupvals);
while (n--) c->upvals[n] = NULL; while (nupvals--) c->upvals[nupvals] = NULL;
return c; return c;
} }

4
lfunc.h

@ -54,8 +54,8 @@
LUAI_FUNC Proto *luaF_newproto (lua_State *L); LUAI_FUNC Proto *luaF_newproto (lua_State *L);
LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals);
LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals);
LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level);

4
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 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) | iABC C(8) | B(8) |k| A(8) | Op(7) |
iABx Bx(17) | 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) | iAx Ax(25) | Op(7) |
isJ sJ(25) | Op(7) | isJ sJ(25) | Op(7) |
@ -133,7 +133,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
#define GETARG_sC(i) sC2int(GETARG_C(i)) #define GETARG_sC(i) sC2int(GETARG_C(i))
#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) #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 GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1))
#define SETARG_k(i,v) setarg(i, v, POS_k, 1) #define SETARG_k(i,v) setarg(i, v, POS_k, 1)

2
lparser.h

@ -35,7 +35,7 @@ typedef enum {
(string is fixed by the lexer) */ (string is fixed by the lexer) */
VNONRELOC, /* expression has its value in a fixed register; VNONRELOC, /* expression has its value in a fixed register;
info = result 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' */ var.vidx = relative index in 'actvar.arr' */
VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */
VCONST, /* compile-time constant; info = absolute index in 'actvar.arr' */ VCONST, /* compile-time constant; info = absolute index in 'actvar.arr' */

2
lvm.c

@ -1082,7 +1082,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
lua_assert(base == ci->func + 1); lua_assert(base == ci->func + 1);
lua_assert(base <= L->top && L->top < L->stack + L->stacksize); lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
/* invalidate top for instructions not expecting it */ /* 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)) { vmdispatch (GET_OPCODE(i)) {
vmcase(OP_MOVE) { vmcase(OP_MOVE) {
setobjs2s(L, ra, RB(i)); setobjs2s(L, ra, RB(i));

5
manual/manual.of

@ -8237,7 +8237,8 @@ This library is implemented through table @defid{os}.
@LibEntry{os.clock ()| @LibEntry{os.clock ()|
Returns an approximation of the amount in seconds of CPU time 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 @@ closes the Lua state before exiting.
@LibEntry{os.getenv (varname)| @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. or @fail if the variable is not defined.
} }

Loading…
Cancel
Save