[Tarantool-patches] [PATCH luajit] Fix maxslots when recording BC_TSETM.

Sergey Bronnikov sergeyb at tarantool.org
Mon Aug 28 15:58:38 MSK 2023


Hi, Sergey


thanks for the patch! LGTM

See a minor comment inline.


Sincerely yours,

Sergey


On 8/25/23 18:00, Sergey Kaplun wrote:
> From: Mike Pall <mike>
>
> Analyzed by Sergey Kaplun.
>
> (cherry-picked from commit 0cc5fdfbc0810073485150eb184dc358dab507d9)
>
> Recording of the `BC_TSETM` bytecode may keep too optimistic JIT
> maxslot. In that case, the slot above the top of the Lua stack may be
> considered used. When any VM event handler is called before the
> recording of the next instruction, this leads to an assertion failure in
> `rec_check_slots()`.
>
> This patch sets the `ra` as a maxslot, as far as the `ra` - 1 contains a
> table, which is always the highest slot after this bytecode. Also, it
> adds an assertion that we check slots below the top of the Lua stack.

I've discovered that bug is not reproduced when LUAJIT_ENABLE_TABLE_BUMP 
is enabled, by default it is disabled.

CFLAGS="-DLUAJIT_ENABLE_TABLE_BUMP" cmake -S . -B build 
-DCMAKE_BUILD_TYPE=Debug

cmake --build build --parallel

It is probably worth to mention in commit message. Feel free to ignore.



<snipped>



More information about the Tarantool-patches mailing list