diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-26 18:40:57 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-26 18:40:57 -0300 |
| commit | 56fdab67d8f419b76ba5fc4237e10c7b31afc8c6 (patch) | |
| tree | 912de17e3ea8eab2b33379adc894a24d6a5bebfb | |
| parent | 3a98c8670dcc5e29679d8e489ab04a101d1f57f8 (diff) | |
| download | lua-56fdab67d8f419b76ba5fc4237e10c7b31afc8c6.tar.gz lua-56fdab67d8f419b76ba5fc4237e10c7b31afc8c6.tar.bz2 lua-56fdab67d8f419b76ba5fc4237e10c7b31afc8c6.zip | |
believe it or not, this makes a difference...
| -rw-r--r-- | opcode.c | 27 |
1 files changed, 15 insertions, 12 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_opcode="$Id: opcode.c,v 4.13 1997/06/19 18:03:04 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 4.14 1997/06/23 18:27:53 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| @@ -178,18 +178,19 @@ static int lua_tostring (TObject *obj) | |||
| 178 | /* | 178 | /* |
| 179 | ** Adjust stack. Set top to the given value, pushing NILs if needed. | 179 | ** Adjust stack. Set top to the given value, pushing NILs if needed. |
| 180 | */ | 180 | */ |
| 181 | static void adjust_top (StkId newtop) | 181 | static void adjust_top_aux (StkId newtop) |
| 182 | { | 182 | { |
| 183 | if (newtop <= top-stack) /* int arith, since newtop may be out of stack */ | 183 | TObject *nt; |
| 184 | top = stack+newtop; | 184 | lua_checkstack(stack+newtop); |
| 185 | else { | 185 | nt = stack+newtop; /* warning: previous call may change stack */ |
| 186 | TObject *nt; | 186 | while (top < nt) ttype(top++) = LUA_T_NIL; |
| 187 | lua_checkstack(stack+newtop); | ||
| 188 | nt = stack+newtop; /* warning: previous call may change stack */ | ||
| 189 | while (top < nt) ttype(top++) = LUA_T_NIL; | ||
| 190 | } | ||
| 191 | } | 187 | } |
| 192 | 188 | ||
| 189 | |||
| 190 | #define adjust_top(newtop) { if (newtop <= top-stack) \ | ||
| 191 | top = stack+newtop; \ | ||
| 192 | else adjust_top_aux(newtop); } | ||
| 193 | |||
| 193 | #define adjustC(nParams) adjust_top(CLS_current.base+nParams) | 194 | #define adjustC(nParams) adjust_top(CLS_current.base+nParams) |
| 194 | 195 | ||
| 195 | 196 | ||
| @@ -1239,9 +1240,11 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
| 1239 | adjust_top(base); | 1240 | adjust_top(base); |
| 1240 | break; | 1241 | break; |
| 1241 | 1242 | ||
| 1242 | case ADJUST: | 1243 | case ADJUST: { |
| 1243 | adjust_top(base + *(pc++)); | 1244 | StkId newtop = base + *(pc++); |
| 1245 | adjust_top(newtop); | ||
| 1244 | break; | 1246 | break; |
| 1247 | } | ||
| 1245 | 1248 | ||
| 1246 | case VARARGS: | 1249 | case VARARGS: |
| 1247 | adjust_varargs(base + *(pc++)); | 1250 | adjust_varargs(base + *(pc++)); |
