1 /* $NetBSD: ljumptab.h,v 1.2 2023/04/16 20:46:17 nikita Exp $ */ 2 3 /* 4 ** Id: ljumptab.h 5 ** Jump Table for the Lua interpreter 6 ** See Copyright Notice in lua.h 7 */ 8 9 10 #undef vmdispatch 11 #undef vmcase 12 #undef vmbreak 13 14 #define vmdispatch(x) goto *disptab[x]; 15 16 #define vmcase(l) L_##l: 17 18 #define vmbreak vmfetch(); vmdispatch(GET_OPCODE(i)); 19 20 21 static const void *const disptab[NUM_OPCODES] = { 22 23 #if 0 24 ** you can update the following list with this command: 25 ** 26 ** sed -n '/^OP_/\!d; s/OP_/\&\&L_OP_/ ; s/,.*/,/ ; s/\/.*// ; p' lopcodes.h 27 ** 28 #endif 29 30 &&L_OP_MOVE, 31 &&L_OP_LOADI, 32 #ifndef _KERNEL 33 &&L_OP_LOADF, 34 #endif /* _KERNEL */ 35 &&L_OP_LOADK, 36 &&L_OP_LOADKX, 37 &&L_OP_LOADFALSE, 38 &&L_OP_LFALSESKIP, 39 &&L_OP_LOADTRUE, 40 &&L_OP_LOADNIL, 41 &&L_OP_GETUPVAL, 42 &&L_OP_SETUPVAL, 43 &&L_OP_GETTABUP, 44 &&L_OP_GETTABLE, 45 &&L_OP_GETI, 46 &&L_OP_GETFIELD, 47 &&L_OP_SETTABUP, 48 &&L_OP_SETTABLE, 49 &&L_OP_SETI, 50 &&L_OP_SETFIELD, 51 &&L_OP_NEWTABLE, 52 &&L_OP_SELF, 53 &&L_OP_ADDI, 54 &&L_OP_ADDK, 55 &&L_OP_SUBK, 56 &&L_OP_MULK, 57 &&L_OP_MODK, 58 #ifndef _KERNEL 59 &&L_OP_POWK, 60 &&L_OP_DIVK, 61 #endif /* _KERNEL */ 62 &&L_OP_IDIVK, 63 &&L_OP_BANDK, 64 &&L_OP_BORK, 65 &&L_OP_BXORK, 66 &&L_OP_SHRI, 67 &&L_OP_SHLI, 68 &&L_OP_ADD, 69 &&L_OP_SUB, 70 &&L_OP_MUL, 71 &&L_OP_MOD, 72 #ifndef _KERNEL 73 &&L_OP_POW, 74 &&L_OP_DIV, 75 #endif /* _KERNEL */ 76 &&L_OP_IDIV, 77 &&L_OP_BAND, 78 &&L_OP_BOR, 79 &&L_OP_BXOR, 80 &&L_OP_SHL, 81 &&L_OP_SHR, 82 &&L_OP_MMBIN, 83 &&L_OP_MMBINI, 84 &&L_OP_MMBINK, 85 &&L_OP_UNM, 86 &&L_OP_BNOT, 87 &&L_OP_NOT, 88 &&L_OP_LEN, 89 &&L_OP_CONCAT, 90 &&L_OP_CLOSE, 91 &&L_OP_TBC, 92 &&L_OP_JMP, 93 &&L_OP_EQ, 94 &&L_OP_LT, 95 &&L_OP_LE, 96 &&L_OP_EQK, 97 &&L_OP_EQI, 98 &&L_OP_LTI, 99 &&L_OP_LEI, 100 &&L_OP_GTI, 101 &&L_OP_GEI, 102 &&L_OP_TEST, 103 &&L_OP_TESTSET, 104 &&L_OP_CALL, 105 &&L_OP_TAILCALL, 106 &&L_OP_RETURN, 107 &&L_OP_RETURN0, 108 &&L_OP_RETURN1, 109 &&L_OP_FORLOOP, 110 &&L_OP_FORPREP, 111 &&L_OP_TFORPREP, 112 &&L_OP_TFORCALL, 113 &&L_OP_TFORLOOP, 114 &&L_OP_SETLIST, 115 &&L_OP_CLOSURE, 116 &&L_OP_VARARG, 117 &&L_OP_VARARGPREP, 118 &&L_OP_EXTRAARG 119 120 }; 121