sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
lopcodes.h File Reference
#include "llimits.h"

Go to the source code of this file.

Macros

#define SIZE_C   8
#define SIZE_B   8
#define SIZE_Bx   (SIZE_C + SIZE_B + 1)
#define SIZE_A   8
#define SIZE_Ax   (SIZE_Bx + SIZE_A)
#define SIZE_sJ   (SIZE_Bx + SIZE_A)
#define SIZE_OP   7
#define POS_OP   0
#define POS_A   (POS_OP + SIZE_OP)
#define POS_k   (POS_A + SIZE_A)
#define POS_B   (POS_k + 1)
#define POS_C   (POS_B + SIZE_B)
#define POS_Bx   POS_k
#define POS_Ax   POS_A
#define POS_sJ   POS_A
#define L_INTHASBITS(b)
#define MAXARG_Bx   MAX_INT
#define OFFSET_sBx   (MAXARG_Bx>>1)
#define MAXARG_Ax   MAX_INT
#define MAXARG_sJ   MAX_INT
#define OFFSET_sJ   (MAXARG_sJ >> 1)
#define MAXARG_A   ((1<<SIZE_A)-1)
#define MAXARG_B   ((1<<SIZE_B)-1)
#define MAXARG_C   ((1<<SIZE_C)-1)
#define OFFSET_sC   (MAXARG_C >> 1)
#define int2sC(i)
#define sC2int(i)
#define MASK1(n, p)
#define MASK0(n, p)
#define GET_OPCODE(i)
#define SET_OPCODE(i, o)
#define checkopm(i, m)
#define getarg(i, pos, size)
#define setarg(i, v, pos, size)
#define GETARG_A(i)
#define SETARG_A(i, v)
#define GETARG_B(i)
#define GETARG_sB(i)
#define SETARG_B(i, v)
#define GETARG_C(i)
#define GETARG_sC(i)
#define SETARG_C(i, v)
#define TESTARG_k(i)
#define GETARG_k(i)
#define SETARG_k(i, v)
#define GETARG_Bx(i)
#define SETARG_Bx(i, v)
#define GETARG_Ax(i)
#define SETARG_Ax(i, v)
#define GETARG_sBx(i)
#define SETARG_sBx(i, b)
#define GETARG_sJ(i)
#define SETARG_sJ(i, j)
#define CREATE_ABCk(o, a, b, c, k)
#define CREATE_ABx(o, a, bc)
#define CREATE_Ax(o, a)
#define CREATE_sJ(o, j, k)
#define MAXINDEXRK   MAXARG_B
#define NO_REG   MAXARG_A
#define NUM_OPCODES   ((int)(OP_EXTRAARG) + 1)
#define getOpMode(m)
#define testAMode(m)
#define testTMode(m)
#define testITMode(m)
#define testOTMode(m)
#define testMMMode(m)
#define isOT(i)
#define isIT(i)
#define opmode(mm, ot, it, t, a, m)
#define LFIELDS_PER_FLUSH   50

Enumerations

enum  OpMode {
  iABC , iABx , iAsBx , iAx ,
  isJ
}
enum  OpCode {
  OP_MOVE , OP_LOADI , OP_LOADF , OP_LOADK ,
  OP_LOADKX , OP_LOADFALSE , OP_LFALSESKIP , OP_LOADTRUE ,
  OP_LOADNIL , OP_GETUPVAL , OP_SETUPVAL , OP_GETTABUP ,
  OP_GETTABLE , OP_GETI , OP_GETFIELD , OP_SETTABUP ,
  OP_SETTABLE , OP_SETI , OP_SETFIELD , OP_NEWTABLE ,
  OP_SELF , OP_ADDI , OP_ADDK , OP_SUBK ,
  OP_MULK , OP_MODK , OP_POWK , OP_DIVK ,
  OP_IDIVK , OP_BANDK , OP_BORK , OP_BXORK ,
  OP_SHRI , OP_SHLI , OP_ADD , OP_SUB ,
  OP_MUL , OP_MOD , OP_POW , OP_DIV ,
  OP_IDIV , OP_BAND , OP_BOR , OP_BXOR ,
  OP_SHL , OP_SHR , OP_MMBIN , OP_MMBINI ,
  OP_MMBINK , OP_UNM , OP_BNOT , OP_NOT ,
  OP_LEN , OP_CONCAT , OP_CLOSE , OP_TBC ,
  OP_JMP , OP_EQ , OP_LT , OP_LE ,
  OP_EQK , OP_EQI , OP_LTI , OP_LEI ,
  OP_GTI , OP_GEI , OP_TEST , OP_TESTSET ,
  OP_CALL , OP_TAILCALL , OP_RETURN , OP_RETURN0 ,
  OP_RETURN1 , OP_FORLOOP , OP_FORPREP , OP_TFORPREP ,
  OP_TFORCALL , OP_TFORLOOP , OP_SETLIST , OP_CLOSURE ,
  OP_VARARG , OP_VARARGPREP , OP_EXTRAARG
}

