2001-06-28 12:58:57 -07:00
|
|
|
/*
|
2018-04-19 08:42:41 -07:00
|
|
|
** $Id: lopcodes.c,v 1.81 2018/04/04 14:23:41 roberto Exp roberto $
|
2012-05-14 06:34:18 -07:00
|
|
|
** Opcodes for Lua virtual machine
|
2001-06-28 12:58:57 -07:00
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
2002-12-04 09:38:31 -08:00
|
|
|
#define lopcodes_c
|
2004-04-30 13:13:38 -07:00
|
|
|
#define LUA_CORE
|
2002-12-04 09:38:31 -08:00
|
|
|
|
2014-11-02 11:19:04 -08:00
|
|
|
#include "lprefix.h"
|
|
|
|
|
2001-06-28 12:58:57 -07:00
|
|
|
|
2015-01-05 05:48:33 -08:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2001-06-28 12:58:57 -07:00
|
|
|
#include "lopcodes.h"
|
|
|
|
|
|
|
|
|
2003-05-14 05:09:12 -07:00
|
|
|
/* ORDER OP */
|
|
|
|
|
2018-04-19 08:42:41 -07:00
|
|
|
#if defined(LUAI_DEFOPNAMES)
|
|
|
|
|
2009-11-19 11:06:52 -08:00
|
|
|
LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
|
2001-11-28 12:13:13 -08:00
|
|
|
"MOVE",
|
2017-04-20 12:53:55 -07:00
|
|
|
"LOADI",
|
2017-09-19 11:38:14 -07:00
|
|
|
"LOADF",
|
2017-09-15 07:19:06 -07:00
|
|
|
"LOADK",
|
2011-04-07 11:14:12 -07:00
|
|
|
"LOADKX",
|
2001-12-11 14:48:44 -08:00
|
|
|
"LOADBOOL",
|
2001-11-28 12:13:13 -08:00
|
|
|
"LOADNIL",
|
|
|
|
"GETUPVAL",
|
2017-04-28 13:57:45 -07:00
|
|
|
"SETUPVAL",
|
2010-02-26 12:40:29 -08:00
|
|
|
"GETTABUP",
|
2001-11-28 12:13:13 -08:00
|
|
|
"GETTABLE",
|
2017-04-28 13:57:45 -07:00
|
|
|
"GETI",
|
|
|
|
"GETFIELD",
|
2010-02-26 12:40:29 -08:00
|
|
|
"SETTABUP",
|
2001-11-28 12:13:13 -08:00
|
|
|
"SETTABLE",
|
2017-04-28 13:57:45 -07:00
|
|
|
"SETI",
|
|
|
|
"SETFIELD",
|
2001-11-28 12:13:13 -08:00
|
|
|
"NEWTABLE",
|
|
|
|
"SELF",
|
2017-04-26 10:46:52 -07:00
|
|
|
"ADDI",
|
2017-10-04 08:49:24 -07:00
|
|
|
"SUBI",
|
|
|
|
"MULI",
|
|
|
|
"MODI",
|
|
|
|
"POWI",
|
|
|
|
"DIVI",
|
|
|
|
"IDIVI",
|
2017-12-13 10:32:09 -08:00
|
|
|
"BANDK",
|
|
|
|
"BORK",
|
|
|
|
"BXORK",
|
2017-12-04 09:41:30 -08:00
|
|
|
"SHRI",
|
|
|
|
"SHLI",
|
2001-11-28 12:13:13 -08:00
|
|
|
"ADD",
|
|
|
|
"SUB",
|
|
|
|
"MUL",
|
2005-03-08 10:00:16 -08:00
|
|
|
"MOD",
|
2001-11-28 12:13:13 -08:00
|
|
|
"POW",
|
2013-12-16 11:06:52 -08:00
|
|
|
"DIV",
|
|
|
|
"IDIV",
|
2013-12-18 06:12:03 -08:00
|
|
|
"BAND",
|
|
|
|
"BOR",
|
|
|
|
"BXOR",
|
2013-12-30 12:47:58 -08:00
|
|
|
"SHL",
|
|
|
|
"SHR",
|
2001-11-28 12:13:13 -08:00
|
|
|
"UNM",
|
2013-12-30 12:47:58 -08:00
|
|
|
"BNOT",
|
2001-11-28 12:13:13 -08:00
|
|
|
"NOT",
|
2005-05-20 08:53:42 -07:00
|
|
|
"LEN",
|
2001-11-28 12:13:13 -08:00
|
|
|
"CONCAT",
|
2017-09-13 12:50:08 -07:00
|
|
|
"CLOSE",
|
2001-11-28 12:13:13 -08:00
|
|
|
"JMP",
|
2002-05-06 08:51:41 -07:00
|
|
|
"EQ",
|
2002-06-12 07:56:22 -07:00
|
|
|
"LT",
|
|
|
|
"LE",
|
2017-11-16 04:59:14 -08:00
|
|
|
"EQK",
|
2017-11-22 10:41:20 -08:00
|
|
|
"EQI",
|
2017-11-27 09:44:31 -08:00
|
|
|
"LTI",
|
|
|
|
"LEI",
|
2018-02-21 07:49:32 -08:00
|
|
|
"GTI",
|
|
|
|
"GEI",
|
2002-05-06 08:51:41 -07:00
|
|
|
"TEST",
|
2005-08-29 13:49:21 -07:00
|
|
|
"TESTSET",
|
2001-11-28 12:13:13 -08:00
|
|
|
"CALL",
|
2002-03-21 12:32:22 -08:00
|
|
|
"TAILCALL",
|
2001-11-28 12:13:13 -08:00
|
|
|
"RETURN",
|
2017-11-29 08:57:36 -08:00
|
|
|
"RETURN0",
|
|
|
|
"RETURN1",
|
2017-12-18 09:53:50 -08:00
|
|
|
"FORLOOP1",
|
|
|
|
"FORPREP1",
|
2001-11-28 12:13:13 -08:00
|
|
|
"FORLOOP",
|
2003-05-13 13:15:59 -07:00
|
|
|
"FORPREP",
|
2008-10-30 08:39:30 -07:00
|
|
|
"TFORCALL",
|
2010-10-13 09:45:54 -07:00
|
|
|
"TFORLOOP",
|
2001-11-28 12:13:13 -08:00
|
|
|
"SETLIST",
|
2004-05-31 11:51:50 -07:00
|
|
|
"CLOSURE",
|
2004-12-02 04:59:10 -08:00
|
|
|
"VARARG",
|
2018-02-07 07:18:04 -08:00
|
|
|
"PREPVARARG",
|
2008-04-02 10:38:54 -07:00
|
|
|
"EXTRAARG",
|
2004-12-02 04:59:10 -08:00
|
|
|
NULL
|
2001-06-28 12:58:57 -07:00
|
|
|
};
|
|
|
|
|
2018-04-19 08:42:41 -07:00
|
|
|
#endif
|
|
|
|
|
2001-06-28 12:58:57 -07:00
|
|
|
|
2009-11-19 11:06:52 -08:00
|
|
|
LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
|
2017-12-22 06:16:46 -08:00
|
|
|
/* OT IT T A mode opcode */
|
|
|
|
opmode(0, 0, 0, 1, iABC) /* OP_MOVE */
|
|
|
|
,opmode(0, 0, 0, 1, iAsBx) /* OP_LOADI */
|
|
|
|
,opmode(0, 0, 0, 1, iAsBx) /* OP_LOADF */
|
|
|
|
,opmode(0, 0, 0, 1, iABx) /* OP_LOADK */
|
|
|
|
,opmode(0, 0, 0, 1, iABx) /* OP_LOADKX */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_LOADBOOL */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_LOADNIL */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_GETUPVAL */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_SETUPVAL */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_GETTABUP */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_GETTABLE */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_GETI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_GETFIELD */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_SETTABUP */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_SETTABLE */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_SETI */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_SETFIELD */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_NEWTABLE */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_SELF */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_ADDI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_SUBI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_MULI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_MODI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_POWI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_DIVI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_IDIVI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_BANDK */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_BORK */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_BXORK */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_SHRI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_SHLI */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_ADD */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_SUB */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_MUL */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_MOD */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_POW */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_DIV */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_IDIV */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_BAND */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_BOR */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_BXOR */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_SHL */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_SHR */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_UNM */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_BNOT */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_NOT */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_LEN */
|
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_CONCAT */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_CLOSE */
|
|
|
|
,opmode(0, 0, 0, 0, isJ) /* OP_JMP */
|
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_EQ */
|
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_LT */
|
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_LE */
|
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_EQK */
|
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_EQI */
|
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_LTI */
|
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_LEI */
|
2018-02-21 07:49:32 -08:00
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_GTI */
|
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_GEI */
|
2017-12-22 06:16:46 -08:00
|
|
|
,opmode(0, 0, 1, 0, iABC) /* OP_TEST */
|
|
|
|
,opmode(0, 0, 1, 1, iABC) /* OP_TESTSET */
|
|
|
|
,opmode(1, 1, 0, 1, iABC) /* OP_CALL */
|
|
|
|
,opmode(1, 1, 0, 1, iABC) /* OP_TAILCALL */
|
|
|
|
,opmode(0, 1, 0, 0, iABC) /* OP_RETURN */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_RETURN0 */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_RETURN1 */
|
|
|
|
,opmode(0, 0, 0, 1, iABx) /* OP_FORLOOP1 */
|
|
|
|
,opmode(0, 0, 0, 1, iABx) /* OP_FORPREP1 */
|
|
|
|
,opmode(0, 0, 0, 1, iABx) /* OP_FORLOOP */
|
|
|
|
,opmode(0, 0, 0, 1, iABx) /* OP_FORPREP */
|
|
|
|
,opmode(0, 0, 0, 0, iABC) /* OP_TFORCALL */
|
|
|
|
,opmode(0, 0, 0, 1, iABx) /* OP_TFORLOOP */
|
|
|
|
,opmode(0, 1, 0, 0, iABC) /* OP_SETLIST */
|
|
|
|
,opmode(0, 0, 0, 1, iABx) /* OP_CLOSURE */
|
|
|
|
,opmode(1, 0, 0, 1, iABC) /* OP_VARARG */
|
2018-02-07 07:18:04 -08:00
|
|
|
,opmode(0, 0, 0, 1, iABC) /* OP_PREPVARARG */
|
2017-12-22 06:16:46 -08:00
|
|
|
,opmode(0, 0, 0, 0, iAx) /* OP_EXTRAARG */
|
2001-06-28 12:58:57 -07:00
|
|
|
};
|
|
|
|
|