aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-02-07 13:04:41 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-02-07 13:04:41 -0200
commit73d797ce7ea4c547cb97e39633a71a242c7356c8 (patch)
treec2f6c17cb7bf6921e83658f216d6846c5b591896 /lopcodes.h
parent51280ef2ad87f3fcc657fdc0f52799432d2bc340 (diff)
downloadlua-73d797ce7ea4c547cb97e39633a71a242c7356c8.tar.gz
lua-73d797ce7ea4c547cb97e39633a71a242c7356c8.tar.bz2
lua-73d797ce7ea4c547cb97e39633a71a242c7356c8.zip
detail
(order of 'OT' and 'IT' bits corresponds with macro 'opmode')
Diffstat (limited to 'lopcodes.h')
-rw-r--r--lopcodes.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 1e3974d9..31bd12f8 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lopcodes.h,v 1.183 2018/01/27 16:56:33 roberto Exp roberto $ 2** $Id: lopcodes.h,v 1.184 2018/01/28 15:13:26 roberto Exp roberto $
3** Opcodes for Lua virtual machine 3** Opcodes for Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -334,8 +334,8 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
334** bits 0-2: op mode 334** bits 0-2: op mode
335** bit 3: instruction set register A 335** bit 3: instruction set register A
336** bit 4: operator is a test (next instruction must be a jump) 336** bit 4: operator is a test (next instruction must be a jump)
337** bit 5: instruction sets 'L->top' for next instruction (when C == 0) 337** bit 5: instruction uses 'L->top' set by previous instruction (when B == 0)
338** bit 6: instruction uses 'L->top' set by previous instruction (when B == 0) 338** bit 6: instruction sets 'L->top' for next instruction (when C == 0)
339*/ 339*/
340 340
341LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES]; 341LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
@@ -343,8 +343,8 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
343#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 7)) 343#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 7))
344#define testAMode(m) (luaP_opmodes[m] & (1 << 3)) 344#define testAMode(m) (luaP_opmodes[m] & (1 << 3))
345#define testTMode(m) (luaP_opmodes[m] & (1 << 4)) 345#define testTMode(m) (luaP_opmodes[m] & (1 << 4))
346#define testOTMode(m) (luaP_opmodes[m] & (1 << 5)) 346#define testITMode(m) (luaP_opmodes[m] & (1 << 5))
347#define testITMode(m) (luaP_opmodes[m] & (1 << 6)) 347#define testOTMode(m) (luaP_opmodes[m] & (1 << 6))
348 348
349/* "out top" (set top for next instruction) */ 349/* "out top" (set top for next instruction) */
350#define isOT(i) (testOTMode(GET_OPCODE(i)) && GETARG_C(i) == 0) 350#define isOT(i) (testOTMode(GET_OPCODE(i)) && GETARG_C(i) == 0)
@@ -352,7 +352,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
352/* "in top" (uses top from previous instruction) */ 352/* "in top" (uses top from previous instruction) */
353#define isIT(i) (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0) 353#define isIT(i) (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0)
354 354
355#define opmode(ot,it,t,a,m) (((ot)<<5) | ((it)<<6) | ((t)<<4) | ((a)<<3) | (m)) 355#define opmode(ot,it,t,a,m) (((ot)<<6) | ((it)<<5) | ((t)<<4) | ((a)<<3) | (m))
356 356
357 357
358LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ 358LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */