aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-11-23 12:23:45 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-11-23 12:23:45 -0200
commit84e32ad2ebd6bd160c1320456743a5b1d8f233e9 (patch)
treec5a32eaf7577c99e7598e9de1385a6b53522f04b /ldebug.c
parent35296e1fde705b3ac8356a4f4ce426497cf7b64c (diff)
downloadlua-84e32ad2ebd6bd160c1320456743a5b1d8f233e9.tar.gz
lua-84e32ad2ebd6bd160c1320456743a5b1d8f233e9.tar.bz2
lua-84e32ad2ebd6bd160c1320456743a5b1d8f233e9.zip
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').
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c10
1 files changed, 8 insertions, 2 deletions
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,
610 tm = TM_NEWINDEX; 610 tm = TM_NEWINDEX;
611 break; 611 break;
612 case OP_ADDI: case OP_SUBI: case OP_MULI: case OP_MODI: 612 case OP_ADDI: case OP_SUBI: case OP_MULI: case OP_MODI:
613 case OP_POWI: case OP_DIVI: case OP_IDIVI: 613 case OP_POWI: case OP_DIVI: case OP_IDIVI: {
614 case OP_BANDK: case OP_BORK: case OP_BXORK: {
615 int offset = GET_OPCODE(i) - OP_ADDI; /* ORDER OP */ 614 int offset = GET_OPCODE(i) - OP_ADDI; /* ORDER OP */
616 tm = cast(TMS, offset + TM_ADD); /* ORDER TM */ 615 tm = cast(TMS, offset + TM_ADD); /* ORDER TM */
617 break; 616 break;
618 } 617 }
618 case OP_ADDK: case OP_SUBK: case OP_MULK: case OP_MODK:
619 case OP_POWK: case OP_DIVK: case OP_IDIVK:
620 case OP_BANDK: case OP_BORK: case OP_BXORK: {
621 int offset = GET_OPCODE(i) - OP_ADDK; /* ORDER OP */
622 tm = cast(TMS, offset + TM_ADD); /* ORDER TM */
623 break;
624 }
619 case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD: 625 case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD:
620 case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND: 626 case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND:
621 case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: { 627 case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: {