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 0E485A03F42; Mon, 4 Mar 2024 17:17:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0E485A03F42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1709561879; bh=7jMX/QbylfJwGMGP3IrBj1RLxcuDtGDb9xZ/E1PqRyo=; 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=U3TVyFWWlCca2/7d5GlGrTXQyw7N+uDkSUW02l3RLvN8hXm/7AgKyxj00Ql5bvv+D M0e0nz26qm4RcWWKg+/fnTHXsJYSgSPqBOw/bI9SBcEArm8ovUyLJWPlkscKvU/xe/ 2BGbVLyCcU41qnsix3Vgrjc/Y7d4nhaohTTpuuCM= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [95.163.41.78]) (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 D65D1A03F42 for ; Mon, 4 Mar 2024 17:17:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D65D1A03F42 Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1rh98e-00000003kCC-3VCF; Mon, 04 Mar 2024 17:17:57 +0300 Date: Mon, 4 Mar 2024 17:13:58 +0300 To: Maxim Kokryashkin Message-ID: References: <20240301132127.136533-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240301132127.136533-1-m.kokryashkin@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD987C0EE6E7F0A597D93F1D92F3B394BDC5B4900BFE0DC88DC182A05F538085040D0EE338B33DD8769A6D5EE0DB6E1EC8D827E2CA0DF6B8274B98030BD5B9714323B9FC492F4C8D7B4 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE788AD3E9728F968ABEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E8DF562B6063DE0A8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D85990E14ADBBB776AE0E5ABE49BE7295A77419C11EFCE4B97CC7F00164DA146DAFE8445B8C89999728AA50765F79006372A3B24BF85B2E607389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8D2DCF9CF1F528DBCF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE33AC447995A7AD182BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735D2D576BCF940C736C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5E940EDC4D328B95F5002B1117B3ED696CC74ED09BDBD4399ED71F038FC046993823CB91A9FED034534781492E4B8EEADA79578C5CF9A9009BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFC6938FABBB7D13155605FF961D0ACECF2EB96B7B8471F04A2204FD0FD99D461746C06E59B4E81405A2A143A52978B9DD16C000AD5420A3C6EB73A26CDCC67CE82A811D49CE8A32FE5F4332CA8FE04980913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj+F5rnR9AEqkdstQAZKjwCA== X-DA7885C5: C5DFA680B91213A3F255D290C0D534F9B4C8BB39C362764545374476C337C7673F88610D233457F15B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393590D8C940224AE3386BB6FBC6C1FF6C05EA5430985A327AE76D215286BB9909AE49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v2] Throw any errors before stack changes in trace stitching. 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, after fixing the comments below. On 01.03.24, Maxim Kokryashkin wrote: > From: Mike Pall > > Thanks to doujiang24. > > (cherry-picked from commit 3f9389edc6cdf3f78a6896d550c236860aed62b2) > > The Lua stack is changed in the `recff_stitch`, so if the trace > is aborted, for example, when the `maxsnap` is reached, and an > error is thrown from there, the execution continues with an > unbalanced stack. > > This patch adds a check for snapshot overflow to the > `recff_stitch` to overcome the issue for the `LJ_TRERR_SNAPOV` > case, but other cases remain unresolved and should be fixed in > other series. For a detailed description of the remaining cases, > see the issue[1]. > > [1]: https://github.com/LuaJIT/LuaJIT/issues/1166 I suppose it is better to drop the link (or just mention it in the test) to avoid excess notification in the upstream repository. > > Maxim Kokryashkin: > * added the description and the test for the problem > > Part of tarantool/tarantool#9595 > --- > Changes in v2: > - Fixed comments as per review by Sergey Kaplun > > Branch: https://github.com/tarantool/luajit/tree/fckxorg/lj-720-errors-before-stitch > > src/lj_ffrecord.c | 4 ++++ > .../lj-720-errors-before-stitch.test.lua | 20 +++++++++++++++++++ > 2 files changed, 24 insertions(+) > create mode 100644 test/tarantool-tests/lj-720-errors-before-stitch.test.lua > > diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c > index 1b2ddb72..e3ed80fb 100644 > --- a/src/lj_ffrecord.c > +++ b/src/lj_ffrecord.c > diff --git a/test/tarantool-tests/lj-720-errors-before-stitch.test.lua b/test/tarantool-tests/lj-720-errors-before-stitch.test.lua > new file mode 100644 > index 00000000..00fb0b9b > --- /dev/null > +++ b/test/tarantool-tests/lj-720-errors-before-stitch.test.lua > @@ -0,0 +1,20 @@ > +local tap = require('tap') > +local test = tap.test('lj-720-errors-before-stitch'):skipcond({ > + ['Test requires JIT enabled'] = not jit.status(), > +}) > +test:plan(1) > + > +-- `math.modf` recording is NYI. > +local modf = math.modf Why do we need to the use local value here? > +jit.opt.start('hotloop=1', 'maxsnap=1') > + > +-- The loop has only two iterations: the first to detect its > +-- hotness and the second to record it. The snapshot limit is > +-- set to one and is certainly reached. > +for _ = 1, 2 do > + -- Forcify stitch. > + modf(1.2) > +end > + > +test:ok(true, 'stack is balanced') > +test:done(true) > -- > 2.43.0 > -- Best regards, Sergey Kaplun