MCPcopy Create free account
hub / github.com/F-Stack/f-stack / traceexec

Function traceexec

freebsd/contrib/openzfs/module/lua/lvm.c:59–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58
59static void traceexec (lua_State *L) {
60 CallInfo *ci = L->ci;
61 lu_byte mask = L->hookmask;
62 int counthook = ((mask & LUA_MASKCOUNT) && L->hookcount == 0);
63 if (counthook)
64 resethookcount(L); /* reset count */
65 if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */
66 ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */
67 return; /* do not call hook again (VM yielded, so it did not move) */
68 }
69 if (counthook)
70 luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */
71 if (mask & LUA_MASKLINE) {
72 Proto *p = ci_func(ci)->p;
73 int npc = pcRel(ci->u.l.savedpc, p);
74 int newline = getfuncline(p, npc);
75 if (npc == 0 || /* call linehook when enter a new function, */
76 ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */
77 newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */
78 luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */
79 }
80 L->oldpc = ci->u.l.savedpc;
81 if (L->status == LUA_YIELD) { /* did hook yield? */
82 if (counthook)
83 L->hookcount = 1; /* undo decrement to zero */
84 ci->u.l.savedpc--; /* undo increment (resume will increment it again) */
85 ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */
86 ci->func = L->top - 1; /* protect stack below results */
87 luaD_throw(L, LUA_YIELD);
88 }
89}
90
91
92static void callTM (lua_State *L, const TValue *f, const TValue *p1,

Callers 1

luaV_executeFunction · 0.70

Calls 2

luaD_hookFunction · 0.85
luaD_throwFunction · 0.70

Tested by

no test coverage detected