rpm  4.5
Macros | Enumerations | Variables
lopcodes.h File Reference
#include "llimits.h"
Include dependency graph for lopcodes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SIZE_C   9
 
#define SIZE_B   9
 
#define SIZE_Bx   (SIZE_C + SIZE_B)
 
#define SIZE_A   8
 
#define SIZE_OP   6
 
#define POS_C   SIZE_OP
 
#define POS_B   (POS_C + SIZE_C)
 
#define POS_Bx   POS_C
 
#define POS_A   (POS_B + SIZE_B)
 
#define MAXARG_Bx   MAX_INT
 
#define MAXARG_sBx   MAX_INT
 
#define MAXARG_A   ((1<<SIZE_A)-1)
 
#define MAXARG_B   ((1<<SIZE_B)-1)
 
#define MAXARG_C   ((1<<SIZE_C)-1)
 
#define MASK1(n, p)   ((~((~(Instruction)0)<<n))<<p)
 
#define MASK0(n, p)   (~MASK1(n,p))
 
#define GET_OPCODE(i)   (cast(OpCode, (i)&MASK1(SIZE_OP,0)))
 
#define SET_OPCODE(i, o)   ((i) = (((i)&MASK0(SIZE_OP,0)) | cast(Instruction, o)))
 
#define GETARG_A(i)   (cast(int, (i)>>POS_A))
 
#define SETARG_A(i, u)
 
#define GETARG_B(i)   (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
 
#define SETARG_B(i, b)
 
#define GETARG_C(i)   (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
 
#define SETARG_C(i, b)
 
#define GETARG_Bx(i)   (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))
 
#define SETARG_Bx(i, b)
 
#define GETARG_sBx(i)   (GETARG_Bx(i)-MAXARG_sBx)
 
#define SETARG_sBx(i, b)   SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
 
#define CREATE_ABC(o, a, b, c)
 
#define CREATE_ABx(o, a, bc)
 
#define NO_REG   MAXARG_A
 
#define NUM_OPCODES   (cast(int, OP_CLOSURE+1))
 
#define getOpMode(m)   (cast(enum OpMode, luaP_opmodes[m] & 3))
 
#define testOpMode(m, b)   (luaP_opmodes[m] & (1 << (b)))
 
#define LFIELDS_PER_FLUSH   32
 

Enumerations

enum  OpMode { iABC, iABx, iAsBx }
 
enum  OpCode {
  OP_MOVE, OP_LOADK, OP_LOADBOOL, OP_LOADNIL,
  OP_GETUPVAL, OP_GETGLOBAL, OP_GETTABLE, OP_SETGLOBAL,
  OP_SETUPVAL, OP_SETTABLE, OP_NEWTABLE, OP_SELF,
  OP_ADD, OP_SUB, OP_MUL, OP_DIV,
  OP_POW, OP_UNM, OP_NOT, OP_CONCAT,
  OP_JMP, OP_EQ, OP_LT, OP_LE,
  OP_TEST, OP_CALL, OP_TAILCALL, OP_RETURN,
  OP_FORLOOP, OP_TFORLOOP, OP_TFORPREP, OP_SETLIST,
  OP_SETLISTO, OP_CLOSE, OP_CLOSURE
}
 
enum  OpModeMask {
  OpModeBreg = 2, OpModeBrk, OpModeCrk, OpModesetA,
  OpModeK, OpModeT
}
 

Variables

const lu_byte luaP_opmodes [(((int)(OP_CLOSURE+1)))]
 

Macro Definition Documentation

#define CREATE_ABC (   o,
  a,
  b,
 
)
Value:
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, b)<<POS_B) \

Definition at line 102 of file lopcodes.h.

Referenced by luaK_codeABC().

#define CREATE_ABx (   o,
  a,
  bc 
)
Value:

Definition at line 107 of file lopcodes.h.

Referenced by luaK_codeABx().

#define GET_OPCODE (   i)    (cast(OpCode, (i)&MASK1(SIZE_OP,0)))
#define GETARG_A (   i)    (cast(int, (i)>>POS_A))
#define GETARG_B (   i)    (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
#define GETARG_Bx (   i)    (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))

Definition at line 94 of file lopcodes.h.

Referenced by getobjname(), luaG_symbexec(), and luaV_execute().

#define GETARG_C (   i)    (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
#define GETARG_sBx (   i)    (GETARG_Bx(i)-MAXARG_sBx)

Definition at line 98 of file lopcodes.h.

Referenced by luaG_symbexec(), luaK_getjump(), and luaV_execute().

#define getOpMode (   m)    (cast(enum OpMode, luaP_opmodes[m] & 3))

Definition at line 224 of file lopcodes.h.

Referenced by luaG_symbexec(), luaK_codeABC(), and luaK_codeABx().

#define LFIELDS_PER_FLUSH   32

Definition at line 236 of file lopcodes.h.

Referenced by closelistfield(), luaG_symbexec(), and luaV_execute().

