Lines Matching full:ci

163   CallInfo *ci;  in relstack()  local
169 for (ci = L->ci; ci != NULL; ci = ci->previous) { in relstack()
170 ci->top.offset = savestack(L, ci->top.p); in relstack()
171 ci->func.offset = savestack(L, ci->func.p); in relstack()
180 CallInfo *ci; in correctstack() local
186 for (ci = L->ci; ci != NULL; ci = ci->previous) { in correctstack()
187 ci->top.p = restorestack(L, ci->top.offset); in correctstack()
188 ci->func.p = restorestack(L, ci->func.offset); in correctstack()
189 if (isLua(ci)) in correctstack()
190 ci->u.l.trap = 1; /* signal to update 'trap' in 'luaV_execute' */ in correctstack()
284 CallInfo *ci; in stackinuse() local
287 for (ci = L->ci; ci != NULL; ci = ci->previous) { in stackinuse()
288 if (lim < ci->top.p) lim = ci->top.p; in stackinuse()
318 luaE_shrinkCI(L); /* shrink CI list */ in luaD_shrinkstack()
340 CallInfo *ci = L->ci; in luaD_hook() local
342 ptrdiff_t ci_top = savestack(L, ci->top.p); /* idem for 'ci->top' */ in luaD_hook()
346 ar.i_ci = ci; in luaD_hook()
348 mask |= CIST_TRAN; /* 'ci' has transfer information */ in luaD_hook()
349 ci->u2.transferinfo.ftransfer = ftransfer; in luaD_hook()
350 ci->u2.transferinfo.ntransfer = ntransfer; in luaD_hook()
352 if (isLua(ci) && L->top.p < ci->top.p) in luaD_hook()
353 L->top.p = ci->top.p; /* protect entire activation register */ in luaD_hook()
355 if (ci->top.p < L->top.p + LUA_MINSTACK) in luaD_hook()
356 ci->top.p = L->top.p + LUA_MINSTACK; in luaD_hook()
358 ci->callstatus |= mask; in luaD_hook()
364 ci->top.p = restorestack(L, ci_top); in luaD_hook()
366 ci->callstatus &= ~mask; in luaD_hook()
376 void luaD_hookcall (lua_State *L, CallInfo *ci) { in luaD_hookcall() argument
379 int event = (ci->callstatus & CIST_TAIL) ? LUA_HOOKTAILCALL in luaD_hookcall()
381 Proto *p = ci_func(ci)->p; in luaD_hookcall()
382 ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */ in luaD_hookcall()
384 ci->u.l.savedpc--; /* correct 'pc' */ in luaD_hookcall()
394 static void rethook (lua_State *L, CallInfo *ci, int nres) { in rethook() argument
399 if (isLua(ci)) { in rethook()
400 Proto *p = ci_func(ci)->p; in rethook()
402 delta = ci->u.l.nextraargs + p->numparams + 1; in rethook()
404 ci->func.p += delta; /* if vararg, back to virtual 'func' */ in rethook()
405 ftransfer = cast(unsigned short, firstres - ci->func.p); in rethook()
407 ci->func.p -= delta; in rethook()
409 if (isLua(ci = ci->previous)) in rethook()
410 L->oldpc = pcRel(ci->u.l.savedpc, ci_func(ci)->p); /* set 'oldpc' */ in rethook()
459 L->ci->callstatus |= CIST_CLSRET; /* in case of yields */ in moveresults()
460 L->ci->u2.nres = nres; in moveresults()
462 L->ci->callstatus &= ~CIST_CLSRET; in moveresults()
465 rethook(L, L->ci, nres); in moveresults()
492 void luaD_poscall (lua_State *L, CallInfo *ci, int nres) { in luaD_poscall() argument
493 int wanted = ci->nresults; in luaD_poscall()
495 rethook(L, ci, nres); in luaD_poscall()
497 moveresults(L, ci->func.p, nres, wanted); in luaD_poscall()
499 lua_assert(!(ci->callstatus & in luaD_poscall()
501 L->ci = ci->previous; /* back to caller (after closing variables) */ in luaD_poscall()
506 #define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L))
511 CallInfo *ci = L->ci = next_ci(L); /* new frame */ in prepCallInfo() local
512 ci->func.p = func; in prepCallInfo()
513 ci->nresults = nret; in prepCallInfo()
514 ci->callstatus = mask; in prepCallInfo()
515 ci->top.p = top; in prepCallInfo()
516 return ci; in prepCallInfo()
526 CallInfo *ci; in precallC() local
528 L->ci = ci = prepCallInfo(L, func, nresults, CIST_C, in precallC()
530 lua_assert(ci->top.p <= L->stack_last.p); in precallC()
539 luaD_poscall(L, ci, n); in precallC()
550 int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, in luaD_pretailcall() argument
564 ci->func.p -= delta; /* restore 'func' (if vararg) */ in luaD_pretailcall()
566 setobjs2s(L, ci->func.p + i, func + i); in luaD_pretailcall()
567 func = ci->func.p; /* moved-down function */ in luaD_pretailcall()
570 ci->top.p = func + 1 + fsize; /* top for new function */ in luaD_pretailcall()
571 lua_assert(ci->top.p <= L->stack_last.p); in luaD_pretailcall()
572 ci->u.l.savedpc = p->code; /* starting point */ in luaD_pretailcall()
573 ci->callstatus |= CIST_TAIL; in luaD_pretailcall()
579 /* return luaD_pretailcall(L, ci, func, narg1 + 1, delta); */ in luaD_pretailcall()
605 CallInfo *ci; in luaD_precall() local
611 L->ci = ci = prepCallInfo(L, func, nresults, 0, func + 1 + fsize); in luaD_precall()
612 ci->u.l.savedpc = p->code; /* starting point */ in luaD_precall()
615 lua_assert(ci->top.p <= L->stack_last.p); in luaD_precall()
616 return ci; in luaD_precall()
636 CallInfo *ci; in ccall() local
642 if ((ci = luaD_precall(L, func, nResults)) != NULL) { /* Lua function? */ in ccall()
643 ci->callstatus = CIST_FRESH; /* mark that it is a "fresh" execute */ in ccall()
644 luaV_execute(L, ci); /* call it */ in ccall()
682 static int finishpcallk (lua_State *L, CallInfo *ci) { in finishpcallk() argument
683 int status = getcistrecst(ci); /* get original status */ in finishpcallk()
687 StkId func = restorestack(L, ci->u2.funcidx); in finishpcallk()
688 L->allowhook = getoah(ci->callstatus); /* restore 'allowhook' */ in finishpcallk()
692 setcistrecst(ci, LUA_OK); /* clear original status */ in finishpcallk()
694 ci->callstatus &= ~CIST_YPCALL; in finishpcallk()
695 L->errfunc = ci->u.c.old_errfunc; in finishpcallk()
715 static void finishCcall (lua_State *L, CallInfo *ci) { in finishCcall() argument
717 if (ci->callstatus & CIST_CLSRET) { /* was returning? */ in finishCcall()
718 lua_assert(hastocloseCfunc(ci->nresults)); in finishCcall()
719 n = ci->u2.nres; /* just redo 'luaD_poscall' */ in finishCcall()
725 lua_assert(ci->u.c.k != NULL && yieldable(L)); in finishCcall()
726 if (ci->callstatus & CIST_YPCALL) /* was inside a 'lua_pcallk'? */ in finishCcall()
727 status = finishpcallk(L, ci); /* finish it */ in finishCcall()
730 n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation */ in finishCcall()
734 luaD_poscall(L, ci, n); /* finish 'luaD_call' */ in finishCcall()
744 CallInfo *ci; in unroll() local
746 while ((ci = L->ci) != &L->base_ci) { /* something in the stack */ in unroll()
747 if (!isLua(ci)) /* C function? */ in unroll()
748 finishCcall(L, ci); /* complete its execution */ in unroll()
751 luaV_execute(L, ci); /* execute down to higher C 'boundary' */ in unroll()
762 CallInfo *ci; in findpcall() local
763 for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */ in findpcall()
764 if (ci->callstatus & CIST_YPCALL) in findpcall()
765 return ci; in findpcall()
795 CallInfo *ci = L->ci; in resume() local
801 if (isLua(ci)) { /* yielded inside a hook? */ in resume()
804 lua_assert(ci->callstatus & CIST_HOOKYIELD); in resume()
805 ci->u.l.savedpc--; in resume()
807 luaV_execute(L, ci); /* just continue running Lua code */ in resume()
810 if (ci->u.c.k != NULL) { /* does it have a continuation function? */ in resume()
812 n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); /* call continuation */ in resume()
816 luaD_poscall(L, ci, n); /* finish 'luaD_call' */ in resume()
832 CallInfo *ci; in precover() local
833 while (errorstatus(status) && (ci = findpcall(L)) != NULL) { in precover()
834 L->ci = ci; /* go down to recovery functions */ in precover()
835 setcistrecst(ci, status); /* status to finish 'pcall' */ in precover()
847 if (L->ci != &L->base_ci) /* not in base level? */ in lua_resume()
849 else if (L->top.p - (L->ci->func.p + 1) == nargs) /* no function? */ in lua_resume()
868 L->ci->top.p = L->top.p; in lua_resume()
870 *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield in lua_resume()
871 : cast_int(L->top.p - (L->ci->func.p + 1)); in lua_resume()
884 CallInfo *ci; in lua_yieldk() local
887 ci = L->ci; in lua_yieldk()
896 ci->u2.nyield = nresults; /* save number of results */ in lua_yieldk()
897 if (isLua(ci)) { /* inside a hook? */ in lua_yieldk()
898 lua_assert(!isLuacode(ci)); in lua_yieldk()
903 if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ in lua_yieldk()
904 ci->u.c.ctx = ctx; /* save context */ in lua_yieldk()
907 lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ in lua_yieldk()
936 CallInfo *old_ci = L->ci; in luaD_closeprotected()
945 L->ci = old_ci; in luaD_closeprotected()
960 CallInfo *old_ci = L->ci; in luaD_pcall()
966 L->ci = old_ci; in luaD_pcall()