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 DB4A45BC4BC; Tue, 29 Aug 2023 12:59:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DB4A45BC4BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1693303168; bh=JkgCUD0VTgFBNTNFdVfEtfOshMNdwA7mHDpSBTwNHUE=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=lYqPcCAoj1piOH/qMhBxgPVUAFqMLC6ffJBGTtlfd0aNwXRx3jn3oQCpCZPaWVjwL XU1qN9CbAEsoyxQiPs7upTizOQ7+tVUXFvp6V4WasIHUwsbLGjmHt40zl0vTMLS6Mk GLvTU6BoC9DdX4aEpT0Vgibjj7SdrlWBBltYXrOU= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [95.163.41.86]) (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 04F3B5BC4B2 for ; Tue, 29 Aug 2023 12:59:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 04F3B5BC4B2 Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1qavVN-00GT7D-2M; Tue, 29 Aug 2023 12:59:26 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Tue, 29 Aug 2023 12:54:40 +0300 Message-ID: <20230829095440.30540-1-skaplun@tarantool.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9AE2E1BB6058F4E36552EA1C3F1CF6DBD59AE557CBA416E4D182A05F538085040FB167926F1DBD6EB8FF4F9719B671828C6F9D32104946D8D70E5E8B6859B9F0D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F1942E6D70B4A2F0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F10563012BA5CCB0EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BE5CCB53A13BC8DBA5F34EDEBB4FDDA04F0BC2EF592AA693DCC7F00164DA146DAFE8445B8C89999728AA50765F79006372389C3B161C5B535389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8989FD0BDF65E50FBF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947CB5C78E0E843E24DA9735652A29929C6C4AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3D264F704C83CBBC7BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE7BEE702378D8A34C7731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5F3F664D9E0D12CE8518A0FD3B40E4740B1F81E620164DE40F87CCE6106E1FC07E67D4AC08A07B9B00A6B3CD6EB70C818C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF77DD89D51EBB7742D3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFABA4663327D8954C88BD3C0692CC012C0AFE73F3657E1AB2C3DD627D54CBDFFEE781F4E203C570785088795BE9012648FB19D24B50E9440B9D29B428010EA5ADA74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojA5xtch+oMC4t/WoiIwN4Vg== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A7690342A59D371EFD9B8FF4F9719B671828009DB4CE3002C7DBDEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: [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: 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" 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