2001-06-28 23:58:57 +04:00
|
|
|
/*
|
2008-10-30 18:39:30 +03:00
|
|
|
** $Id: lopcodes.c,v 1.39 2008/04/02 16:16:06 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
|
2004-05-01 00:13:38 +04:00
|
|
|
#define LUA_CORE
|
2002-12-04 20:38:31 +03:00
|
|
|
|
2001-06-28 23:58:57 +04:00
|
|
|
|
|
|
|
#include "lopcodes.h"
|
|
|
|
|
|
|
|
|
2003-05-14 16:09:12 +04:00
|
|
|
/* ORDER OP */
|
|
|
|
|
2004-12-02 15:59:10 +03:00
|
|
|
const char *const luaP_opnames[NUM_OPCODES+1] = {
|
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",
|
2005-03-08 21:00:16 +03:00
|
|
|
"MOD",
|
2001-11-28 23:13:13 +03:00
|
|
|
"POW",
|
|
|
|
"UNM",
|
|
|
|
"NOT",
|
2005-05-20 19:53:42 +04:00
|
|
|
"LEN",
|
2001-11-28 23:13:13 +03:00
|
|
|
"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",
|
2005-08-30 00:49:21 +04:00
|
|
|
"TESTSET",
|
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",
|
2008-10-30 18:39:30 +03:00
|
|
|
"TFORCALL",
|
2001-11-28 23:13:13 +03:00
|
|
|
"SETLIST",
|
|
|
|
"CLOSE",
|
2004-05-31 22:51:50 +04:00
|
|
|
"CLOSURE",
|
2004-12-02 15:59:10 +03:00
|
|
|
"VARARG",
|
2008-10-30 18:39:30 +03:00
|
|
|
"TFORLOOP",
|
2008-04-02 21:38:54 +04:00
|
|
|
"EXTRAARG",
|
2004-12-02 15:59:10 +03:00
|
|
|
NULL
|
2001-06-28 23:58:57 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
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 */
|
2006-09-11 18:07:24 +04:00
|
|
|
opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
|
2003-05-14 16:09:12 +04:00
|
|
|
,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 */
|
2005-03-08 21:00:16 +03:00
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */
|
2003-05-14 16:09:12 +04:00
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */
|
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */
|
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */
|
2005-05-20 19:53:42 +04:00
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */
|
2003-05-14 16:09:12 +04:00
|
|
|
,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 */
|
2005-10-13 16:22:05 +04:00
|
|
|
,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */
|
2005-08-30 00:49:21 +04:00
|
|
|
,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */
|
2003-05-14 16:09:12 +04:00
|
|
|
,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 */
|
2008-10-30 18:39:30 +03:00
|
|
|
,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */
|
2004-10-04 23:01:53 +04:00
|
|
|
,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */
|
2003-05-14 16:09:12 +04:00
|
|
|
,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */
|
|
|
|
,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
|
2004-05-31 22:51:50 +04:00
|
|
|
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */
|
2008-10-30 18:39:30 +03:00
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */
|
2008-04-02 21:38:54 +04:00
|
|
|
,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */
|
2001-06-28 23:58:57 +04:00
|
|
|
};
|
|
|
|
|