aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lvm.c b/lvm.c
index 071b1d0f..3eeb2ff8 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.248 2002/07/17 16:25:13 roberto Exp $ 2** $Id: lvm.c,v 1.249 2002/08/05 17:36:24 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*/
@@ -385,10 +385,12 @@ StkId luaV_execute (lua_State *L) {
385 /* main loop of interpreter */ 385 /* main loop of interpreter */
386 for (;;) { 386 for (;;) {
387 const Instruction i = *pc++; 387 const Instruction i = *pc++;
388 const StkId ra = RA(i); 388 StkId ra;
389 if (L->hookmask >= LUA_MASKLINE && 389 if (L->hookmask >= LUA_MASKLINE &&
390 (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) 390 (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE))
391 traceexec(L); 391 traceexec(L);
392 /* warning!! several calls may realloc the stack and invalidate `ra' */
393 ra = RA(i);
392 lua_assert(L->top <= L->stack + L->stacksize && L->top >= L->ci->base); 394 lua_assert(L->top <= L->stack + L->stacksize && L->top >= L->ci->base);
393 lua_assert(L->top == L->ci->top || 395 lua_assert(L->top == L->ci->top ||
394 GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || 396 GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL ||
@@ -544,7 +546,7 @@ StkId luaV_execute (lua_State *L) {
544 int b = GETARG_B(i); 546 int b = GETARG_B(i);
545 int c = GETARG_C(i); 547 int c = GETARG_C(i);
546 luaV_concat(L, c-b+1, c); /* may change `base' (and `ra') */ 548 luaV_concat(L, c-b+1, c); /* may change `base' (and `ra') */
547 setobj(base+GETARG_A(i), base+b); 549 setobj(RA(i), base+b);
548 luaV_checkGC(L, base+c+1); 550 luaV_checkGC(L, base+c+1);
549 break; 551 break;
550 } 552 }
@@ -634,13 +636,13 @@ StkId luaV_execute (lua_State *L) {
634 return ra; /* no: return */ 636 return ra; /* no: return */
635 else { /* yes: continue its execution (go through) */ 637 else { /* yes: continue its execution (go through) */
636 int nresults; 638 int nresults;
637 lua_assert(ttisfunction(ci->base-1)); 639 lua_assert(ttisfunction(ci->base - 1));
638 ci->pc = &pc; /* function is active again */ 640 lua_assert(GET_OPCODE(*(ci->u.l.savedpc - 1)) == OP_CALL);
639 pc = ci->u.l.savedpc; 641 nresults = GETARG_C(*(ci->u.l.savedpc - 1)) - 1;
640 lua_assert(GET_OPCODE(*(pc-1)) == OP_CALL);
641 nresults = GETARG_C(*(pc-1)) - 1;
642 luaD_poscall(L, nresults, ra); 642 luaD_poscall(L, nresults, ra);
643 if (nresults >= 0) L->top = L->ci->top; 643 if (nresults >= 0) L->top = L->ci->top;
644 L->ci->pc = &pc; /* function is active again */
645 pc = L->ci->u.l.savedpc;
644 goto retentry; 646 goto retentry;
645 } 647 }
646 } 648 }
@@ -670,7 +672,7 @@ StkId luaV_execute (lua_State *L) {
670 L->top = ra+5; 672 L->top = ra+5;
671 luaD_call(L, ra+2, GETARG_C(i) + 1); 673 luaD_call(L, ra+2, GETARG_C(i) + 1);
672 L->top = L->ci->top; 674 L->top = L->ci->top;
673 if (ttisnil(ra+2)) pc++; /* skip jump (break loop) */ 675 if (ttisnil(RA(i)+2)) pc++; /* skip jump (break loop) */
674 else dojump(pc, GETARG_sBx(*pc) + 1); /* else jump back */ 676 else dojump(pc, GETARG_sBx(*pc) + 1); /* else jump back */
675 break; 677 break;
676 } 678 }