diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-01 16:20:48 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-01 16:20:48 -0200 |
commit | b9e76be8a691ed83a716a85c6b85cb80f66cc480 (patch) | |
tree | 851df615f2cb00ba1bdf4042336a56b7c4609a40 /ldo.c | |
parent | c5482468fde11c6c169da3b331a0653455f8fc94 (diff) | |
download | lua-b9e76be8a691ed83a716a85c6b85cb80f66cc480.tar.gz lua-b9e76be8a691ed83a716a85c6b85cb80f66cc480.tar.bz2 lua-b9e76be8a691ed83a716a85c6b85cb80f66cc480.zip |
using 'L->func' when possible
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.162 2017/07/27 13:50:16 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.163 2017/10/31 17:54:35 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 | */ |
@@ -368,7 +368,7 @@ int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) { | |||
368 | } | 368 | } |
369 | L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ | 369 | L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ |
370 | } | 370 | } |
371 | res = ci->func; /* res == final position of 1st result */ | 371 | res = L->func; /* res == final position of 1st result */ |
372 | L->ci = ci->previous; /* back to caller */ | 372 | L->ci = ci->previous; /* back to caller */ |
373 | L->func -= L->func->stkci.previous; | 373 | L->func -= L->func->stkci.previous; |
374 | lua_assert(L->func == L->ci->func); | 374 | lua_assert(L->func == L->ci->func); |
@@ -604,7 +604,7 @@ static void resume (lua_State *L, void *ud) { | |||
604 | else { /* resuming from previous yield */ | 604 | else { /* resuming from previous yield */ |
605 | lua_assert(L->status == LUA_YIELD); | 605 | lua_assert(L->status == LUA_YIELD); |
606 | L->status = LUA_OK; /* mark that it is running (again) */ | 606 | L->status = LUA_OK; /* mark that it is running (again) */ |
607 | ci->func = restorestack(L, ci->extra); | 607 | L->func = ci->func = restorestack(L, ci->extra); |
608 | if (isLua(ci)) /* yielded inside a hook? */ | 608 | if (isLua(ci)) /* yielded inside a hook? */ |
609 | luaV_execute(L); /* just continue running Lua code */ | 609 | luaV_execute(L); /* just continue running Lua code */ |
610 | else { /* 'common' yield */ | 610 | else { /* 'common' yield */ |
@@ -679,14 +679,14 @@ LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, | |||
679 | luaG_runerror(L, "attempt to yield from outside a coroutine"); | 679 | luaG_runerror(L, "attempt to yield from outside a coroutine"); |
680 | } | 680 | } |
681 | L->status = LUA_YIELD; | 681 | L->status = LUA_YIELD; |
682 | ci->extra = savestack(L, ci->func); /* save current 'func' */ | 682 | ci->extra = savestack(L, L->func); /* save current 'func' */ |
683 | if (isLua(ci)) { /* inside a hook? */ | 683 | if (isLua(ci)) { /* inside a hook? */ |
684 | api_check(L, k == NULL, "hooks cannot continue after yielding"); | 684 | api_check(L, k == NULL, "hooks cannot continue after yielding"); |
685 | } | 685 | } |
686 | else { | 686 | else { |
687 | if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ | 687 | if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ |
688 | ci->u.c.ctx = ctx; /* save context */ | 688 | ci->u.c.ctx = ctx; /* save context */ |
689 | ci->func = L->top - nresults - 1; /* protect stack below results */ | 689 | L->func = ci->func = L->top - nresults - 1; /* protect stack below results */ |
690 | luaD_throw(L, LUA_YIELD); | 690 | luaD_throw(L, LUA_YIELD); |
691 | } | 691 | } |
692 | lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ | 692 | lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ |