[Tarantool-patches] [PATCH luajit 5/6] FFI: Fix dangling reference to CType. Improve checks.

Sergey Kaplun skaplun at tarantool.org
Wed Oct 25 13:46:29 MSK 2023


Hi, Maxim!
Thanks for the review!

On 25.10.23, Maxim Kokryashkin wrote:
> Hi, Sergey!
> Thanks for the patch!
> LGTM, after answering the same questions as for the previous patch.
> On Mon, Oct 23, 2023 at 12:22:05PM +0300, Sergey Kaplun wrote:

See the iterative patch below, branch is force pushed:
===================================================================
diff --git a/test/tarantool-tests/lj-920-fix-dangling-reference-to-ctype.test.lua b/test/tarantool-tests/lj-920-fix-dangling-reference-to-ctype.test.lua
index a7e35888..0b8be04f 100644
--- a/test/tarantool-tests/lj-920-fix-dangling-reference-to-ctype.test.lua
+++ b/test/tarantool-tests/lj-920-fix-dangling-reference-to-ctype.test.lua
@@ -11,7 +11,7 @@ test:plan(1)
 -- This test demonstrates LuaJIT's incorrect behaviour when the
 -- reallocation of `cts->tab` strikes during the recording of the
 -- cdata metamethod arithmetic.
--- The test fails under ASAN.
+-- Before the patch, the test failed only under ASAN.
 
 -- XXX: Just some C functions to be casted. There is no need to
 -- declare their prototypes correctly.
@@ -38,6 +38,9 @@ local _ = ffi.new('struct {int a; long b; float c; double d;}', 0)
 -- Anchor table to prevent cdata objects from being collected.
 local anchor = {}
 -- Each call to this function grows `cts->top` by 3.
+-- `lj_ctype_new()` and `lj_ctype_intern()` during the parsing of
+-- the `CType` declaration in the `ffi.cast()` plus
+-- `lj_ctype_intern()` during the conversion to another `CType`.
 local function save_new_func(func)
   anchor[#anchor + 1] = ffi.cast('void (*)(void)', func)
 end
===================================================================

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list