diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-09-26 15:14:45 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-09-26 15:14:45 -0300 |
commit | 00e728af885d2781e365071557530a6685110d7e (patch) | |
tree | 3e864db8a1ffa0dcb8b60a8b5c18418709ca6fc2 | |
parent | 13256a4173af4004518d65211b4bf1aebcd5fc25 (diff) | |
download | lua-00e728af885d2781e365071557530a6685110d7e.tar.gz lua-00e728af885d2781e365071557530a6685110d7e.tar.bz2 lua-00e728af885d2781e365071557530a6685110d7e.zip |
binary operators use R instead of RK
faster + nobody uses RK(B), so B can be smaller (freeing one bit
for more opcodes, soon)
-rw-r--r-- | lcode.c | 21 | ||||
-rw-r--r-- | lopcodes.c | 32 | ||||
-rw-r--r-- | lopcodes.h | 32 | ||||
-rw-r--r-- | lvm.c | 64 |
4 files changed, 73 insertions, 76 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.123 2017/09/19 18:38:14 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.124 2017/09/26 17:10:49 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1157,7 +1157,7 @@ static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) { | |||
1157 | ** (everything but logical operators 'and'/'or' and comparison | 1157 | ** (everything but logical operators 'and'/'or' and comparison |
1158 | ** operators). | 1158 | ** operators). |
1159 | ** Expression to produce final result will be encoded in 'e1'. | 1159 | ** Expression to produce final result will be encoded in 'e1'. |
1160 | ** Because 'luaK_exp2RK' can free registers, its calls must be | 1160 | ** Because 'luaK_exp2anyreg' can free registers, its calls must be |
1161 | ** in "stack order" (that is, first on 'e2', which may have more | 1161 | ** in "stack order" (that is, first on 'e2', which may have more |
1162 | ** recent registers to be released). | 1162 | ** recent registers to be released). |
1163 | */ | 1163 | */ |
@@ -1176,8 +1176,8 @@ static void codebinexpval (FuncState *fs, OpCode op, | |||
1176 | op = OP_ADDI; | 1176 | op = OP_ADDI; |
1177 | } | 1177 | } |
1178 | else { | 1178 | else { |
1179 | v2 = luaK_exp2RK(fs, e2); /* both operands are "RK" */ | 1179 | v2 = luaK_exp2anyreg(fs, e2); /* both operands are in registers */ |
1180 | v1 = luaK_exp2RK(fs, e1); | 1180 | v1 = luaK_exp2anyreg(fs, e1); |
1181 | } | 1181 | } |
1182 | freeexps(fs, e1, e2); | 1182 | freeexps(fs, e1, e2); |
1183 | e1->u.info = luaK_codeABC(fs, op, 0, v1, v2); /* generate opcode */ | 1183 | e1->u.info = luaK_codeABC(fs, op, 0, v1, v2); /* generate opcode */ |
@@ -1188,12 +1188,12 @@ static void codebinexpval (FuncState *fs, OpCode op, | |||
1188 | 1188 | ||
1189 | /* | 1189 | /* |
1190 | ** Emit code for comparisons. | 1190 | ** Emit code for comparisons. |
1191 | ** 'e1' was already put in R/K form by 'luaK_infix'. | 1191 | ** 'e1' was already put in register by 'luaK_infix'. |
1192 | */ | 1192 | */ |
1193 | static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { | 1193 | static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { |
1194 | int rk1 = (e1->k == VK) ? RKASK(e1->u.info) | 1194 | int rk1 = (e1->k == VK) ? RKASK(e1->u.info) |
1195 | : check_exp(e1->k == VNONRELOC, e1->u.info); | 1195 | : check_exp(e1->k == VNONRELOC, e1->u.info); |
1196 | int rk2 = luaK_exp2RK(fs, e2); | 1196 | int rk2 = luaK_exp2anyreg(fs, e2); |
1197 | freeexps(fs, e1, e2); | 1197 | freeexps(fs, e1, e2); |
1198 | switch (opr) { | 1198 | switch (opr) { |
1199 | case OPR_NE: { /* '(a ~= b)' ==> 'not (a == b)' */ | 1199 | case OPR_NE: { /* '(a ~= b)' ==> 'not (a == b)' */ |
@@ -1258,14 +1258,13 @@ void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { | |||
1258 | case OPR_MOD: case OPR_POW: | 1258 | case OPR_MOD: case OPR_POW: |
1259 | case OPR_BAND: case OPR_BOR: case OPR_BXOR: | 1259 | case OPR_BAND: case OPR_BOR: case OPR_BXOR: |
1260 | case OPR_SHL: case OPR_SHR: { | 1260 | case OPR_SHL: case OPR_SHR: { |
1261 | if (!tonumeral(v, NULL)) | 1261 | if (tonumeral(v, NULL)) |
1262 | luaK_exp2RK(fs, v); | 1262 | break; /* keep numeral, which may be folded with 2nd operand */ |
1263 | /* else keep numeral, which may be folded with 2nd operand */ | 1263 | /* else *//* FALLTHROUGH */ |
1264 | break; | ||
1265 | } | 1264 | } |
1266 | case OPR_EQ: case OPR_LT: case OPR_LE: | 1265 | case OPR_EQ: case OPR_LT: case OPR_LE: |
1267 | case OPR_NE: case OPR_GT: case OPR_GE: { | 1266 | case OPR_NE: case OPR_GT: case OPR_GE: { |
1268 | luaK_exp2RK(fs, v); | 1267 | luaK_exp2anyreg(fs, v); |
1269 | break; | 1268 | break; |
1270 | } | 1269 | } |
1271 | default: lua_assert(0); | 1270 | default: lua_assert(0); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lopcodes.c,v 1.62 2017/09/15 14:19:06 roberto Exp roberto $ | 2 | ** $Id: lopcodes.c,v 1.63 2017/09/19 18:38:14 roberto Exp roberto $ |
3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -101,18 +101,18 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | |||
101 | ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ | 101 | ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ |
102 | ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ | 102 | ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ |
103 | ,opmode(0, 1, OpArgR, OpArgU, iABC) /* OP_ADDI */ | 103 | ,opmode(0, 1, OpArgR, OpArgU, iABC) /* OP_ADDI */ |
104 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ | 104 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_ADD */ |
105 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ | 105 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_SUB */ |
106 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ | 106 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_MUL */ |
107 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ | 107 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_MOD */ |
108 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ | 108 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_POW */ |
109 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ | 109 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_DIV */ |
110 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_IDIV */ | 110 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_IDIV */ |
111 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BAND */ | 111 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_BAND */ |
112 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BOR */ | 112 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_BOR */ |
113 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BXOR */ | 113 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_BXOR */ |
114 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHL */ | 114 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_SHL */ |
115 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHR */ | 115 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_SHR */ |
116 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ | 116 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ |
117 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */ | 117 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */ |
118 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ | 118 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ |
@@ -120,9 +120,9 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | |||
120 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ | 120 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ |
121 | ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ | 121 | ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ |
122 | ,opmode(0, 0, OpArgU, OpArgN, iAsBx) /* OP_JMP */ | 122 | ,opmode(0, 0, OpArgU, OpArgN, iAsBx) /* OP_JMP */ |
123 | ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ | 123 | ,opmode(1, 0, OpArgR, OpArgR, iABC) /* OP_EQ */ |
124 | ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ | 124 | ,opmode(1, 0, OpArgR, OpArgR, iABC) /* OP_LT */ |
125 | ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ | 125 | ,opmode(1, 0, OpArgR, OpArgR, iABC) /* OP_LE */ |
126 | ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */ | 126 | ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */ |
127 | ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ | 127 | ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ |
128 | ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ | 128 | ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lopcodes.h,v 1.159 2017/09/18 16:07:54 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.160 2017/09/19 18:38:14 roberto Exp roberto $ |
3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -198,18 +198,18 @@ OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */ | |||
198 | OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C):string] */ | 198 | OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C):string] */ |
199 | 199 | ||
200 | OP_ADDI,/* A B C R(A) := R(B) + C */ | 200 | OP_ADDI,/* A B C R(A) := R(B) + C */ |
201 | OP_ADD,/* A B C R(A) := RK(B) + RK(C) */ | 201 | OP_ADD,/* A B C R(A) := R(B) + R(C) */ |
202 | OP_SUB,/* A B C R(A) := RK(B) - RK(C) */ | 202 | OP_SUB,/* A B C R(A) := R(B) - R(C) */ |
203 | OP_MUL,/* A B C R(A) := RK(B) * RK(C) */ | 203 | OP_MUL,/* A B C R(A) := R(B) * R(C) */ |
204 | OP_MOD,/* A B C R(A) := RK(B) % RK(C) */ | 204 | OP_MOD,/* A B C R(A) := R(B) % R(C) */ |
205 | OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */ | 205 | OP_POW,/* A B C R(A) := R(B) ^ R(C) */ |
206 | OP_DIV,/* A B C R(A) := RK(B) / RK(C) */ | 206 | OP_DIV,/* A B C R(A) := R(B) / R(C) */ |
207 | OP_IDIV,/* A B C R(A) := RK(B) // RK(C) */ | 207 | OP_IDIV,/* A B C R(A) := R(B) // R(C) */ |
208 | OP_BAND,/* A B C R(A) := RK(B) & RK(C) */ | 208 | OP_BAND,/* A B C R(A) := R(B) & R(C) */ |
209 | OP_BOR,/* A B C R(A) := RK(B) | RK(C) */ | 209 | OP_BOR,/* A B C R(A) := R(B) | R(C) */ |
210 | OP_BXOR,/* A B C R(A) := RK(B) ~ RK(C) */ | 210 | OP_BXOR,/* A B C R(A) := R(B) ~ R(C) */ |
211 | OP_SHL,/* A B C R(A) := RK(B) << RK(C) */ | 211 | OP_SHL,/* A B C R(A) := R(B) << R(C) */ |
212 | OP_SHR,/* A B C R(A) := RK(B) >> RK(C) */ | 212 | OP_SHR,/* A B C R(A) := R(B) >> R(C) */ |
213 | OP_UNM,/* A B R(A) := -R(B) */ | 213 | OP_UNM,/* A B R(A) := -R(B) */ |
214 | OP_BNOT,/* A B R(A) := ~R(B) */ | 214 | OP_BNOT,/* A B R(A) := ~R(B) */ |
215 | OP_NOT,/* A B R(A) := not R(B) */ | 215 | OP_NOT,/* A B R(A) := not R(B) */ |
@@ -219,9 +219,9 @@ OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ | |||
219 | 219 | ||
220 | OP_CLOSE,/* A close all upvalues >= R(A) */ | 220 | OP_CLOSE,/* A close all upvalues >= R(A) */ |
221 | OP_JMP,/* sBx pc+=sBx */ | 221 | OP_JMP,/* sBx pc+=sBx */ |
222 | OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ | 222 | OP_EQ,/* A B C if ((R(B) == R(C)) ~= A) then pc++ */ |
223 | OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ | 223 | OP_LT,/* A B C if ((R(B) < R(C)) ~= A) then pc++ */ |
224 | OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ | 224 | OP_LE,/* A B C if ((R(B) <= R(C)) ~= A) then pc++ */ |
225 | 225 | ||
226 | OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ | 226 | OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ |
227 | OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ | 227 | OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.292 2017/09/13 19:50:08 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.293 2017/09/19 18:38:14 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -739,8 +739,6 @@ void luaV_finishOp (lua_State *L) { | |||
739 | #define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) | 739 | #define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) |
740 | #define vRC(i) s2v(RC(i)) | 740 | #define vRC(i) s2v(RC(i)) |
741 | #define KC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, k+GETARG_C(i)) | 741 | #define KC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, k+GETARG_C(i)) |
742 | #define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ | ||
743 | (GETARG_Bk(i)) ? k + GETARG_Br(i) : s2v(base + GETARG_Br(i))) | ||
744 | #define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ | 742 | #define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ |
745 | (GETARG_Ck(i)) ? k + GETARG_Cr(i) : s2v(base + GETARG_Cr(i))) | 743 | (GETARG_Ck(i)) ? k + GETARG_Cr(i) : s2v(base + GETARG_Cr(i))) |
746 | 744 | ||
@@ -1013,8 +1011,8 @@ void luaV_execute (lua_State *L) { | |||
1013 | vmbreak; | 1011 | vmbreak; |
1014 | } | 1012 | } |
1015 | vmcase(OP_ADD) { | 1013 | vmcase(OP_ADD) { |
1016 | TValue *rb = RKB(i); | 1014 | TValue *rb = vRB(i); |
1017 | TValue *rc = RKC(i); | 1015 | TValue *rc = vRC(i); |
1018 | lua_Number nb; lua_Number nc; | 1016 | lua_Number nb; lua_Number nc; |
1019 | if (ttisinteger(rb) && ttisinteger(rc)) { | 1017 | if (ttisinteger(rb) && ttisinteger(rc)) { |
1020 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); | 1018 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); |
@@ -1027,8 +1025,8 @@ void luaV_execute (lua_State *L) { | |||
1027 | vmbreak; | 1025 | vmbreak; |
1028 | } | 1026 | } |
1029 | vmcase(OP_SUB) { | 1027 | vmcase(OP_SUB) { |
1030 | TValue *rb = RKB(i); | 1028 | TValue *rb = vRB(i); |
1031 | TValue *rc = RKC(i); | 1029 | TValue *rc = vRC(i); |
1032 | lua_Number nb; lua_Number nc; | 1030 | lua_Number nb; lua_Number nc; |
1033 | if (ttisinteger(rb) && ttisinteger(rc)) { | 1031 | if (ttisinteger(rb) && ttisinteger(rc)) { |
1034 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); | 1032 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); |
@@ -1041,8 +1039,8 @@ void luaV_execute (lua_State *L) { | |||
1041 | vmbreak; | 1039 | vmbreak; |
1042 | } | 1040 | } |
1043 | vmcase(OP_MUL) { | 1041 | vmcase(OP_MUL) { |
1044 | TValue *rb = RKB(i); | 1042 | TValue *rb = vRB(i); |
1045 | TValue *rc = RKC(i); | 1043 | TValue *rc = vRC(i); |
1046 | lua_Number nb; lua_Number nc; | 1044 | lua_Number nb; lua_Number nc; |
1047 | if (ttisinteger(rb) && ttisinteger(rc)) { | 1045 | if (ttisinteger(rb) && ttisinteger(rc)) { |
1048 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); | 1046 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); |
@@ -1055,8 +1053,8 @@ void luaV_execute (lua_State *L) { | |||
1055 | vmbreak; | 1053 | vmbreak; |
1056 | } | 1054 | } |
1057 | vmcase(OP_DIV) { /* float division (always with floats) */ | 1055 | vmcase(OP_DIV) { /* float division (always with floats) */ |
1058 | TValue *rb = RKB(i); | 1056 | TValue *rb = vRB(i); |
1059 | TValue *rc = RKC(i); | 1057 | TValue *rc = vRC(i); |
1060 | lua_Number nb; lua_Number nc; | 1058 | lua_Number nb; lua_Number nc; |
1061 | if (tonumberns(rb, nb) && tonumberns(rc, nc)) { | 1059 | if (tonumberns(rb, nb) && tonumberns(rc, nc)) { |
1062 | setfltvalue(s2v(ra), luai_numdiv(L, nb, nc)); | 1060 | setfltvalue(s2v(ra), luai_numdiv(L, nb, nc)); |
@@ -1065,8 +1063,8 @@ void luaV_execute (lua_State *L) { | |||
1065 | vmbreak; | 1063 | vmbreak; |
1066 | } | 1064 | } |
1067 | vmcase(OP_BAND) { | 1065 | vmcase(OP_BAND) { |
1068 | TValue *rb = RKB(i); | 1066 | TValue *rb = vRB(i); |
1069 | TValue *rc = RKC(i); | 1067 | TValue *rc = vRC(i); |
1070 | lua_Integer ib; lua_Integer ic; | 1068 | lua_Integer ib; lua_Integer ic; |
1071 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { | 1069 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { |
1072 | setivalue(s2v(ra), intop(&, ib, ic)); | 1070 | setivalue(s2v(ra), intop(&, ib, ic)); |
@@ -1075,8 +1073,8 @@ void luaV_execute (lua_State *L) { | |||
1075 | vmbreak; | 1073 | vmbreak; |
1076 | } | 1074 | } |
1077 | vmcase(OP_BOR) { | 1075 | vmcase(OP_BOR) { |
1078 | TValue *rb = RKB(i); | 1076 | TValue *rb = vRB(i); |
1079 | TValue *rc = RKC(i); | 1077 | TValue *rc = vRC(i); |
1080 | lua_Integer ib; lua_Integer ic; | 1078 | lua_Integer ib; lua_Integer ic; |
1081 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { | 1079 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { |
1082 | setivalue(s2v(ra), intop(|, ib, ic)); | 1080 | setivalue(s2v(ra), intop(|, ib, ic)); |
@@ -1085,8 +1083,8 @@ void luaV_execute (lua_State *L) { | |||
1085 | vmbreak; | 1083 | vmbreak; |
1086 | } | 1084 | } |
1087 | vmcase(OP_BXOR) { | 1085 | vmcase(OP_BXOR) { |
1088 | TValue *rb = RKB(i); | 1086 | TValue *rb = vRB(i); |
1089 | TValue *rc = RKC(i); | 1087 | TValue *rc = vRC(i); |
1090 | lua_Integer ib; lua_Integer ic; | 1088 | lua_Integer ib; lua_Integer ic; |
1091 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { | 1089 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { |
1092 | setivalue(s2v(ra), intop(^, ib, ic)); | 1090 | setivalue(s2v(ra), intop(^, ib, ic)); |
@@ -1095,8 +1093,8 @@ void luaV_execute (lua_State *L) { | |||
1095 | vmbreak; | 1093 | vmbreak; |
1096 | } | 1094 | } |
1097 | vmcase(OP_SHL) { | 1095 | vmcase(OP_SHL) { |
1098 | TValue *rb = RKB(i); | 1096 | TValue *rb = vRB(i); |
1099 | TValue *rc = RKC(i); | 1097 | TValue *rc = vRC(i); |
1100 | lua_Integer ib; lua_Integer ic; | 1098 | lua_Integer ib; lua_Integer ic; |
1101 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { | 1099 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { |
1102 | setivalue(s2v(ra), luaV_shiftl(ib, ic)); | 1100 | setivalue(s2v(ra), luaV_shiftl(ib, ic)); |
@@ -1105,8 +1103,8 @@ void luaV_execute (lua_State *L) { | |||
1105 | vmbreak; | 1103 | vmbreak; |
1106 | } | 1104 | } |
1107 | vmcase(OP_SHR) { | 1105 | vmcase(OP_SHR) { |
1108 | TValue *rb = RKB(i); | 1106 | TValue *rb = vRB(i); |
1109 | TValue *rc = RKC(i); | 1107 | TValue *rc = vRC(i); |
1110 | lua_Integer ib; lua_Integer ic; | 1108 | lua_Integer ib; lua_Integer ic; |
1111 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { | 1109 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { |
1112 | setivalue(s2v(ra), luaV_shiftl(ib, -ic)); | 1110 | setivalue(s2v(ra), luaV_shiftl(ib, -ic)); |
@@ -1115,8 +1113,8 @@ void luaV_execute (lua_State *L) { | |||
1115 | vmbreak; | 1113 | vmbreak; |
1116 | } | 1114 | } |
1117 | vmcase(OP_MOD) { | 1115 | vmcase(OP_MOD) { |
1118 | TValue *rb = RKB(i); | 1116 | TValue *rb = vRB(i); |
1119 | TValue *rc = RKC(i); | 1117 | TValue *rc = vRC(i); |
1120 | lua_Number nb; lua_Number nc; | 1118 | lua_Number nb; lua_Number nc; |
1121 | if (ttisinteger(rb) && ttisinteger(rc)) { | 1119 | if (ttisinteger(rb) && ttisinteger(rc)) { |
1122 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); | 1120 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); |
@@ -1131,8 +1129,8 @@ void luaV_execute (lua_State *L) { | |||
1131 | vmbreak; | 1129 | vmbreak; |
1132 | } | 1130 | } |
1133 | vmcase(OP_IDIV) { /* floor division */ | 1131 | vmcase(OP_IDIV) { /* floor division */ |
1134 | TValue *rb = RKB(i); | 1132 | TValue *rb = vRB(i); |
1135 | TValue *rc = RKC(i); | 1133 | TValue *rc = vRC(i); |
1136 | lua_Number nb; lua_Number nc; | 1134 | lua_Number nb; lua_Number nc; |
1137 | if (ttisinteger(rb) && ttisinteger(rc)) { | 1135 | if (ttisinteger(rb) && ttisinteger(rc)) { |
1138 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); | 1136 | lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); |
@@ -1145,8 +1143,8 @@ void luaV_execute (lua_State *L) { | |||
1145 | vmbreak; | 1143 | vmbreak; |
1146 | } | 1144 | } |
1147 | vmcase(OP_POW) { | 1145 | vmcase(OP_POW) { |
1148 | TValue *rb = RKB(i); | 1146 | TValue *rb = vRB(i); |
1149 | TValue *rc = RKC(i); | 1147 | TValue *rc = vRC(i); |
1150 | lua_Number nb; lua_Number nc; | 1148 | lua_Number nb; lua_Number nc; |
1151 | if (tonumberns(rb, nb) && tonumberns(rc, nc)) { | 1149 | if (tonumberns(rb, nb) && tonumberns(rc, nc)) { |
1152 | setfltvalue(s2v(ra), luai_numpow(L, nb, nc)); | 1150 | setfltvalue(s2v(ra), luai_numpow(L, nb, nc)); |
@@ -1212,8 +1210,8 @@ void luaV_execute (lua_State *L) { | |||
1212 | vmbreak; | 1210 | vmbreak; |
1213 | } | 1211 | } |
1214 | vmcase(OP_EQ) { | 1212 | vmcase(OP_EQ) { |
1215 | TValue *rb = RKB(i); | 1213 | TValue *rb = vRB(i); |
1216 | TValue *rc = RKC(i); | 1214 | TValue *rc = vRC(i); |
1217 | Protect( | 1215 | Protect( |
1218 | if (luaV_equalobj(L, rb, rc) != GETARG_A(i)) | 1216 | if (luaV_equalobj(L, rb, rc) != GETARG_A(i)) |
1219 | pc++; | 1217 | pc++; |
@@ -1223,8 +1221,8 @@ void luaV_execute (lua_State *L) { | |||
1223 | vmbreak; | 1221 | vmbreak; |
1224 | } | 1222 | } |
1225 | vmcase(OP_LT) { | 1223 | vmcase(OP_LT) { |
1226 | TValue *rb = RKB(i); | 1224 | TValue *rb = vRB(i); |
1227 | TValue *rc = RKC(i); | 1225 | TValue *rc = vRC(i); |
1228 | int res; | 1226 | int res; |
1229 | if (ttisinteger(rb) && ttisinteger(rc)) | 1227 | if (ttisinteger(rb) && ttisinteger(rc)) |
1230 | res = (ivalue(rb) < ivalue(rc)); | 1228 | res = (ivalue(rb) < ivalue(rc)); |
@@ -1238,8 +1236,8 @@ void luaV_execute (lua_State *L) { | |||
1238 | vmbreak; | 1236 | vmbreak; |
1239 | } | 1237 | } |
1240 | vmcase(OP_LE) { | 1238 | vmcase(OP_LE) { |
1241 | TValue *rb = RKB(i); | 1239 | TValue *rb = vRB(i); |
1242 | TValue *rc = RKC(i); | 1240 | TValue *rc = vRC(i); |
1243 | int res; | 1241 | int res; |
1244 | if (ttisinteger(rb) && ttisinteger(rc)) | 1242 | if (ttisinteger(rb) && ttisinteger(rc)) |
1245 | res = (ivalue(rb) <= ivalue(rc)); | 1243 | res = (ivalue(rb) <= ivalue(rc)); |