More uniformity in code generation for 'for' loops

Added new instruction 'OP_TFORPREP' to prepare a generic for loop.
Currently it is equivalent to a jump (but with a format 'iABx',
similar to other for-loop preparing instructions), but soon it will
be the place to create upvalues for closing loop states.
This commit is contained in:
Roberto Ierusalimschy
2018-10-26 10:38:50 -03:00
parent 34840301b5
commit 6e9b719694
6 changed files with 14 additions and 10 deletions

4
lvm.c
View File

@@ -1744,6 +1744,10 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
pc += GETARG_Bx(i);
vmbreak;
}
vmcase(OP_TFORPREP) {
pc += GETARG_Bx(i);
vmbreak;
}
vmcase(OP_TFORCALL) {
StkId cb = ra + 3; /* call base */
setobjs2s(L, cb+2, ra+2);