diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-21 13:16:04 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-21 13:16:04 -0200 |
| commit | ddc144e4d297e5e008f5693a568a1c74ac3e4f54 (patch) | |
| tree | 273211ca4e0add6f5aa9e28b494e94d3267fbcc3 | |
| parent | b48c6e768035a44ced1af0affa4b8c0970f1bdfd (diff) | |
| download | lua-ddc144e4d297e5e008f5693a568a1c74ac3e4f54.tar.gz lua-ddc144e4d297e5e008f5693a568a1c74ac3e4f54.tar.bz2 lua-ddc144e4d297e5e008f5693a568a1c74ac3e4f54.zip | |
keep L->ci->base in L->base for faster access
| -rw-r--r-- | lapi.c | 34 | ||||
| -rw-r--r-- | ldebug.c | 4 | ||||
| -rw-r--r-- | ldo.c | 28 | ||||
| -rw-r--r-- | lobject.c | 4 | ||||
| -rw-r--r-- | lstate.c | 4 | ||||
| -rw-r--r-- | lstate.h | 3 | ||||
| -rw-r--r-- | lvm.c | 12 |
7 files changed, 48 insertions, 41 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.220 2002/11/14 16:15:53 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.221 2002/11/21 14:16:52 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -36,7 +36,7 @@ const char lua_ident[] = | |||
| 36 | #define api_check(L, o) /*{ assert(o); }*/ | 36 | #define api_check(L, o) /*{ assert(o); }*/ |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| 39 | #define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->ci->base)) | 39 | #define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) |
| 40 | 40 | ||
| 41 | #define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} | 41 | #define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} |
| 42 | 42 | ||
| @@ -45,14 +45,14 @@ const char lua_ident[] = | |||
| 45 | 45 | ||
| 46 | static TObject *negindex (lua_State *L, int index) { | 46 | static TObject *negindex (lua_State *L, int index) { |
| 47 | if (index > LUA_REGISTRYINDEX) { | 47 | if (index > LUA_REGISTRYINDEX) { |
| 48 | api_check(L, index != 0 && -index <= L->top - L->ci->base); | 48 | api_check(L, index != 0 && -index <= L->top - L->base); |
| 49 | return L->top+index; | 49 | return L->top+index; |
| 50 | } | 50 | } |
| 51 | else switch (index) { /* pseudo-indices */ | 51 | else switch (index) { /* pseudo-indices */ |
| 52 | case LUA_REGISTRYINDEX: return registry(L); | 52 | case LUA_REGISTRYINDEX: return registry(L); |
| 53 | case LUA_GLOBALSINDEX: return gt(L); | 53 | case LUA_GLOBALSINDEX: return gt(L); |
| 54 | default: { | 54 | default: { |
| 55 | TObject *func = (L->ci->base - 1); | 55 | TObject *func = (L->base - 1); |
| 56 | index = LUA_GLOBALSINDEX - index; | 56 | index = LUA_GLOBALSINDEX - index; |
| 57 | api_check(L, iscfunction(func) && index <= clvalue(func)->c.nupvalues); | 57 | api_check(L, iscfunction(func) && index <= clvalue(func)->c.nupvalues); |
| 58 | return &clvalue(func)->c.upvalue[index-1]; | 58 | return &clvalue(func)->c.upvalue[index-1]; |
| @@ -63,8 +63,8 @@ static TObject *negindex (lua_State *L, int index) { | |||
| 63 | 63 | ||
| 64 | static TObject *luaA_index (lua_State *L, int index) { | 64 | static TObject *luaA_index (lua_State *L, int index) { |
| 65 | if (index > 0) { | 65 | if (index > 0) { |
| 66 | api_check(L, index <= L->top - L->ci->base); | 66 | api_check(L, index <= L->top - L->base); |
| 67 | return L->ci->base + index - 1; | 67 | return L->base + index - 1; |
| 68 | } | 68 | } |
| 69 | else | 69 | else |
| 70 | return negindex(L, index); | 70 | return negindex(L, index); |
| @@ -73,8 +73,8 @@ static TObject *luaA_index (lua_State *L, int index) { | |||
| 73 | 73 | ||
| 74 | static TObject *luaA_indexAcceptable (lua_State *L, int index) { | 74 | static TObject *luaA_indexAcceptable (lua_State *L, int index) { |
| 75 | if (index > 0) { | 75 | if (index > 0) { |
| 76 | TObject *o = L->ci->base+(index-1); | 76 | TObject *o = L->base+(index-1); |
| 77 | api_check(L, index <= L->stack_last - L->ci->base); | 77 | api_check(L, index <= L->stack_last - L->base); |
| 78 | if (o >= L->top) return NULL; | 78 | if (o >= L->top) return NULL; |
| 79 | else return o; | 79 | else return o; |
| 80 | } | 80 | } |
| @@ -92,7 +92,7 @@ void luaA_pushobject (lua_State *L, const TObject *o) { | |||
| 92 | LUA_API int lua_checkstack (lua_State *L, int size) { | 92 | LUA_API int lua_checkstack (lua_State *L, int size) { |
| 93 | int res; | 93 | int res; |
| 94 | lua_lock(L); | 94 | lua_lock(L); |
| 95 | if ((L->top - L->ci->base + size) > LUA_MAXCSTACK) | 95 | if ((L->top - L->base + size) > LUA_MAXCSTACK) |
| 96 | res = 0; /* stack overflow */ | 96 | res = 0; /* stack overflow */ |
| 97 | else { | 97 | else { |
| 98 | luaD_checkstack(L, size); | 98 | luaD_checkstack(L, size); |
| @@ -148,20 +148,20 @@ LUA_API lua_State *lua_newthread (lua_State *L) { | |||
| 148 | 148 | ||
| 149 | 149 | ||
| 150 | LUA_API int lua_gettop (lua_State *L) { | 150 | LUA_API int lua_gettop (lua_State *L) { |
| 151 | return (L->top - L->ci->base); | 151 | return (L->top - L->base); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | 154 | ||
| 155 | LUA_API void lua_settop (lua_State *L, int index) { | 155 | LUA_API void lua_settop (lua_State *L, int index) { |
| 156 | lua_lock(L); | 156 | lua_lock(L); |
| 157 | if (index >= 0) { | 157 | if (index >= 0) { |
| 158 | api_check(L, index <= L->stack_last - L->ci->base); | 158 | api_check(L, index <= L->stack_last - L->base); |
| 159 | while (L->top < L->ci->base + index) | 159 | while (L->top < L->base + index) |
| 160 | setnilvalue(L->top++); | 160 | setnilvalue(L->top++); |
| 161 | L->top = L->ci->base + index; | 161 | L->top = L->base + index; |
| 162 | } | 162 | } |
| 163 | else { | 163 | else { |
| 164 | api_check(L, -(index+1) <= (L->top - L->ci->base)); | 164 | api_check(L, -(index+1) <= (L->top - L->base)); |
| 165 | L->top += index+1; /* `subtract' index (index is negative) */ | 165 | L->top += index+1; /* `subtract' index (index is negative) */ |
| 166 | } | 166 | } |
| 167 | lua_unlock(L); | 167 | lua_unlock(L); |
| @@ -763,7 +763,7 @@ LUA_API void lua_concat (lua_State *L, int n) { | |||
| 763 | luaC_checkGC(L); | 763 | luaC_checkGC(L); |
| 764 | api_checknelems(L, n); | 764 | api_checknelems(L, n); |
| 765 | if (n >= 2) { | 765 | if (n >= 2) { |
| 766 | luaV_concat(L, n, L->top - L->ci->base - 1); | 766 | luaV_concat(L, n, L->top - L->base - 1); |
| 767 | L->top -= (n-1); | 767 | L->top -= (n-1); |
| 768 | } | 768 | } |
| 769 | else if (n == 0) { /* push empty string */ | 769 | else if (n == 0) { /* push empty string */ |
| @@ -791,8 +791,8 @@ LUA_API int lua_pushupvalues (lua_State *L) { | |||
| 791 | Closure *func; | 791 | Closure *func; |
| 792 | int n, i; | 792 | int n, i; |
| 793 | lua_lock(L); | 793 | lua_lock(L); |
| 794 | api_check(L, iscfunction(L->ci->base - 1)); | 794 | api_check(L, iscfunction(L->base - 1)); |
| 795 | func = clvalue(L->ci->base - 1); | 795 | func = clvalue(L->base - 1); |
| 796 | n = func->c.nupvalues; | 796 | n = func->c.nupvalues; |
| 797 | luaD_checkstack(L, n + LUA_MINSTACK); | 797 | luaD_checkstack(L, n + LUA_MINSTACK); |
| 798 | for (i=0; i<n; i++) { | 798 | for (i=0; i<n; i++) { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.136 2002/11/07 15:37:10 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.137 2002/11/18 11:01:55 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -497,7 +497,7 @@ void luaG_typeerror (lua_State *L, const TObject *o, const char *op) { | |||
| 497 | const char *name = NULL; | 497 | const char *name = NULL; |
| 498 | const char *t = luaT_typenames[ttype(o)]; | 498 | const char *t = luaT_typenames[ttype(o)]; |
| 499 | const char *kind = (isinstack(L->ci, o)) ? | 499 | const char *kind = (isinstack(L->ci, o)) ? |
| 500 | getobjname(L->ci, o - L->ci->base, &name) : NULL; | 500 | getobjname(L->ci, o - L->base, &name) : NULL; |
| 501 | if (kind) | 501 | if (kind) |
| 502 | luaG_runerror(L, "attempt to %s %s `%s' (a %s value)", | 502 | luaG_runerror(L, "attempt to %s %s `%s' (a %s value)", |
| 503 | op, kind, name, t); | 503 | op, kind, name, t); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 1.203 2002/11/18 15:24:11 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.204 2002/11/18 18:45:38 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 | */ |
| @@ -115,6 +115,7 @@ static void correctstack (lua_State *L, TObject *oldstack) { | |||
| 115 | } | 115 | } |
| 116 | ci->base = newbase; | 116 | ci->base = newbase; |
| 117 | } | 117 | } |
| 118 | L->base = L->ci->base; | ||
| 118 | } | 119 | } |
| 119 | 120 | ||
| 120 | 121 | ||
| @@ -230,8 +231,8 @@ StkId luaD_precall (lua_State *L, StkId func) { | |||
| 230 | adjust_varargs(L, p->numparams, func+1); | 231 | adjust_varargs(L, p->numparams, func+1); |
| 231 | luaD_checkstack(L, p->maxstacksize); | 232 | luaD_checkstack(L, p->maxstacksize); |
| 232 | ci = ++L->ci; /* now `enter' new function */ | 233 | ci = ++L->ci; /* now `enter' new function */ |
| 233 | ci->base = restorestack(L, funcr) + 1; | 234 | L->base = L->ci->base = restorestack(L, funcr) + 1; |
| 234 | ci->top = ci->base + p->maxstacksize; | 235 | ci->top = L->base + p->maxstacksize; |
| 235 | ci->u.l.savedpc = p->code; /* starting point */ | 236 | ci->u.l.savedpc = p->code; /* starting point */ |
| 236 | ci->state = CI_SAVEDPC; | 237 | ci->state = CI_SAVEDPC; |
| 237 | while (L->top < ci->top) | 238 | while (L->top < ci->top) |
| @@ -244,7 +245,7 @@ StkId luaD_precall (lua_State *L, StkId func) { | |||
| 244 | int n; | 245 | int n; |
| 245 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ | 246 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ |
| 246 | ci = ++L->ci; /* now `enter' new function */ | 247 | ci = ++L->ci; /* now `enter' new function */ |
| 247 | ci->base = restorestack(L, funcr) + 1; | 248 | L->base = L->ci->base = restorestack(L, funcr) + 1; |
| 248 | ci->top = L->top + LUA_MINSTACK; | 249 | ci->top = L->top + LUA_MINSTACK; |
| 249 | ci->state = CI_C; /* a C function */ | 250 | ci->state = CI_C; /* a C function */ |
| 250 | if (L->hookmask & LUA_MASKCALL) { | 251 | if (L->hookmask & LUA_MASKCALL) { |
| @@ -255,7 +256,7 @@ StkId luaD_precall (lua_State *L, StkId func) { | |||
| 255 | #ifdef LUA_COMPATUPVALUES | 256 | #ifdef LUA_COMPATUPVALUES |
| 256 | lua_pushupvalues(L); | 257 | lua_pushupvalues(L); |
| 257 | #endif | 258 | #endif |
| 258 | n = (*clvalue(ci->base-1)->c.f)(L); /* do the actual call */ | 259 | n = (*clvalue(L->base - 1)->c.f)(L); /* do the actual call */ |
| 259 | lua_lock(L); | 260 | lua_lock(L); |
| 260 | return L->top - n; | 261 | return L->top - n; |
| 261 | } | 262 | } |
| @@ -269,8 +270,9 @@ void luaD_poscall (lua_State *L, int wanted, StkId firstResult) { | |||
| 269 | luaD_callhook(L, LUA_HOOKRET, -1); | 270 | luaD_callhook(L, LUA_HOOKRET, -1); |
| 270 | firstResult = restorestack(L, fr); | 271 | firstResult = restorestack(L, fr); |
| 271 | } | 272 | } |
| 272 | res = L->ci->base - 1; /* res == final position of 1st result */ | 273 | res = L->base - 1; /* res == final position of 1st result */ |
| 273 | L->ci--; | 274 | L->ci--; |
| 275 | L->base = L->ci->base; /* restore base */ | ||
| 274 | /* move results to correct place */ | 276 | /* move results to correct place */ |
| 275 | while (wanted != 0 && firstResult < L->top) { | 277 | while (wanted != 0 && firstResult < L->top) { |
| 276 | setobjs2s(res++, firstResult++); | 278 | setobjs2s(res++, firstResult++); |
| @@ -307,7 +309,7 @@ static void resume (lua_State *L, void *ud) { | |||
| 307 | int nargs = *cast(int *, ud); | 309 | int nargs = *cast(int *, ud); |
| 308 | CallInfo *ci = L->ci; | 310 | CallInfo *ci = L->ci; |
| 309 | if (ci == L->base_ci) { /* no activation record? */ | 311 | if (ci == L->base_ci) { /* no activation record? */ |
| 310 | if (nargs >= L->top - L->ci->base) | 312 | if (nargs >= L->top - L->base) |
| 311 | luaG_runerror(L, "cannot resume dead coroutine"); | 313 | luaG_runerror(L, "cannot resume dead coroutine"); |
| 312 | luaD_precall(L, L->top - (nargs + 1)); /* start coroutine */ | 314 | luaD_precall(L, L->top - (nargs + 1)); /* start coroutine */ |
| 313 | } | 315 | } |
| @@ -343,8 +345,9 @@ LUA_API int lua_resume (lua_State *L, int nargs) { | |||
| 343 | status = luaD_rawrunprotected(L, resume, &nargs); | 345 | status = luaD_rawrunprotected(L, resume, &nargs); |
| 344 | if (status != 0) { /* error? */ | 346 | if (status != 0) { /* error? */ |
| 345 | L->ci = L->base_ci; /* go back to initial level */ | 347 | L->ci = L->base_ci; /* go back to initial level */ |
| 346 | luaF_close(L, L->ci->base); /* close eventual pending closures */ | 348 | L->base = L->ci->base; |
| 347 | seterrorobj(L, status, L->ci->base); | 349 | luaF_close(L, L->base); /* close eventual pending closures */ |
| 350 | seterrorobj(L, status, L->base); | ||
| 348 | L->allowhook = old_allowhooks; | 351 | L->allowhook = old_allowhooks; |
| 349 | restore_stack_limit(L); | 352 | restore_stack_limit(L); |
| 350 | } | 353 | } |
| @@ -360,11 +363,11 @@ LUA_API int lua_yield (lua_State *L, int nresults) { | |||
| 360 | if (ci->state & CI_C) { /* usual yield */ | 363 | if (ci->state & CI_C) { /* usual yield */ |
| 361 | if ((ci-1)->state & CI_C) | 364 | if ((ci-1)->state & CI_C) |
| 362 | luaG_runerror(L, "cannot yield a C function"); | 365 | luaG_runerror(L, "cannot yield a C function"); |
| 363 | if (L->top - nresults > ci->base) { /* is there garbage in the stack? */ | 366 | if (L->top - nresults > L->base) { /* is there garbage in the stack? */ |
| 364 | int i; | 367 | int i; |
| 365 | for (i=0; i<nresults; i++) /* move down results */ | 368 | for (i=0; i<nresults; i++) /* move down results */ |
| 366 | setobjs2s(ci->base + i, L->top - nresults + i); | 369 | setobjs2s(L->base + i, L->top - nresults + i); |
| 367 | L->top = ci->base + nresults; | 370 | L->top = L->base + nresults; |
| 368 | } | 371 | } |
| 369 | } | 372 | } |
| 370 | /* else it's an yield inside a hook: nothing to do */ | 373 | /* else it's an yield inside a hook: nothing to do */ |
| @@ -405,6 +408,7 @@ int luaD_pcall (lua_State *L, int nargs, int nresults, ptrdiff_t errfunc) { | |||
| 405 | luaF_close(L, oldtop); /* close eventual pending closures */ | 408 | luaF_close(L, oldtop); /* close eventual pending closures */ |
| 406 | seterrorobj(L, status, oldtop); | 409 | seterrorobj(L, status, oldtop); |
| 407 | L->ci = restoreci(L, old_ci); | 410 | L->ci = restoreci(L, old_ci); |
| 411 | L->base = L->ci->base; | ||
| 408 | L->allowhook = old_allowhooks; | 412 | L->allowhook = old_allowhooks; |
| 409 | restore_stack_limit(L); | 413 | restore_stack_limit(L); |
| 410 | } | 414 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 1.91 2002/10/22 17:18:28 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.92 2002/11/07 15:37:10 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -128,7 +128,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
| 128 | fmt = e+2; | 128 | fmt = e+2; |
| 129 | } | 129 | } |
| 130 | pushstr(L, fmt); | 130 | pushstr(L, fmt); |
| 131 | luaV_concat(L, n+1, L->top - L->ci->base - 1); | 131 | luaV_concat(L, n+1, L->top - L->base - 1); |
| 132 | L->top -= n; | 132 | L->top -= n; |
| 133 | return svalue(L->top - 1); | 133 | return svalue(L->top - 1); |
| 134 | } | 134 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 1.113 2002/11/19 14:12:13 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.114 2002/11/21 14:14:42 roberto Exp roberto $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -66,7 +66,7 @@ static void stack_init (lua_State *L1, lua_State *L) { | |||
| 66 | L1->ci = L1->base_ci; | 66 | L1->ci = L1->base_ci; |
| 67 | L1->ci->state = CI_C; /* not a Lua function */ | 67 | L1->ci->state = CI_C; /* not a Lua function */ |
| 68 | setnilvalue(L1->top++); /* `function' entry for this `ci' */ | 68 | setnilvalue(L1->top++); /* `function' entry for this `ci' */ |
| 69 | L1->ci->base = L1->top; | 69 | L1->base = L1->ci->base = L1->top; |
| 70 | L1->ci->top = L1->top + LUA_MINSTACK; | 70 | L1->ci->top = L1->top + LUA_MINSTACK; |
| 71 | L1->size_ci = BASIC_CI_SIZE; | 71 | L1->size_ci = BASIC_CI_SIZE; |
| 72 | L1->end_ci = L1->base_ci + L1->size_ci; | 72 | L1->end_ci = L1->base_ci + L1->size_ci; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.h,v 1.102 2002/11/18 11:01:55 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.103 2002/11/18 15:23:43 roberto Exp roberto $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -131,6 +131,7 @@ typedef struct global_State { | |||
| 131 | struct lua_State { | 131 | struct lua_State { |
| 132 | CommonHeader; | 132 | CommonHeader; |
| 133 | StkId top; /* first free slot in the stack */ | 133 | StkId top; /* first free slot in the stack */ |
| 134 | StkId base; /* base of current function */ | ||
| 134 | global_State *l_G; | 135 | global_State *l_G; |
| 135 | CallInfo *ci; /* call info for current function */ | 136 | CallInfo *ci; /* call info for current function */ |
| 136 | StkId stack_last; /* last free slot in the stack */ | 137 | StkId stack_last; /* last free slot in the stack */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.264 2002/11/19 08:50:56 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.265 2002/11/21 14:18:01 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -283,7 +283,7 @@ int luaV_equalval (lua_State *L, const TObject *t1, const TObject *t2) { | |||
| 283 | 283 | ||
| 284 | void luaV_concat (lua_State *L, int total, int last) { | 284 | void luaV_concat (lua_State *L, int total, int last) { |
| 285 | do { | 285 | do { |
| 286 | StkId top = L->ci->base + last + 1; | 286 | StkId top = L->base + last + 1; |
| 287 | int n = 2; /* number of elements handled in this pass (at least 2) */ | 287 | int n = 2; /* number of elements handled in this pass (at least 2) */ |
| 288 | if (!tostring(L, top-2) || !tostring(L, top-1)) { | 288 | if (!tostring(L, top-2) || !tostring(L, top-1)) { |
| 289 | if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) | 289 | if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) |
| @@ -377,7 +377,7 @@ StkId luaV_execute (lua_State *L) { | |||
| 377 | L->ci->state == (CI_SAVEDPC | CI_CALLING)); | 377 | L->ci->state == (CI_SAVEDPC | CI_CALLING)); |
| 378 | L->ci->state = CI_HASFRAME; /* activate frame */ | 378 | L->ci->state = CI_HASFRAME; /* activate frame */ |
| 379 | pc = L->ci->u.l.savedpc; | 379 | pc = L->ci->u.l.savedpc; |
| 380 | base = L->ci->base; | 380 | base = L->base; |
| 381 | cl = &clvalue(base - 1)->l; | 381 | cl = &clvalue(base - 1)->l; |
| 382 | k = cl->p->k; | 382 | k = cl->p->k; |
| 383 | /* main loop of interpreter */ | 383 | /* main loop of interpreter */ |
| @@ -394,9 +394,10 @@ StkId luaV_execute (lua_State *L) { | |||
| 394 | } | 394 | } |
| 395 | } | 395 | } |
| 396 | /* warning!! several calls may realloc the stack and invalidate `ra' */ | 396 | /* warning!! several calls may realloc the stack and invalidate `ra' */ |
| 397 | lua_assert((L->ci->state & CI_HASFRAME) && base == L->ci->base); | ||
| 398 | ra = RA(i); | 397 | ra = RA(i); |
| 399 | lua_assert(L->top <= L->stack + L->stacksize && L->top >= L->ci->base); | 398 | lua_assert(L->ci->state & CI_HASFRAME); |
| 399 | lua_assert(base == L->base && base == L->ci->base); | ||
| 400 | lua_assert(L->top <= L->stack + L->stacksize && L->top >= base); | ||
| 400 | lua_assert(L->top == L->ci->top || | 401 | lua_assert(L->top == L->ci->top || |
| 401 | GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || | 402 | GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || |
| 402 | GET_OPCODE(i) == OP_RETURN || GET_OPCODE(i) == OP_SETLISTO); | 403 | GET_OPCODE(i) == OP_RETURN || GET_OPCODE(i) == OP_SETLISTO); |
| @@ -618,6 +619,7 @@ StkId luaV_execute (lua_State *L) { | |||
| 618 | (L->ci - 1)->u.l.savedpc = L->ci->u.l.savedpc; | 619 | (L->ci - 1)->u.l.savedpc = L->ci->u.l.savedpc; |
| 619 | (L->ci - 1)->state = CI_SAVEDPC; | 620 | (L->ci - 1)->state = CI_SAVEDPC; |
| 620 | L->ci--; /* remove new frame */ | 621 | L->ci--; /* remove new frame */ |
| 622 | L->base = L->ci->base; | ||
| 621 | } | 623 | } |
| 622 | goto callentry; | 624 | goto callentry; |
| 623 | } | 625 | } |
