lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 17ee57f8e022be330d4c9de3754d7455f46a851d
parent 3c6d0aaa7d07de2cf24d09195b6678abbfee2268
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon, 21 Jul 2014 13:01:45 -0300

'iswhite' and related macros now can work directly on any object
(no need to convert to 'GCObject')

Diffstat:
Mlparser.c | 8++++----
Mlstring.c | 6+++---
Mlvm.c | 4++--
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lparser.c b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.140 2014/07/18 12:17:54 roberto Exp roberto $ +** $Id: lparser.c,v 2.141 2014/07/18 13:36:14 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -164,7 +164,7 @@ static int registerlocalvar (LexState *ls, TString *varname) { LocVar, SHRT_MAX, "local variables"); while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; f->locvars[fs->nlocvars].varname = varname; - luaC_objbarrier(ls->L, f, obj2gco(varname)); + luaC_objbarrier(ls->L, f, varname); return fs->nlocvars++; } @@ -232,7 +232,7 @@ static int newupvalue (FuncState *fs, TString *name, expdesc *v) { f->upvalues[fs->nups].instack = (v->k == VLOCAL); f->upvalues[fs->nups].idx = cast_byte(v->u.info); f->upvalues[fs->nups].name = name; - luaC_objbarrier(fs->ls->L, f, obj2gco(name)); + luaC_objbarrier(fs->ls->L, f, name); return fs->nups++; } @@ -1630,7 +1630,7 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, incr_top(L); funcstate.f = cl->p = luaF_newproto(L); funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ - luaC_objbarrier(L, funcstate.f, obj2gco(funcstate.f->source)); + luaC_objbarrier(L, funcstate.f, funcstate.f->source); lexstate.buff = buff; lexstate.dyd = dyd; dyd->actvar.n = dyd->gt.n = dyd->label.n = 0; diff --git a/lstring.c b/lstring.c @@ -1,5 +1,5 @@ /* -** $Id: lstring.c,v 2.42 2014/07/18 13:36:14 roberto Exp roberto $ +** $Id: lstring.c,v 2.43 2014/07/18 14:46:47 roberto Exp roberto $ ** String table (keeps all strings handled by Lua) ** See Copyright Notice in lua.h */ @@ -126,8 +126,8 @@ static TString *internshrstr (lua_State *L, const char *str, size_t l) { if (l == ts->len && (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) { /* found! */ - if (isdead(g, obj2gco(ts))) /* dead (but not collected yet)? */ - changewhite(obj2gco(ts)); /* resurrect it */ + if (isdead(g, ts)) /* dead (but not collected yet)? */ + changewhite(ts); /* resurrect it */ return ts; } } diff --git a/lvm.c b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.218 2014/07/17 12:30:53 roberto Exp roberto $ +** $Id: lvm.c,v 2.219 2014/07/18 13:36:14 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -549,7 +549,7 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, ncl->upvals[i]->refcount++; /* new closure is white, so we do not need a barrier here */ } - if (!isblack(obj2gco(p))) /* cache will not break GC invariant? */ + if (!isblack(p)) /* cache will not break GC invariant? */ p->cache = ncl; /* save it on cache for reuse */ }