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.h,v 1.9 1997/11/19 17:29:23 roberto Exp roberto $
** $Id: lobject.h,v 1.10 1997/11/27 18:25:06 roberto Exp roberto $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
@@ -42,9 +42,11 @@ typedef enum {
LUA_T_PROTO = -4, /* fixed tag for functions */
LUA_T_CPROTO = -5, /* fixed tag for Cfunctions */
LUA_T_NIL = -6, /* last "pre-defined" tag */
LUA_T_FUNCTION = -7,
LUA_T_MARK = -8,
LUA_T_LINE = -10
LUA_T_CLOSURE = -7,
LUA_T_CLMARK = -8, /* mark for closures */
LUA_T_PMARK = -9, /* mark for Lua prototypes */
LUA_T_CMARK = -10, /* mark for C prototypes */
LUA_T_LINE = -11
} lua_Type;
#define NUM_TYPES 11
@@ -52,11 +54,11 @@ typedef enum {
typedef union {
lua_CFunction f; /* LUA_T_CPROTO */
lua_CFunction f; /* LUA_T_CPROTO, LUA_T_CMARK */
real n; /* LUA_T_NUMBER */
struct TaggedString *ts; /* LUA_T_STRING, LUA_T_USERDATA */
struct TProtoFunc *tf; /* LUA_T_PROTO */
struct Closure *cl; /* LUA_T_FUNCTION, LUA_T_MARK */
struct TProtoFunc *tf; /* LUA_T_PROTO, LUA_T_PMARK */
struct Closure *cl; /* LUA_T_CLOSURE, LUA_T_CLMARK */
struct Hash *a; /* LUA_T_ARRAY */
int i; /* LUA_T_LINE */
} Value;
@@ -133,6 +135,7 @@ typedef struct LocVar {
#define protovalue(o) ((o)->value.cl->consts)
/*
** Closures
*/