diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-03-02 15:56:14 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-03-02 15:56:14 -0300 |
| commit | 893f382e94e05578063f91830ee735f48ee95c8b (patch) | |
| tree | 212aaf256230dda170c3ec77f6f8533855dedd88 | |
| parent | 0eb10c6303dadf29be349b0331e6029b5ae03298 (diff) | |
| download | lua-893f382e94e05578063f91830ee735f48ee95c8b.tar.gz lua-893f382e94e05578063f91830ee735f48ee95c8b.tar.bz2 lua-893f382e94e05578063f91830ee735f48ee95c8b.zip | |
Jump Table for the interpreter
| -rw-r--r-- | ljumptab.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/ljumptab.h b/ljumptab.h new file mode 100644 index 00000000..ac6a0357 --- /dev/null +++ b/ljumptab.h | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | #undef vmdispatch | ||
| 2 | #undef vmcase | ||
| 3 | #undef vmbreak | ||
| 4 | |||
| 5 | #define vmdispatch(x) goto *disptab[x]; | ||
| 6 | |||
| 7 | #define vmcase(l) L_##l: | ||
| 8 | |||
| 9 | #define vmbreak vmfetch(); vmdispatch(GET_OPCODE(i)); | ||
| 10 | |||
| 11 | |||
| 12 | static void *disptab[] = { | ||
| 13 | |||
| 14 | // you can update the following list with this command: | ||
| 15 | // | ||
| 16 | // sed -n '/^OP_/\!d; s/OP_/\&\&L_OP_/ ; s/,.*/,/ ; s/\/.*// ; p' lopcodes.h | ||
| 17 | // | ||
| 18 | // | ||
| 19 | |||
| 20 | &&L_OP_MOVE, | ||
| 21 | &&L_OP_LOADI, | ||
| 22 | &&L_OP_LOADF, | ||
| 23 | &&L_OP_LOADK, | ||
| 24 | &&L_OP_LOADKX, | ||
| 25 | &&L_OP_LOADBOOL, | ||
| 26 | &&L_OP_LOADNIL, | ||
| 27 | &&L_OP_GETUPVAL, | ||
| 28 | &&L_OP_SETUPVAL, | ||
| 29 | &&L_OP_GETTABUP, | ||
| 30 | &&L_OP_GETTABLE, | ||
| 31 | &&L_OP_GETI, | ||
| 32 | &&L_OP_GETFIELD, | ||
| 33 | &&L_OP_SETTABUP, | ||
| 34 | &&L_OP_SETTABLE, | ||
| 35 | &&L_OP_SETI, | ||
| 36 | &&L_OP_SETFIELD, | ||
| 37 | &&L_OP_NEWTABLE, | ||
| 38 | &&L_OP_SELF, | ||
| 39 | &&L_OP_ADDI, | ||
| 40 | &&L_OP_SUBI, | ||
| 41 | &&L_OP_MULI, | ||
| 42 | &&L_OP_MODI, | ||
| 43 | &&L_OP_POWI, | ||
| 44 | &&L_OP_DIVI, | ||
| 45 | &&L_OP_IDIVI, | ||
| 46 | &&L_OP_BANDK, | ||
| 47 | &&L_OP_BORK, | ||
| 48 | &&L_OP_BXORK, | ||
| 49 | &&L_OP_SHRI, | ||
| 50 | &&L_OP_SHLI, | ||
| 51 | &&L_OP_ADD, | ||
| 52 | &&L_OP_SUB, | ||
| 53 | &&L_OP_MUL, | ||
| 54 | &&L_OP_MOD, | ||
| 55 | &&L_OP_POW, | ||
| 56 | &&L_OP_DIV, | ||
| 57 | &&L_OP_IDIV, | ||
| 58 | &&L_OP_BAND, | ||
| 59 | &&L_OP_BOR, | ||
| 60 | &&L_OP_BXOR, | ||
| 61 | &&L_OP_SHL, | ||
| 62 | &&L_OP_SHR, | ||
| 63 | &&L_OP_UNM, | ||
| 64 | &&L_OP_BNOT, | ||
| 65 | &&L_OP_NOT, | ||
| 66 | &&L_OP_LEN, | ||
| 67 | &&L_OP_CONCAT, | ||
| 68 | &&L_OP_CLOSE, | ||
| 69 | &&L_OP_JMP, | ||
| 70 | &&L_OP_EQ, | ||
| 71 | &&L_OP_LT, | ||
| 72 | &&L_OP_LE, | ||
| 73 | &&L_OP_EQK, | ||
| 74 | &&L_OP_EQI, | ||
| 75 | &&L_OP_LTI, | ||
| 76 | &&L_OP_LEI, | ||
| 77 | &&L_OP_GTI, | ||
| 78 | &&L_OP_GEI, | ||
| 79 | &&L_OP_TEST, | ||
| 80 | &&L_OP_TESTSET, | ||
| 81 | &&L_OP_CALL, | ||
| 82 | &&L_OP_TAILCALL, | ||
| 83 | &&L_OP_RETURN, | ||
| 84 | &&L_OP_RETURN0, | ||
| 85 | &&L_OP_RETURN1, | ||
| 86 | &&L_OP_FORLOOP1, | ||
| 87 | &&L_OP_FORPREP1, | ||
| 88 | &&L_OP_FORLOOP, | ||
| 89 | &&L_OP_FORPREP, | ||
| 90 | &&L_OP_TFORCALL, | ||
| 91 | &&L_OP_TFORLOOP, | ||
| 92 | &&L_OP_SETLIST, | ||
| 93 | &&L_OP_CLOSURE, | ||
| 94 | &&L_OP_VARARG, | ||
| 95 | &&L_OP_PREPVARARG, | ||
| 96 | &&L_OP_EXTRAARG | ||
| 97 | |||
| 98 | }; | ||
