From 0465c23b3ee214ea3a117ab9d69a83cf85e7a82f Mon Sep 17 00:00:00 2001 From: Roberto I Date: Thu, 28 May 2026 15:10:17 -0300 Subject: Cleaning 'luaP_isIT' and 'luaP_isOT' - 'luaP_isOT' is only used for tests, so it is defined as a macro to avoid wasting space with an unused function. - 'luaP_isIT' must include OP_VARARGPREP. --- lopcodes.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'lopcodes.c') 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] = { }; - -/* -** Check whether instruction sets top for next instruction, that is, -** it results in multiple values. -*/ -int luaP_isOT (Instruction i) { - OpCode op = GET_OPCODE(i); - switch (op) { - case OP_TAILCALL: return 1; - default: - return testOTMode(op) && GETARG_C(i) == 0; - } -} +#define testITMode(m) (luaP_opmodes[m] & (1 << 5)) /* -** Check whether instruction uses top from previous instruction, that is, -** it accepts multiple results. +** Check whether instruction uses top. That happens for OP_VARARGPREP +** and for instructions that use multiple values set by the previous +** instruction. */ int luaP_isIT (Instruction i) { OpCode op = GET_OPCODE(i); switch (op) { case OP_SETLIST: - return testITMode(GET_OPCODE(i)) && GETARG_vB(i) == 0; + return GETARG_vB(i) == 0; + case OP_VARARGPREP: + return 1; default: return testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0; } -- cgit v1.2.3-55-g6feb