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 32FD56F3C8; Wed, 28 Sep 2022 10:40:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 32FD56F3C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1664350823; bh=FungRYcdHqa7y527LghtNB6rZzMpgnOEa2lLmcARHmw=; 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=Tra18pIExj7rnpkrPaDr0QWW9621rDUFuqC7+/eDnwl7p5n8jQ1wuS+1lIolfSMVt 4Uj7XhiitTWwCQILoHWiF71iCL3EYSICeMVQWwhk5eM+x4v9zrMCs07doxD5VdOwsQ XudE72llz8Qbq5mOjUnaQRIqsgglPD5VvuPcBzoI= Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (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 E73A86F3C8 for ; Wed, 28 Sep 2022 10:40:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E73A86F3C8 Received: by smtp50.i.mail.ru with esmtpa (envelope-from ) id 1odRg3-0006gJ-Dz; Wed, 28 Sep 2022 10:40:20 +0300 Date: Wed, 28 Sep 2022 10:37:24 +0300 To: sergos Message-ID: References: <20220912080158.12220-1-skaplun@tarantool.org> <1663573807.727706952@f769.i.mail.ru> <8E2BF2B3-C6BA-4F3E-A9AE-DA8F8413C4AF@tarantool.org> <1663667902.185627333@f160.i.mail.ru> <7378A34A-6A2D-4634-B7A0-C9AA33267042@tarantool.org> <304DA549-389D-468A-80F5-7424FF84FCF9@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <304DA549-389D-468A-80F5-7424FF84FCF9@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD99929F1169E77FC7AA3CC1720AE12F5C8687AA5D7BD2FA789182A05F538085040F14E5DD47277EF87F2764A51A3138DDD52516AA4F5B6B816C361CC1D880D4B78 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE741DC22BF90A736D8EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637A85D247F7B1E5F958638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D87FEE2A22FDEBF2BAE65B45831C43A73F117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCFF6C1D329F95ABD4A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE042285CD7A5C321F6E0066C2D8992A164AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C325C33BDE98D8A053BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637149D0840703ADBE5EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E142185AC9E3593CE4B31AB1881A6453793CE9274300E5CE05BD4401A9E91200F654B08B38D1BE91256DA7F04B2EF7FE17FE7718317389112337EDAAAB7FB2358F51D89C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D345C064E16D8ABF335B32372A40AC9DB786396093A70F62AE24F10C4B4B624626F00CC1C20F60512451D7E09C32AA3244CFDB708793F62C24065FD55B491CA30858580396430872480FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojVySwzd+bxOdUlgoNJbcrkA== X-Mailru-Sender: 11ABF2DAD5F2676891056722DE4A719EBFFB5739B20C9CFFF2764A51A3138DDD1442BDFAA4939184DEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] FFI: Add tonumber() specialization for failed conversions. 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, Sergos! On 26.09.22, sergos wrote: > Since we fallback to interpreter it looks safe to keep the test for GC64. > Still you’d better mention it in commit message. Strictly saying, this problem still exists for GC64 mode if we get the cdata argument to record via loading from a table, for example. I didn't modify the recorded function `check()` to keep the test case clear. I just added the following comment behind. =================================================================== diff --git a/test/tarantool-tests/lj-408-tonumber-cdata-record.test.lua b/test/tarantool-tests/lj-408-tonumber-cdata-record.test.lua index 1c175de1..bf9e8e46 100644 --- a/test/tarantool-tests/lj-408-tonumber-cdata-record.test.lua +++ b/test/tarantool-tests/lj-408-tonumber-cdata-record.test.lua @@ -14,6 +14,15 @@ local NULL = ffi.cast('void *', 0) test:plan(4) +-- This test won't fail for GC64 on x86_64. This happens due to +-- wrong instruction emitting for SLOAD IR -- we always exit by +-- the assertion guard on the argument type check. See also +-- https://github.com/LuaJIT/LuaJIT/pull/350. +-- The test fails without fix in the current commit, if the +-- following commit is backported: +-- https://github.com/LuaJIT/LuaJIT/commit/05fbdf56 +-- Feel free to remove this comment after backporting of the +-- aforementioned commit. local function check(x) -- Don't use a tail call to avoid "leaving loop in root trace" -- error, so the trace will be compiled. =================================================================== The branch is force-pushed. > > LGTM with above. > > Sergos > > > > On 22 Sep 2022, at 14:28, Sergey Kaplun wrote: > > > > Hi, Sergos! > > > > On 21.09.22, sergos wrote: > >> Hi! > >> > >> I see four ‘ok’s as a result of run. > >> See the full output for the run with dump() below: > >> > >> > >> s.ostanevich@s-ostanevich2:~/workspaces/t.sergos/third_party/luajit/test/tarantool-tests % ../../../../build-debug/src/tarantool -e 'require"jit.dump".start("ib")' lj-408-tonumber-cdata-record.test.lua > >> > >> TAP version 13 > >> 1..4 > >> ---- TRACE 1 start lj-408-tonumber-cdata-record.test.lua:17 > >> 0001 GGET 1 0 ; "tonumber" > >> 0002 MOV 3 0 > >> 0003 CALL 1 2 2 > >> 0000 . FUNCC ; tonumber > >> 0004 RET1 1 2 > >> ---- TRACE 1 IR > >> 0001 fun SLOAD #0 R > >> 0002 tab FLOAD 0001 func.env > >> 0003 int FLOAD 0002 tab.hmask > >> 0004 > int EQ 0003 +63 > >> 0005 p64 FLOAD 0002 tab.node > >> 0006 > p64 HREFK 0005 "tonumber" @8 > >> 0007 > fun HLOAD 0006 > >> 0008 > cdt SLOAD #2 T > >> 0009 > fun EQ 0007 tonumber > >> ---- TRACE 1 stop -> return > > > > Gotcha! > > It's a funny thing: > > This is happening due to GC64 mode on x86_x64. > > > > There is an invalid type check for SLOAD IR with the following emitted > > mcode: > > > > | 55557f6bffc9 mov rdi, [rdx+0x4] > > | 55557f6bffcd sar rdi, 0x2f > > | 55557f6bffd1 cmp edi, -0x0b > > | 55557f6bffd4 jnz 0x55557f6b0010 ->0 > > > > This 0x4 addiction is crucial: > > We got the invalid irtype value to compare (due wrong addressing) -- so > > the assertion guard is always failed and we always exit from the trace. > > This is why we fallback into the interpreter and the test is passed. > > > > In LuaJIT upstream this issue fixed via the following commit: > > https://github.com/LuaJIT/LuaJIT/commit/05fbdf56 > > > > See also https://github.com/LuaJIT/LuaJIT/pull/350 > > > > > > > >> > > > > -- > > Best regards, > > Sergey Kaplun > -- Best regards, Sergey Kaplun