diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-08-29 12:52:37 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-08-29 12:52:37 -0300 |
| commit | 72a094bda7d71050a91a88474d67d39aa2bc1c46 (patch) | |
| tree | b14358bae6d5e0ba4a4d2c2bf515d82d8cf25b40 /lvm.c | |
| parent | 46b84580d6d7890f4ba813f312e52514fffc38a7 (diff) | |
| download | lua-72a094bda7d71050a91a88474d67d39aa2bc1c46.tar.gz lua-72a094bda7d71050a91a88474d67d39aa2bc1c46.tar.bz2 lua-72a094bda7d71050a91a88474d67d39aa2bc1c46.zip | |
Undo change in the handling of 'L->top' (commit b80077b8f3)
With MMBIN instructions, there are fewer opcodes that need to update
'L->top', so that change does not seem to pay for the increased
complexity.
Diffstat (limited to '')
| -rw-r--r-- | lvm.c | 19 |
1 files changed, 9 insertions, 10 deletions
| @@ -516,7 +516,6 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { | |||
| 516 | if (tm == NULL) /* no TM? */ | 516 | if (tm == NULL) /* no TM? */ |
| 517 | return 0; /* objects are different */ | 517 | return 0; /* objects are different */ |
| 518 | else { | 518 | else { |
| 519 | L->top = L->ci->top; | ||
| 520 | luaT_callTMres(L, tm, t1, t2, L->top); /* call TM */ | 519 | luaT_callTMres(L, tm, t1, t2, L->top); /* call TM */ |
| 521 | return !l_isfalse(s2v(L->top)); | 520 | return !l_isfalse(s2v(L->top)); |
| 522 | } | 521 | } |
| @@ -925,7 +924,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 925 | else if (ttisnumber(s2v(ra)) && ttisnumber(rb)) \ | 924 | else if (ttisnumber(s2v(ra)) && ttisnumber(rb)) \ |
| 926 | cond = opf(s2v(ra), rb); \ | 925 | cond = opf(s2v(ra), rb); \ |
| 927 | else \ | 926 | else \ |
| 928 | ProtectNT(cond = other(L, s2v(ra), rb)); \ | 927 | Protect(cond = other(L, s2v(ra), rb)); \ |
| 929 | docondjump(); } | 928 | docondjump(); } |
| 930 | 929 | ||
| 931 | 930 | ||
| @@ -944,7 +943,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 944 | } \ | 943 | } \ |
| 945 | else { \ | 944 | else { \ |
| 946 | int isf = GETARG_C(i); \ | 945 | int isf = GETARG_C(i); \ |
| 947 | ProtectNT(cond = luaT_callorderiTM(L, s2v(ra), im, inv, isf, tm)); \ | 946 | Protect(cond = luaT_callorderiTM(L, s2v(ra), im, inv, isf, tm)); \ |
| 948 | } \ | 947 | } \ |
| 949 | docondjump(); } | 948 | docondjump(); } |
| 950 | 949 | ||
| @@ -989,7 +988,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 989 | 988 | ||
| 990 | 989 | ||
| 991 | /* for test instructions, execute the jump instruction that follows it */ | 990 | /* for test instructions, execute the jump instruction that follows it */ |
| 992 | #define donextjump(ci) { i = *pc; dojump(ci, i, 1); } | 991 | #define donextjump(ci) { Instruction ni = *pc; dojump(ci, ni, 1); } |
| 993 | 992 | ||
| 994 | /* | 993 | /* |
| 995 | ** do a conditional jump: skip next instruction if 'cond' is not what | 994 | ** do a conditional jump: skip next instruction if 'cond' is not what |
| @@ -1408,7 +1407,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1408 | TMS tm = (TMS)GETARG_C(i); | 1407 | TMS tm = (TMS)GETARG_C(i); |
| 1409 | StkId result = RA(pi); | 1408 | StkId result = RA(pi); |
| 1410 | lua_assert(OP_ADD <= GET_OPCODE(pi) && GET_OPCODE(pi) <= OP_SHR); | 1409 | lua_assert(OP_ADD <= GET_OPCODE(pi) && GET_OPCODE(pi) <= OP_SHR); |
| 1411 | ProtectNT(luaT_trybinTM(L, s2v(ra), rb, result, tm)); | 1410 | Protect(luaT_trybinTM(L, s2v(ra), rb, result, tm)); |
| 1412 | vmbreak; | 1411 | vmbreak; |
| 1413 | } | 1412 | } |
| 1414 | vmcase(OP_MMBINI) { | 1413 | vmcase(OP_MMBINI) { |
| @@ -1417,7 +1416,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1417 | TMS tm = (TMS)GETARG_C(i); | 1416 | TMS tm = (TMS)GETARG_C(i); |
| 1418 | int flip = GETARG_k(i); | 1417 | int flip = GETARG_k(i); |
| 1419 | StkId result = RA(pi); | 1418 | StkId result = RA(pi); |
| 1420 | ProtectNT(luaT_trybiniTM(L, s2v(ra), imm, flip, result, tm)); | 1419 | Protect(luaT_trybiniTM(L, s2v(ra), imm, flip, result, tm)); |
| 1421 | vmbreak; | 1420 | vmbreak; |
| 1422 | } | 1421 | } |
| 1423 | vmcase(OP_MMBINK) { | 1422 | vmcase(OP_MMBINK) { |
| @@ -1426,7 +1425,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1426 | TMS tm = (TMS)GETARG_C(i); | 1425 | TMS tm = (TMS)GETARG_C(i); |
| 1427 | int flip = GETARG_k(i); | 1426 | int flip = GETARG_k(i); |
| 1428 | StkId result = RA(pi); | 1427 | StkId result = RA(pi); |
| 1429 | ProtectNT(luaT_trybinassocTM(L, s2v(ra), imm, flip, result, tm)); | 1428 | Protect(luaT_trybinassocTM(L, s2v(ra), imm, flip, result, tm)); |
| 1430 | vmbreak; | 1429 | vmbreak; |
| 1431 | } | 1430 | } |
| 1432 | vmcase(OP_UNM) { | 1431 | vmcase(OP_UNM) { |
| @@ -1440,7 +1439,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1440 | setfltvalue(s2v(ra), luai_numunm(L, nb)); | 1439 | setfltvalue(s2v(ra), luai_numunm(L, nb)); |
| 1441 | } | 1440 | } |
| 1442 | else | 1441 | else |
| 1443 | ProtectNT(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); | 1442 | Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); |
| 1444 | vmbreak; | 1443 | vmbreak; |
| 1445 | } | 1444 | } |
| 1446 | vmcase(OP_BNOT) { | 1445 | vmcase(OP_BNOT) { |
| @@ -1450,7 +1449,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1450 | setivalue(s2v(ra), intop(^, ~l_castS2U(0), ib)); | 1449 | setivalue(s2v(ra), intop(^, ~l_castS2U(0), ib)); |
| 1451 | } | 1450 | } |
| 1452 | else | 1451 | else |
| 1453 | ProtectNT(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); | 1452 | Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); |
| 1454 | vmbreak; | 1453 | vmbreak; |
| 1455 | } | 1454 | } |
| 1456 | vmcase(OP_NOT) { | 1455 | vmcase(OP_NOT) { |
| @@ -1486,7 +1485,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1486 | vmcase(OP_EQ) { | 1485 | vmcase(OP_EQ) { |
| 1487 | int cond; | 1486 | int cond; |
| 1488 | TValue *rb = vRB(i); | 1487 | TValue *rb = vRB(i); |
| 1489 | ProtectNT(cond = luaV_equalobj(L, s2v(ra), rb)); | 1488 | Protect(cond = luaV_equalobj(L, s2v(ra), rb)); |
| 1490 | docondjump(); | 1489 | docondjump(); |
| 1491 | vmbreak; | 1490 | vmbreak; |
| 1492 | } | 1491 | } |
