diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-29 17:19:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-29 17:19:20 -0300 |
commit | a69356e9e0a7525b1cebadc928a0efcce8c39b46 (patch) | |
tree | c676ee2997c699d3e0b036323ecbafa7ea0d786f /ltm.c | |
parent | b53dc0c4853c56694dda727793e5f6188de39dd8 (diff) | |
download | lua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.tar.gz lua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.tar.bz2 lua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.zip |
no more special cases for closures with 0 upvalues (performance is the same,
memory use a little higher, code much simpler).
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 1.36 2000/03/27 20:08:02 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.37 2000/03/27 20:10:21 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -47,8 +47,8 @@ static const char luaT_validevents[NUM_TAGS][IM_N] = { | |||
47 | {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, /* TAG_NUMBER */ | 47 | {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, /* TAG_NUMBER */ |
48 | {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, /* TAG_STRING */ | 48 | {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, /* TAG_STRING */ |
49 | {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* TAG_TABLE */ | 49 | {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* TAG_TABLE */ |
50 | {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* TAG_LPROTO */ | 50 | {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* TAG_LCLOSURE */ |
51 | {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* TAG_CPROTO */ | 51 | {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, /* TAG_CCLOSURE */ |
52 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} /* TAG_NIL */ | 52 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} /* TAG_NIL */ |
53 | }; | 53 | }; |
54 | 54 | ||
@@ -105,19 +105,14 @@ int lua_copytagmethods (lua_State *L, int tagto, int tagfrom) { | |||
105 | 105 | ||
106 | 106 | ||
107 | int luaT_effectivetag (lua_State *L, const TObject *o) { | 107 | int luaT_effectivetag (lua_State *L, const TObject *o) { |
108 | static const int realtag[] = { /* ORDER LUA_T */ | 108 | lua_Type t = ttype(o); |
109 | TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_TABLE, | 109 | switch (t) { |
110 | TAG_LPROTO, TAG_CPROTO, TAG_NIL, | ||
111 | TAG_LPROTO, TAG_CPROTO, /* TAG_LCLOSURE, TAG_CCLOSURE */ | ||
112 | }; | ||
113 | lua_Type t; | ||
114 | switch (t = ttype(o)) { | ||
115 | case TAG_USERDATA: { | 110 | case TAG_USERDATA: { |
116 | int tag = o->value.ts->u.d.tag; | 111 | int tag = o->value.ts->u.d.tag; |
117 | return (tag > L->last_tag) ? TAG_USERDATA : tag; /* deprecated test */ | 112 | return (tag > L->last_tag) ? TAG_USERDATA : tag; /* deprecated test */ |
118 | } | 113 | } |
119 | case TAG_TABLE: return o->value.a->htag; | 114 | case TAG_TABLE: return o->value.a->htag; |
120 | default: return realtag[t]; | 115 | default: return t; |
121 | } | 116 | } |
122 | } | 117 | } |
123 | 118 | ||