mirror of https://github.com/lua/lua
102 lines
2.7 KiB
C
102 lines
2.7 KiB
C
/*
|
|
** $Id: lopcodes.c,v 1.24 2003/05/14 12:09:12 roberto Exp roberto $
|
|
** See Copyright Notice in lua.h
|
|
*/
|
|
|
|
|
|
#define lopcodes_c
|
|
|
|
#include "lua.h"
|
|
|
|
#include "lobject.h"
|
|
#include "lopcodes.h"
|
|
|
|
|
|
/* ORDER OP */
|
|
|
|
#ifdef LUA_OPNAMES
|
|
|
|
const char *const luaP_opnames[NUM_OPCODES] = {
|
|
"MOVE",
|
|
"LOADK",
|
|
"LOADBOOL",
|
|
"LOADNIL",
|
|
"GETUPVAL",
|
|
"GETGLOBAL",
|
|
"GETTABLE",
|
|
"SETGLOBAL",
|
|
"SETUPVAL",
|
|
"SETTABLE",
|
|
"NEWTABLE",
|
|
"SELF",
|
|
"ADD",
|
|
"SUB",
|
|
"MUL",
|
|
"DIV",
|
|
"POW",
|
|
"UNM",
|
|
"NOT",
|
|
"CONCAT",
|
|
"JMP",
|
|
"EQ",
|
|
"LT",
|
|
"LE",
|
|
"TEST",
|
|
"CALL",
|
|
"TAILCALL",
|
|
"RETURN",
|
|
"FORLOOP",
|
|
"FORPREP",
|
|
"TFORLOOP",
|
|
"TFORPREP",
|
|
"SETLIST",
|
|
"SETLISTO",
|
|
"CLOSE",
|
|
"CLOSURE"
|
|
};
|
|
|
|
#endif
|
|
|
|
#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
|
|
|
|
const lu_byte luaP_opmodes[NUM_OPCODES] = {
|
|
/* T A B C mode opcode */
|
|
opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
|
|
,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */
|
|
,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */
|
|
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */
|
|
,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */
|
|
,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */
|
|
,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */
|
|
,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */
|
|
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */
|
|
,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */
|
|
,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */
|
|
,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */
|
|
,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */
|
|
,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */
|
|
,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */
|
|
,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */
|
|
,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */
|
|
,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */
|
|
,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */
|
|
,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */
|
|
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */
|
|
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */
|
|
,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */
|
|
,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_TFORPREP */
|
|
,opmode(0, 0, OpArgU, OpArgN, iABx) /* OP_SETLIST */
|
|
,opmode(0, 0, OpArgU, OpArgN, iABx) /* OP_SETLISTO */
|
|
,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */
|
|
,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
|
|
};
|
|
|