[Tarantool-patches] [PATCH luajit] Prevent snapshot purge while recording a function header.
Sergey Kaplun
skaplun at tarantool.org
Tue Mar 3 15:01:22 MSK 2026
Hi, Sergey!
Thanks for the review!
See my answer below.
On 03.03.26, Sergey Bronnikov wrote:
> Hi, Sergey,
>
> thanks for the patch! LGTM with a minor comment.
>
> Sergey
>
> On 2/25/26 15:11, Sergey Kaplun wrote:
<snipped>
> > +
> > +local checkers = {}
> > +
> > +-- Called twice for the pseudo-type that aliases base Lua type via
> > +-- checkers map.
> > +local function checks(expected_type)
> > + -- Value expected to be `checks_tab()` or `checks_obj()`
> > + -- argument. It is always a table.
> > + local _, value = debug_getlocal(2, 1)
> > + -- Simple stitching function. Additional arguments are needed to
> > + -- occupy the corresponding slot.
>
> It is not clear for me why this corresponding slot is needed.
>
> The bug can be reproduced without double nil's passed to math_modf().
Not for all builds (i.e. GC64 and non-GC64).
>
> > + math_modf(0, nil, nil)
> > + -- Start trace now, one iteration only.
> > + -- luacheck: ignore 512
> > + while true do
> > + -- Base type?
> > + if type(value) == expected_type then
> > + return true
> > + end
> > + -- Pseudo types fallbacks to the map.
> > + local checker = checkers[expected_type]
> > + -- For the xpcall.
> > + if checker(value) == true then
> > + return true
> > + end
> > + break
> > + end
> > + error('Unreachable path taken')
> > +end
<snipped>
--
Best regards,
Sergey Kaplun
More information about the Tarantool-patches
mailing list