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 B40F64F3F5D; Sat, 15 Jul 2023 14:31:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B40F64F3F5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1689420695; bh=+Q4gHjcoRk0rgK7q20Ua2dZXUGDFoPjFWSW8QWrtLRc=; 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=FYoR8y0oPg0cJaBLijSo2FQCwQa27w3aD0eSanKTltQyT0hvqFg5Nym3+Kai21juM uRkdI9SCJR0LiIKesUOaQxHN1Xj3JhizT8373WgDRYX9QNC6Ny6jOlTN67L8T2L9eB J0wC2h/zZpvWNl4Gt8Nez9nZhess1d0NqyT6qLpw= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 1943C4F3F5D for ; Sat, 15 Jul 2023 14:31:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1943C4F3F5D Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1qKdUr-0001xL-3p; Sat, 15 Jul 2023 14:31:33 +0300 Date: Sat, 15 Jul 2023 14:27:10 +0300 To: Maxim Kokryashkin Message-ID: References: <20230710155624.70639-1-max.kokryashkin@gmail.com> <1689346625.351693821@f380.i.mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1689346625.351693821@f380.i.mail.ru> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9A075ED63965291970579FBC130BD7639CA280C20EDAC75ED182A05F5380850407D3C370F7D69C6DDB44FA40CED3E7F7D3E944D77FC450134E77E019CE0F2D734 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7811C3E343B302E2EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063715C0BCBD048C6310EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BE5CCB53A13BC8DBA9D9054AF751E13ADBC7F776BABE94197CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F79006378214201309F6546C389733CBF5DBD5E9B5C8C57E37DE458B9E9CE733340B9D5F3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735D05AD665AB97B35DC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A587D594CA12FFAB21C93A409C277EEC0BBEB6444B51F03523F87CCE6106E1FC07E67D4AC08A07B9B062B3BD3CC35DA588CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF76AE80FABCC41AEC2102D0960F8B85540FC2D5E1D802401F5D3BB9AE19A4CD9B2DF5FAC740BFE7CD7BBDB0A562C82D599F8681E41F2202BC5648E5BCDE4678B9A74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojTPX5czuwuGE3zmovcdHkvQ== X-DA7885C5: 4DD4E7EFE4244F637F7E3B961BE5F2BF66438D60FDBA2DA92BAF4E2C0EE846E4262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986B799D5EA20E9CAAD76B6C22913891B3980FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] FFI: Fix recording of union initialization. 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: Maksim Kokryashkin , tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Max! Thanks for the fixes! LGTM, with a minor reminder below. I suppose, that Sergey concerned about test name in the `test:ok()` routine. On 14.07.23, Maxim Kokryashkin wrote: > > Hi! > Thanks for the review! > Added a comment with the test description, the branch is force-pushed. > Here is the diff for the test description: > ============================================== > diff --git a/test/tarantool-tests/lj-128-fix-union-init.test.lua b/test/tarantool-tests/lj-128-fix-union-init.test.lua > index 6a49cec8..65ba0f28 100644 > --- a/test/tarantool-tests/lj-128-fix-union-init.test.lua > +++ b/test/tarantool-tests/lj-128-fix-union-init.test.lua > @@ -10,6 +10,46 @@ test:plan(NITERATIONS) >  local ffi = require('ffi') >  local union_type = ffi.typeof('union { uint32_t u; float f; }') >   > +-- Before the patch, the `union_type` call resulted in the > +-- initialization of both the integer and the float members > +-- of the union, leading to undefined behavior since the > +-- integer member was overwritten. > +-- The IR was the following: > +-- > +-- 0031 ------ LOOP ------------ > +-- 0032    u8  XLOAD  [0x100684521]  V > +-- 0033    int BAND   0032  +12 > +-- 0034 >  int EQ     0033  +0 > +-- 0035 >  cdt CNEW   +96 > +-- 0036    p64 ADD    0035  +16 > +-- 0037    u32 XSTORE 0036  0029 <--- `u` member init > +-- 0038    flt XSTORE 0036  0022 <--- `f` member init > +-- 0039    u32 XLOAD  0036 > +-- 0040    num CONV   0039  num.u32 > +-- 0041    num CONV   0029  num.int > +-- 0042 >  num EQ     0041  0040 > +-- 0043  + int ADD    0029  +1 > +-- 0044 >  int LE     0043  0001 > +-- 0045    int PHI    0029  0043 > +-- > +-- After the patch, the initialization is performed only > +-- for the first member of the union, so now IR looks > +-- like this: > +-- 0029 ------ LOOP ------------ > +-- 0030    u8  XLOAD  [0x1047c4521]  V > +-- 0031    int BAND   0030  +12 > +-- 0032 >  int EQ     0031  +0 > +-- 0033 }  cdt CNEW   +96 > +-- 0034    p64 ADD    0033  +16 > +-- 0035 }  u32 XSTORE 0034  0027 <--- `u` member init > +-- 0036    u32 CONV   0027  u32.int > +-- 0037    num CONV   0036  num.u32 > +-- 0038    num CONV   0027  num.int > +-- 0039 >  num EQ     0038  0037 > +-- 0040  + int ADD    0027  +1 > +-- 0041 >  int LE     0040  0001 > +-- 0042    int PHI    0027  0040 > + >  jit.opt.start('hotloop=1') >  for i = 1, NITERATIONS do >    test:ok(union_type(i).u == i) Minor: the description of the test is still missing. > ============================================== > >>> +for i = 1, NITERATIONS do > >>> + test:ok(union_type(i).u == i) > >>testcases description is missed, please add one. > >>> +end > >>> + > >>> +os.exit(test:check() and 0 or 1) > >  -- Best regards, Sergey Kaplun