mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Bug: Call hook may be called twice when count hook yields
Took the opportunity and moved the code that controls call hooks in 'luaV_execute' into a function.
This commit is contained in:
parent
6b51133a98
commit
1b3f507f62
4 changed files with 27 additions and 11 deletions
13
lvm.c
13
lvm.c
|
|
@ -1157,18 +1157,11 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
|
|||
startfunc:
|
||||
trap = L->hookmask;
|
||||
returning: /* trap already set */
|
||||
cl = clLvalue(s2v(ci->func.p));
|
||||
cl = ci_func(ci);
|
||||
k = cl->p->k;
|
||||
pc = ci->u.l.savedpc;
|
||||
if (l_unlikely(trap)) {
|
||||
if (pc == cl->p->code) { /* first instruction (not resuming)? */
|
||||
if (cl->p->is_vararg)
|
||||
trap = 0; /* hooks will start after VARARGPREP instruction */
|
||||
else /* check 'call' hook */
|
||||
luaD_hookcall(L, ci);
|
||||
}
|
||||
ci->u.l.trap = 1; /* assume trap is on, for now */
|
||||
}
|
||||
if (l_unlikely(trap))
|
||||
trap = luaG_tracecall(L);
|
||||
base = ci->func.p + 1;
|
||||
/* main loop of interpreter */
|
||||
for (;;) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue