diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-08-03 16:50:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-08-03 16:50:49 -0300 |
commit | 3b795541c488c7e633567897c9112312007a20a0 (patch) | |
tree | baa671c28bef6a13def34e5872fb81594a168861 /lvm.h | |
parent | 20b9e594419787cceaa04c645e485b13a2a9f4dc (diff) | |
download | lua-3b795541c488c7e633567897c9112312007a20a0.tar.gz lua-3b795541c488c7e633567897c9112312007a20a0.tar.bz2 lua-3b795541c488c7e633567897c9112312007a20a0.zip |
fast track for 'settable'
Diffstat (limited to 'lvm.h')
-rw-r--r-- | lvm.h | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.h,v 2.35 2015/02/20 14:27:53 roberto Exp roberto $ | 2 | ** $Id: lvm.h,v 2.36 2015/07/20 18:24:50 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 | */ |
@@ -70,6 +70,21 @@ | |||
70 | else luaV_finishget(L,t,k,v,aux); } | 70 | else luaV_finishget(L,t,k,v,aux); } |
71 | 71 | ||
72 | 72 | ||
73 | #define luaV_fastset(L,t,k,aux,f,v) \ | ||
74 | (!ttistable(t) \ | ||
75 | ? (aux = NULL, 0) \ | ||
76 | : (aux = f(hvalue(t), k), \ | ||
77 | ttisnil(aux) ? 0 \ | ||
78 | : (invalidateTMcache(hvalue(t)), \ | ||
79 | luaC_barrierback(L, hvalue(t), v), 1))) | ||
80 | |||
81 | #define luaV_settable(L,t,k,v) { const TValue *aux; \ | ||
82 | if (luaV_fastset(L,t,k,aux,luaH_get,v)) \ | ||
83 | { setobj2t(L, cast(TValue *,aux), v); } \ | ||
84 | else luaV_finishset(L,t,k,v,aux); } | ||
85 | |||
86 | |||
87 | |||
73 | LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); | 88 | LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); |
74 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); | 89 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); |
75 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); | 90 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); |
@@ -77,8 +92,8 @@ LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); | |||
77 | LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); | 92 | LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); |
78 | LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, | 93 | LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, |
79 | StkId val, const TValue *tm); | 94 | StkId val, const TValue *tm); |
80 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, | 95 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, |
81 | StkId val); | 96 | StkId val, const TValue *oldval); |
82 | LUAI_FUNC void luaV_finishOp (lua_State *L); | 97 | LUAI_FUNC void luaV_finishOp (lua_State *L); |
83 | LUAI_FUNC void luaV_execute (lua_State *L); | 98 | LUAI_FUNC void luaV_execute (lua_State *L); |
84 | LUAI_FUNC void luaV_concat (lua_State *L, int total); | 99 | LUAI_FUNC void luaV_concat (lua_State *L, int total); |