aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'lopcodes.c')
-rw-r--r--lopcodes.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/lopcodes.c b/lopcodes.c
index da64ff18..bb1a4162 100644
--- a/lopcodes.c
+++ b/lopcodes.c
@@ -109,30 +109,21 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
109}; 109};
110 110
111 111
112 112#define testITMode(m) (luaP_opmodes[m] & (1 << 5))
113/*
114** Check whether instruction sets top for next instruction, that is,
115** it results in multiple values.
116*/
117int luaP_isOT (Instruction i) {
118 OpCode op = GET_OPCODE(i);
119 switch (op) {
120 case OP_TAILCALL: return 1;
121 default:
122 return testOTMode(op) && GETARG_C(i) == 0;
123 }
124}
125 113
126 114
127/* 115/*
128** Check whether instruction uses top from previous instruction, that is, 116** Check whether instruction uses top. That happens for OP_VARARGPREP
129** it accepts multiple results. 117** and for instructions that use multiple values set by the previous
118** instruction.
130*/ 119*/
131int luaP_isIT (Instruction i) { 120int luaP_isIT (Instruction i) {
132 OpCode op = GET_OPCODE(i); 121 OpCode op = GET_OPCODE(i);
133 switch (op) { 122 switch (op) {
134 case OP_SETLIST: 123 case OP_SETLIST:
135 return testITMode(GET_OPCODE(i)) && GETARG_vB(i) == 0; 124 return GETARG_vB(i) == 0;
125 case OP_VARARGPREP:
126 return 1;
136 default: 127 default:
137 return testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0; 128 return testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0;
138 } 129 }