2011-08-08 15:19:44 -06:00
|
|
|
/*
|
2021-08-05 21:04:43 -06:00
|
|
|
** $Id: lopcodes.c,v 1.55.1.1 2017/04/19 17:20:42 roberto Exp $
|
2012-06-17 05:59:03 -06:00
|
|
|
** Opcodes for Lua virtual machine
|
2011-08-08 15:19:44 -06:00
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define lopcodes_c
|
|
|
|
#define LUA_CORE
|
|
|
|
|
2016-07-26 21:23:26 -06:00
|
|
|
#include "lprefix.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2011-08-08 15:19:44 -06:00
|
|
|
|
|
|
|
#include "lopcodes.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* ORDER OP */
|
|
|
|
|
2012-03-31 02:11:43 -06:00
|
|
|
LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
|
2011-08-08 15:19:44 -06:00
|
|
|
"MOVE",
|
|
|
|
"LOADK",
|
2012-03-31 02:11:43 -06:00
|
|
|
"LOADKX",
|
2011-08-08 15:19:44 -06:00
|
|
|
"LOADBOOL",
|
|
|
|
"LOADNIL",
|
|
|
|
"GETUPVAL",
|
2012-03-31 02:11:43 -06:00
|
|
|
"GETTABUP",
|
2011-08-08 15:19:44 -06:00
|
|
|
"GETTABLE",
|
2012-03-31 02:11:43 -06:00
|
|
|
"SETTABUP",
|
2011-08-08 15:19:44 -06:00
|
|
|
"SETUPVAL",
|
|
|
|
"SETTABLE",
|
|
|
|
"NEWTABLE",
|
|
|
|
"SELF",
|
|
|
|
"ADD",
|
|
|
|
"SUB",
|
|
|
|
"MUL",
|
|
|
|
"MOD",
|
|
|
|
"POW",
|
2016-07-26 21:23:26 -06:00
|
|
|
"DIV",
|
|
|
|
"IDIV",
|
|
|
|
"BAND",
|
|
|
|
"BOR",
|
|
|
|
"BXOR",
|
|
|
|
"SHL",
|
|
|
|
"SHR",
|
2011-08-08 15:19:44 -06:00
|
|
|
"UNM",
|
2016-07-26 21:23:26 -06:00
|
|
|
"BNOT",
|
2011-08-08 15:19:44 -06:00
|
|
|
"NOT",
|
|
|
|
"LEN",
|
|
|
|
"CONCAT",
|
|
|
|
"JMP",
|
|
|
|
"EQ",
|
|
|
|
"LT",
|
|
|
|
"LE",
|
|
|
|
"TEST",
|
|
|
|
"TESTSET",
|
|
|
|
"CALL",
|
|
|
|
"TAILCALL",
|
|
|
|
"RETURN",
|
|
|
|
"FORLOOP",
|
|
|
|
"FORPREP",
|
2012-03-31 02:11:43 -06:00
|
|
|
"TFORCALL",
|
2011-08-08 15:19:44 -06:00
|
|
|
"TFORLOOP",
|
|
|
|
"SETLIST",
|
|
|
|
"CLOSURE",
|
|
|
|
"VARARG",
|
2012-03-31 02:11:43 -06:00
|
|
|
"EXTRAARG",
|
2011-08-08 15:19:44 -06:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
|
|
|
|
|
2012-03-31 02:11:43 -06:00
|
|
|
LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
|
2011-08-08 15:19:44 -06:00
|
|
|
/* T A B C mode opcode */
|
2012-03-31 02:11:43 -06:00
|
|
|
opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
|
2011-08-08 15:19:44 -06:00
|
|
|
,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */
|
2012-03-31 02:11:43 -06:00
|
|
|
,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_LOADKX */
|
2011-08-08 15:19:44 -06:00
|
|
|
,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */
|
2012-03-31 02:11:43 -06:00
|
|
|
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_LOADNIL */
|
2011-08-08 15:19:44 -06:00
|
|
|
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */
|
2012-03-31 02:11:43 -06:00
|
|
|
,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_GETTABUP */
|
2011-08-08 15:19:44 -06:00
|
|
|
,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */
|
2012-03-31 02:11:43 -06:00
|
|
|
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP */
|
2011-08-08 15:19:44 -06:00
|
|
|
,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_MOD */
|
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */
|
2016-07-26 21:23:26 -06:00
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */
|
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_IDIV */
|
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BAND */
|
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BOR */
|
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BXOR */
|
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHL */
|
|
|
|
,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHR */
|
2011-08-08 15:19:44 -06:00
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */
|
2016-07-26 21:23:26 -06:00
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */
|
2011-08-08 15:19:44 -06:00
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */
|
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */
|
|
|
|
,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 */
|
2012-03-31 02:11:43 -06:00
|
|
|
,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */
|
2011-08-08 15:19:44 -06:00
|
|
|
,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */
|
|
|
|
,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 */
|
2012-03-31 02:11:43 -06:00
|
|
|
,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */
|
|
|
|
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */
|
2011-08-08 15:19:44 -06:00
|
|
|
,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */
|
|
|
|
,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
|
|
|
|
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */
|
2012-03-31 02:11:43 -06:00
|
|
|
,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */
|
2011-08-08 15:19:44 -06:00
|
|
|
};
|
|
|
|
|