`optimization' doesn't seem to make any difference...

This commit is contained in:
Roberto Ierusalimschy 1999-12-06 17:30:53 -02:00
parent 617be66015
commit ba1f504970
1 changed files with 10 additions and 16 deletions

26
lvm.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lvm.c,v 1.69 1999/12/01 19:50:08 roberto Exp roberto $ ** $Id: lvm.c,v 1.70 1999/12/06 11:40:55 roberto Exp roberto $
** Lua virtual machine ** Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -170,21 +170,15 @@ void luaV_rawsettable (lua_State *L, StkId t) {
void luaV_getglobal (lua_State *L, GlobalVar *gv) { void luaV_getglobal (lua_State *L, GlobalVar *gv) {
/* WARNING: caller must assure stack space */ /* WARNING: caller must assure stack space */
const TObject *value = &gv->value; const TObject *value = &gv->value;
switch (ttype(value)) { TObject *im = luaT_getimbyObj(L, value, IM_GETGLOBAL);
/* only userdata, tables and nil can have getglobal tag methods */ if (ttype(im) != LUA_T_NIL) { /* is there a tag method? */
case LUA_T_USERDATA: case LUA_T_ARRAY: case LUA_T_NIL: { ttype(L->top) = LUA_T_STRING;
TObject *im = luaT_getimbyObj(L, value, IM_GETGLOBAL); tsvalue(L->top) = gv->name; /* global name */
if (ttype(im) != LUA_T_NIL) { /* is there a tag method? */ L->top++;
ttype(L->top) = LUA_T_STRING; *L->top++ = *value;
tsvalue(L->top) = gv->name; /* global name */ luaD_callTM(L, im, 2, 1);
L->top++; } else { /* no tag method */
*L->top++ = *value; *L->top++ = *value; /* default behavior */
luaD_callTM(L, im, 2, 1);
return;
}
/* else no tag method: go through to default behavior */
}
default: *L->top++ = *value; /* default behavior */
} }
} }