[Tarantool-patches] [PATCH luajit] FFI: Fix recording of union initialization.

Igor Munkin imun at tarantool.org
Thu Jul 20 21:37:25 MSK 2023


Max,

Thanks for the patch! 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 10.07.23, Maksim Kokryashkin via Tarantool-patches wrote:
> From: Mike Pall <mike>
> 
> Thanks to Alex Shpilkin.
> 
> (cherry-picked from commit 56c04accf975bff2519c34721dccbbdb7b8e6963)
> 
> As stated here[1], only the first field of a union can be
> initialized with a flat initializer. However, before this
> patch, on-trace initialization instructions were emitted
> for other union members too, overwriting the previous
> initialization values.
> 
> This patch fixes the mentioned behavior by preventing
> initialization of members other than the first one.
> 
> [1]: https://luajit.org/ext_ffi_semantics.html#init
> 
> Maxim Kokryashkin:
> * added the description and the test for the problem
> 
> Part of tarantool/tarantool#8825
> ---
> Branch: https://github.com/tarantool/luajit/tree/fckxorg/lj-128-fix-union-init
> PR: https://github.com/tarantool/tarantool/pull/8867
> Original LuaJIT PR: https://github.com/LuaJIT/LuaJIT/pull/650
> 
>  src/lj_crecord.c                               |  5 +++++
>  .../lj-128-fix-union-init.test.lua             | 18 ++++++++++++++++++
>  2 files changed, 23 insertions(+)
>  create mode 100644 test/tarantool-tests/lj-128-fix-union-init.test.lua
> 

<snipped>

> -- 
> 2.39.2 (Apple Git-143)
> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list