aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/lcode.c b/lcode.c
index 6e43f499..50ed11e6 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 1.36 2000/06/16 17:51:40 roberto Exp roberto $ 2** $Id: lcode.c,v 1.37 2000/06/21 17:05: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*/
@@ -307,9 +307,8 @@ static void luaK_goiffalse (FuncState *fs, expdesc *v, int keepvalue) {
307 307
308 308
309static int code_label (FuncState *fs, OpCode op, int arg) { 309static int code_label (FuncState *fs, OpCode op, int arg) {
310 int j = luaK_getlabel(fs); 310 luaK_getlabel(fs); /* those instructions may be jump targets */
311 luaK_code1(fs, op, arg); 311 return luaK_code1(fs, op, arg);
312 return j;
313} 312}
314 313
315 314
@@ -624,9 +623,17 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) {
624 case iS: i = CREATE_S(o, arg1); break; 623 case iS: i = CREATE_S(o, arg1); break;
625 case iAB: i = CREATE_AB(o, arg1, arg2); break; 624 case iAB: i = CREATE_AB(o, arg1, arg2); break;
626 } 625 }
627 /* put new instruction in code array */ 626 /* check space for new instruction plus eventual SETLINE */
628 luaM_growvector(fs->L, fs->f->code, fs->pc, 1, Instruction, 627 luaM_growvector(fs->L, fs->f->code, fs->pc, 2, Instruction,
629 "code size overflow", MAX_INT); 628 "code size overflow", MAX_INT);
629 /* check the need for SETLINE */
630 if (fs->debug && fs->ls->lastline != fs->lastsetline) {
631 LexState *ls = fs->ls;
632 luaX_checklimit(ls, ls->lastline, MAXARG_U, "lines in a chunk");
633 fs->f->code[fs->pc++] = CREATE_U(OP_SETLINE, ls->lastline);
634 fs->lastsetline = ls->lastline;
635 }
636 /* put new instruction in code array */
630 fs->f->code[fs->pc] = i; 637 fs->f->code[fs->pc] = i;
631 return fs->pc++; 638 return fs->pc++;
632} 639}