Browse Source

no more optimization to avoid LOADNIL at function start

Roberto Ierusalimschy 18 years ago
parent
commit
5f4f0d4a63
3 changed files with 5 additions and 10 deletions
  1. 1 3
      lcode.c
  2. 2 5
      ldo.c
  3. 2 2
      lparser.c

+ 1 - 3
lcode.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lcode.c,v 2.31 2006/10/10 17:39:00 roberto Exp roberto $
+** $Id: lcode.c,v 2.32 2007/03/09 18:50:56 roberto Exp roberto $
 ** Code generator for Lua
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -35,8 +35,6 @@ static int isnumeral(expdesc *e) {
 void luaK_nil (FuncState *fs, int from, int n) {
 void luaK_nil (FuncState *fs, int from, int n) {
   Instruction *previous;
   Instruction *previous;
   if (fs->pc > fs->lasttarget) {  /* no jumps to current position? */
   if (fs->pc > fs->lasttarget) {  /* no jumps to current position? */
-    if (fs->pc == 0)  /* function start? */
-      return;  /* positions are already clean */
     previous = &fs->f->code[fs->pc-1];
     previous = &fs->f->code[fs->pc-1];
     if (GET_OPCODE(*previous) == OP_LOADNIL) {
     if (GET_OPCODE(*previous) == OP_LOADNIL) {
       int pfrom = GETARG_A(*previous);
       int pfrom = GETARG_A(*previous);

+ 2 - 5
ldo.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ldo.c,v 2.43 2006/09/19 13:57:50 roberto Exp roberto $
+** $Id: ldo.c,v 2.44 2006/10/10 17:40:17 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -278,11 +278,8 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
     Proto *p = cl->p;
     Proto *p = cl->p;
     luaD_checkstack(L, p->maxstacksize);
     luaD_checkstack(L, p->maxstacksize);
     func = restorestack(L, funcr);
     func = restorestack(L, funcr);
-    if (!p->is_vararg) {  /* no varargs? */
+    if (!p->is_vararg)  /* no varargs? */
       base = func + 1;
       base = func + 1;
-      if (L->top > base + p->numparams)
-        L->top = base + p->numparams;
-    }
     else {  /* vararg function */
     else {  /* vararg function */
       int nargs = cast_int(L->top - func) - 1;
       int nargs = cast_int(L->top - func) - 1;
       base = adjust_varargs(L, p, nargs);
       base = adjust_varargs(L, p, nargs);

+ 2 - 2
lparser.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lparser.c,v 2.50 2006/11/22 11:02:03 roberto Exp roberto $
+** $Id: lparser.c,v 2.51 2007/02/07 17:49:18 roberto Exp roberto $
 ** Lua Parser
 ** Lua Parser
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -336,7 +336,7 @@ static void open_func (LexState *ls, FuncState *fs) {
   fs->L = L;
   fs->L = L;
   ls->fs = fs;
   ls->fs = fs;
   fs->pc = 0;
   fs->pc = 0;
-  fs->lasttarget = -1;
+  fs->lasttarget = 0;
   fs->jpc = NO_JUMP;
   fs->jpc = NO_JUMP;
   fs->freereg = 0;
   fs->freereg = 0;
   fs->nk = 0;
   fs->nk = 0;