MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / luaD_callhook

Function luaD_callhook

lua/ldo.c:182–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180
181
182void luaD_callhook (lua_State *L, int event, int line) {
183 lua_Hook hook = L->hook;
184 if (hook && L->allowhook) {
185 ptrdiff_t top = savestack(L, L->top);
186 ptrdiff_t ci_top = savestack(L, L->ci->top);
187 lua_Debug ar;
188 ar.event = event;
189 ar.currentline = line;
190 if (event == LUA_HOOKTAILRET)
191 ar.i_ci = 0; /* tail call; no debug information about it */
192 else
193 ar.i_ci = cast_int(L->ci - L->base_ci);
194 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
195 L->ci->top = L->top + LUA_MINSTACK;
196 lua_assert(L->ci->top <= L->stack_last);
197 L->allowhook = 0; /* cannot call hooks inside a hook */
198 lua_unlock(L);
199 (*hook)(L, &ar);
200 lua_lock(L);
201 lua_assert(!L->allowhook);
202 L->allowhook = 1;
203 L->ci->top = restorestack(L, ci_top);
204 L->top = restorestack(L, top);
205 }
206}
207
208
209static StkId adjust_varargs (lua_State *L, Proto *p, int actual) {

Callers 3

traceexecFunction · 0.85
luaD_precallFunction · 0.85
callrethooksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected