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 105434DCAE2; Wed, 8 Nov 2023 19:42:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 105434DCAE2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1699461744; bh=7N2yirAlj1vlvGO7hNcOTxRrG3Eo/2PtMZLi4ffsQ3U=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Bfz/zOKd2t5w7p/47n7l6wk+PgIwrTwsMPBicVKmfbh1sdTYzg5LojWw4/UmCEUMj ZWDx341veObBVkcf/5DZ7N/vsNe9GPfsnhg9YvuDF/ltwWJgk//rLgi5BYhotdzJ5r puQlBFhXmTZC3PYlaGQFnVZIRF+9HDhM1dr6UhcQ= Received: from smtp31.i.mail.ru (smtp31.i.mail.ru [95.163.41.72]) (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 E9D2F4DCAE2 for ; Wed, 8 Nov 2023 19:42:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E9D2F4DCAE2 Received: by smtp31.i.mail.ru with esmtpa (envelope-from ) id 1r0ldF-003VVR-2X; Wed, 08 Nov 2023 19:42:22 +0300 Message-ID: <0f961122-a8bd-4809-8fe5-d60e164a20bb@tarantool.org> Date: Wed, 8 Nov 2023 19:42:21 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Maksim Kokryashkin , tarantool-patches@dev.tarantool.org, skaplun@tarantool.org, m.kokryashkin@tarantool.org References: <20231025114047.55743-1-max.kokryashkin@gmail.com> In-Reply-To: <20231025114047.55743-1-max.kokryashkin@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9562B317E0136C8D382B5AB51A0CE7EC9F5A0ADFABA6D1A49182A05F5380850404C228DA9ACA6FE270973954A22444DFD7687BE452A08E93E49B988542F14FFE1BEA7812688ABE991 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7227E4400968B082FEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637670E1B164B70895C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D82469A613122096DB89E65B618AE7A2E7117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC60CDF180582EB8FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE26055571C92BF10F7B089FF177BE8049D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE32D01283D1ACF37BAAD7EC71F1DB88427C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947C062BEEFFB5F8EA3E2E808ACE2090B5E1725E5C173C3A84C317B107DEF921CE79089D37D7C0E48F6C8AA50765F7900637A2D17A18B0C1A664EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A512CA72C69B3DB5988F0D1A6444B31C56F76EBFBB66855357F87CCE6106E1FC07E67D4AC08A07B9B0AD74539164518AE5CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D34AB80C45F81B80D63FDE618D5CC9D2479F64AB7B59C0411EDBE9DA9A6DC80AA23D13A66D48177B1631D7E09C32AA3244C84D84AE4DDB9105BCA6120B6CDFA5BAA30452B15D76AEC14BAD658CF5C8AB4025DA084F8E80FEBD3FFA33E6B6B2F82C47A83BD0C44CE203720ABEDE4BBDD9CDD X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojGx6zOZpnTNBfpdQ35SprVA== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769742FCDB97D88370D7687BE452A08E93E8FF8BC079CCEBBDCEBA65886582A37BD66FEC6BF5C9C28D98A98C1125256619760D574B6FC815AB872D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Prevent compile of __concat with tailcall to fast function. 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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Max! Thanks for the patch! LGTM see my minor comments below On 10/25/23 14:40, Maksim Kokryashkin wrote: > From: Mike Pall > diff --git a/test/tarantool-tests/lj-690-concat-tail-call.test.lua b/test/tarantool-tests/lj-690-concat-tail-call.test.lua > new file mode 100644 > index 00000000..20775417 > --- /dev/null > +++ b/test/tarantool-tests/lj-690-concat-tail-call.test.lua > @@ -0,0 +1,34 @@ > +local tap = require('tap') > +local test = tap.test('lj-690-concat-tail-call'):skipcond({ > + ['Test requires JIT enabled'] = not jit.status(), > +}) > + > +test:plan(1) > + > +-- XXX: Test execution results in an `unbalanced stack after > +-- hot instruction` assertion fail, only if the LuaJIT is built > +-- with assertion support. Otherwise, the behavior is undefined > +-- (it usually fails with a bus error instead). > + > +-- The 'setmetatable' tailcall is delayed, but the non-trivial > +-- MM_concat continuation is not delayed, and recording fails > +-- since there is no metatable with a defined concat for one of > +-- the arguments. During the continuation processing, the stack > +-- delta is altered and fixed up after the continuation frame > +-- recording. Since continuation frame recording fails, the > +-- stack delta is not restored, and the stack becomes unbalanced. > + > +local t = {} > +t.__concat = function () excess whitespace after "function" > + return setmetatable({}, t) > +end > +local a = setmetatable({}, t) > + > +jit.opt.start('hotloop=1') > +for _ = 1, 4 do > + -- XXX: Extra concat is needed for a non-trivial continuation. > + local _ = '' .. '' .. a > +end > + > +test:ok(true, 'stack is balanced') > +test:done(true) > -- > 2.39.3 (Apple Git-145) >