[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Can't interrupt tight loops in Lua 5.4 anymore?
- From: "Joseph C. Sible" <josephcsible@...>
- Date: Wed, 20 May 2020 09:42:10 -0400
On Wed, May 20, 2020 at 3:12 AM Massimo Sala <massimo.sala.71@gmail.com> wrote:
>
> file ldo.c, function rethook, starting at line 337/340:
>
>> if (globalhook || (L->hookmask & LUA_MASKRET)) { /* is return hook on? */
>> ...
>> luaD_hook(L, globalhook, LUA_HOOKRET, -1, ftransfer, nres); /* call it */
>> if (L->hookmask & LUA_MASKRET)
>> luaD_hook(L, L->hook, LUA_HOOKRET, -1, ftransfer, nres); /* call it */
>
>
>
> Looking at the indentation and the previous test,
> I expected the globalhook is called this way:
>
>> if (globalhook)
>> luaD_hook(L, globalhook, LUA_HOOKRET, -1, ftransfer, nres); /* call it */
>
The first "if" in my patch is just for efficiency, to avoid setting up
for the hooks if neither will be called. Testing for globalhook later
isn't necessary here, since luaD_hook does that itself. The reason
that the regular hook still needs "if (L->hookmask & LUA_MASKRET)" is
that it's testing the mask rather than the function, and luaD_hook
only tests the function.
Joseph C. Sible
- References:
- Can't interrupt tight loops in Lua 5.4 anymore?, Joseph C. Sible
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Roberto Ierusalimschy
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Andrew Gierth
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Roberto Ierusalimschy
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Viacheslav Usov
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Roberto Ierusalimschy
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Viacheslav Usov
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Roberto Ierusalimschy
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Joseph C. Sible
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Roberto Ierusalimschy
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Joseph C. Sible
- Re: Can't interrupt tight loops in Lua 5.4 anymore?, Massimo Sala