diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-02-27 12:59:22 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-02-27 12:59:22 -0300 |
| commit | 6eb53b752617fae9e1329bfe2cfecdcbb593c398 (patch) | |
| tree | c392ef632bbcfbf7b3716f5c6c17b06617bca8da /lvm.c | |
| parent | 9b7987a9d1471ba94764286b28e0998f73deb46a (diff) | |
| download | lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.tar.gz lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.tar.bz2 lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.zip | |
Details
Several details in code (e.g., moving a variable to the most inner
scope that encloses its uses), comments, parameter names, extra tests.
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 13 |
1 files changed, 7 insertions, 6 deletions
| @@ -980,11 +980,11 @@ void luaV_finishOp (lua_State *L) { | |||
| 980 | 980 | ||
| 981 | 981 | ||
| 982 | /* | 982 | /* |
| 983 | ** Order operations with register operands. 'opf' actually works | 983 | ** Order operations with register operands. 'opn' actually works |
| 984 | ** for all numbers, but the fast track improves performance for | 984 | ** for all numbers, but the fast track improves performance for |
| 985 | ** integers. | 985 | ** integers. |
| 986 | */ | 986 | */ |
| 987 | #define op_order(L,opi,opf,other) { \ | 987 | #define op_order(L,opi,opn,other) { \ |
| 988 | int cond; \ | 988 | int cond; \ |
| 989 | TValue *rb = vRB(i); \ | 989 | TValue *rb = vRB(i); \ |
| 990 | if (ttisinteger(s2v(ra)) && ttisinteger(rb)) { \ | 990 | if (ttisinteger(s2v(ra)) && ttisinteger(rb)) { \ |
| @@ -993,7 +993,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 993 | cond = opi(ia, ib); \ | 993 | cond = opi(ia, ib); \ |
| 994 | } \ | 994 | } \ |
| 995 | else if (ttisnumber(s2v(ra)) && ttisnumber(rb)) \ | 995 | else if (ttisnumber(s2v(ra)) && ttisnumber(rb)) \ |
| 996 | cond = opf(s2v(ra), rb); \ | 996 | cond = opn(s2v(ra), rb); \ |
| 997 | else \ | 997 | else \ |
| 998 | Protect(cond = other(L, s2v(ra), rb)); \ | 998 | Protect(cond = other(L, s2v(ra), rb)); \ |
| 999 | docondjump(); } | 999 | docondjump(); } |
| @@ -1323,8 +1323,9 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1323 | Table *t; | 1323 | Table *t; |
| 1324 | if (b > 0) | 1324 | if (b > 0) |
| 1325 | b = 1 << (b - 1); /* size is 2^(b - 1) */ | 1325 | b = 1 << (b - 1); /* size is 2^(b - 1) */ |
| 1326 | if (TESTARG_k(i)) | 1326 | lua_assert((!TESTARG_k(i)) == (GETARG_Ax(*pc) == 0)); |
| 1327 | c += GETARG_Ax(*pc) * (MAXARG_C + 1); | 1327 | if (TESTARG_k(i)) /* non-zero extra argument? */ |
| 1328 | c += GETARG_Ax(*pc) * (MAXARG_C + 1); /* add it to size */ | ||
| 1328 | pc++; /* skip extra argument */ | 1329 | pc++; /* skip extra argument */ |
| 1329 | L->top = ra + 1; /* correct top in case of emergency GC */ | 1330 | L->top = ra + 1; /* correct top in case of emergency GC */ |
| 1330 | t = luaH_new(L); /* memory allocation */ | 1331 | t = luaH_new(L); /* memory allocation */ |
| @@ -1558,7 +1559,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1558 | vmcase(OP_EQK) { | 1559 | vmcase(OP_EQK) { |
| 1559 | TValue *rb = KB(i); | 1560 | TValue *rb = KB(i); |
| 1560 | /* basic types do not use '__eq'; we can use raw equality */ | 1561 | /* basic types do not use '__eq'; we can use raw equality */ |
| 1561 | int cond = luaV_equalobj(NULL, s2v(ra), rb); | 1562 | int cond = luaV_rawequalobj(s2v(ra), rb); |
| 1562 | docondjump(); | 1563 | docondjump(); |
| 1563 | vmbreak; | 1564 | vmbreak; |
| 1564 | } | 1565 | } |
