summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-06-02 16:07:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-06-02 16:07:55 -0300
commite8d4fe72366dd44e45ffd9fca09d92c3db4f8214 (patch)
treed9f28bbce22a50c9e1de2f239ee6584934afb510 /ldo.c
parentb8691f13a8e3e9bb7fbd91d1f099eb517a9d5b35 (diff)
downloadlua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.tar.gz
lua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.tar.bz2
lua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.zip
new macro `lua_threadyield' + lock stuff in `luaconf.h' + details
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ldo.c b/ldo.c
index 293e66a3..a5fe6908 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.5 2004/05/14 19:25:09 roberto Exp roberto $ 2** $Id: ldo.c,v 2.6 2004/05/31 18:51:50 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*/
@@ -256,8 +256,8 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
256 ci->func = func; 256 ci->func = func;
257 L->base = ci->base = base; 257 L->base = ci->base = base;
258 ci->top = L->base + p->maxstacksize; 258 ci->top = L->base + p->maxstacksize;
259 ci->u.l.savedpc = p->code; /* starting point */ 259 ci->savedpc = p->code; /* starting point */
260 ci->u.l.tailcalls = 0; 260 ci->tailcalls = 0;
261 ci->nresults = nresults; 261 ci->nresults = nresults;
262 for (st = L->top; st < ci->top; st++) 262 for (st = L->top; st < ci->top; st++)
263 setnilvalue(st); 263 setnilvalue(st);
@@ -293,7 +293,7 @@ static StkId callrethooks (lua_State *L, StkId firstResult) {
293 ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ 293 ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */
294 luaD_callhook(L, LUA_HOOKRET, -1); 294 luaD_callhook(L, LUA_HOOKRET, -1);
295 if (f_isLua(L->ci)) { /* Lua function? */ 295 if (f_isLua(L->ci)) { /* Lua function? */
296 while (L->ci->u.l.tailcalls--) /* call hook for eventual tail calls */ 296 while (L->ci->tailcalls--) /* call hook for eventual tail calls */
297 luaD_callhook(L, LUA_HOOKTAILRET, -1); 297 luaD_callhook(L, LUA_HOOKTAILRET, -1);
298 } 298 }
299 return restorestack(L, fr); 299 return restorestack(L, fr);
@@ -352,8 +352,8 @@ static void resume (lua_State *L, void *ud) {
352 if (!f_isLua(ci)) { /* `common' yield? */ 352 if (!f_isLua(ci)) { /* `common' yield? */
353 /* finish interrupted execution of `OP_CALL' */ 353 /* finish interrupted execution of `OP_CALL' */
354 int nresults = ci->nresults; 354 int nresults = ci->nresults;
355 lua_assert(GET_OPCODE(*((ci-1)->u.l.savedpc - 1)) == OP_CALL || 355 lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL ||
356 GET_OPCODE(*((ci-1)->u.l.savedpc - 1)) == OP_TAILCALL); 356 GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL);
357 luaD_poscall(L, nresults, L->top - nargs); /* complete it */ 357 luaD_poscall(L, nresults, L->top - nargs); /* complete it */
358 if (nresults >= 0) L->top = L->ci->top; 358 if (nresults >= 0) L->top = L->ci->top;
359 } /* else yielded inside a hook: just continue its execution */ 359 } /* else yielded inside a hook: just continue its execution */