diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-03-27 11:11:38 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-03-27 11:11:38 -0300 |
commit | 5f4f0d4a6371e950a9606ab16780a8933017e54b (patch) | |
tree | 669ea1f3c97950391f8a7d52d5015ea43e3b98c8 | |
parent | 8e36e1fe4928c60a09573a850e6807d922a56664 (diff) | |
download | lua-5f4f0d4a6371e950a9606ab16780a8933017e54b.tar.gz lua-5f4f0d4a6371e950a9606ab16780a8933017e54b.tar.bz2 lua-5f4f0d4a6371e950a9606ab16780a8933017e54b.zip |
no more optimization to avoid LOADNIL at function start
-rw-r--r-- | lcode.c | 4 | ||||
-rw-r--r-- | ldo.c | 7 | ||||
-rw-r--r-- | lparser.c | 4 |
3 files changed, 5 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.31 2006/10/10 17:39:00 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.32 2007/03/09 18:50:56 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 | */ |
@@ -35,8 +35,6 @@ static int isnumeral(expdesc *e) { | |||
35 | void luaK_nil (FuncState *fs, int from, int n) { | 35 | void luaK_nil (FuncState *fs, int from, int n) { |
36 | Instruction *previous; | 36 | Instruction *previous; |
37 | if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ | 37 | if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ |
38 | if (fs->pc == 0) /* function start? */ | ||
39 | return; /* positions are already clean */ | ||
40 | previous = &fs->f->code[fs->pc-1]; | 38 | previous = &fs->f->code[fs->pc-1]; |
41 | if (GET_OPCODE(*previous) == OP_LOADNIL) { | 39 | if (GET_OPCODE(*previous) == OP_LOADNIL) { |
42 | int pfrom = GETARG_A(*previous); | 40 | int pfrom = GETARG_A(*previous); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.43 2006/09/19 13:57:50 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.44 2006/10/10 17:40:17 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -278,11 +278,8 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { | |||
278 | Proto *p = cl->p; | 278 | Proto *p = cl->p; |
279 | luaD_checkstack(L, p->maxstacksize); | 279 | luaD_checkstack(L, p->maxstacksize); |
280 | func = restorestack(L, funcr); | 280 | func = restorestack(L, funcr); |
281 | if (!p->is_vararg) { /* no varargs? */ | 281 | if (!p->is_vararg) /* no varargs? */ |
282 | base = func + 1; | 282 | base = func + 1; |
283 | if (L->top > base + p->numparams) | ||
284 | L->top = base + p->numparams; | ||
285 | } | ||
286 | else { /* vararg function */ | 283 | else { /* vararg function */ |
287 | int nargs = cast_int(L->top - func) - 1; | 284 | int nargs = cast_int(L->top - func) - 1; |
288 | base = adjust_varargs(L, p, nargs); | 285 | base = adjust_varargs(L, p, nargs); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.50 2006/11/22 11:02:03 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.51 2007/02/07 17:49:18 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -336,7 +336,7 @@ static void open_func (LexState *ls, FuncState *fs) { | |||
336 | fs->L = L; | 336 | fs->L = L; |
337 | ls->fs = fs; | 337 | ls->fs = fs; |
338 | fs->pc = 0; | 338 | fs->pc = 0; |
339 | fs->lasttarget = -1; | 339 | fs->lasttarget = 0; |
340 | fs->jpc = NO_JUMP; | 340 | fs->jpc = NO_JUMP; |
341 | fs->freereg = 0; | 341 | fs->freereg = 0; |
342 | fs->nk = 0; | 342 | fs->nk = 0; |