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 707075D11D7; Wed, 30 Aug 2023 13:37:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 707075D11D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1693391879; bh=RXuJfFp72tOVNcn3cDFmUkFsMgV2Zo6eSJ2bLeNHxYA=; 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=Lsl6fHnAEoTeKlCJeFKdttBwBR2MpSTNtGMGL2jS2POKPUD+rrf84YofdS8HT0mmm 9WaaLXKNvumul3PKr+0pnCQjKJmjIVNveqnd5q3qBi/Tk4xwCJ25IZQE7q3c3Dak0X zjD/r/IXu6Jrm1lqSUU2mJOJnIyCafhOddokn3iA= Received: from smtp53.i.mail.ru (smtp53.i.mail.ru [95.163.41.90]) (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 048B2540BC1 for ; Wed, 30 Aug 2023 13:37:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 048B2540BC1 Received: by smtp53.i.mail.ru with esmtpa (envelope-from ) id 1qbIaC-000eLn-39; Wed, 30 Aug 2023 13:37:57 +0300 Date: Wed, 30 Aug 2023 13:37:56 +0300 To: Sergey Kaplun Message-ID: References: <20230829095440.30540-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230829095440.30540-1-skaplun@tarantool.org> X-Mailru-Src: smtp X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD96E142CFC92DB15CDE741B5A425A82425F40C3C491EBE3605182A05F538085040E1C227573160106CC9B1DC9C28B170E62115AB83AD70F6D751860CDC3DF35DF7 X-C1DE0DAB: 0D63561A33F958A5F8345AC2EEE4C3EBBD71C1B1F19D36ABE82865275326A57DF87CCE6106E1FC07E67D4AC08A07B9B0E753FA5741D1AD02CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0AD5177F0B940C8B66ECE892A7B2722663E91682638B966EB3F662256BEEFA9527FDC9A9BBC7732A4D079F3F9B69D59768E455D184910967DDF076F0538ED196A896471360B95630C6237FD76D11AF80A0D48A6F6FD314487FA192CF80B6C800D32EA455F16B58544A2557BDE0DD54B3590965026E5D17F6739C77C69D99B9914278E50E1F0597A6FD5CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojA5xtch+oMC4DRfew5JvfYQ== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE40731E8FF0654BD11B15A7F55CE581C2C526C1AAAEF533A82E5D51284F0FE6F529ABC7555A253F5B200DF104D74F62EE79D27EC13EC74F6107F4198E0F3ECE9B5443453F38A29522196 X-Mras: OK Subject: Re: [Tarantool-patches] [PATCH luajit] Fix handling of instable types in TNEW/TDUP load forwarding. 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the patch! LGTM On Tue, Aug 29, 2023 at 12:54:40PM +0300, Sergey Kaplun wrote: > From: Mike Pall > > Analyzed by Sergey Kaplun. > > (cherry-picked from commit 9f452bbef5031afc506d8615f5e720c45acd6fdf) > > This is a follow-up for the commit > a9d183b2be63fd91be4b8c9494c213c56c491092 ("Fix TNEW load forwarding with > instable types."). It fixes a similar issue, but for TDUP load > forwarding. > > Sergey Kaplun: > * added the description and the test for the problem > > Part of tarantool/tarantool#8825 > --- > > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-994-load-fwd-instable-types-tdup > Tarantool PR: https://github.com/tarantool/tarantool/pull/9053 > Related issues: > * https://github.com/LuaJIT/LuaJIT/issues/994 > * https://github.com/tarantool/tarantool/issues/8825 > > src/lj_opt_mem.c | 4 ++-- > .../lj-994-instable-types-during-loop-unroll.test.lua | 8 +------- > 2 files changed, 3 insertions(+), 9 deletions(-) > > diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c > index 59fddbdd..3c58d342 100644 > --- a/src/lj_opt_mem.c > +++ b/src/lj_opt_mem.c > @@ -194,8 +194,8 @@ static TRef fwd_ahload(jit_State *J, IRRef xref) > if (key->o == IR_KSLOT) key = IR(key->op1); > lj_ir_kvalue(J->L, &keyv, key); > tv = lj_tab_get(J->L, ir_ktab(IR(ir->op1)), &keyv); > - lj_assertJ(itype2irt(tv) == irt_type(fins->t), > - "mismatched type in constant table"); > + if (itype2irt(tv) != irt_type(fins->t)) > + return 0; /* Type instability in loop-carried dependency. */ > if (irt_isnum(fins->t)) > return lj_ir_knum_u64(J, tv->u64); > else if (LJ_DUALNUM && irt_isint(fins->t)) > diff --git a/test/tarantool-tests/lj-994-instable-types-during-loop-unroll.test.lua b/test/tarantool-tests/lj-994-instable-types-during-loop-unroll.test.lua > index 730b0e61..6e2cf5ed 100644 > --- a/test/tarantool-tests/lj-994-instable-types-during-loop-unroll.test.lua > +++ b/test/tarantool-tests/lj-994-instable-types-during-loop-unroll.test.lua > @@ -10,7 +10,7 @@ local test = tap.test('lj-994-instable-types-during-loop-unroll'):skipcond({ > > -- TODO: test that compiled traces don't always exit by the type > -- guard. See also the comment for the TDUP test chunk. > -test:plan(1) > +test:plan(2) > > -- TNEW. > local result > @@ -34,11 +34,6 @@ end > test:is(result, nil, 'TNEW load forwarding was successful') > > -- TDUP. > ---[[ > --- FIXME: Disable test case for now. Enable, with another > --- backported commit with a fix for the aforementioned issue > --- (and after patch "Improve assertions."). > --- Test taken trace exits too. > for _ = 1, 5 do > local t = slot > -- Now use constant key slot to get necessary branch. > @@ -48,6 +43,5 @@ for _ = 1, 5 do > slot = _ % 2 ~= 0 and stored_tab or {true} > end > test:is(result, true, 'TDUP load forwarding was successful') > -]] > > test:done(true) > -- > 2.42.0 >