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 303816ECE3; Thu, 14 Jul 2022 14:54:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 303816ECE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1657799673; bh=rlAaUI0EI2r/nOomq47v44R9LaOYx3U8NBZ8a23GqTw=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ACOCg1v5LJBLw//d8KwClA+gCvXfXsmxv+UIrtoqdYTglYqatLBC5TtqW/gP2RCdQ 53KA8db9jsYVZBPVnTEYzQJg2ceeE8hAKHR2+/8in6m5lWnqkNiWYU4GsPNRZRSTsu 4a1FZ2UqXdRNP5bROEFOkgRkFLdB+BslevmhqkGI= Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id BD2D86ECE3 for ; Thu, 14 Jul 2022 14:54:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BD2D86ECE3 Received: by smtp3.mail.ru with esmtpa (envelope-from ) id 1oBxQN-0004bq-17; Thu, 14 Jul 2022 14:54:31 +0300 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) In-Reply-To: <20220713095349.31718-1-skaplun@tarantool.org> Date: Thu, 14 Jul 2022 14:54:30 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <8B86F311-0882-4D94-9FD4-EB93EB11393C@tarantool.org> References: <20220713095349.31718-1-skaplun@tarantool.org> To: Sergey Kaplun X-Mailer: Apple Mail (2.3696.100.31) X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9E1E7861EDEC0DEA65A68347C9B259EB908949543F36DD78A00894C459B0CD1B950CD2CCB88FA40BD99862127F5017363E60E4EEBB8EF1C0E780541A005FBAD07 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F8E53417176C7207EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063788758EA7442DD2858638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8DD63D7129F4BDF007B09EB4ABF1BF4D5117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2F22DFD7D6B35478A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10FCB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4B8F49F126DDB898E8D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3A7DFDF579AB090EF2D242C3BD2E3F4C6C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637F765F39FA4E70FFE43847C11F186F3C59DAA53EE0834AAEE X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E142185AC9E3593CE4B31AB1881A6453793CE9274300E5CE05BD4401A9E91200F654B0D4C601CEA03E70EEEEDD2DF4914E7A124BCFDA19C3F9C9812C0AB5DDEA84657B9C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349A949488F6BF46DD0EC455FF05E5365D837C8B669789829E414DA2CE58E543B28E5AF06589EAC6CA1D7E09C32AA3244CEDCCD5CFD902DC973E0E21FA25631EECF94338140B71B8EEFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojpV6+aF9js3/SUlcUzWMzcQ== X-Mailru-Sender: 5AA3D5B9D8C486460F131602D6A791BC249502CADD0AB82A822A716568841D19D2623EF30751231B19381EE24192DF5555834048F03EF5D4C9A814A92B2E3B1BA4250FC3964EA4964198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] LJ_GC64: Fix IR_VARG offset for fixed number of results. 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: sergos via Tarantool-patches Reply-To: sergos Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch, some updates to the test. Regards, Sergos > On 13 Jul 2022, at 12:53, Sergey Kaplun wrote: >=20 > From: Mike Pall >=20 > Reported by George Vaintrub. Fixed by Sergey Kaplun. >=20 > (cherry picked from commit 6bda30d8c745b3963ba870221b9be6acdffed9b1) >=20 > This bug occurs when recording `BC_VARG` with the following = conditions: > 1) varargs undefined on trace. Later in the test you just mention its size should be bigger than = results=E2=80=99 one? > 2) known fixed number of results. >=20 > For this case the vararg slots loads via `IR_VLOAD` by offset from are loaded by using an > vararg base. In GC64 mode this offset was miscounting due to missing the the is miscounted > `LJ_FR2` correction in the base TRef calculation. As the result the > wrong (+1) vararg slot is used. >=20 > This patch adds the missing the aforementioned `LJ_FR2` correction. xxx >=20 > Sergey Kaplun: > * added the description and the test for the problem >=20 > Resolves tarantool/tarantool#7172 > Part of tarantool/tarantool#7230 > --- >=20 > Branch: = https://github.com/tarantool/luajit/tree/skaplun/lj-864-varg-rec-base-offs= et-full-ci > Issues: > * https://github.com/tarantool/tarantool/issues/7172 > * https://github.com/LuaJIT/LuaJIT/issues/864 >=20 > src/lj_record.c | 2 +- > .../lj-864-varg-rec-base-offset.test.lua | 25 +++++++++++++++++++ > 2 files changed, 26 insertions(+), 1 deletion(-) > create mode 100644 = test/tarantool-tests/lj-864-varg-rec-base-offset.test.lua >=20 > diff --git a/src/lj_record.c b/src/lj_record.c > index a11f3712..9e2e1d9e 100644 > --- a/src/lj_record.c > +++ b/src/lj_record.c > @@ -1794,7 +1794,7 @@ static void rec_varg(jit_State *J, BCReg dst, = ptrdiff_t nresults) > emitir(IRTGI(IR_EQ), fr, > lj_ir_kint(J, (int32_t)frame_ftsz(J->L->base-1))); > vbase =3D emitir(IRT(IR_SUB, IRT_IGC), REF_BASE, fr); > - vbase =3D emitir(IRT(IR_ADD, IRT_PGC), vbase, lj_ir_kint(J, = frofs-8)); > + vbase =3D emitir(IRT(IR_ADD, IRT_PGC), vbase, lj_ir_kint(J, = frofs-8*(1+LJ_FR2))); = Wherearemyspaces? = (nevermind, just a moan) > for (i =3D 0; i < nload; i++) { > IRType t =3D itype2irt(&J->L->base[i-1-LJ_FR2-nvararg]); > TRef aref =3D emitir(IRT(IR_AREF, IRT_PGC), > diff --git a/test/tarantool-tests/lj-864-varg-rec-base-offset.test.lua = b/test/tarantool-tests/lj-864-varg-rec-base-offset.test.lua > new file mode 100644 > index 00000000..ca30f92f > --- /dev/null > +++ b/test/tarantool-tests/lj-864-varg-rec-base-offset.test.lua > @@ -0,0 +1,25 @@ > +local tap =3D require('tap') > + > +-- Test file to demonstrate LuaJIT misbehaviour during recording > +-- BC_VARG with nvarargs >=3D nresults in GC64 mode. In the message you say it should be unknown. What=E2=80=99s the dirty = truth is? > +-- See also https://github.com/LuaJIT/LuaJIT/issues/864, > +-- https://github.com/tarantool/tarantool/issues/7172. > +local test =3D tap.test('lj-864-varg-rec-base-offset') > +test:plan(1) > + > +jit.opt.start('hotloop=3D1') > + > +local MAGIC =3D 42 Should be enough to test against the first argument, no MAGIC :) > +local function test_rec_varg(...) > + local slot1 > + for _ =3D 1, 3 do > + slot1 =3D ... > + end ++ args =3D {...} +- return slot1 =3D=3D args[1] > +end > + > +-- Test case for nvarargs >=3D nresults. Equality is not suitable > +-- due to failing assertion guard for type of loaded vararg slot. > +test:ok(test_rec_varg(MAGIC, 0), 'correct BC_VARG recording') > + > +os.exit(test:check() and 0 or 1) > --=20 > 2.34.1 >=20