#define MASK0 (   n,
 
)    (~MASK1(n,p))

Definition at line 73 of file lopcodes.h.

#define MASK1 (   n,
 
)    ((~((~(Instruction)0)<<n))<<p)

Definition at line 70 of file lopcodes.h.

#define MAXARG_A   ((1<<SIZE_A)-1)

Definition at line 64 of file lopcodes.h.

#define MAXARG_B   ((1<<SIZE_B)-1)

Definition at line 65 of file lopcodes.h.

#define MAXARG_Bx   MAX_INT

Definition at line 59 of file lopcodes.h.

Referenced by addk(), listfield(), and pushclosure().

#define MAXARG_C   ((1<<SIZE_C)-1)

Definition at line 66 of file lopcodes.h.

Referenced by luaK_exp2RK().

#define MAXARG_sBx   MAX_INT

Definition at line 60 of file lopcodes.h.

Referenced by luaK_fixjump().

#define NO_REG   MAXARG_A
#define NUM_OPCODES   (cast(int, OP_CLOSURE+1))

Definition at line 189 of file lopcodes.h.

#define POS_A   (POS_B + SIZE_B)

Definition at line 47 of file lopcodes.h.

#define POS_B   (POS_C + SIZE_C)

Definition at line 45 of file lopcodes.h.

#define POS_Bx   POS_C

Definition at line 46 of file lopcodes.h.

#define POS_C   SIZE_OP

Definition at line 44 of file lopcodes.h.

#define SET_OPCODE (   i,
 
)    ((i) = (((i)&MASK0(SIZE_OP,0)) | cast(Instruction, o)))

Definition at line 80 of file lopcodes.h.

Referenced by retstat().

#define SETARG_A (   i,
 
)
Value:
((i) = (((i)&MASK0(SIZE_A,POS_A)) | \

Definition at line 83 of file lopcodes.h.

Referenced by discharge2reg(), invertjump(), and patchtestreg().

#define SETARG_B (   i,
 
)
Value:
((i) = (((i)&MASK0(SIZE_B,POS_B)) | \

Definition at line 87 of file lopcodes.h.

Referenced by constructor(), luaK_nil(), and luaK_posfix().

#define SETARG_Bx (   i,
 
)
Value:
((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \

Definition at line 95 of file lopcodes.h.

#define SETARG_C (   i,
 
)
Value:
((i) = (((i)&MASK0(SIZE_C,POS_C)) | \

Definition at line 91 of file lopcodes.h.

Referenced by constructor(), and luaK_setcallreturns().

#define SETARG_sBx (   i,
 
)    SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))

Definition at line 99 of file lopcodes.h.

Referenced by luaK_fixjump().

#define SIZE_A   8

Definition at line 40 of file lopcodes.h.

Referenced by DumpHeader(), and LoadHeader().

#define SIZE_B   9

Definition at line 38 of file lopcodes.h.

Referenced by DumpHeader(), and LoadHeader().

#define SIZE_Bx   (SIZE_C + SIZE_B)

Definition at line 39 of file lopcodes.h.

#define SIZE_C   9

Definition at line 37 of file lopcodes.h.

Referenced by DumpHeader(), and LoadHeader().

#define SIZE_OP   6

Definition at line 42 of file lopcodes.h.

Referenced by DumpHeader(), and LoadHeader().

#define testOpMode (   m,
 
)    (luaP_opmodes[m] & (1 << (b)))

Definition at line 225 of file lopcodes.h.

Referenced by getjumpcontrol(), invertjump(), and luaG_symbexec().

Enumeration Type Documentation

enum OpCode
Enumerator
OP_MOVE 
OP_LOADK 
OP_LOADBOOL 
OP_LOADNIL 
OP_GETUPVAL 
OP_GETGLOBAL 
OP_GETTABLE 
OP_SETGLOBAL 
OP_SETUPVAL 
OP_SETTABLE 
OP_NEWTABLE 
OP_SELF 
OP_ADD 
OP_SUB 
OP_MUL 
OP_DIV 
OP_POW 
OP_UNM 
OP_NOT 
OP_CONCAT 
OP_JMP 
OP_EQ 
OP_LT 
OP_LE 
OP_TEST 
OP_CALL 
OP_TAILCALL 
OP_RETURN 
OP_FORLOOP 
OP_TFORLOOP 
OP_TFORPREP 
OP_SETLIST 
OP_SETLISTO 
OP_CLOSE 
OP_CLOSURE 

Definition at line 131 of file lopcodes.h.

enum OpMode
Enumerator
iABC 
iABx 
iAsBx 

Definition at line 31 of file lopcodes.h.

enum OpModeMask
Enumerator
OpModeBreg 
OpModeBrk 
OpModeCrk 
OpModesetA 
OpModeK 
OpModeT 

Definition at line 210 of file lopcodes.h.

Variable Documentation

const lu_byte luaP_opmodes[(((int)(OP_CLOSURE+1)))]

Definition at line 64 of file lopcodes.c.