| 1 | /* |
| 2 | ** $Id: lopcodes.c $ |
| 3 | ** Opcodes for Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h |
| 5 | */ |
| 6 | |
| 7 | #define lopcodes_c |
| 8 | #define LUA_CORE |
| 9 | |
| 10 | #include "lprefix.h" |
| 11 | |
| 12 | |
| 13 | #include "lopcodes.h" |
| 14 | |
| 15 | |
| 16 | /* ORDER OP */ |
| 17 | |
| 18 | LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { |
| 19 | /* MM OT IT T A mode opcode */ |
| 20 | opmode(0, 0, 0, 0, 1, iABC) /* OP_MOVE */ |
| 21 | ,opmode(0, 0, 0, 0, 1, iAsBx) /* OP_LOADI */ |
| 22 | ,opmode(0, 0, 0, 0, 1, iAsBx) /* OP_LOADF */ |
| 23 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADK */ |
| 24 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADKX */ |
| 25 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADFALSE */ |
| 26 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LFALSESKIP */ |
| 27 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADTRUE */ |
| 28 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADNIL */ |
| 29 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETUPVAL */ |
| 30 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETUPVAL */ |
| 31 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETTABUP */ |
| 32 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETTABLE */ |
| 33 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETI */ |
| 34 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETFIELD */ |
| 35 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETTABUP */ |
| 36 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETTABLE */ |
| 37 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETI */ |
| 38 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETFIELD */ |
| 39 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_NEWTABLE */ |
| 40 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SELF */ |
| 41 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADDI */ |
| 42 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADDK */ |
| 43 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SUBK */ |
| 44 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_MULK */ |
| 45 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_MODK */ |
| 46 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_POWK */ |
| 47 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_DIVK */ |
| 48 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_IDIVK */ |
| 49 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BANDK */ |
| 50 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BORK */ |
| 51 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BXORK */ |
| 52 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SHRI */ |
| 53 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SHLI */ |
| 54 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADD */ |
| 55 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SUB */ |
| 56 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_MUL */ |
| 57 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_MOD */ |
| 58 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_POW */ |
| 59 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_DIV */ |
| 60 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_IDIV */ |
| 61 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BAND */ |
| 62 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BOR */ |
| 63 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BXOR */ |
| 64 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SHL */ |
| 65 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SHR */ |
| 66 | ,opmode(1, 0, 0, 0, 0, iABC) /* OP_MMBIN */ |
| 67 | ,opmode(1, 0, 0, 0, 0, iABC) /* OP_MMBINI*/ |
| 68 | ,opmode(1, 0, 0, 0, 0, iABC) /* OP_MMBINK*/ |
| 69 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_UNM */ |
| 70 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BNOT */ |
| 71 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_NOT */ |
| 72 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LEN */ |
| 73 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_CONCAT */ |
| 74 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_CLOSE */ |
| 75 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_TBC */ |
| 76 | ,opmode(0, 0, 0, 0, 0, isJ) /* OP_JMP */ |
| 77 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_EQ */ |
| 78 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_LT */ |
| 79 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_LE */ |
| 80 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_EQK */ |
| 81 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_EQI */ |
| 82 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_LTI */ |
| 83 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_LEI */ |
| 84 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_GTI */ |
| 85 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_GEI */ |
| 86 | ,opmode(0, 0, 0, 1, 0, iABC) /* OP_TEST */ |
| 87 | ,opmode(0, 0, 0, 1, 1, iABC) /* OP_TESTSET */ |
| 88 | ,opmode(0, 1, 1, 0, 1, iABC) /* OP_CALL */ |
| 89 | ,opmode(0, 1, 1, 0, 1, iABC) /* OP_TAILCALL */ |
| 90 | ,opmode(0, 0, 1, 0, 0, iABC) /* OP_RETURN */ |
| 91 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_RETURN0 */ |
| 92 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_RETURN1 */ |
| 93 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_FORLOOP */ |
| 94 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_FORPREP */ |
| 95 | ,opmode(0, 0, 0, 0, 0, iABx) /* OP_TFORPREP */ |
| 96 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_TFORCALL */ |
| 97 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_TFORLOOP */ |
| 98 | ,opmode(0, 0, 1, 0, 0, iABC) /* OP_SETLIST */ |
| 99 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_CLOSURE */ |
| 100 | ,opmode(0, 1, 0, 0, 1, iABC) /* OP_VARARG */ |
| 101 | ,opmode(0, 0, 1, 0, 1, iABC) /* OP_VARARGPREP */ |
| 102 | ,opmode(0, 0, 0, 0, 0, iAx) /* OP_EXTRAARG */ |
| 103 | }; |
| 104 | |
| 105 | |