aboutsummaryrefslogtreecommitdiff
path: root/ltm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-02-24 11:14:44 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-02-24 11:14:44 -0300
commit59c88f846d1dcd901a4420651aedf27816618923 (patch)
tree0e76a066c383cbc99cc2f60b8b4f97c5df45e479 /ltm.c
parentc03c527fd207b4ad8f5a8e0f4f2c176bd227c979 (diff)
downloadlua-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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ltm.c b/ltm.c
index 4770f96b..b657b783 100644
--- a/ltm.c
+++ b/ltm.c
@@ -147,7 +147,7 @@ static int callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
147 147
148void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, 148void 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
167void luaT_tryconcatTM (lua_State *L) { 167void 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