diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-07-25 16:50:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-07-25 16:50:44 -0300 |
commit | 1b3f507f620d996ffb69da7476a19251acfb89ca (patch) | |
tree | 71f5a6482d4a33fea53678b411d4837c6450be44 /lvm.c | |
parent | 6b51133a988587f34ee9581d799ea9913581afd3 (diff) | |
download | lua-1b3f507f620d996ffb69da7476a19251acfb89ca.tar.gz lua-1b3f507f620d996ffb69da7476a19251acfb89ca.tar.bz2 lua-1b3f507f620d996ffb69da7476a19251acfb89ca.zip |
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.
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -1157,18 +1157,11 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1157 | startfunc: | 1157 | startfunc: |
1158 | trap = L->hookmask; | 1158 | trap = L->hookmask; |
1159 | returning: /* trap already set */ | 1159 | returning: /* trap already set */ |
1160 | cl = clLvalue(s2v(ci->func.p)); | 1160 | cl = ci_func(ci); |
1161 | k = cl->p->k; | 1161 | k = cl->p->k; |
1162 | pc = ci->u.l.savedpc; | 1162 | pc = ci->u.l.savedpc; |
1163 | if (l_unlikely(trap)) { | 1163 | if (l_unlikely(trap)) |
1164 | if (pc == cl->p->code) { /* first instruction (not resuming)? */ | 1164 | trap = luaG_tracecall(L); |
1165 | if (cl->p->is_vararg) | ||
1166 | trap = 0; /* hooks will start after VARARGPREP instruction */ | ||
1167 | else /* check 'call' hook */ | ||
1168 | luaD_hookcall(L, ci); | ||
1169 | } | ||
1170 | ci->u.l.trap = 1; /* assume trap is on, for now */ | ||
1171 | } | ||
1172 | base = ci->func.p + 1; | 1165 | base = ci->func.p + 1; |
1173 | /* main loop of interpreter */ | 1166 | /* main loop of interpreter */ |
1174 | for (;;) { | 1167 | for (;;) { |