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 0C3D1D5DED8; Wed, 13 Mar 2024 11:50:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0C3D1D5DED8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1710319819; bh=XnC3csGEOzFmTAZgW7tW9cFcOCAkOL6teDrJsNjIEAM=; 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=E12M6J6nSEhWUv1RO77gjokqTshiRFSx82zAiOrNU16ahDjaiI4C7pa72CLaXfgtW BAKLlebECK7+26VQ7WKXaf+YYevVcVDkAV405PKNFu/hY0QOzaukN0Zmf6KSvMl6o7 RyKyaqgXgxWrZEzpzYWGrX8Rd1VAZTwbJULLyYEw= 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 7A6C4D5DED8 for ; Wed, 13 Mar 2024 11:50:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7A6C4D5DED8 Received: by smtp51.i.mail.ru with esmtpa (envelope-from ) id 1rkKJS-00000001SZB-47eV; Wed, 13 Mar 2024 11:50:15 +0300 Date: Wed, 13 Mar 2024 11:50:14 +0300 To: Sergey Kaplun Message-ID: References: <20240312052627.21222-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD987C0EE6E7F0A597D14B510CDCFC426C47375EECC9EF82252182A05F5380850405B84B97D475A48CC9487ABAC94A94B54E1B34E4A9514302405A355599DF1B17BA24CDA786A8AA87E X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE76042E2DB3E33BF2BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637C8DFB935205A313D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8B61E4C543F2977FA8D6367B61F66D5D7A78B5558EDEDE965CC7F00164DA146DAFE8445B8C89999728AA50765F790063783E00425F71A4181389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8EDCF5861DED71B2F389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F790063733EA442CA6AF7949D81D268191BDAD3DBD4B6F7A4D31EC0BE2F48590F00D11D6D81D268191BDAD3D78DA827A17800CE748726E9139292FFDEC76A7562686271ED91E3A1F190DE8FD2E808ACE2090B5E14AD6D5ED66289B5278DA827A17800CE76631511D42670FFE2EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE732FCE54C4D9A645443847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A5C142DC7892CBAD7F5002B1117B3ED696E55683457519E69F5B6221DB6D7A72AD823CB91A9FED034534781492E4B8EEADB05233B9BC4759D3 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF6179D8471CC5926616BAC5BF43DE0BE424AF34955AE830D1FB618DDB10958F0E744A43F78FC6FA907C77D8D956826D33372F5471DC420B4973DFA08233DFEC49EEFC5205CA2E47955F4332CA8FE04980913E6812662D5F2A54F6898A6FDCBDC72A617DFBE5FEC2C6383653B6C8D9AE0FD16FCAA6493B703A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojtv/CB9kl0S0pTnpuSwf4fQ== X-Mailru-Sender: 7940E2A4EB16C9976F80DCDCD59EC22700BC31D2665FC5989487ABAC94A94B54E1B34E4A95143024E2527C969975515CFF9FCECFB8D89CB6C77752E0C033A69E235A20A81F3B0E39AB3C5F247CB2F7F93A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Check frame size limit before returning to a lower frame. 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the fixes! LGTM now. On Wed, Mar 13, 2024 at 11:35:30AM +0300, Sergey Kaplun wrote: > Hi, Maxim! > Thanks for the review! > Fixed your comments below. > > On 12.03.24, Maxim Kokryashkin wrote: > > Hi, Sergey! > > Thanks for the patch! > > LGTM, except for the single comment below. > > On Tue, Mar 12, 2024 at 08:26:27AM +0300, Sergey Kaplun wrote: > > > From: Mike Pall > > > > > > Thanks to Sergey Kaplun. > > > > > > (cherry picked from commit 302366a33853b730f1b7eb61d792abc4f84f0caa) > > > > > > When compiling a stitched (or side) trace, there is no check for the > > > frame size of the current prototype during recording. Hence, when we > > > return (for example, after stitching) to the lower frame with a maximum > > > possible frame size (249), the 251 = `baseslot` (2) + `maxslot` (249) > > > slot for GC64 mode may be used. This leads to the corresponding assertion > > > failure in `rec_check_slots()`. > > > > > > This patch adds the corresponding check. > > > > > > Sergey Kaplun: > > > * added the description and the test for the problem > > > > > > Part of tarantool/tarantool#9595 > > > --- > > > > > > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-1173-frame-limit-lower-frame > > > Tarantool PR: https://github.com/tarantool/tarantool/pull/9791 > > > Related issues: > > > * https://github.com/tarantool/tarantool/issues/9595 > > > * https://github.com/LuaJIT/LuaJIT/issues/1173 > > > > > > > > > +local chunk = 'local uv = {key = 1}\n' > > > +chunk = chunk .. 'return function()\n' > > > +chunk = chunk .. 'local r = retf()\n' > > Kind of a strange way to define a chunk. I believe that multiline > > is better here. > > Totally agree, thanks! > > > > + > > > +-- Each `UGET` occupies 1 slot, `KNIL` occupies the same amount. > > > +-- 1 slot is reserved (`r` variable), 1 pair is set outside the > > > +-- cycle. 249 slots (the maximum available amount, see > > > +-- , `bcreg_bump()` for details) are occupied in > > > +-- total. > > > +for _ = 1, LJ_MAX_JSLOTS / 2 - 2 do > > > + chunk = chunk .. ('uv.key, ') > > > +end > > > +chunk = chunk .. 'uv.key = nil\n' > > > +chunk = chunk .. 'end\n' > > Same applies here. > > Fixed. See the iterative patch below. Branch is force-pushed. > > =================================================================== > diff --git a/test/tarantool-tests/lj-1173-frame-limit-lower-frame.test.lua b/test/tarantool-tests/lj-1173-frame-limit-lower-frame.test.lua > index 91e2c603..468462d2 100644 > --- a/test/tarantool-tests/lj-1173-frame-limit-lower-frame.test.lua > +++ b/test/tarantool-tests/lj-1173-frame-limit-lower-frame.test.lua > @@ -44,9 +44,11 @@ local LJ_MAX_JSLOTS = 250 > -- `maxslot` (the first free slot) to 249. Hence, the JIT slots > -- are overflowing. > > -local chunk = 'local uv = {key = 1}\n' > -chunk = chunk .. 'return function()\n' > -chunk = chunk .. 'local r = retf()\n' > +local chunk = [[ > +local uv = {key = 1} > +return function() > + local r = retf() > + ]] > > -- Each `UGET` occupies 1 slot, `KNIL` occupies the same amount. > -- 1 slot is reserved (`r` variable), 1 pair is set outside the > @@ -56,8 +58,8 @@ chunk = chunk .. 'local r = retf()\n' > for _ = 1, LJ_MAX_JSLOTS / 2 - 2 do > chunk = chunk .. ('uv.key, ') > end > -chunk = chunk .. 'uv.key = nil\n' > -chunk = chunk .. 'end\n' > +chunk = chunk .. [[uv.key = nil > +end]] > > local get_func = assert(loadstring(chunk)) > local function_max_framesize = get_func() > =================================================================== > > > > > > > > -- > Best regards, > Sergey Kaplun