aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-06-27 15:01:57 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-06-27 15:01:57 -0300
commit6ac7219da31df0238dc33c2d4457f69bfe0c1e79 (patch)
treec9fc124ed998ea39a6222556bb581817791089de /lopcodes.c
parent9904c253da9690728710082cfb94654709ab89e7 (diff)
downloadlua-6ac7219da31df0238dc33c2d4457f69bfe0c1e79.tar.gz
lua-6ac7219da31df0238dc33c2d4457f69bfe0c1e79.tar.bz2
lua-6ac7219da31df0238dc33c2d4457f69bfe0c1e79.zip
'isIT'/'isOT' turned from macros to functions
Diffstat (limited to 'lopcodes.c')
-rw-r--r--lopcodes.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/lopcodes.c b/lopcodes.c
index c67aa227..2f9d55c5 100644
--- a/lopcodes.c
+++ b/lopcodes.c
@@ -13,6 +13,10 @@
13#include "lopcodes.h" 13#include "lopcodes.h"
14 14
15 15
16#define opmode(mm,ot,it,t,a,m) \
17 (((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m))
18
19
16/* ORDER OP */ 20/* ORDER OP */
17 21
18LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { 22LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
@@ -102,3 +106,27 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
102 ,opmode(0, 0, 0, 0, 0, iAx) /* OP_EXTRAARG */ 106 ,opmode(0, 0, 0, 0, 0, iAx) /* OP_EXTRAARG */
103}; 107};
104 108
109
110
111/*
112** Check whether instruction sets top for next instruction, that is,
113** it results in multiple values.
114*/
115int luaP_isOT (Instruction i) {
116 OpCode op = GET_OPCODE(i);
117 switch (op) {
118 case OP_TAILCALL: return 1;
119 default:
120 return testOTMode(op) && GETARG_C(i) == 0;
121 }
122}
123
124
125/*
126** Check whether instruction uses top from previous instruction, that is,
127** it accepts multiple results.
128*/
129int luaP_isIT (Instruction i) {
130 return testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0;
131}
132