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 /ltm.c | |
| 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 'ltm.c')
| -rw-r--r-- | ltm.c | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltm.c,v 1.10 1997/12/11 14:48:46 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.11 1997/12/11 17:21:11 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 | */ |
| @@ -112,16 +112,17 @@ int luaT_efectivetag (TObject *o) | |||
| 112 | { | 112 | { |
| 113 | int t; | 113 | int t; |
| 114 | switch (t = ttype(o)) { | 114 | switch (t = ttype(o)) { |
| 115 | case LUA_T_ARRAY: | ||
| 116 | return o->value.a->htag; | ||
| 115 | case LUA_T_USERDATA: { | 117 | case LUA_T_USERDATA: { |
| 116 | int tag = o->value.ts->u.d.tag; | 118 | int tag = o->value.ts->u.d.tag; |
| 117 | return (tag >= 0) ? LUA_T_USERDATA : tag; | 119 | return (tag >= 0) ? LUA_T_USERDATA : tag; |
| 118 | } | 120 | } |
| 119 | case LUA_T_ARRAY: | 121 | case LUA_T_CLOSURE: |
| 120 | return o->value.a->htag; | ||
| 121 | case LUA_T_FUNCTION: case LUA_T_MARK: | ||
| 122 | return o->value.cl->consts[0].ttype; | 122 | return o->value.cl->consts[0].ttype; |
| 123 | #ifdef DEBUG | 123 | #ifdef DEBUG |
| 124 | case LUA_T_LINE: case LUA_T_PROTO: case LUA_T_CPROTO: | 124 | case LUA_T_PMARK: case LUA_T_CMARK: |
| 125 | case LUA_T_CLMARK: case LUA_T_LINE: | ||
| 125 | lua_error("internal error"); | 126 | lua_error("internal error"); |
| 126 | #endif | 127 | #endif |
| 127 | default: | 128 | default: |
