[Tarantool-patches] [PATCH luajit] Fix HREFK forwarding vs. table.clear().
Igor Munkin
imun at tarantool.org
Wed Jan 10 11:51:19 MSK 2024
Sergey,
I've checked the patchset into all long-term branches in
tarantool/luajit and bumped a new version in master, release/2.11 and
release/2.10.
On 09.11.23, Sergey Kaplun via Tarantool-patches wrote:
> From: Mike Pall <mike>
>
> Reported by XmiliaH.
>
> (cherry-picked from commit d5a237eae03d2ad346f82390836371a952e9a286)
>
> When performing HREFK (and also ALOAD, HLOAD) forwarding optimization,
> the `table.clear()` function call may be performed on the table operand
> from HREFK between table creation and IR, from which value is forwarded.
> This call isn't taken in the account, so it may lead to too optimistic
> value-forwarding from NEWREF (and also ASTORE, HSTORE), or the omitted
> type guard for HREFK operation. Therefore, this leads to incorrect trace
> behaviour (for example, taking a non-nil value from the cleared table).
>
> This patch adds necessary checks for `table.clear()` calls.
>
> Sergey Kaplun:
> * added the description and the test for the problem
>
> Part of tarantool/tarantool#9145
> ---
>
> Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-792-hrefk-table-clear
> Tarantool PR: https://github.com/tarantool/tarantool/pull/9351
> Relate issues:
> * https://github.com/LuaJIT/LuaJIT/issues/792
> * https://github.com/tarantool/tarantool/issues/9145
>
> src/lj_opt_mem.c | 63 +++---
> .../lj-792-hrefk-table-clear.test.lua | 181 ++++++++++++++++++
> 2 files changed, 213 insertions(+), 31 deletions(-)
> create mode 100644 test/tarantool-tests/lj-792-hrefk-table-clear.test.lua
>
<snipped>
> --
> 2.42.0
>
--
Best regards,
IM
More information about the Tarantool-patches
mailing list