Macro Definition Documentation

◆ checkopm

#define checkopm ( i,
m )
Value:
(getOpMode(GET_OPCODE(i)) == m)

Definition at line 122 of file lopcodes.h.

◆ CREATE_ABCk

#define CREATE_ABCk ( o,
a,
b,
c,
k )
Value:
((cast(Instruction, o)<<POS_OP) \
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, b)<<POS_B) \
| (cast(Instruction, c)<<POS_C) \
| (cast(Instruction, k)<<POS_k))

Definition at line 160 of file lopcodes.h.

◆ CREATE_ABx

#define CREATE_ABx ( o,
a,
bc )
Value:
((cast(Instruction, o)<<POS_OP) \
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, bc)<<POS_Bx))

Definition at line 166 of file lopcodes.h.

◆ CREATE_Ax

#define CREATE_Ax ( o,
a )
Value:
((cast(Instruction, o)<<POS_OP) \
| (cast(Instruction, a)<<POS_Ax))

Definition at line 170 of file lopcodes.h.

◆ CREATE_sJ

#define CREATE_sJ ( o,
j,
k )
Value:
((cast(Instruction, o) << POS_OP) \
| (cast(Instruction, j) << POS_sJ) \
| (cast(Instruction, k) << POS_k))

Definition at line 173 of file lopcodes.h.

◆ GET_OPCODE

#define GET_OPCODE ( i)
Value:
(cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))

Definition at line 118 of file lopcodes.h.

◆ getarg

#define getarg ( i,
pos,
size )
Value:
(cast_int(((i)>>(pos)) & MASK1(size,0)))

Definition at line 125 of file lopcodes.h.

◆ GETARG_A

#define GETARG_A ( i)
Value:
getarg(i, POS_A, SIZE_A)

Definition at line 129 of file lopcodes.h.

◆ GETARG_Ax

#define GETARG_Ax ( i)
Value:
check_exp(checkopm(i, iAx), getarg(i, POS_Ax, SIZE_Ax))

Definition at line 147 of file lopcodes.h.

◆ GETARG_B

#define GETARG_B ( i)
Value:
check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B))

Definition at line 132 of file lopcodes.h.

◆ GETARG_Bx

#define GETARG_Bx ( i)
Value:
check_exp(checkopm(i, iABx), getarg(i, POS_Bx, SIZE_Bx))

Definition at line 144 of file lopcodes.h.

◆ GETARG_C

#define GETARG_C ( i)
Value:
check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C))

Definition at line 136 of file lopcodes.h.

◆ GETARG_k

#define GETARG_k ( i)
Value:
check_exp(checkopm(i, iABC), getarg(i, POS_k, 1))

Definition at line 141 of file lopcodes.h.

◆ GETARG_sB

#define GETARG_sB ( i)
Value:
sC2int(GETARG_B(i))

Definition at line 133 of file lopcodes.h.

◆ GETARG_sBx

#define GETARG_sBx ( i)
Value:
check_exp(checkopm(i, iAsBx), getarg(i, POS_Bx, SIZE_Bx) - OFFSET_sBx)

