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 BAE856E674A; Mon, 20 Nov 2023 11:56:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BAE856E674A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1700470593; bh=8Vi73u4/wsQA91f54tNKIrQLXawoSuUaW+Am7ZzDREE=; 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=oQuouP7jCZ3E6rl86w+WVSwXEktm9B9mZpF1jybpS13xouQyaGYcMFnLK1a7lId98 AtEK8tzGmw7R6PWIpHTvyu2FwxHIxMfF7ufzwsls/QnFbuqsq8/3sqDVG4YUlHHpch xaYUtdH+JrwCNKqrtbusy4HppTuJXcqInB4nW2so= Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [95.163.41.87]) (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 EE30B6E674A for ; Mon, 20 Nov 2023 11:56:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EE30B6E674A Received: by smtp51.i.mail.ru with esmtpa (envelope-from ) id 1r5050-0018fl-0l; Mon, 20 Nov 2023 11:56:30 +0300 Date: Mon, 20 Nov 2023 11:51:57 +0300 To: Sergey Bronnikov Message-ID: References: <20231116084959.24798-1-skaplun@tarantool.org> <4ef24841-3ff6-4dd4-9c25-ab80c2a041c5@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ef24841-3ff6-4dd4-9c25-ab80c2a041c5@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD93F1575C7510F5547D25917A9C8A3601FF489A39E1D724A1300894C459B0CD1B9B7C5CBBA9826B70A2B8E48213BBC2761EA0BB5E2BD04166D4E552D6BF4A3C874 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B9EA053ECF1425EFEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370CE4B4B08BC34B6C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F92F1EDE1CF71C5E46BCE12B7486F6C7117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD186FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE0AC5B80A05675ACDB78CF848AE20165DD8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3093C2F12201C912A6E0066C2D8992A16C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CA9FF340AA05FB58C2E808ACE2090B5E1725E5C173C3A84C317B107DEF921CE79089D37D7C0E48F6C8AA50765F790063710A74FE5B09D3CF8731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A51D73EB01707E4143FB11D05FF4AF8DC58351C2138419A1DFF87CCE6106E1FC07E67D4AC08A07B9B02A336C6518635091CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFB7CCFA2E54EC6D56D51F9A79EDE9602BF7B55B265ECA60428B6AFBFCCCCBBBAE9C8755E3AEA661EF88AD3775A6B0C834FBA133CE7CCF915D07D2E2E8DC289B63E48CAC7CA610320002C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmRIjd71J0y0FfxngzWDCKg== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A7694DD21DDC0273C100DB40E6B1B68FD059FE5F7FEA15315F16DEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Add NaN check to IR_NEWREF. 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, Sergey! Thanks for the review! Fixed your comment and force-pushed the branch. On 18.11.23, Sergey Bronnikov wrote: > Hello, Sergey, > > > thanks for the patch. LGTM > > See my comments below. > > > On 11/16/23 11:49, Sergey Kaplun wrote: > > From: Mike Pall > > > > Thanks to Peter Cawley. > > > > (cherry-picked from commit 7f9907b4ed0870ba64342bcc4b26cff0a94540da) > > > > When emitting IR NEWREF, there is no check for a non-NaN stored key > > value. Thus, when the NaN number value is given to trace, it may be > > stored as a key. This patch adds the corresponding check. If fold > > optimization is enabled, this IR EQ check is dropped if it references > > CONV IR from any (unsigned) integer type since NaN can be created via > > conversion from an integer. > > > > Sergey Kaplun: > > * added the description and the test for the problem > > > > Part of tarantool/tarantool#9145 > > --- > > > > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-1069-newref-nan-key > > Tarantool PR: https://github.com/tarantool/tarantool/pull/9374 > > Fuzzer link: https://oss-fuzz.com/testcase-detail/5251574662037504 > Updated https://github.com/tarantool/tarantool/wiki/Fuzzing Thanks! > > Relate issues: > > * https://github.com/LuaJIT/LuaJIT/issues/1069 > > * https://github.com/tarantool/tarantool/issues/9145 > > > > src/lj_opt_fold.c | 5 +- > > src/lj_record.c | 12 +- > > .../lj-1069-newref-nan-key.test.lua | 151 ++++++++++++++++++ > > 3 files changed, 164 insertions(+), 4 deletions(-) > > create mode 100644 test/tarantool-tests/lj-1069-newref-nan-key.test.lua > > > > + > > + local tset_table = table_new(0, NKEYS) > > + > > + local function tset(t, k) > > + -- Value doesn't matter. > > + t[k] = true > > + end > > + > > + -- Compile the function. > > + jit.opt.start('hotloop=1') > > + > > + -- Use number keys to emit NEWREF. > > + tset(tset_table, 0.1) > > + tset(tset_table, 0.2) > > + > > + -- Insert NaN on the trace. > > + local ok, err = pcall(tset, tset_table, NaN) > > + > > + subtest:ok(not ok, 'function returns an error') > > + subtest:like(err, 'table index is NaN', 'correct error message') > > + > > + local nkeys = 0 > > + for k in pairs(tset_table) do > > + nkeys = nkeys + 1 > > + subtest:ok(k == k, ('not NaN key by number %d'):format(nkeys)) > > + end > > + subtest:is(nkeys, NKEYS - 1, 'correct amount of keys') > > +end) > > + > > +test:test('NaN on trace in the non-constant IR CONV', function(subtest) > > + local tonumber = tonumber > What for do you need this? Added the following comment for clarification: =================================================================== diff --git a/test/tarantool-tests/lj-1069-newref-nan-key.test.lua b/test/tarantool-tests/lj-1069-newref-nan-key.test.lua index 22553423..67b4f5b3 100644 --- a/test/tarantool-tests/lj-1069-newref-nan-key.test.lua +++ b/test/tarantool-tests/lj-1069-newref-nan-key.test.lua @@ -52,7 +52,9 @@ test:test('NaN on trace in the non-constant IR', function(subtest) end) test:test('NaN on trace in the non-constant IR CONV', function(subtest) + -- XXX: simplify `jit.dump()` output. local tonumber = tonumber + local NKEYS = 3 -- XXX: NaN isn't stored, so the number of tests is: =================================================================== Branch is force-pushed. > > + local NKEYS = 3 > > + > -- Best regards, Sergey Kaplun