[Tarantool-patches] [PATCH luajit] LJ_GC64: Make ASMREF_L references 64 bit.
imun at tarantool.org
Thu May 25 09:16:33 MSK 2023
I've checked the patchset into all long-term branches in
tarantool/luajit and bumped a new version in master, 2.11 and 2.10.
On 11.04.23, Sergey Kaplun via Tarantool-patches wrote:
> From: Mike Pall <mike>
> Reported by Yichun Zhang.
> (cherry picked from commit 850f8c59d3d04a9847f21f32a6c36d8269b5b6b1)
> The `ASMREF_L` reference is defined as `REF_NIL`, so it isn't considered
> as 64 bit address. On GC64 mode it may lead to the following assembly:
> | mov eax, edi
> so, high 32 bits of the reference are lost.
> This patch adds `IRT_NIL` to `IRT_IS64` mask, to consider `ASMREF_L`
> 64 bit long. Now the resulting assembly is the following:
> | mov rax, rdi
> False-positive `if` condition in <src/lj_asm.c> is OK, since `op12`
> already initialized as 0.
> False-positive `if` condition in <src/lj_opt_sink.c>, <src/lj_opt_split.c>,
> <src/lj_record.c> is OK, since `REF_NIL` is the last reference before
> `REF_BASE` and this iteration of a cycle is still the last one.
> Sergey Kaplun:
> * added the description and the test for the problem
> Part of tarantool/tarantool#8516
> Branch: https://github.com/tarantool/luajit/tree/skaplun/or-144-gc64-asmref-l
> Related issues:
> * https://github.com/openresty/lua-resty-core/issues/144
> * https://github.com/tarantool/tarantool/issues/8516
> PR: https://github.com/tarantool/tarantool/pull/8553
> ML: https://www.freelists.org/post/luajit/Consistent-SEGV-on-x64-with-the-latest-LuaJIT-v21-GC64-mode
> Don't restrict test case by GC64 mode, because want to test `IR_LREF`
> for any mode. Keep GC64 in the test name, to be clear where expect the
> src/lj_asm.c | 1 +
> src/lj_ir.h | 4 ++-
> src/lj_opt_sink.c | 1 +
> .../or-144-gc64-asmref-l.test.lua | 28 +++++++++++++++++++
> 4 files changed, 33 insertions(+), 1 deletion(-)
> create mode 100644 test/tarantool-tests/or-144-gc64-asmref-l.test.lua
More information about the Tarantool-patches