diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-22 15:54:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-22 15:54:49 -0300 |
commit | 6fcd334ca0baa76a4509ff584aff3b146b43e027 (patch) | |
tree | bb047506b7982aea1dcda71f63d36e53bbb6e64a /lvm.c | |
parent | 43ad0637ca376d22f8b64924b965d7316283ade7 (diff) | |
download | lua-6fcd334ca0baa76a4509ff584aff3b146b43e027.tar.gz lua-6fcd334ca0baa76a4509ff584aff3b146b43e027.tar.bz2 lua-6fcd334ca0baa76a4509ff584aff3b146b43e027.zip |
small improvements
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.50 2005/08/09 19:49:04 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.51 2005/08/10 20:20:13 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 | */ |
@@ -358,7 +358,7 @@ static void Arith (lua_State *L, StkId ra, const TValue *rb, | |||
358 | #define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } | 358 | #define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } |
359 | 359 | ||
360 | 360 | ||
361 | StkId luaV_execute (lua_State *L, int nexeccalls) { | 361 | void luaV_execute (lua_State *L, int nexeccalls) { |
362 | LClosure *cl; | 362 | LClosure *cl; |
363 | StkId base; | 363 | StkId base; |
364 | TValue *k; | 364 | TValue *k; |
@@ -377,7 +377,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
377 | traceexec(L, pc); | 377 | traceexec(L, pc); |
378 | if (L->status == LUA_YIELD) { /* did hook yield? */ | 378 | if (L->status == LUA_YIELD) { /* did hook yield? */ |
379 | L->savedpc = pc - 1; | 379 | L->savedpc = pc - 1; |
380 | return NULL; | 380 | return; |
381 | } | 381 | } |
382 | base = L->base; | 382 | base = L->base; |
383 | } | 383 | } |
@@ -617,7 +617,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
617 | continue; | 617 | continue; |
618 | } | 618 | } |
619 | default: { | 619 | default: { |
620 | return NULL; | 620 | return; /* yield */ |
621 | } | 621 | } |
622 | } | 622 | } |
623 | } | 623 | } |
@@ -644,13 +644,12 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
644 | L->ci--; /* remove new frame */ | 644 | L->ci--; /* remove new frame */ |
645 | goto reentry; | 645 | goto reentry; |
646 | } | 646 | } |
647 | case PCRC: { | 647 | case PCRC: { /* it was a C function (`precall' called it) */ |
648 | /* it was a C function (`precall' called it) */ | ||
649 | base = L->base; | 648 | base = L->base; |
650 | continue; | 649 | continue; |
651 | } | 650 | } |
652 | default: { | 651 | default: { |
653 | return NULL; | 652 | return; /* yield */ |
654 | } | 653 | } |
655 | } | 654 | } |
656 | } | 655 | } |
@@ -659,14 +658,13 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
659 | if (b != 0) L->top = ra+b-1; | 658 | if (b != 0) L->top = ra+b-1; |
660 | if (L->openupval) luaF_close(L, base); | 659 | if (L->openupval) luaF_close(L, base); |
661 | L->savedpc = pc; | 660 | L->savedpc = pc; |
661 | b = luaD_poscall(L, ra); | ||
662 | if (--nexeccalls == 0) /* was previous function running `here'? */ | 662 | if (--nexeccalls == 0) /* was previous function running `here'? */ |
663 | return ra; /* no: return */ | 663 | return; /* no: return */ |
664 | else { /* yes: continue its execution */ | 664 | else { /* yes: continue its execution */ |
665 | int nresults = L->ci->nresults; | 665 | if (b) L->top = L->ci->top; |
666 | lua_assert(isLua(L->ci - 1)); | 666 | lua_assert(isLua(L->ci)); |
667 | lua_assert(GET_OPCODE(*((L->ci - 1)->savedpc - 1)) == OP_CALL); | 667 | lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL); |
668 | luaD_poscall(L, nresults, ra); | ||
669 | if (nresults >= 0) L->top = L->ci->top; | ||
670 | goto reentry; | 668 | goto reentry; |
671 | } | 669 | } |
672 | } | 670 | } |