[Tarantool-patches] [PATCH luajit] Fix FOLD rule for BUFHDR append.
Igor Munkin
imun at tarantool.org
Wed Jan 10 11:51:32 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 14.11.23, Sergey Kaplun via Tarantool-patches wrote:
> From: Mike Pall <mike>
>
> Reported by XmiliaH.
>
> (cherry-picked from commit bc1bdbf620f58f0978385828bc51272903601e17)
>
> `bufput_append()` may fold `BUFHDR RESET` + `BUFPUT` IRs to `BUFHDR
> APPEND` even if the right operand (`BUFSTR`) is the PHI. If it's not the
> last IR in the `BUFSTR` chain, this may lead to an incorrect resulting
> value in the buffer, which contains a longer string since `APPEND` is
> used instead of `RESET`.
>
> This patch adds the corresponding check inside the fold rule.
>
> 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-791-fold-bufhdr-append
> Tarantool PR: https://github.com/tarantool/tarantool/pull/9369
> Relate issues:
> * https://github.com/LuaJIT/LuaJIT/issues/791
> * https://github.com/tarantool/tarantool/issues/9145
>
> src/lj_opt_fold.c | 3 +-
> .../lj-791-fold-bufhdr-append.test.lua | 54 +++++++++++++++++++
> 2 files changed, 56 insertions(+), 1 deletion(-)
> create mode 100644 test/tarantool-tests/lj-791-fold-bufhdr-append.test.lua
>
<snipped>
> --
> 2.42.0
>
--
Best regards,
IM
More information about the Tarantool-patches
mailing list