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 A542B6F3C8; Wed, 21 Sep 2022 11:51:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A542B6F3C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1663750293; bh=Ie4lLn48GXQ+SkWLIfMv9meDXoqAKNB6vMTjdE6dmts=; 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=YL6XkP79xbKeq5OPhHwrNupbTj9tNsSLBR7vSE3CT+1gp0OBmxGsqKZX6ZDw9uKLH yGKupGFfIXRUmpKbko3qRMymRthx0ATuUNE/WClINUV6d3+GcN0njUM6040/agRJyT 9krBXkBnjBMax5Hbk0zBeQQxzldSTMAKMrNnvzlM= Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [94.100.177.96]) (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 AA4C46F3C8 for ; Wed, 21 Sep 2022 11:51:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AA4C46F3C8 Received: by smtp36.i.mail.ru with esmtpa (envelope-from ) id 1oavS6-00078x-UR; Wed, 21 Sep 2022 11:51:31 +0300 Date: Wed, 21 Sep 2022 11:48:47 +0300 To: Maksim Kokryashkin Message-ID: References: <20220920111649.86190-1-max.kokryashkin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220920111649.86190-1-max.kokryashkin@gmail.com> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9EBD81B01C038F8F36A57FB7662AB83D96380708D891104AE182A05F538085040060B7854F61626ABCF219A1620BE99B9DE718D232E97DD99F39A158B964429CD X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74260010D6E447003EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006374F897F3E43A934888638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8ECA3AAE84518753980A0EB46E76BD3E0117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAB5495298CADBD05A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18CB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEC24E1E72F37C03A08F49F126DDB898E8D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE367F1C1C3ABB44F3A6E0066C2D8992A16C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637EC3198ECE464ADAEEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E142185AC9E3593CE4B31AB1881A6453793CE9274300E5CE05BD4401A9E91200F654B08B38D1BE91256DA74BE6EA2CDDC0A3E05BD3D47BB07DEAF3A8693E443F29018D9C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D345B8C2BEC800D1021BCE4F4CEC055CACC07D82D58488CA29CFD016304C85B9CF7FF71CF1443DDB4E31D7E09C32AA3244C986C29A0871BA222057BB658588DE506A95CA90A1D8AC565FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojii4D+KDnlyqfatgZMKJafA== X-Mailru-Sender: F16D9CAFEEA6770E7B6EAD4ADB3BCAF07593C8172B287BF05F88E2BA3A5ECF383C7394056920479DF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A84198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v2] Fix narrowing of unary minus. 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 fixes! LGTM, except a few nits below. On 20.09.22, Maksim Kokryashkin wrote: > From: Mike Pall > > src/lj_opt_narrow.c | 9 +++- > .../gh-6976-narrowing-of-unary-minus.test.lua | 51 +++++++++++++++++++ > 2 files changed, 58 insertions(+), 2 deletions(-) > create mode 100644 test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua > > diff --git a/src/lj_opt_narrow.c b/src/lj_opt_narrow.c > index cd96ca4b..bb61f97b 100644 > --- a/src/lj_opt_narrow.c > +++ b/src/lj_opt_narrow.c > diff --git a/test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua b/test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua > new file mode 100644 > index 00000000..18778a55 > --- /dev/null > +++ b/test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua > @@ -0,0 +1,51 @@ > +local tap = require('tap') > +local test = tap.test('gh-6976-narrowing-of-unary-minus') > +test:plan(2) > + > +jit.opt.start('hotloop=1', 'hotexit=1') As far as we use `table.new` there is no table resizing, so there are no exits from traces to compile and 'hotexit=1' can be removed. > + > +local function check(routine) > + jit.off() > + jit.flush() > + local interp_res = routine() > + jit.on() > + local jit_res = routine() > + > + for i = 1, #interp_res do > + if interp_res[i] ~= jit_res[i] then > + return false > + end > + end > + > + return true > +end > + > +test:ok( Minor: I suggest the following indentation to make this chunk more readable: | test:ok(check(function() | local res = require('table.new')(3, 0) | for _ = 1, 3 do | local zero = 0 | zero = -zero | table.insert(res, tostring(zero)) | end | return res | end), 'incorrect recording for zero') Feel free to ignore. > + check( > + function() > + local res = require('table.new')(3, 0) Please, add a comment why do we use `table.new` here. > + for _ = 1, 3 do > + local zero = 0 > + zero = -zero > + table.insert(res, tostring(zero)) Minor: we need `tostring()` routine to get different strings for -0 and 0, as far as 0 == -0 as numbers. Please, add the corresponding comment. > + end > + return res > + end > + ), > + 'incorrect recording for zero' > +) > + Ditto, about indentation. Feel free to ignore. > +test:ok( > + check( > + function() > + local res = require('table.new')(3, 0) > + for i = 2, 0, -1 do > + table.insert(res, tostring(-i)) > + end > + return res > + end > + ), > + 'assertion guard fail' > +) > + > +os.exit(test:check() and 0 or 1) > -- > 2.32.1 (Apple Git-133) > -- Best regards, Sergey Kaplun