aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-27 13:59:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-27 13:59:39 -0300
commitdf13f259487459f3a28d31d76c890aa6c2d061e0 (patch)
treef354a0746530369d4dd70113c9752d019fbd200b /lopcodes.h
parent643188d6e58dfd3270d689230867289347260b74 (diff)
downloadlua-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 'lopcodes.h')
-rw-r--r--lopcodes.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 26b1850d..fd578c68 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -255,6 +255,10 @@ OP_BXOR,/* A B C R(A) := R(B) ~ R(C) */
255OP_SHL,/* A B C R(A) := R(B) << R(C) */ 255OP_SHL,/* A B C R(A) := R(B) << R(C) */
256OP_SHR,/* A B C R(A) := R(B) >> R(C) */ 256OP_SHR,/* A B C R(A) := R(B) >> R(C) */
257 257
258OP_MMBIN,/* A B C call B metamethod for previous bin. operation */
259OP_MMBINI,/* A B C call B metamethod for previous binI. operation */
260OP_MMBINK,/* A B C call B metamethod for previous binK. operation */
261
258OP_UNM,/* A B R(A) := -R(B) */ 262OP_UNM,/* A B R(A) := -R(B) */
259OP_BNOT,/* A B R(A) := ~R(B) */ 263OP_BNOT,/* A B R(A) := ~R(B) */
260OP_NOT,/* A B R(A) := not R(B) */ 264OP_NOT,/* A B R(A) := not R(B) */