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 97CE86F3C8; Thu, 22 Sep 2022 14:30:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 97CE86F3C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1663846257; bh=wnCes+erBJw4CjSXgMRlP6roJTACh+Aky4i3hgF6KyI=; 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=lw4TMjGI9O/MVtl7Uk0eNKJvaKU3EORrMI2h1nCt6+u1F1sqdHHDM3H+qNM3wiIEF fcEGUd8+9jhdRaQlH/EYNK1a7tNgP1M0MqX2brhAPuZvfSe315urHMjBNtveK5caM3 gZTZ58h7jCeUtsi5z4WALHbLFz7bZfhA94M5Q0vM= Received: from smtp44.i.mail.ru (smtp44.i.mail.ru [94.100.177.104]) (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 992296F3C8 for ; Thu, 22 Sep 2022 14:30:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 992296F3C8 Received: by smtp44.i.mail.ru with esmtpa (envelope-from ) id 1obKPv-0000dl-Qx; Thu, 22 Sep 2022 14:30:56 +0300 Date: Thu, 22 Sep 2022 14:28:11 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7378A34A-6A2D-4634-B7A0-C9AA33267042@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9EBD81B01C038F8F3599E352275EC4F4DB34066843E24BA54182A05F53808504041F6E151CC9BEABEA02F25D3FBD5632588FA9DF9BCAF9EA01B1055001B9ED345 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7235646FAB97B4BEDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BE899A9B5C1209058638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8B276DFCFC8D7030A73F2E94D4B85EEAF117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC1F8789D36234D406A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EED76C6ED7039589DE287C8E22D4AE2A51D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3A816C540FC8EEC30302FCEF25BFAB345C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B80B9CEB5436E71E375ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E142185AC9E3593CE4B31AB1881A6453793CE9274300E5CE05BD4401A9E91200F654B0D4C601CEA03E70EE5036A336AC3467B414BF2A8985B7FEB9220340C8D07994009C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D347D10A9FCB2A62DFEC751B82A0B6FEB2661B1BFAC12368AB682A5DD9DDFEED4865D6432133DDCCB8A1D7E09C32AA3244C3AB19E5E2E8EA22BE1125593A9B53C81F26BFA4C8A6946B8FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojS8Mlo6Y3xQmgNKBjrNQb7w== X-Mailru-Sender: F16D9CAFEEA6770E7B6EAD4ADB3BCAF05E869DE3B0021B12C7A3C661E0625EBAB6D7C204EFE07EBBF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A84198E0F3ECE9B5443453F38A29522196 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 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