Definition at line 150 of file lopcodes.h.

◆ GETARG_sC

#define GETARG_sC ( i)
Value:
sC2int(GETARG_C(i))

Definition at line 137 of file lopcodes.h.

◆ GETARG_sJ

#define GETARG_sJ ( i)
Value:
check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ)

Definition at line 154 of file lopcodes.h.

◆ getOpMode

#define getOpMode ( m)
Value:
(cast(enum OpMode, luaP_opmodes[m] & 7))

Definition at line 387 of file lopcodes.h.

◆ int2sC

#define int2sC ( i)
Value:
((i) + OFFSET_sC)

Definition at line 104 of file lopcodes.h.

◆ isIT

#define isIT ( i)
Value:
(testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0)

Definition at line 400 of file lopcodes.h.

◆ isOT

#define isOT ( i)
Value:
((testOTMode(GET_OPCODE(i)) && GETARG_C(i) == 0) || \
GET_OPCODE(i) == OP_TAILCALL)

Definition at line 395 of file lopcodes.h.

◆ L_INTHASBITS

#define L_INTHASBITS ( b)
Value:
((UINT_MAX >> ((b) - 1)) >= 1)

Definition at line 72 of file lopcodes.h.

◆ LFIELDS_PER_FLUSH

#define LFIELDS_PER_FLUSH   50

Definition at line 407 of file lopcodes.h.

◆ MASK0

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

Definition at line 112 of file lopcodes.h.

◆ MASK1

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

Definition at line 109 of file lopcodes.h.

◆ MAXARG_A

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

Definition at line 99 of file lopcodes.h.

◆ MAXARG_Ax

#define MAXARG_Ax   MAX_INT

Definition at line 87 of file lopcodes.h.

◆ MAXARG_B

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

Definition at line 100 of file lopcodes.h.

◆ MAXARG_Bx

#define MAXARG_Bx   MAX_INT

Definition at line 78 of file lopcodes.h.

◆ MAXARG_C

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

Definition at line 101 of file lopcodes.h.

◆ MAXARG_sJ

#define MAXARG_sJ   MAX_INT

Definition at line 93 of file lopcodes.h.

◆ MAXINDEXRK

#define MAXINDEXRK   MAXARG_B

Definition at line 179 of file lopcodes.h.

◆ NO_REG

#define NO_REG   MAXARG_A

Definition at line 186 of file lopcodes.h.

◆ NUM_OPCODES

#define NUM_OPCODES   ((int)(OP_EXTRAARG) + 1)

Definition at line 317 of file lopcodes.h.

◆ OFFSET_sBx

#define OFFSET_sBx   (MAXARG_Bx>>1)

Definition at line 81 of file lopcodes.h.

◆ OFFSET_sC

#define OFFSET_sC   (MAXARG_C >> 1)

Definition at line 102 of file lopcodes.h.

◆ OFFSET_sJ

#define OFFSET_sJ   (MAXARG_sJ >> 1)

Definition at line 96 of file lopcodes.h.

◆ opmode

#define opmode ( mm,
ot,
it,
t,
a,
m )
Value:
(((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m))

Definition at line 402 of file lopcodes.h.

◆ POS_A

#define POS_A   (POS_OP + SIZE_OP)

Definition at line 53 of file lopcodes.h.

◆ POS_Ax

#define POS_Ax   POS_A

Definition at line 60 of file lopcodes.h.

◆ POS_B

#define POS_B   (POS_k + 1)

Definition at line 55 of file lopcodes.h.

◆ POS_Bx

#define POS_Bx   POS_k

Definition at line 58 of file lopcodes.h.

◆ POS_C

#define POS_C   (POS_B + SIZE_B)

Definition at line 56 of file lopcodes.h.

◆ POS_k

#define POS_k   (POS_A + SIZE_A)

Definition at line 54 of file lopcodes.h.

◆ POS_OP

#define POS_OP   0

Definition at line 51 of file lopcodes.h.

◆ POS_sJ

#define POS_sJ   POS_A

Definition at line 62 of file lopcodes.h.

◆ sC2int

#define sC2int ( i)
Value:
((i) - OFFSET_sC)

Definition at line 105 of file lopcodes.h.

◆ SET_OPCODE

#define SET_OPCODE ( i,
o )
Value:
((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))

