1
0
mirror of https://github.com/lua/lua.git synced 2025-01-28 06:03:00 +08:00

details (direct access to 'Ck' bit in instructions)

This commit is contained in:
Roberto Ierusalimschy 2017-05-08 13:08:01 -03:00
parent fb9de1b4d7
commit ab5a650029
2 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: lopcodes.h,v 1.152 2017/04/26 17:46:52 roberto Exp roberto $
** $Id: lopcodes.h,v 1.153 2017/04/28 20:57:45 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -106,6 +106,9 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */
#define GETARG_C(i) getarg(i, POS_C, SIZE_C)
#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
#define GETARG_Cr(i) getarg(i, POS_C, SIZE_C - 1)
#define GETARG_Ck(i) getarg(i, (POS_C + SIZE_C - 1), 1)
#define GETARG_Bx(i) getarg(i, POS_Bx, SIZE_Bx)
#define SETARG_Bx(i,v) setarg(i, v, POS_Bx, SIZE_Bx)

6
lvm.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.276 2017/05/04 13:32:01 roberto Exp roberto $
** $Id: lvm.c,v 2.277 2017/05/05 17:16:11 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -737,9 +737,9 @@ void luaV_finishOp (lua_State *L) {
#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))
#define KC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, k+GETARG_C(i))
#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \
(GETARG_Bk(i)) ? k+GETARG_Br(i) : base+GETARG_Br(i))
(GETARG_Bk(i)) ? k + GETARG_Br(i) : base + GETARG_Br(i))
#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \
ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i))
(GETARG_Ck(i)) ? k + GETARG_Cr(i) : base + GETARG_Cr(i))