believe it or not, this makes a difference...

This commit is contained in:
Roberto Ierusalimschy
1997-06-26 18:40:57 -03:00
parent 3a98c8670d
commit 56fdab67d8

View File

@@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio ** TecCGraf - PUC-Rio
*/ */
char *rcs_opcode="$Id: opcode.c,v 4.13 1997/06/19 18:03:04 roberto Exp roberto $"; char *rcs_opcode="$Id: opcode.c,v 4.14 1997/06/23 18:27:53 roberto Exp roberto $";
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
@@ -178,18 +178,19 @@ static int lua_tostring (TObject *obj)
/* /*
** Adjust stack. Set top to the given value, pushing NILs if needed. ** Adjust stack. Set top to the given value, pushing NILs if needed.
*/ */
static void adjust_top (StkId newtop) static void adjust_top_aux (StkId newtop)
{ {
if (newtop <= top-stack) /* int arith, since newtop may be out of stack */ TObject *nt;
top = stack+newtop; lua_checkstack(stack+newtop);
else { nt = stack+newtop; /* warning: previous call may change stack */
TObject *nt; while (top < nt) ttype(top++) = LUA_T_NIL;
lua_checkstack(stack+newtop);
nt = stack+newtop; /* warning: previous call may change stack */
while (top < nt) ttype(top++) = LUA_T_NIL;
}
} }
#define adjust_top(newtop) { if (newtop <= top-stack) \
top = stack+newtop; \
else adjust_top_aux(newtop); }
#define adjustC(nParams) adjust_top(CLS_current.base+nParams) #define adjustC(nParams) adjust_top(CLS_current.base+nParams)
@@ -1239,9 +1240,11 @@ static StkId lua_execute (Byte *pc, StkId base)
adjust_top(base); adjust_top(base);
break; break;
case ADJUST: case ADJUST: {
adjust_top(base + *(pc++)); StkId newtop = base + *(pc++);
adjust_top(newtop);
break; break;
}
case VARARGS: case VARARGS:
adjust_varargs(base + *(pc++)); adjust_varargs(base + *(pc++));