summaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-07-10 14:58:31 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-07-10 14:58:31 -0300
commitbe8445d7e4b6122620c428877b51a27d464253d5 (patch)
treee0160895d105e5a3c20ec65c3196bffa042bd93f /lvm.c
parent3d296304ef14ac9a6d1fa9357541ddd9bb54722f (diff)
downloadlua-github-be8445d7e4b6122620c428877b51a27d464253d5.tar.gz
Details
In the generic for loop, it is simpler for OP_TFORLOOP to use the same 'ra' as OP_TFORCALL. Moreover, the internal names of the loop temporaries "(for ...)" don't need to leak internal details (even because the numerical for loop doesn't have a fixed role for each of its temporaries).
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lvm.c b/lvm.c
index b05a887d..a52f186f 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1746,14 +1746,13 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
Protect(luaD_call(L, ra + 4, GETARG_C(i))); /* do the call */
updatestack(ci); /* stack may have changed */
i = *(pc++); /* go to next instruction */
- ra += 2; /* adjust for next instruction */
lua_assert(GET_OPCODE(i) == OP_TFORLOOP && ra == RA(i));
goto l_tforloop;
}
vmcase(OP_TFORLOOP) {
l_tforloop:
- if (!ttisnil(s2v(ra + 2))) { /* continue loop? */
- setobjs2s(L, ra, ra + 2); /* save control variable */
+ if (!ttisnil(s2v(ra + 4))) { /* continue loop? */
+ setobjs2s(L, ra + 2, ra + 4); /* save control variable */
pc -= GETARG_Bx(i); /* jump back */
}
vmbreak;