diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-08-27 13:59:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-08-27 13:59:39 -0300 |
commit | df13f259487459f3a28d31d76c890aa6c2d061e0 (patch) | |
tree | f354a0746530369d4dd70113c9752d019fbd200b /ltm.c | |
parent | 643188d6e58dfd3270d689230867289347260b74 (diff) | |
download | lua-df13f259487459f3a28d31d76c890aa6c2d061e0.tar.gz lua-df13f259487459f3a28d31d76c890aa6c2d061e0.tar.bz2 lua-df13f259487459f3a28d31d76c890aa6c2d061e0.zip |
First version of OP_MMBIN opcodes
In arithmetic/bitwise operators, the call to metamethods is made
in a separate opcode following the main one. (The main
opcode skips this next one when the operation succeeds.) This
change reduces slightly the size of the binary and the complexity
of the arithmetic/bitwise opcodes. It also simplfies the treatment
of errors and yeld/resume in these operations, as there are much
fewer cases to consider. (Only OP_MMBIN/OP_MMBINI/OP_MMBINK,
instead of all variants of all arithmetic/bitwise operators.)
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -173,7 +173,7 @@ void luaT_tryconcatTM (lua_State *L) { | |||
173 | 173 | ||
174 | 174 | ||
175 | void luaT_trybinassocTM (lua_State *L, const TValue *p1, const TValue *p2, | 175 | void luaT_trybinassocTM (lua_State *L, const TValue *p1, const TValue *p2, |
176 | StkId res, int flip, TMS event) { | 176 | int flip, StkId res, TMS event) { |
177 | if (flip) | 177 | if (flip) |
178 | luaT_trybinTM(L, p2, p1, res, event); | 178 | luaT_trybinTM(L, p2, p1, res, event); |
179 | else | 179 | else |
@@ -185,7 +185,7 @@ void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2, | |||
185 | int flip, StkId res, TMS event) { | 185 | int flip, StkId res, TMS event) { |
186 | TValue aux; | 186 | TValue aux; |
187 | setivalue(&aux, i2); | 187 | setivalue(&aux, i2); |
188 | luaT_trybinassocTM(L, p1, &aux, res, flip, event); | 188 | luaT_trybinassocTM(L, p1, &aux, flip, res, event); |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||