aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lcode.c b/lcode.c
index 30a25a65..8fb0f70c 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 1.57 2001/01/19 13:20:30 roberto Exp roberto $ 2** $Id: lcode.c,v 1.58 2001/01/29 13:14:49 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -59,6 +59,17 @@ static void luaK_fixjump (FuncState *fs, int pc, int dest) {
59} 59}
60 60
61 61
62/*
63** prep-for instructions (OP_FORPREP & OP_LFORPREP) have a negated jump,
64** as they simulate the real jump...
65*/
66void luaK_fixfor (FuncState *fs, int pc, int dest) {
67 Instruction *jmp = &fs->f->code[pc];
68 int offset = dest-(pc+1);
69 SETARG_S(*jmp, -offset);
70}
71
72
62static int luaK_getjump (FuncState *fs, int pc) { 73static int luaK_getjump (FuncState *fs, int pc) {
63 int offset = GETARG_S(fs->f->code[pc]); 74 int offset = GETARG_S(fs->f->code[pc]);
64 if (offset == NO_JUMP) /* point to itself represents end of list */ 75 if (offset == NO_JUMP) /* point to itself represents end of list */