better field name

This commit is contained in:
Roberto Ierusalimschy
2000-05-30 16:00:31 -03:00
parent f63d7753b8
commit 7e30900def
7 changed files with 19 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: ldebug.c,v 1.19 2000/05/12 19:49:18 roberto Exp roberto $ ** $Id: ldebug.c,v 1.20 2000/05/15 19:30:41 roberto Exp roberto $
** Debug Interface ** Debug Interface
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -89,7 +89,7 @@ static int lua_nups (StkId f) {
switch (ttype(f)) { switch (ttype(f)) {
case TAG_LCLOSURE: case TAG_CCLOSURE: case TAG_LCLOSURE: case TAG_CCLOSURE:
case TAG_LMARK: case TAG_CMARK: case TAG_LMARK: case TAG_CMARK:
return f->value.cl->nelems; return f->value.cl->nupvalues;
default: default:
return 0; return 0;
} }

6
ldo.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: ldo.c,v 1.75 2000/05/09 14:50:16 roberto Exp roberto $ ** $Id: ldo.c,v 1.76 2000/05/24 13:54:49 roberto Exp roberto $
** Stack and Call structure of Lua ** Stack and Call structure of Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -139,7 +139,7 @@ static void luaD_callHook (lua_State *L, StkId func, lua_Hook callhook,
static StkId callCclosure (lua_State *L, const struct Closure *cl, StkId base) { static StkId callCclosure (lua_State *L, const struct Closure *cl, StkId base) {
int nup = cl->nelems; /* number of upvalues */ int nup = cl->nupvalues; /* number of upvalues */
int numarg = L->top-base; int numarg = L->top-base;
struct C_Lua_Stack oldCLS = L->Cstack; struct C_Lua_Stack oldCLS = L->Cstack;
StkId firstResult; StkId firstResult;
@@ -151,7 +151,7 @@ static StkId callCclosure (lua_State *L, const struct Closure *cl, StkId base) {
L->top += nup; L->top += nup;
numarg += nup; numarg += nup;
/* copy upvalues into stack */ /* copy upvalues into stack */
while (nup--) *(base+nup) = cl->consts[nup]; while (nup--) *(base+nup) = cl->upvalue[nup];
} }
L->Cstack.num = numarg; L->Cstack.num = numarg;
L->Cstack.lua2C = base; L->Cstack.lua2C = base;

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lfunc.c,v 1.21 2000/03/29 20:19:20 roberto Exp roberto $ ** $Id: lfunc.c,v 1.22 2000/05/24 13:54:49 roberto Exp roberto $
** Auxiliary functions to manipulate prototypes and closures ** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -14,7 +14,7 @@
#include "lstate.h" #include "lstate.h"
#define gcsizeproto(L, p) numblocks(L, 0, sizeof(Proto)) #define gcsizeproto(L, p) numblocks(L, 0, sizeof(Proto))
#define gcsizeclosure(L, c) numblocks(L, c->nelems, sizeof(Closure)) #define gcsizeclosure(L, c) numblocks(L, c->nupvalues, sizeof(Closure))
@@ -24,7 +24,7 @@ Closure *luaF_newclosure (lua_State *L, int nelems) {
c->next = L->rootcl; c->next = L->rootcl;
L->rootcl = c; L->rootcl = c;
c->marked = 0; c->marked = 0;
c->nelems = nelems; c->nupvalues = nelems;
L->nblocks += gcsizeclosure(L, c); L->nblocks += gcsizeclosure(L, c);
return c; return c;
} }

6
lgc.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lgc.c,v 1.51 2000/05/24 13:54:49 roberto Exp roberto $ ** $Id: lgc.c,v 1.52 2000/05/30 18:54:49 roberto Exp roberto $
** Garbage Collector ** Garbage Collector
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -44,10 +44,10 @@ static void protomark (lua_State *L, Proto *f) {
static void closuremark (lua_State *L, Closure *f) { static void closuremark (lua_State *L, Closure *f) {
if (!f->marked) { if (!f->marked) {
int i = f->nelems; int i = f->nupvalues;
f->marked = 1; f->marked = 1;
while (i--) while (i--)
markobject(L, &f->consts[i]); markobject(L, &f->upvalue[i]);
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lobject.h,v 1.64 2000/05/10 16:33:20 roberto Exp roberto $ ** $Id: lobject.h,v 1.65 2000/05/24 13:54:49 roberto Exp roberto $
** Type definitions for Lua objects ** Type definitions for Lua objects
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -144,8 +144,8 @@ typedef struct Closure {
lua_CFunction c; /* C functions */ lua_CFunction c; /* C functions */
struct Proto *l; /* Lua functions */ struct Proto *l; /* Lua functions */
} f; } f;
int nelems; int nupvalues;
TObject consts[1]; TObject upvalue[1];
} Closure; } Closure;

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lparser.c,v 1.91 2000/05/25 18:26:42 roberto Exp roberto $ ** $Id: lparser.c,v 1.92 2000/05/25 18:59:59 roberto Exp roberto $
** LL(1) Parser and code generator for Lua ** LL(1) Parser and code generator for Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -170,7 +170,7 @@ static int checkname (LexState *ls) {
static TString *str_checkname (LexState *ls) { static TString *str_checkname (LexState *ls) {
int i = checkname(ls); /* this call may realloc `f->consts' */ int i = checkname(ls); /* this call may realloc `f->kstr' */
return ls->fs->f->kstr[i]; return ls->fs->f->kstr[i];
} }

6
lvm.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lvm.c,v 1.108 2000/05/24 13:54:49 roberto Exp roberto $ ** $Id: lvm.c,v 1.109 2000/05/25 19:02:21 roberto Exp roberto $
** Lua virtual machine ** Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -77,7 +77,7 @@ static Closure *luaV_closure (lua_State *L, lua_Type t, int nelems) {
Closure *c = luaF_newclosure(L, nelems); Closure *c = luaF_newclosure(L, nelems);
L->top -= nelems; L->top -= nelems;
while (nelems--) while (nelems--)
c->consts[nelems] = *(L->top+nelems); c->upvalue[nelems] = *(L->top+nelems);
ttype(L->top) = t; ttype(L->top) = t;
clvalue(L->top) = c; clvalue(L->top) = c;
incr_top; incr_top;
@@ -409,7 +409,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
break; break;
case OP_PUSHUPVALUE: case OP_PUSHUPVALUE:
*top++ = cl->consts[GETARG_U(i)]; *top++ = cl->upvalue[GETARG_U(i)];
break; break;
case OP_GETLOCAL: case OP_GETLOCAL: