aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-06-28 11:18:14 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-06-28 11:18:14 -0300
commitc403e456b66ddacf7f8f974323e9cffdfe6365d4 (patch)
tree2e25027eface85c3156359e4ec182b4a9215903b /lopcodes.c
parent6ac7219da31df0238dc33c2d4457f69bfe0c1e79 (diff)
downloadlua-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.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lopcodes.c b/lopcodes.c
index 2f9d55c5..5533b517 100644
--- a/lopcodes.c
+++ b/lopcodes.c
@@ -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*/
129int luaP_isIT (Instruction i) { 129int 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