diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-28 11:18:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-28 11:18:14 -0300 |
commit | c403e456b66ddacf7f8f974323e9cffdfe6365d4 (patch) | |
tree | 2e25027eface85c3156359e4ec182b4a9215903b /lopcodes.c | |
parent | 6ac7219da31df0238dc33c2d4457f69bfe0c1e79 (diff) | |
download | lua-c403e456b66ddacf7f8f974323e9cffdfe6365d4.tar.gz lua-c403e456b66ddacf7f8f974323e9cffdfe6365d4.tar.bz2 lua-c403e456b66ddacf7f8f974323e9cffdfe6365d4.zip |
New instruction format for SETLIST/NEWTABLE
New instruction format 'ivABC' (a variant of iABC where parameter vC has
10 bits) allows constructors of up to 1024 elements to be coded without
EXTRAARG.
Diffstat (limited to 'lopcodes.c')
-rw-r--r-- | lopcodes.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -40,7 +40,7 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | |||
40 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETTABLE */ | 40 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETTABLE */ |
41 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETI */ | 41 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETI */ |
42 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETFIELD */ | 42 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETFIELD */ |
43 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_NEWTABLE */ | 43 | ,opmode(0, 0, 0, 0, 1, ivABC) /* OP_NEWTABLE */ |
44 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SELF */ | 44 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SELF */ |
45 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADDI */ | 45 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADDI */ |
46 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADDK */ | 46 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADDK */ |
@@ -99,7 +99,7 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | |||
99 | ,opmode(0, 0, 0, 0, 0, iABx) /* OP_TFORPREP */ | 99 | ,opmode(0, 0, 0, 0, 0, iABx) /* OP_TFORPREP */ |
100 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_TFORCALL */ | 100 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_TFORCALL */ |
101 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_TFORLOOP */ | 101 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_TFORLOOP */ |
102 | ,opmode(0, 0, 1, 0, 0, iABC) /* OP_SETLIST */ | 102 | ,opmode(0, 0, 1, 0, 0, ivABC) /* OP_SETLIST */ |
103 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_CLOSURE */ | 103 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_CLOSURE */ |
104 | ,opmode(0, 1, 0, 0, 1, iABC) /* OP_VARARG */ | 104 | ,opmode(0, 1, 0, 0, 1, iABC) /* OP_VARARG */ |
105 | ,opmode(0, 0, 1, 0, 1, iABC) /* OP_VARARGPREP */ | 105 | ,opmode(0, 0, 1, 0, 1, iABC) /* OP_VARARGPREP */ |
@@ -127,6 +127,12 @@ int luaP_isOT (Instruction i) { | |||
127 | ** it accepts multiple results. | 127 | ** it accepts multiple results. |
128 | */ | 128 | */ |
129 | int luaP_isIT (Instruction i) { | 129 | int luaP_isIT (Instruction i) { |
130 | return testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0; | 130 | OpCode op = GET_OPCODE(i); |
131 | switch (op) { | ||
132 | case OP_SETLIST: | ||
133 | return testITMode(GET_OPCODE(i)) && GETARG_vB(i) == 0; | ||
134 | default: | ||
135 | return testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0; | ||
136 | } | ||
131 | } | 137 | } |
132 | 138 | ||