summaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-21 13:16:04 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-21 13:16:04 -0200
commitddc144e4d297e5e008f5693a568a1c74ac3e4f54 (patch)
tree273211ca4e0add6f5aa9e28b494e94d3267fbcc3 /lvm.c
parentb48c6e768035a44ced1af0affa4b8c0970f1bdfd (diff)
downloadlua-ddc144e4d297e5e008f5693a568a1c74ac3e4f54.tar.gz
lua-ddc144e4d297e5e008f5693a568a1c74ac3e4f54.tar.bz2
lua-ddc144e4d297e5e008f5693a568a1c74ac3e4f54.zip
keep L->ci->base in L->base for faster access
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lvm.c b/lvm.c
index b93f6502..a9f297c5 100644
--- a/lvm.c
+++ b/lvm.c
@@ -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
284void luaV_concat (lua_State *L, int total, int last) { 284void 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 }