diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-05-18 16:44:19 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-05-18 16:44:19 -0300 |
| commit | de74289049acf199d422feaf00605bb6e1fbaf72 (patch) | |
| tree | 701bd3d41b106730a7015e06ead4864b2e9046fa | |
| parent | 92b3deaffa642f331326d54a6b93d80240b3af60 (diff) | |
| download | lua-de74289049acf199d422feaf00605bb6e1fbaf72.tar.gz lua-de74289049acf199d422feaf00605bb6e1fbaf72.tar.bz2 lua-de74289049acf199d422feaf00605bb6e1fbaf72.zip | |
table field names for dedicated opcodes can be restricted to
small strings for slightly faster access
| -rw-r--r-- | lcode.c | 6 | ||||
| -rw-r--r-- | lvm.c | 10 |
2 files changed, 8 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lcode.c,v 2.117 2017/04/26 17:46:52 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.118 2017/04/28 20:57:45 roberto Exp roberto $ |
| 3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -978,11 +978,11 @@ static void codenot (FuncState *fs, expdesc *e) { | |||
| 978 | 978 | ||
| 979 | 979 | ||
| 980 | /* | 980 | /* |
| 981 | ** Check whether expression 'e' is a literal string | 981 | ** Check whether expression 'e' is a small literal string |
| 982 | */ | 982 | */ |
| 983 | static int isKstr (FuncState *fs, expdesc *e) { | 983 | static int isKstr (FuncState *fs, expdesc *e) { |
| 984 | return (e->k == VK && !hasjumps(e) && e->u.info <= MAXARG_C && | 984 | return (e->k == VK && !hasjumps(e) && e->u.info <= MAXARG_C && |
| 985 | ttisstring(&fs->f->k[e->u.info])); | 985 | ttisshrstring(&fs->f->k[e->u.info])); |
| 986 | } | 986 | } |
| 987 | 987 | ||
| 988 | 988 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.282 2017/05/13 13:54:47 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.283 2017/05/18 19:34:39 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -865,7 +865,7 @@ void luaV_execute (lua_State *L) { | |||
| 865 | TValue *upval = cl->upvals[GETARG_B(i)]->v; | 865 | TValue *upval = cl->upvals[GETARG_B(i)]->v; |
| 866 | TValue *rc = KC(i); | 866 | TValue *rc = KC(i); |
| 867 | TString *key = tsvalue(rc); /* key must be a string */ | 867 | TString *key = tsvalue(rc); /* key must be a string */ |
| 868 | if (luaV_fastget(L, upval, key, slot, luaH_getstr)) { | 868 | if (luaV_fastget(L, upval, key, slot, luaH_getshortstr)) { |
| 869 | setobj2s(L, ra, slot); | 869 | setobj2s(L, ra, slot); |
| 870 | } | 870 | } |
| 871 | else Protect(luaV_finishget(L, upval, rc, ra, slot)); | 871 | else Protect(luaV_finishget(L, upval, rc, ra, slot)); |
| @@ -904,7 +904,7 @@ void luaV_execute (lua_State *L) { | |||
| 904 | StkId rb = RB(i); | 904 | StkId rb = RB(i); |
| 905 | TValue *rc = KC(i); | 905 | TValue *rc = KC(i); |
| 906 | TString *key = tsvalue(rc); /* key must be a string */ | 906 | TString *key = tsvalue(rc); /* key must be a string */ |
| 907 | if (luaV_fastget(L, rb, key, slot, luaH_getstr)) { | 907 | if (luaV_fastget(L, rb, key, slot, luaH_getshortstr)) { |
| 908 | setobj2s(L, ra, slot); | 908 | setobj2s(L, ra, slot); |
| 909 | } | 909 | } |
| 910 | else Protect(luaV_finishget(L, rb, rc, ra, slot)); | 910 | else Protect(luaV_finishget(L, rb, rc, ra, slot)); |
| @@ -916,7 +916,7 @@ void luaV_execute (lua_State *L) { | |||
| 916 | TValue *rb = KB(i); | 916 | TValue *rb = KB(i); |
| 917 | TValue *rc = RKC(i); | 917 | TValue *rc = RKC(i); |
| 918 | TString *key = tsvalue(rb); /* key must be a string */ | 918 | TString *key = tsvalue(rb); /* key must be a string */ |
| 919 | if (luaV_fastget(L, upval, key, slot, luaH_getstr)) | 919 | if (luaV_fastget(L, upval, key, slot, luaH_getshortstr)) |
| 920 | luaV_finishfastset(L, upval, slot, rc); | 920 | luaV_finishfastset(L, upval, slot, rc); |
| 921 | else | 921 | else |
| 922 | Protect(luaV_finishset(L, upval, rb, rc, slot)); | 922 | Protect(luaV_finishset(L, upval, rb, rc, slot)); |
| @@ -953,7 +953,7 @@ void luaV_execute (lua_State *L) { | |||
| 953 | TValue *rb = KB(i); | 953 | TValue *rb = KB(i); |
| 954 | TValue *rc = RKC(i); | 954 | TValue *rc = RKC(i); |
| 955 | TString *key = tsvalue(rb); /* key must be a string */ | 955 | TString *key = tsvalue(rb); /* key must be a string */ |
| 956 | if (luaV_fastget(L, ra, key, slot, luaH_getstr)) | 956 | if (luaV_fastget(L, ra, key, slot, luaH_getshortstr)) |
| 957 | luaV_finishfastset(L, ra, slot, rc); | 957 | luaV_finishfastset(L, ra, slot, rc); |
| 958 | else | 958 | else |
| 959 | Protect(luaV_finishset(L, ra, rb, rc, slot)); | 959 | Protect(luaV_finishset(L, ra, rb, rc, slot)); |
