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 00AEB6E1E5; Mon, 23 Nov 2026 18:17:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 00AEB6E1E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1795447067; bh=mDV3jCQ+ilpx9at3fp0i1ih8QRkBnfV1AERdXMWYjMc=; 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=wdO0kVJaP1B1SJbn2FB9UIymZOPccd5DxHjPdW4F3bGK0g7hPEPbqsvd87jugFPjq qq3Bl3N2T/qSTpYB+7cxv2nZxNt1C79nFmzqtOu7U91VPwMbasvXvV0dymailAPV4X VFxQwMwAcvsbP8Ll2z7uV2qn64DtZNDw5pFYI6tE= Received: from send196.i.mail.ru (send196.i.mail.ru [95.163.59.35]) (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 98AEE6E1E5 for ; Mon, 23 Nov 2026 18:17:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 98AEE6E1E5 Received: by exim-smtp-56bb8ff957-mp468 with esmtpa (envelope-from ) id 1xVVnc-000000004y9-1AXC; Mon, 23 Nov 2026 18:17:44 +0300 Content-Type: multipart/alternative; boundary="------------62p5agVz0d9to96qtnRim6JB" Message-ID: <72041486-fcbd-470d-abaf-18240c4f518b@tarantool.org> Date: Mon, 23 Nov 2026 18:17:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Sergey Kaplun , Evgeniy Temirgaleev Cc: tarantool-patches@dev.tarantool.org References: <20261123070910.1354298-1-skaplun@tarantool.org> Content-Language: en-US In-Reply-To: <20261123070910.1354298-1-skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD90028F27364C53ECEFDB20ED40AE272AA91B53401A991F974182A05F5380850404C228DA9ACA6FE274A31A9D63AFF1CE63DE06ABAFEAF6705DC47F8883EABEA0FD7E95FB67D542C5C261E30AE1A3D80FE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79FF7180C05A1FF7CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB5533756603DA5D6BE41EFC0D3E64E7098FF9773D04F587AFC503B4937933438430573691389733CBF5DBD5E9D5E8D9A59859A8B64854413538E1713FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE765B758295022C166731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A579A32E216A6D2C7D5002B1117B3ED696713A9896C552786D30C8F815570A35303610D81D389A125CDE35189EBF2DEA28FEA14CD2CD220BB99C5DF10A05D560A9880EC71AF561E0AAD9143641EC25BB39D1AAE889B2A4D82D X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE1918E10F71CB4DF9F96AB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D65943A12BA6118397D5B521877511A48916033BB92164622C88D109A6211D9C28A066B2B1CF7F8C74A7B8341EE9D5BE9A0A3F83B0432D28078ED6B7571DDFCA09693A1D30B056CF40506536EB022892E5344C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXOcIETfglQORZ0zpDET4Zrk3igikrdHlWBvkdh3o3WKwtEW4g7DlDWI= X-Mailru-Sender: 689FA8AB762F73937C9FA53A4753B313818646347B1051F380056300DF2C63D0D81EAD6E6F068FCBEF86D5F70DA33880E41E8EF7A07863ECB274557F927329BE2DDF8182D28ACDB545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Fix external C call stack check when using LUAJIT_MODE_WRAPCFUNC. 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. --------------62p5agVz0d9to96qtnRim6JB Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey! Thanks for the patch! Please see the comment below. Sergey On 11/23/26 10:09, Sergey Kaplun wrote: > From: Mike Pall > > Thanks to Peter Cawley. > > (cherry picked from commit 14e2917e7ab3d6f043d6604298bfa66470c6f47d) > > Enabling and disabling wrapped C function mode [1] unconditionally > changes the bytecode to `BC_FUCC[W] 0 0`. The first operand (RA) is > unused for x86/x64 VMs, but other VMs use it like the minimum available > stack slots required for the function call (`LUA_MINSTACK` by default on > VM startup). Hence, these bytecode rewriting lead to the different > timing of the STACKOV error being raised (before the call or during the > invocation of the C function). > > This patch makes the behaviour consistent across VMs by modifying only > the opcode without changing its operands. Hence the `LUA_MINSTACK` > value of the first operand is preserved. > > [1]:https://luajit.org/ext_c_api.html#mode_wrapcfunc > > Sergey Kaplun: > * added the description and the test for the problem > > Part of tarantool/tarantool#13442 > --- > > Branch:https://github.com/tarantool/luajit/tree/skaplun/lj-1047-fix-funccw-arm64 > Related issues: > *https://github.com/LuaJIT/LuaJIT/issues/1047 > *https://github.com/tarantool/tarantool/issues/13442 > > Side note: CI on macOS x86_64 is red due to runner issues. > > src/lj_dispatch.c | 4 +- > .../lj-1047-fix-funccw-arm64.test.c | 105 ++++++++++++++++++ > 2 files changed, 107 insertions(+), 2 deletions(-) > create mode 100644 test/tarantool-c-tests/lj-1047-fix-funccw-arm64.test.c It is not clear why the test (or patch) is arm64-specific. Either explain in the commit message or remove suffix. --------------62p5agVz0d9to96qtnRim6JB Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey!

Thanks for the patch! Please see the comment below.

Sergey

On 11/23/26 10:09, Sergey Kaplun wrote:
From: Mike Pall <mike>

Thanks to Peter Cawley.

(cherry picked from commit 14e2917e7ab3d6f043d6604298bfa66470c6f47d)

Enabling and disabling wrapped C function mode [1] unconditionally
changes the bytecode to `BC_FUCC[W] 0 0`. The first operand (RA) is
unused for x86/x64 VMs, but other VMs use it like the minimum available
stack slots required for the function call (`LUA_MINSTACK` by default on
VM startup). Hence, these bytecode rewriting lead to the different
timing of the STACKOV error being raised (before the call or during the
invocation of the C function).

This patch makes the behaviour consistent across VMs by modifying only
the opcode without changing its operands. Hence the `LUA_MINSTACK`
value of the first operand is preserved.

[1]: https://luajit.org/ext_c_api.html#mode_wrapcfunc

Sergey Kaplun:
* added the description and the test for the problem

Part of tarantool/tarantool#13442
---

Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-1047-fix-funccw-arm64
Related issues:
* https://github.com/LuaJIT/LuaJIT/issues/1047
* https://github.com/tarantool/tarantool/issues/13442

Side note: CI on macOS x86_64 is red due to runner issues.

 src/lj_dispatch.c                             |   4 +-
 .../lj-1047-fix-funccw-arm64.test.c           | 105 ++++++++++++++++++
 2 files changed, 107 insertions(+), 2 deletions(-)
 create mode 100644 test/tarantool-c-tests/lj-1047-fix-funccw-arm64.test.c

It is not clear why the test (or patch) is arm64-specific.

Either explain in the commit message or remove suffix.

<snipped>

    
--------------62p5agVz0d9to96qtnRim6JB--