From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 80C676EC7B; Mon, 1 Jun 2026 16:07:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 80C676EC7B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1780319226; bh=xcVAjsD9hE8LlHMxjpXB4zjIL5K/GNfMjhGx3iOzFIs=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=yUdYf6hPWSbBXyS0dQpQ2p6N+WVKWqEze3qWHaGqxucYwGUlbHlRrQrCKvb0Te6Hc nuE2hxKGnsb1fGOEgqAsJwAvSiO2SHQshwyfX82mEQSW6jZY9sVlHgWgoi0n4PyKDh L2xwBGINBrM2BMDc+EdSzkXjINZk1iO2xou7CHsA= Received: from send60.i.mail.ru (send60.i.mail.ru [89.221.237.155]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0AA3B6EC7B for ; Mon, 1 Jun 2026 16:07:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0AA3B6EC7B Received: by exim-smtp-5b85998476-mqvxk with esmtpa (envelope-from ) id 1wU2MC-000000007Ns-3QB3; Mon, 01 Jun 2026 16:07:05 +0300 Content-Type: multipart/alternative; boundary="------------UrecUf5aWm9kgGbl0DanJJut" Message-ID: Date: Mon, 1 Jun 2026 16:07:03 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun , Evgeniy Temirgaleev Cc: tarantool-patches@dev.tarantool.org References: <20260530160409.4043089-1-skaplun@tarantool.org> <20260530160409.4043089-6-skaplun@tarantool.org> In-Reply-To: <20260530160409.4043089-6-skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9402BF17F4A9A44D6B5B9AAD00C530C650B6B4D9F3374708F00894C459B0CD1B9270E7BD8E3B2D84A91417EB218679B82FB5DEA18DC9AB0B2FF110112759CD33D8472923344694FB0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72F22E6DC541F75D9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F88016AB904663428638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2D426289EAE85251C2E070BE324C7D3C43772FBA5920B80AFF6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249957A4DEDD2346B42CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C078FCF50C7EAF9C588941B15DA834481F9449624AB7ADAF372E808ACE2090B5E14AD6D5ED66289B5259CC434672EE63711DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C37725542EFDE5E0D335872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A59424A52FFC2E21BB5002B1117B3ED696AC4854BCA6C784B103803A57F48E4E5A823CB91A9FED034534781492E4B8EEADC24E78AA85F86F6CBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D6598AB91BA72D6B8519C93B7DC0116D040FC311C759C75EFB69CCE64944DB446C3C03C7DC742FA35098B8341EE9D5BE9A0A72A3F4BA71D6C6F166070B427F095FFDD747AA4A373E0FFB6536EB022892E5344C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVRI2994ruhLU9Q2YBW0Wyjc= X-DA7885C5: F8FBE258418B9C31F255D290C0D534F9FBC18D15C35D735063DE36A3246492EF5F434E20DC1292E95B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393520AF17B8A65FDE2F9FE0711304D102CC05FBA4EB33BE7426D297ADE80B14019EF86D5F70DA33880E41E8EF7A07863ECB274557F927329BE2DDF8182D28ACDB545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 5/5] FFI/MacOS: Fix calling convention for enums. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------UrecUf5aWm9kgGbl0DanJJut Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey, thanks for the patch! LGTM Sergey On 5/30/26 19:04, Sergey Kaplun wrote: > From: Mike Pall > > Thanks to Sergey Kaplun. > > (cherry picked from commit b925b3e3fc6771171602323b45fbe9fb8fc90369) > > This patch fixes the regression in the arm64 OSX FFI behaviour when the > fundamental C types are passed via the stack. The given arguments should > occupy the "packed" size on the stack if they are fundamental C > types [1]. Structures require the pointer-size alignment like it was done > in the previous commit. This patch fixes that (not only for enums but for > other data types too). This fixes the tests that were failing after the > previous commit. > > [1]:https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Pass-arguments-to-functions-correctly > > Sergey Kaplun: > * added the description for the problem > > Part of tarantool/tarantool#12480 > --- > src/lj_ccall.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/lj_ccall.c b/src/lj_ccall.c > index 1beccc10..7c3ec1e5 100644 > --- a/src/lj_ccall.c > +++ b/src/lj_ccall.c > @@ -1082,7 +1082,7 @@ static int ccall_set_args(lua_State *L, CTState *cts, CType *ct, > if (CCALL_ALIGN_STACKARG) { /* Align argument on stack. */ > MSize align = (1u << ctype_align(ccall_struct_align(cts, d))) - 1; > #if LJ_TARGET_ARM64 && LJ_TARGET_OSX > - isva = 1; > + isva = ctype_isstruct(d->info); > #endif > if (rp || (CCALL_PACK_STACKARG && isva && align < CTSIZE_PTR-1)) > align = CTSIZE_PTR-1; --------------UrecUf5aWm9kgGbl0DanJJut Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey,

thanks for the patch! LGTM

Sergey

On 5/30/26 19:04, Sergey Kaplun wrote:
From: Mike Pall <mike>

Thanks to Sergey Kaplun.

(cherry picked from commit b925b3e3fc6771171602323b45fbe9fb8fc90369)

This patch fixes the regression in the arm64 OSX FFI behaviour when the
fundamental C types are passed via the stack. The given arguments should
occupy the "packed" size on the stack if they are fundamental C
types [1]. Structures require the pointer-size alignment like it was done
in the previous commit. This patch fixes that (not only for enums but for
other data types too). This fixes the tests that were failing after the
previous commit.

[1]: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Pass-arguments-to-functions-correctly

Sergey Kaplun:
* added the description for the problem

Part of tarantool/tarantool#12480
---
 src/lj_ccall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lj_ccall.c b/src/lj_ccall.c
index 1beccc10..7c3ec1e5 100644
--- a/src/lj_ccall.c
+++ b/src/lj_ccall.c
@@ -1082,7 +1082,7 @@ static int ccall_set_args(lua_State *L, CTState *cts, CType *ct,
     if (CCALL_ALIGN_STACKARG) {  /* Align argument on stack. */
       MSize align = (1u << ctype_align(ccall_struct_align(cts, d))) - 1;
 #if LJ_TARGET_ARM64 && LJ_TARGET_OSX
-      isva = 1;
+      isva = ctype_isstruct(d->info);
 #endif
       if (rp || (CCALL_PACK_STACKARG && isva && align < CTSIZE_PTR-1))
 	align = CTSIZE_PTR-1;
--------------UrecUf5aWm9kgGbl0DanJJut--