2001-06-28 23:58:57 +04:00
|
|
|
/*
|
2003-05-15 01:09:53 +04:00
|
|
|
** $Id: lopcodes.c,v 1.24 2003/05/14 12:09:12 roberto Exp roberto $
|
2001-06-28 23:58:57 +04:00
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-12-04 20:38:31 +03:00
|
|
|
#define lopcodes_c
|
|
|
|
|
2001-06-28 23:58:57 +04:00
|
|
|
#include "lua.h"
|
|
|
|
|
2001-08-31 23:46:07 +04:00
|
|
|
#include "lobject.h"
|
2001-06-28 23:58:57 +04:00
|
|
|
#include "lopcodes.h"
|
|
|
|
|
|
|
|
|
2003-05-14 16:09:12 +04:00
|
|
|
/* ORDER OP */
|
|
|
|
|
2001-06-28 23:58:57 +04:00
|
|
|
#ifdef LUA_OPNAMES
|
|
|
|
|
2003-05-15 01:09:53 +04:00
|
|
|
const char *const luaP_opnames[NUM_OPCODES] = {
|
2001-11-28 23:13:13 +03:00
|
|
|
"MOVE",
|
|
|
|
"LOADK",
|
2001-12-12 01:48:44 +03:00
|
|
|
"LOADBOOL",
|
2001-11-28 23:13:13 +03:00
|
|
|
"LOADNIL",
|
|
|
|
"GETUPVAL",
|
|
|
|
"GETGLOBAL",
|
|
|
|
"GETTABLE",
|
|
|
|
"SETGLOBAL",
|
|
|
|
"SETUPVAL",
|
|
|
|
"SETTABLE",
|
|
|
|
"NEWTABLE",
|
|
|
|
"SELF",
|
|
|
|
"ADD",
|
|
|
|
"SUB",
|
|
|
|
"MUL",
|
|
|
|
"DIV",
|
|
|
|
"POW",
|
|
|
|
"UNM",
|
|
|
|
"NOT",
|
|
|
|
"CONCAT",
|
|
|
|
"JMP",
|
2002-05-06 19:51:41 +04:00
|
|
|
"EQ",
|
2002-06-12 18:56:22 +04:00
|
|
|
"LT",
|
|
|
|
"LE",
|
2002-05-06 19:51:41 +04:00
|
|
|
"TEST",
|
2001-11-28 23:13:13 +03:00
|
|
|
"CALL",
|
2002-03-21 23:32:22 +03:00
|
|
|
"TAILCALL",
|
2001-11-28 23:13:13 +03:00
|
|
|
"RETURN",
|
|
|
|
"FORLOOP",
|
2003-05-14 00:15:59 +04:00
|
|
|
"FORPREP",
|
2001-11-28 23:13:13 +03:00
|
|
|
"TFORLOOP",
|
2002-04-10 22:05:08 +04:00
|
|
|
"TFORPREP",
|
2001-11-28 23:13:13 +03:00
|
|
|
"SETLIST",
|
|
|
|
"SETLISTO",
|
|
|
|
"CLOSE",
|
|
|
|
"CLOSURE"
|
2001-06-28 23:58:57 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2003-05-14 16:09:12 +04:00
|
|
|
#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
|
2002-03-08 22:10:32 +03:00
|
|
|
|
2001-08-27 19:14:57 +04:00
|
|
|
const lu_byte luaP_opmodes[NUM_OPCODES] = {
|
2003-05-14 16:09:12 +04:00
|
|
|
/* 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 */
|
2001-06-28 23:58:57 +04:00
|
|
|
};
|
|
|
|
|