simpler implementation for `for' loops

This commit is contained in:
Roberto Ierusalimschy
2002-02-05 20:39:12 -02:00
parent addbe8c8b0
commit 38b0e6128d
7 changed files with 57 additions and 95 deletions

11
lcode.c
View File

@@ -76,17 +76,6 @@ static void luaK_fixjump (FuncState *fs, int pc, int dest) {
}
/*
** prep-for instructions (OP_FORPREP & OP_TFORPREP) have a negated jump,
** as they simulate the real jump...
*/
void luaK_fixfor (FuncState *fs, int pc, int dest) {
Instruction *jmp = &fs->f->code[pc];
int offset = dest-(pc+1);
SETARG_sBc(*jmp, -offset);
}
/*
** returns current `pc' and marks it as a jump target (to avoid wrong
** optimizations with consecutive instructions not in the same basic block).