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 CB79C6F87B; Fri, 28 Jan 2022 11:44:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CB79C6F87B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1643359488; bh=/OCyKs1DXp715AHcBOeRrOPJgJt91RjdKWcMXjL3o6Y=; 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=szezM43S1nSplz4Hfv7+3yPXRrkxk7OgoCHzUGnH4nxRhi6NLDK0VKipQpmDP45Qe lOjLo8GAIsZaSkyojTA9/GFjiMLr8+zb8i8g6pHJMdb+fFPPEzlpkVrCKUwISrdhcm JvC4Q8nw7vnCe/yZBG88xHj3zj0bja3divty6NPc= Received: from smtp42.i.mail.ru (smtp42.i.mail.ru [94.100.177.102]) (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 0AB096F87B for ; Fri, 28 Jan 2022 11:44:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0AB096F87B Received: by smtp42.i.mail.ru with esmtpa (envelope-from ) id 1nDMsB-0003aj-26; Fri, 28 Jan 2022 11:44:47 +0300 Date: Fri, 28 Jan 2022 11:42:47 +0300 To: Igor Munkin Message-ID: References: <20211229122731.31617-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9AA78FDF62ECAE61FE8F0416753E75F32ADD2080602F20CE6182A05F538085040CA3340871C42C764D9BB9C02CC0D0902655DE36CCAB20AF57FA49F31FC4560AF X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7E628FE8A185FCFBEEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006379703D7D5B138802D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8EFB281898517EB67D85F3CFB831E819D117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BB07C9E286C61B7F975ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5509FEBF1A0BA892CA1895611AA7B79041C22157F3F5E3ADDD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA757165F9D92552535A410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34431D0341F6B74DD32EF9586D7A4E37D28EC1A9F4E02F05796356CF4651CFEE49FE9CE57E9BCC78421D7E09C32AA3244C4FB8EB5B26A00F06A2F6941B28E4D56CCE0B41342B755BCDFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojqLK0kLh8sGfHhMuA/i5KcA== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB499C9740D8D23D64E71637EF7809D60049D086FC03DADA47AF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A84198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Actually implement maxirconst trace limit. 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" Igor, Thanks for the review! On 28.01.22, Igor Munkin wrote: > Sergey, > > Thanks for the patch! LGTM, except a couple of nits. > > On 29.12.21, Sergey Kaplun wrote: > > From: Mike Pall > > > > Suggested by spacewander. > > > > (cherry picked from 9ff94c4a1fcec2c310dcb092da694f23186e23) > > Typo: s/9ff94c4a1fcec2c310dcb092da694f23186e23/0a9ff94c4a1fcec2c310dcb092da694f23186e23/. Ouch! Fixed. > > > > > `maxirconst` should restrict the amount of IR constants for 1 trace. > > Typo: It's better s/for 1/per/, but feel free to ignore. Fixed. The new commit message is the following: =================================================================== Actually implement maxirconst trace limit. Suggested by spacewander. (cherry picked from 0a9ff94c4a1fcec2c310dcb092da694f23186e23) `maxirconst` should restrict the amount of IR constants per trace. Nevertheless, its value isn't checked anywhere. This patch adds the corresponding check after instruction recording. Sergey Kaplun: * added the description and the test for the problem Part of tarantool/tarantool#6548 =================================================================== > > > Nevertheless, its value isn't checked anywhere. > > Lol, classic. > > > > > This patch adds the corresponding check after instruction recording. > > > > Sergey Kaplun: > > * added the description and the test for the problem > > > > Part of tarantool/tarantool#6548 > > --- > > > > Issue: https://github.com/LuaJIT/LuaJIT/issues/430 > > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-430-maxirconst-actually-implement-full-ci > > Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/lj-430-maxirconst-actually-implement-full-ci > > > > src/lj_record.c | 5 ++- > > .../lj-430-maxirconst.test.lua | 43 +++++++++++++++++++ > > 2 files changed, 46 insertions(+), 2 deletions(-) > > create mode 100644 test/tarantool-tests/lj-430-maxirconst.test.lua > > > > > > > diff --git a/test/tarantool-tests/lj-430-maxirconst.test.lua b/test/tarantool-tests/lj-430-maxirconst.test.lua > > new file mode 100644 > > index 00000000..1829b37d > > --- /dev/null > > +++ b/test/tarantool-tests/lj-430-maxirconst.test.lua > > @@ -0,0 +1,43 @@ > > +-- XXX: avoid any other traces compilation due to hotcount > > +-- collisions for predictible results. > > Typo: s/predictible/predictable/. Fixed. Branch is force-pushed. =================================================================== diff --git a/test/tarantool-tests/lj-430-maxirconst.test.lua b/test/tarantool-tests/lj-430-maxirconst.test.lua index 1829b37d..df17637f 100644 --- a/test/tarantool-tests/lj-430-maxirconst.test.lua +++ b/test/tarantool-tests/lj-430-maxirconst.test.lua @@ -1,5 +1,5 @@ -- XXX: avoid any other traces compilation due to hotcount --- collisions for predictible results. +-- collisions for predictable results. jit.off() jit.flush() =================================================================== > > > +jit.off() > > +jit.flush() > > Minor: I'd rather move this part closer to 'jit.opt.start' to save the > test structure closer to the other test chunks. Feel free to ignore. I really want to exclude __any__ JIT work here to avoid false-positive hotcount (was precendents during writing this test :)). Ignoring. > > > + > > +-- Disabled on *BSD due to #4819. > > +require('utils').skipcond(jit.os == 'BSD', 'Disabled due to #4819') > > + > > +local tap = require('tap') > > + > > +local test = tap.test('lj-430-maxirconst') > > +test:plan(2) > > + > > +-- XXX: trace always has at least 3 IR constants: for nil, false > > +-- and true. > > +jit.opt.start('hotloop=1', 'maxirconst=3') > > + > > +-- This function has only 3 IR constant. > > +local function irconst3() > > +end > > + > > +-- This function has 4 IR constants before optimizations. > > +local function irconst4() > > + local _ = 42 > > +end > > + > > +local ntrace_old = misc.getmetrics().jit_trace_num > > +jit.on() > > +irconst3() > > +irconst3() > > +jit.off() > > +test:ok(ntrace_old + 1 == misc.getmetrics().jit_trace_num, > > + 'trace number increases') > > Typo: I doubt we use tabs in Lua sources, but I might be wrong... I suggest to use quarter tabs indent style as we use for C code and Mike use in src/jit/*.lua (see bcsave.lua for example). There was no precedent before, IINM :). > > > + > > +ntrace_old = misc.getmetrics().jit_trace_num > > +jit.on() > > +irconst4() > > +irconst4() > > +jit.off() > > +test:ok(ntrace_old == misc.getmetrics().jit_trace_num, > > + 'trace number is the same') > > Ditto. > > > + > > +os.exit(test:check() and 0 or 1) > > -- > > 2.34.1 > > > > -- > Best regards, > IM -- Best regards, Sergey Kaplun