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 3809C6ECE3; Tue, 21 Jun 2022 16:44:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3809C6ECE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1655819047; bh=FTMMcypqD1I7euyu0ve26xL4qPuXZIsv1kycHtB0Lrk=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RNBTj7145sBroXUjIOUItBwow5+1B8kOdjCusvBKKhP/pOQHB4c5byeI+x3QiCJqd mvHr+Ia4Y9DAav2hl09EDZC9WME4J/i2dh5w6EHOMpAup/i+3nSOuEYGj4DF36A/Du Jnf+DKDuK8OUcM/tsC32j7rNSt4vYCQy3uC1G+PY= Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [94.100.177.96]) (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 88A246ECE3 for ; Tue, 21 Jun 2022 16:44:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 88A246ECE3 Received: by smtp36.i.mail.ru with esmtpa (envelope-from ) id 1o3eAn-00082c-0R; Tue, 21 Jun 2022 16:44:05 +0300 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) In-Reply-To: <20220506045339.8919-1-skaplun@tarantool.org> Date: Tue, 21 Jun 2022 16:44:04 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <11EF65C0-3018-4434-AC5C-22EC23EF550F@tarantool.org> References: <20220506045339.8919-1-skaplun@tarantool.org> To: Sergey Kaplun X-Mailer: Apple Mail (2.3696.100.31) X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD947AAA3FEFDE5AEDDB7D5B1125E7A1FC4CF25C0F5F3BD22AC182A05F5380850401ACE9FE81D45D85C0CF90723CD343530E7D8C5BA6FCDDD6641A6742C476D7E4A X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E1421899BE56938A744AE37866D6147AF826D824983B86A66786BCDC1303D62F8874C7F972CCD2F8FE1EF1CFC4036BBF6A4EA9B11811A4A51E3B0915E2725BA614EAEA1EF972C1F679AE1C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A503FBFE8BE8FC4909E2E6E57ED29995B006CA19BEDF49A0682AE8A426823CE1194ACD896C3632651D7E09C32AA3244CBD85C6ADC779CA139C1AB190BE525B57A95CA90A1D8AC565FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj+ZQCdndr4HlL+cKasl0E+A== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE4078FF6EF38B82D5CC097D2945C9EB2B3DB8564D608E3D9F2BB19381EE24192DF5555834048F03EF5D4C9A814A92B2E3B1BA4250FC3964EA4964198E0F3ECE9B5443453F38A29522196 X-Mras: OK Subject: Re: [Tarantool-patches] [PATCH luajit] FFI: Handle zero-fill of struct-of-NYI. 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: sergos via Tarantool-patches Reply-To: sergos Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch! LGTM=20 Sergos > On 6 May 2022, at 07:53, Sergey Kaplun wrote: >=20 > From: Mike Pall >=20 > Trace recording is NYI for the case of a struct with aggregate > allocation. >=20 > This patch adds workaround for the zero-fill struct-of-NYI case. >=20 > Sergey Kaplun: > * added the description and the test for the problem >=20 > Related to tarantool/tarantool#4630 > Related to tarantool/tarantool#5885 > --- >=20 > Issues: > * https://github.com/LuaJIT/LuaJIT/issues/672 > * https://github.com/tarantool/tarantool/issues/4630 > * https://github.com/tarantool/tarantool/issues/5885 > Branch: = https://github.com/tarantool/luajit/tree/skaplun/lj-672-cdata-allocation-r= ecording-full-ci > Tarantool PR: https://github.com/tarantool/tarantool/pull/7114 >=20 > src/lj_crecord.c | 20 ++++++++++++- > ...lj-672-cdata-allocation-recording.test.lua | 28 +++++++++++++++++++ > 2 files changed, 47 insertions(+), 1 deletion(-) > create mode 100644 = test/tarantool-tests/lj-672-cdata-allocation-recording.test.lua >=20 > diff --git a/src/lj_crecord.c b/src/lj_crecord.c > index 59186dab..0d7b71f0 100644 > --- a/src/lj_crecord.c > +++ b/src/lj_crecord.c > @@ -1021,8 +1021,26 @@ static void crec_alloc(jit_State *J, = RecordFFData *rd, CTypeID id) > crec_ct_tv(J, dc, dp, sp, sval); > } > } else if (ctype_isstruct(d->info)) { > - CTypeID fid =3D d->sib; > + CTypeID fid; > MSize i =3D 1; > + if (!J->base[1]) { /* Handle zero-fill of struct-of-NYI. */ > + fid =3D d->sib; > + while (fid) { > + CType *df =3D ctype_get(cts, fid); > + fid =3D df->sib; > + if (ctype_isfield(df->info)) { > + CType *dc; > + if (!gcref(df->name)) continue; /* Ignore unnamed fields. = */ > + dc =3D ctype_rawchild(cts, df); /* Field type. */ > + if (!(ctype_isnum(dc->info) || ctype_isptr(dc->info) || > + ctype_isenum(dc->info))) > + goto special; > + } else if (!ctype_isconstval(df->info)) { > + goto special; > + } > + } > + } > + fid =3D d->sib; > while (fid) { > CType *df =3D ctype_get(cts, fid); > fid =3D df->sib; > diff --git = a/test/tarantool-tests/lj-672-cdata-allocation-recording.test.lua = b/test/tarantool-tests/lj-672-cdata-allocation-recording.test.lua > new file mode 100644 > index 00000000..28ad61e5 > --- /dev/null > +++ b/test/tarantool-tests/lj-672-cdata-allocation-recording.test.lua > @@ -0,0 +1,28 @@ > +-- Disabled on *BSD due to #4819. > +require('utils').skipcond(jit.os =3D=3D 'BSD', 'Disabled due to = #4819') > + > +local ffi =3D require('ffi') > +local traceinfo =3D require('jit.util').traceinfo > + > +local tap =3D require('tap') > +local test =3D tap.test('lj-672-cdata-allocation-recording') > +test:plan(1) > + > +-- Structure with array. > +ffi.cdef('struct my_struct {int a; char d[8];}') > + > +-- Be sure that we have no other traces. > +jit.off() > +jit.flush() > +jit.on() > + > +jit.opt.start("hotloop=3D1") > +local r > +for i =3D 1, 4 do > + r =3D ffi.new('struct my_struct') > + r.a =3D i > +end > + > +test:ok(traceinfo(1), 'new trace created') > + > +os.exit(test:check() and 0 or 1) > --=20 > 2.34.1 >=20