diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-02-24 11:14:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-02-24 11:14:44 -0300 |
commit | 59c88f846d1dcd901a4420651aedf27816618923 (patch) | |
tree | 0e76a066c383cbc99cc2f60b8b4f97c5df45e479 /ltm.c | |
parent | c03c527fd207b4ad8f5a8e0f4f2c176bd227c979 (diff) | |
download | lua-59c88f846d1dcd901a4420651aedf27816618923.tar.gz lua-59c88f846d1dcd901a4420651aedf27816618923.tar.bz2 lua-59c88f846d1dcd901a4420651aedf27816618923.zip |
Broadening the use of branch hints
More uses of macros 'likely'/'unlikely' (renamed to
'l_likely'/'l_unlikely'), both in range (extended to the
libraries) and in scope (extended to hooks, stack growth).
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -147,7 +147,7 @@ static int callbinTM (lua_State *L, const TValue *p1, const TValue *p2, | |||
147 | 147 | ||
148 | void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, | 148 | void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, |
149 | StkId res, TMS event) { | 149 | StkId res, TMS event) { |
150 | if (!callbinTM(L, p1, p2, res, event)) { | 150 | if (l_unlikely(!callbinTM(L, p1, p2, res, event))) { |
151 | switch (event) { | 151 | switch (event) { |
152 | case TM_BAND: case TM_BOR: case TM_BXOR: | 152 | case TM_BAND: case TM_BOR: case TM_BXOR: |
153 | case TM_SHL: case TM_SHR: case TM_BNOT: { | 153 | case TM_SHL: case TM_SHR: case TM_BNOT: { |
@@ -166,7 +166,8 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, | |||
166 | 166 | ||
167 | void luaT_tryconcatTM (lua_State *L) { | 167 | void luaT_tryconcatTM (lua_State *L) { |
168 | StkId top = L->top; | 168 | StkId top = L->top; |
169 | if (!callbinTM(L, s2v(top - 2), s2v(top - 1), top - 2, TM_CONCAT)) | 169 | if (l_unlikely(!callbinTM(L, s2v(top - 2), s2v(top - 1), top - 2, |
170 | TM_CONCAT))) | ||
170 | luaG_concaterror(L, s2v(top - 2), s2v(top - 1)); | 171 | luaG_concaterror(L, s2v(top - 2), s2v(top - 1)); |
171 | } | 172 | } |
172 | 173 | ||