lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, May 22, 2020 at 9:03 PM Joseph C. Sible <josephcsible@gmail.com> wrote:

> I'm not sure of a good way do that. Only two ideas come to mind
> (either adding a new check without being able to remove any existing
> ones, or rolling back the change that added ci->u.l.trap), and both of
> them seem like they'd make it less efficient rather than making it
> more efficient.

Looking at the commit that introduced the trap field, I come to the
conclusion that the original problem was to signal to the interpreter
that it needs to update the cached stack base pointer after the stack
was reallocated. Adding a check for that into the hot path that
already had a check for instruction/line hooks apparently was seen
undesired from the performance standpoint, which is partly
corroborated by Roberto's comments about performance earlier in this
thread. So the solution was to combine the signals in a new field and
check only that field (somewhat similar to my own proposal in this
thread). I'd appreciate a direct confirmation from Roberto whether my
analysis is correct.

What I do not understand is why the field is in the Callinfo
structure. On the one hand, when hooks are set, all the structures in
a given Lua thread are updated; on the other hand, when the stack is
reallocated, only one structure is updated. Apparently I am missing
something, because I do not see why the trap field cannot just be in
lua_State. I'd appreciate having this clarified.

Anyway, for the current 5.4 code, I would like to withdraw my previous
proposal. Before the above is clarified, it seems that Joseph's latest
patch cannot be improved.

Cheers,
V.