Definition at line 119 of file lopcodes.h.

◆ setarg

#define setarg ( i,
v,
pos,
size )
Value:
((i) = (((i)&MASK0(size,pos)) | \
((cast(Instruction, v)<<pos)&MASK1(size,pos))))

Definition at line 126 of file lopcodes.h.

◆ SETARG_A

#define SETARG_A ( i,
v )
Value:
setarg(i, v, POS_A, SIZE_A)

Definition at line 130 of file lopcodes.h.

◆ SETARG_Ax

#define SETARG_Ax ( i,
v )
Value:
setarg(i, v, POS_Ax, SIZE_Ax)

Definition at line 148 of file lopcodes.h.

◆ SETARG_B

#define SETARG_B ( i,
v )
Value:
setarg(i, v, POS_B, SIZE_B)

Definition at line 134 of file lopcodes.h.

◆ SETARG_Bx

#define SETARG_Bx ( i,
v )
Value:
setarg(i, v, POS_Bx, SIZE_Bx)

Definition at line 145 of file lopcodes.h.

◆ SETARG_C

#define SETARG_C ( i,
v )
Value:
setarg(i, v, POS_C, SIZE_C)

Definition at line 138 of file lopcodes.h.

◆ SETARG_k

#define SETARG_k ( i,
v )
Value:
setarg(i, v, POS_k, 1)

Definition at line 142 of file lopcodes.h.

◆ SETARG_sBx

#define SETARG_sBx ( i,
b )
Value:
SETARG_Bx((i),cast_uint((b)+OFFSET_sBx))

Definition at line 152 of file lopcodes.h.

◆ SETARG_sJ

#define SETARG_sJ ( i,
j )
Value:
setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ)

Definition at line 156 of file lopcodes.h.

◆ SIZE_A

#define SIZE_A   8

Definition at line 45 of file lopcodes.h.

◆ SIZE_Ax

#define SIZE_Ax   (SIZE_Bx + SIZE_A)

Definition at line 46 of file lopcodes.h.

◆ SIZE_B

#define SIZE_B   8

Definition at line 43 of file lopcodes.h.

◆ SIZE_Bx

#define SIZE_Bx   (SIZE_C + SIZE_B + 1)

Definition at line 44 of file lopcodes.h.

◆ SIZE_C

#define SIZE_C   8

Definition at line 42 of file lopcodes.h.

◆ SIZE_OP

#define SIZE_OP   7

Definition at line 49 of file lopcodes.h.

◆ SIZE_sJ

#define SIZE_sJ   (SIZE_Bx + SIZE_A)

Definition at line 47 of file lopcodes.h.

◆ testAMode

#define testAMode ( m)
Value:
(luaP_opmodes[m] & (1 << 3))

Definition at line 388 of file lopcodes.h.

◆ TESTARG_k

#define TESTARG_k ( i)
Value:
check_exp(checkopm(i, iABC), (cast_int(((i) & (1u << POS_k)))))

Definition at line 140 of file lopcodes.h.

◆ testITMode

#define testITMode ( m)
Value:
(luaP_opmodes[m] & (1 << 5))

Definition at line 390 of file lopcodes.h.

◆ testMMMode

#define testMMMode ( m)
Value:
(luaP_opmodes[m] & (1 << 7))

Definition at line 392 of file lopcodes.h.

◆ testOTMode

#define testOTMode ( m)
Value:
(luaP_opmodes[m] & (1 << 6))

Definition at line 391 of file lopcodes.h.

◆ testTMode

#define testTMode ( m)
Value:
(luaP_opmodes[m] & (1 << 4))

Definition at line 389 of file lopcodes.h.

Enumeration Type Documentation

◆ OpCode

enum OpCode

Definition at line 201 of file lopcodes.h.

◆ OpMode

enum OpMode

Definition at line 36 of file lopcodes.h.