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 F3F3272F6E8; Tue, 12 Dec 2023 13:14:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F3F3272F6E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1702376075; bh=t1kaEkFzirpG1Hb1+hQdWw5+ySLozLeubZ7dSRNma10=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ovAzK08nO5CkAFHrxaM0Eoq9l12Mfcfdqxpsvd1etHnHu74WWuW4d15b8KooM6YrE TIKvAaiAdzF6StU7gjBqP3XFHCBYBbdmasR5aNi45CNR2+9hyqcwC+472CObTRPw9f AQSjJUd+8jeUTc+lzb23rSxtS7iXyfSZrmyjgnMU= Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [95.163.41.96]) (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 0C53A72F6C1 for ; Tue, 12 Dec 2023 13:14:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0C53A72F6C1 Received: by smtp58.i.mail.ru with esmtpa (envelope-from ) id 1rCzma-00HM7r-1n; Tue, 12 Dec 2023 13:14:33 +0300 Date: Tue, 12 Dec 2023 13:10:00 +0300 To: Maxim Kokryashkin Message-ID: References: <20231211153520.9322-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9B1592A052B88CCADA8593BE3AFB895B57F888ED933B199AE1313CFAB8367EF908E2BE116634AD74D4867C63F0292B86A9ABF9DF76AFA57A3B19B4B66BD655AAC724492119CBD5D09 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73DDC6BBB7CD71318EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373D332FFE8BBF4EB58638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8429FEA84F039EE84C19DC44059941385117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF80095D1E57F4578A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD186FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE0AC5B80A05675ACDA5FD2DD08EB4836CD8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3F8BD4E506CFA3D88040F9FF01DFDA4A8C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB861051D4BA689FC2E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F890A246B268E114E42539A7722CA490CB5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A5662AD3D359C1EBFB6FA6B81CABC59A117EF99FC0F73872F6F87CCE6106E1FC07E67D4AC08A07B9B064E7220B7C550592CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFC9F5F9FBFC43D50DB4A9E56ED6603484A6675DED4C0BB7216A99AEBAE9C7E9AE60B027A3EDF90BC1FC43826C574F1C6F7A444E66A17E51EF5B52E77F091CEFD1E48CAC7CA610320002C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojm/AwjadTR3QVaA6r2dS1lQ== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A76908D2D3DE8BAD7E8B33CAB6519061B4F85F9045B74F665CC8DEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Emit sunk IR_NEWREF only once per key on snapshot replay. 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 Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Maxim! Thanks for the review! Fixed your comments and force-pushed the branch. On 12.12.23, Maxim Kokryashkin wrote: > Hi, Sergey! > Thanks for the patch! > Please consider my comments below. > > On Mon, Dec 11, 2023 at 06:35:20PM +0300, Sergey Kaplun wrote: > > From: Mike Pall > > > > Thanks to Sergey Kaplun and Peter Cawley. > > > > (cherry-picked from commit 1761fd2ef79ffe1778011c7e9cb03ed361b48c5e) > > +-- Uncompiled function to end up side trace here. > > +local function trace_base_wp(num) > > + return trace_base(num) > > +end > > +jit.off(trace_base_wp) > > + > > +-- Same function as above, but with two IRs NEWREF emitted. > Please mention that this test cases checks situation when last NEWREF > is not the same. Fixed, see the iterative patch below. > > +local function trace_2newref(num) > > + local tab = {} > > + tab.key = false > > + -- This + op can't be folded since `num` can be -0. > > + tab.key = num + 0 > > + tab.key2 = false > > + -- This check can't be folded since `num` can be NaN. > > + tab.key2 = num == num > > + -- luacheck: ignore > > + if take_side then end > > + return tab.key, tab.key2 > > +end > Nit: `key` and `key2` naming seems a bit inconsistent. Fixed, thanks! =================================================================== diff --git a/test/tarantool-tests/lj-1128-double-ir-newref-on-restore-sunk.test.lua b/test/tarantool-tests/lj-1128-double-ir-newref-on-restore-sunk.test.lua index a89beab6..77efd0f4 100644 --- a/test/tarantool-tests/lj-1128-double-ir-newref-on-restore-sunk.test.lua +++ b/test/tarantool-tests/lj-1128-double-ir-newref-on-restore-sunk.test.lua @@ -37,17 +37,18 @@ end jit.off(trace_base_wp) -- Same function as above, but with two IRs NEWREF emitted. +-- The last NEWREF references another key. local function trace_2newref(num) local tab = {} - tab.key = false + tab.key1 = false -- This + op can't be folded since `num` can be -0. - tab.key = num + 0 + tab.key1 = num + 0 tab.key2 = false -- This check can't be folded since `num` can be NaN. tab.key2 = num == num -- luacheck: ignore if take_side then end - return tab.key, tab.key2 + return tab.key1, tab.key2 end -- Uncompiled function to end up side trace here. =================================================================== > > + > > +-- Uncompiled function to end up side trace here. > > +local function trace_2newref_wp(num) > > + return trace_2newref(num) > > +end > > +jit.off(trace_2newref_wp) > > + > > +jit.opt.start('hotloop=1', 'hotexit=1', 'tryside=1') > > + > > +-- Compile parent traces. > > +trace_base_wp(0) > > +trace_base_wp(0) > > +trace_2newref_wp(0) > > +trace_2newref_wp(0) > > + > > +-- Compile side traces. > > +take_side = true > > +trace_base_wp(0) > > +trace_base_wp(0) > > +trace_2newref_wp(0) > > +trace_2newref_wp(0) > > + > > +test:is(trace_base(0), true, 'sunk value restored correctly') > > + > > +local arg = 0 > > +local r1, r2 = trace_2newref(arg) > > +test:is(r1, arg, 'sunk value restored correctly with 2 keys, first key') > > +test:is(r2, true, 'sunk value restored correctly with 2 keys, second key') > These assertions pass before the patch. Is this expected behavior? If > so, please drop a comment. Added: =================================================================== diff --git a/test/tarantool-tests/lj-1128-double-ir-newref-on-restore-sunk.test.lua b/test/tarantool-tests/lj-1128-double-ir-newref-on-restore-sunk.test.lua index a89beab6..77efd0f4 100644 --- a/test/tarantool-tests/lj-1128-double-ir-newref-on-restore-sunk.test.lua +++ b/test/tarantool-tests/lj-1128-double-ir-newref-on-restore-sunk.test.lua @@ -75,6 +76,8 @@ test:is(trace_base(0), true, 'sunk value restored correctly') local arg = 0 local r1, r2 = trace_2newref(arg) +-- These tests didn't fail before the patch. +-- They check the patch's correctness. test:is(r1, arg, 'sunk value restored correctly with 2 keys, first key') test:is(r2, true, 'sunk value restored correctly with 2 keys, second key') =================================================================== > > + > > +test:done(true) > > -- > > 2.43.0 > > -- Best regards, Sergey Kaplun