optimization: closures without upvalues don't need to be closures

This commit is contained in:
Roberto Ierusalimschy
1997-12-15 14:17:20 -02:00
parent 94144a7821
commit 45e533599f
13 changed files with 132 additions and 93 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lobject.c,v 1.6 1997/11/03 20:45:23 roberto Exp roberto $
** $Id: lobject.c,v 1.7 1997/11/19 17:29:23 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@@ -12,8 +12,8 @@
char *luaO_typenames[] = { /* ORDER LUA_T */
"userdata", "number", "string", "table", "prototype", "cprototype",
"nil", "function", "mark", "cmark", "line", NULL
"userdata", "number", "string", "table", "function", "function",
"nil", "function", "mark", "mark", "mark", "line", NULL
};
@@ -48,7 +48,9 @@ int luaO_equalObj (TObject *t1, TObject *t2)
case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2);
case LUA_T_STRING: case LUA_T_USERDATA: return svalue(t1) == svalue(t2);
case LUA_T_ARRAY: return avalue(t1) == avalue(t2);
case LUA_T_FUNCTION: return t1->value.cl == t2->value.cl;
case LUA_T_CLOSURE: return t1->value.cl == t2->value.cl;
case LUA_T_PROTO: return tfvalue(t1) == tfvalue(t2);
case LUA_T_CPROTO: return fvalue(t1) == fvalue(t2);
default:
lua_error("internal error in `lua_equalObj'");
return 0; /* UNREACHEABLE */