diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-27 15:01:57 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-27 15:01:57 -0300 |
| commit | 6ac7219da31df0238dc33c2d4457f69bfe0c1e79 (patch) | |
| tree | c9fc124ed998ea39a6222556bb581817791089de /lopcodes.c | |
| parent | 9904c253da9690728710082cfb94654709ab89e7 (diff) | |
| download | lua-6ac7219da31df0238dc33c2d4457f69bfe0c1e79.tar.gz lua-6ac7219da31df0238dc33c2d4457f69bfe0c1e79.tar.bz2 lua-6ac7219da31df0238dc33c2d4457f69bfe0c1e79.zip | |
'isIT'/'isOT' turned from macros to functions
Diffstat (limited to 'lopcodes.c')
| -rw-r--r-- | lopcodes.c | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -13,6 +13,10 @@ | |||
| 13 | #include "lopcodes.h" | 13 | #include "lopcodes.h" |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | #define opmode(mm,ot,it,t,a,m) \ | ||
| 17 | (((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m)) | ||
| 18 | |||
| 19 | |||
| 16 | /* ORDER OP */ | 20 | /* ORDER OP */ |
| 17 | 21 | ||
| 18 | LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | 22 | LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { |
| @@ -102,3 +106,27 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | |||
| 102 | ,opmode(0, 0, 0, 0, 0, iAx) /* OP_EXTRAARG */ | 106 | ,opmode(0, 0, 0, 0, 0, iAx) /* OP_EXTRAARG */ |
| 103 | }; | 107 | }; |
| 104 | 108 | ||
| 109 | |||
| 110 | |||
| 111 | /* | ||
| 112 | ** Check whether instruction sets top for next instruction, that is, | ||
| 113 | ** it results in multiple values. | ||
| 114 | */ | ||
| 115 | int luaP_isOT (Instruction i) { | ||
| 116 | OpCode op = GET_OPCODE(i); | ||
| 117 | switch (op) { | ||
| 118 | case OP_TAILCALL: return 1; | ||
| 119 | default: | ||
| 120 | return testOTMode(op) && GETARG_C(i) == 0; | ||
| 121 | } | ||
| 122 | } | ||
| 123 | |||
| 124 | |||
| 125 | /* | ||
| 126 | ** Check whether instruction uses top from previous instruction, that is, | ||
| 127 | ** it accepts multiple results. | ||
| 128 | */ | ||
| 129 | int luaP_isIT (Instruction i) { | ||
| 130 | return testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0; | ||
| 131 | } | ||
| 132 | |||
