From 84e32ad2ebd6bd160c1320456743a5b1d8f233e9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 23 Nov 2018 12:23:45 -0200 Subject: Added opcodes for arithmetic with K operands Added opcodes for all seven arithmetic operators with K operands (that is, operands that are numbers in the array of constants of the function). They cover the cases of constant float operands (e.g., 'x + .0.0', 'x^0.5') and large integer operands (e.g., 'x % 10000'). --- ldebug.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index ee1b87d9..766a5231 100644 --- a/ldebug.c +++ b/ldebug.c @@ -610,12 +610,18 @@ static const char *funcnamefromcode (lua_State *L, CallInfo *ci, tm = TM_NEWINDEX; break; case OP_ADDI: case OP_SUBI: case OP_MULI: case OP_MODI: - case OP_POWI: case OP_DIVI: case OP_IDIVI: - case OP_BANDK: case OP_BORK: case OP_BXORK: { + case OP_POWI: case OP_DIVI: case OP_IDIVI: { int offset = GET_OPCODE(i) - OP_ADDI; /* ORDER OP */ tm = cast(TMS, offset + TM_ADD); /* ORDER TM */ break; } + case OP_ADDK: case OP_SUBK: case OP_MULK: case OP_MODK: + case OP_POWK: case OP_DIVK: case OP_IDIVK: + case OP_BANDK: case OP_BORK: case OP_BXORK: { + int offset = GET_OPCODE(i) - OP_ADDK; /* ORDER OP */ + tm = cast(TMS, offset + TM_ADD); /* ORDER TM */ + break; + } case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD: case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND: case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: { -- cgit v1.2.3-55-g6feb