diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-12-15 14:17:20 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-12-15 14:17:20 -0200 |
commit | 45e533599f08d849951b49bcab0be4fd735a966d (patch) | |
tree | b8e3b175989f694391dd3da4191894f5df1e7d75 /lobject.h | |
parent | 94144a7821c0fa412d5d228ab5197a8ebaaa3c25 (diff) | |
download | lua-45e533599f08d849951b49bcab0be4fd735a966d.tar.gz lua-45e533599f08d849951b49bcab0be4fd735a966d.tar.bz2 lua-45e533599f08d849951b49bcab0be4fd735a966d.zip |
optimization: closures without upvalues don't need to be closures
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 1.9 1997/11/19 17:29:23 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.10 1997/11/27 18:25:06 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -42,9 +42,11 @@ typedef enum { | |||
42 | LUA_T_PROTO = -4, /* fixed tag for functions */ | 42 | LUA_T_PROTO = -4, /* fixed tag for functions */ |
43 | LUA_T_CPROTO = -5, /* fixed tag for Cfunctions */ | 43 | LUA_T_CPROTO = -5, /* fixed tag for Cfunctions */ |
44 | LUA_T_NIL = -6, /* last "pre-defined" tag */ | 44 | LUA_T_NIL = -6, /* last "pre-defined" tag */ |
45 | LUA_T_FUNCTION = -7, | 45 | LUA_T_CLOSURE = -7, |
46 | LUA_T_MARK = -8, | 46 | LUA_T_CLMARK = -8, /* mark for closures */ |
47 | LUA_T_LINE = -10 | 47 | LUA_T_PMARK = -9, /* mark for Lua prototypes */ |
48 | LUA_T_CMARK = -10, /* mark for C prototypes */ | ||
49 | LUA_T_LINE = -11 | ||
48 | } lua_Type; | 50 | } lua_Type; |
49 | 51 | ||
50 | #define NUM_TYPES 11 | 52 | #define NUM_TYPES 11 |
@@ -52,11 +54,11 @@ typedef enum { | |||
52 | 54 | ||
53 | 55 | ||
54 | typedef union { | 56 | typedef union { |
55 | lua_CFunction f; /* LUA_T_CPROTO */ | 57 | lua_CFunction f; /* LUA_T_CPROTO, LUA_T_CMARK */ |
56 | real n; /* LUA_T_NUMBER */ | 58 | real n; /* LUA_T_NUMBER */ |
57 | struct TaggedString *ts; /* LUA_T_STRING, LUA_T_USERDATA */ | 59 | struct TaggedString *ts; /* LUA_T_STRING, LUA_T_USERDATA */ |
58 | struct TProtoFunc *tf; /* LUA_T_PROTO */ | 60 | struct TProtoFunc *tf; /* LUA_T_PROTO, LUA_T_PMARK */ |
59 | struct Closure *cl; /* LUA_T_FUNCTION, LUA_T_MARK */ | 61 | struct Closure *cl; /* LUA_T_CLOSURE, LUA_T_CLMARK */ |
60 | struct Hash *a; /* LUA_T_ARRAY */ | 62 | struct Hash *a; /* LUA_T_ARRAY */ |
61 | int i; /* LUA_T_LINE */ | 63 | int i; /* LUA_T_LINE */ |
62 | } Value; | 64 | } Value; |
@@ -133,6 +135,7 @@ typedef struct LocVar { | |||
133 | 135 | ||
134 | #define protovalue(o) ((o)->value.cl->consts) | 136 | #define protovalue(o) ((o)->value.cl->consts) |
135 | 137 | ||
138 | |||
136 | /* | 139 | /* |
137 | ** Closures | 140 | ** Closures |
138 | */ | 141 | */ |