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 70C4C6EC58; Wed, 4 Aug 2021 18:31:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 70C4C6EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628091089; bh=I+3ty/WpqnFFlBaM/QgSDgyk8iNoCs073b5Jyy86qrU=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=CgNueHI+iCtxmsGhoyzJnQNG8dFSKXG4+Fyz77Y9KCP084FH1aLKYpUFrlKYBoK5+ 8wXKDyF0gPznzt0+4+uWxWJlGBI7gfm6uHur6mz/SnRi3Lu23iSme+O1Zq2cZflffC iitpvmt0TJgj0RMZe612gPBuOKmbAaUhPdSFp9HE= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (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 4ED676EC58 for ; Wed, 4 Aug 2021 18:31:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4ED676EC58 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1mBIrf-0006ya-6S; Wed, 04 Aug 2021 18:31:27 +0300 Date: Wed, 4 Aug 2021 18:07:49 +0300 To: Sergey Ostanevich , Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Message-ID: <20210804150749.GF27855@tarantool.org> References: <5fdb4899061156f0fb4c53027d55f93be3a24759.1627144350.git.imun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5fdb4899061156f0fb4c53027d55f93be3a24759.1627144350.git.imun@tarantool.org> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C351B198F4576AC7B2770D7874BA03B4AE182A05F538085040EDCF104C59110633FE6A64F4CACD8A994E4B28939514AEE403381A919034B6AB X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE792C68BF9CD4C0E9EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637DDCE02C19EA0BA868638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8DF4B417F43D21BE5E32A3015DEAD79EC117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD1828451B159A507268D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67393CE827C55B5F775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505E2BBC306C2D7612B0F3160E95EDF6713 X-C1DE0DAB: 0D63561A33F958A57377EE829552CD2FA86C6017A76659B57D7B7105667CFD28D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7501A9DF589746230F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349EC559D073CA5B68FE1091115924C98643AD9B5CE4200B9628C20E830888280947E72FD6CE9843771D7E09C32AA3244C1FF97CE047DCAC6C1DE84990A2CE578DFE8DA44ABE2443F7927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojeDyvyeZJDJGkTvmyKlQb8g== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D5EB530F6FD42BE9D3B6687DD85FF52C5A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Detect inconsistent renames even in the presence of sunk values. 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" I've checked the patch into all long-term branches in tarantool/luajit and bumped a new version in 1.10, 2.7, 2.8 and master. On 24.07.21, Igor Munkin wrote: > From: Mike Pall > > Reported by Igor Munkin. > > (cherry picked from commit 33e3f4badfde8cd9c202cedd1f4ed9275bc92e7d) > > Side exits with the same exitno use the same snapshot for restoring > guest stack values. This obliges all guards related to the particular > snapshot use the same RegSP mapping for the values to be restored at the > trace exit. RENAME emitted prior to the guard for the same snapshot > leads to the aforementioned invariant violation. The easy way to save > the snapshot consistency is spilling the renamed IR reference, that is > done in scope of . > > However, the previous implementation considers > only the IR references explicitly mentioned in the snapshot. E.g. if > there is a sunk[1] object to be restored at the trace exit, and the > renamed reference is a *STORE to that object, the spill slot is not > allocated. As a result an invalid value is stored while unsinking that > object at all corresponding side exits prior to the emitted renaming. > > To handle also those IR references implicitly used in the snapshot, all > non-constant and non-sunk references are added to the Bloom filter (it's > worth to mention that two hash functions are used to reduce collisions > for the cases when the number of IR references emitted between two > different snapshots exceeds the filter size). New > implementation tests whether the renamed IR reference is in the filter > and forces a spill slot for it as a result. > > [1]: http://wiki.luajit.org/Allocation-Sinking-Optimization > > Igor Munkin: > * added the description and the test for the problem > > Resolves tarantool/tarantool#5118 > Follows up tarantool/tarantool#4252 > > Signed-off-by: Igor Munkin > --- > > Related issues: > * https://github.com/tarantool/tarantool/issues/5118 > * https://github.com/tarantool/tarantool/issues/4252 > * https://github.com/LuaJIT/LuaJIT/issues/584 > Branch: https://github.com/tarantool/luajit/tree/imun/lj-584-bad-renames-for-sunk-values > CI: https://github.com/tarantool/tarantool/commit/b35e2ee > > src/lj_asm.c | 25 ++++--- > ...j-584-bad-renames-for-sunk-values.test.lua | 69 +++++++++++++++++++ > 2 files changed, 81 insertions(+), 13 deletions(-) > create mode 100644 test/tarantool-tests/lj-584-bad-renames-for-sunk-values.test.lua > > -- > 2.25.0 > -- Best regards, IM