From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <tarantool-patches-bounces@dev.tarantool.org>
Received: from [87.239.111.99] (localhost [127.0.0.1])
	by dev.tarantool.org (Postfix) with ESMTP id 23B7E6EC40;
	Mon, 20 Sep 2021 12:38:16 +0300 (MSK)
DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 23B7E6EC40
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev;
	t=1632130696; bh=JvITRJiKTRHQXLXI1MKReNLjv1Oy8bpytVKfzqzN4eA=;
	h=Date:In-Reply-To:To:References:Subject:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=j/dFiVHI9+r36/g8sk34YgDOYcSpcRPzLMFhPzjlZ5k/RneuzfjgYiB0i2aDQ4dxc
	 qBCDkMppPDbLzFS+vr87obsEPCWHXSYg7JonxQbww4831sd36DCAT0l6x3/JZT018r
	 wKlbQ0clSdBDDa1jthRx7+4hy6HJyPbq6lCkFdjI=
Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35])
 (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 90E5F6EC40
 for <tarantool-patches@dev.tarantool.org>;
 Mon, 20 Sep 2021 12:37:54 +0300 (MSK)
DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 90E5F6EC40
Received: by smtp55.i.mail.ru with esmtpa (envelope-from
 <sergos@tarantool.org>)
 id 1mSFkH-0003o0-Bn; Mon, 20 Sep 2021 12:37:53 +0300
Message-Id: <91CFF19A-C295-4E72-AC7D-12CE78698B39@tarantool.org>
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_02150FFD-83EB-461C-871B-6B01554BDF72"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\))
Date: Mon, 20 Sep 2021 12:37:53 +0300
In-Reply-To: <YUhHJvZgPdMtCI1/@root>
To: Sergey Kaplun <skaplun@tarantool.org>
References: <cover.1631170629.git.skaplun@tarantool.org>
 <369e050ce6799ca94ac08205fdbedad94b56ff87.1631170629.git.skaplun@tarantool.org>
 <47908C94-AB2E-4E82-AE4A-ADF6F58AA616@tarantool.org> <YUhHJvZgPdMtCI1/@root>
X-Mailer: Apple Mail (2.3654.120.0.1.13)
X-4EC0790: 10
X-7564579A: 646B95376F6C166E
X-77F55803: 4F1203BC0FB41BD91AE02D33A9C88A2F250B8A21226859B08342E9AB5F4ECC3300894C459B0CD1B9868128A59728D42A70046FB6B8D99F1A29E88886021A938758021F299768AAFE
X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7747FD4AFDBA6C67AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E724D704EAF55A818638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D814BD537D3472B2974BD9575CC5B09E25117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A1DCCEB63E2F10FB089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF
X-C1DE0DAB: 0D63561A33F958A5EA7F61A5D0928245080339878928475765BF8B6D34947D82D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75DD5744CF7ED0C6846D6546786ADF492D5A0AA20F8A030721787CBDA4B9FA07AC4DDFAF11955870C28E8E86DC7131B365E7726E8460B7C23C
X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34FD9114F69CA58D1EFD60C41D5D748EF67E807880A75718679436F7BB205F34DD49FA761981D746E41D7E09C32AA3244C3738B06D14E847D6CFC78E703F20A3AB4DBEAD0ED6C55A80FACE5A9C96DEB163
X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojsFc9NKou+3ixgA3nM690KQ==
X-Mailru-Sender: 3B9A0136629DC912F4AABCEFC589C81EAC31BDF4125C9C843A76FAFCC64737ED56F721F4092211F1AD07DD1419AC565FA614486B47F28B67C5E079CCF3B0523AED31B7EB2E253A9E112434F685709FCF0DA7A0AF5A3A8387
X-Mras: Ok
Subject: Re: [Tarantool-patches] [PATCH luajit 2/3] Reorganize lightuserdata
 interning code.
X-BeenThere: tarantool-patches@dev.tarantool.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: Tarantool development patches <tarantool-patches.dev.tarantool.org>
List-Unsubscribe: <https://lists.tarantool.org/mailman/options/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=unsubscribe>
List-Archive: <https://lists.tarantool.org/pipermail/tarantool-patches/>
List-Post: <mailto:tarantool-patches@dev.tarantool.org>
List-Help: <mailto:tarantool-patches-request@dev.tarantool.org?subject=help>
List-Subscribe: <https://lists.tarantool.org/mailman/listinfo/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=subscribe>
From: sergos via Tarantool-patches <tarantool-patches@dev.tarantool.org>
Reply-To: sergos <sergos@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Errors-To: tarantool-patches-bounces@dev.tarantool.org
Sender: "Tarantool-patches" <tarantool-patches-bounces@dev.tarantool.org>


--Apple-Mail=_02150FFD-83EB-461C-871B-6B01554BDF72
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Thanks!

LGTM.

Sergos

> On 20 Sep 2021, at 11:32, Sergey Kaplun <skaplun@tarantool.org> wrote:
>=20
> Hi, Sergos!
>=20
> Thanks for the review!
>=20
> On 15.09.21, sergos wrote:
>> Hi! Thanks for the patch!
>>=20
>> I would put something in description about the fact it=E2=80=99s =
pulled in just
>> to ease following the upstream - in particular, the following 3/3 is =
done
>> in this very moved code.
>>=20
>> LGTM with above.
>=20
> Updated the commit message to the following:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Reorganize lightuserdata interning code.
>=20
> This patch only performs a code movement of lightuserdata interning to
> <lj_udata.c> file and does nothing else. This patch is backported to
> simplify syncing with the upstream.
>=20
> Sergey Kaplun:
> * added the description for the patch
>=20
> Needed for tarantool/tarantool#5629
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> Branch is force pushed.
>=20
>>=20
>> Sergos
>>=20
>>=20
>>> On 9 Sep 2021, at 10:03, Sergey Kaplun <skaplun@tarantool.org> =
wrote:
>>>=20
>>> From: Mike Pall <mike>
>>>=20
>>> This patch only performs a code movement of lightuserdata interning =
to
>>> <lj_udata.c> file and does nothing else.
>>>=20
>>> Sergey Kaplun:
>>> * added the description for the patch
>>>=20
>>> Needed for tarantool/tarantool#5629
>>> ---
>>> src/lj_api.c   | 30 ++----------------------------
>>> src/lj_udata.c | 27 +++++++++++++++++++++++++++
>>> src/lj_udata.h |  3 +++
>>> 3 files changed, 32 insertions(+), 28 deletions(-)
>>>=20
>>> diff --git a/src/lj_api.c b/src/lj_api.c
>>> index c7a0b327..b6655e5a 100644
>>> --- a/src/lj_api.c
>>> +++ b/src/lj_api.c
>>> @@ -716,36 +716,10 @@ LUA_API void lua_pushboolean(lua_State *L, int =
b)
>>>  incr_top(L);
>>> }
>>>=20
>>> -#if LJ_64
>>> -static void *lightud_intern(lua_State *L, void *p)
>>> -{
>>> -  global_State *g =3D G(L);
>>> -  uint64_t u =3D (uint64_t)p;
>>> -  uint32_t up =3D lightudup(u);
>>> -  uint32_t *segmap =3D mref(g->gc.lightudseg, uint32_t);
>>> -  MSize segnum =3D g->gc.lightudnum;
>>> -  if (segmap) {
>>> -    MSize seg;
>>> -    for (seg =3D 0; seg <=3D segnum; seg++)
>>> -      if (segmap[seg] =3D=3D up)  /* Fast path. */
>>> -	return (void *)(((uint64_t)seg << LJ_LIGHTUD_BITS_LO) | =
lightudlo(u));
>>> -    segnum++;
>>> -  }
>>> -  if (!((segnum-1) & segnum) && segnum !=3D 1) {
>>> -    if (segnum >=3D (1 << LJ_LIGHTUD_BITS_SEG)) lj_err_msg(L, =
LJ_ERR_BADLU);
>>> -    lj_mem_reallocvec(L, segmap, segnum, segnum ? 2*segnum : 2u, =
uint32_t);
>>> -    setmref(g->gc.lightudseg, segmap);
>>> -  }
>>> -  g->gc.lightudnum =3D segnum;
>>> -  segmap[segnum] =3D up;
>>> -  return (void *)(((uint64_t)segnum << LJ_LIGHTUD_BITS_LO) | =
lightudlo(u));
>>> -}
>>> -#endif
>>> -
>>> LUA_API void lua_pushlightuserdata(lua_State *L, void *p)
>>> {
>>> #if LJ_64
>>> -  p =3D lightud_intern(L, p);
>>> +  p =3D lj_lightud_intern(L, p);
>>> #endif
>>>  setrawlightudV(L->top, p);
>>>  incr_top(L);
>>> @@ -1197,7 +1171,7 @@ static TValue *cpcall(lua_State *L, =
lua_CFunction func, void *ud)
>>>  setfuncV(L, top++, fn);
>>>  if (LJ_FR2) setnilV(top++);
>>> #if LJ_64
>>> -  ud =3D lightud_intern(L, ud);
>>> +  ud =3D lj_lightud_intern(L, ud);
>>> #endif
>>>  setrawlightudV(top++, ud);
>>>  cframe_nres(L->cframe) =3D 1+0;  /* Zero results. */
>>> diff --git a/src/lj_udata.c b/src/lj_udata.c
>>> index 70c722a3..6808b1bc 100644
>>> --- a/src/lj_udata.c
>>> +++ b/src/lj_udata.c
>>> @@ -8,6 +8,7 @@
>>>=20
>>> #include "lj_obj.h"
>>> #include "lj_gc.h"
>>> +#include "lj_err.h"
>>> #include "lj_udata.h"
>>>=20
>>> GCudata *lj_udata_new(lua_State *L, MSize sz, GCtab *env)
>>> @@ -34,3 +35,29 @@ void LJ_FASTCALL lj_udata_free(global_State *g, =
GCudata *ud)
>>>  lj_mem_free(g, ud, sizeudata(ud));
>>> }
>>>=20
>>> +#if LJ_64
>>> +void *lj_lightud_intern(lua_State *L, void *p)
>>> +{
>>> +  global_State *g =3D G(L);
>>> +  uint64_t u =3D (uint64_t)p;
>>> +  uint32_t up =3D lightudup(u);
>>> +  uint32_t *segmap =3D mref(g->gc.lightudseg, uint32_t);
>>> +  MSize segnum =3D g->gc.lightudnum;
>>> +  if (segmap) {
>>> +    MSize seg;
>>> +    for (seg =3D 0; seg <=3D segnum; seg++)
>>> +      if (segmap[seg] =3D=3D up)  /* Fast path. */
>>> +	return (void *)(((uint64_t)seg << LJ_LIGHTUD_BITS_LO) | =
lightudlo(u));
>>> +    segnum++;
>>> +  }
>>> +  if (!((segnum-1) & segnum) && segnum !=3D 1) {
>>> +    if (segnum >=3D (1 << LJ_LIGHTUD_BITS_SEG)) lj_err_msg(L, =
LJ_ERR_BADLU);
>>> +    lj_mem_reallocvec(L, segmap, segnum, segnum ? 2*segnum : 2u, =
uint32_t);
>>> +    setmref(g->gc.lightudseg, segmap);
>>> +  }
>>> +  g->gc.lightudnum =3D segnum;
>>> +  segmap[segnum] =3D up;
>>> +  return (void *)(((uint64_t)segnum << LJ_LIGHTUD_BITS_LO) | =
lightudlo(u));
>>> +}
>>> +#endif
>>> +
>>> diff --git a/src/lj_udata.h b/src/lj_udata.h
>>> index f271a42d..d97936d4 100644
>>> --- a/src/lj_udata.h
>>> +++ b/src/lj_udata.h
>>> @@ -10,5 +10,8 @@
>>>=20
>>> LJ_FUNC GCudata *lj_udata_new(lua_State *L, MSize sz, GCtab *env);
>>> LJ_FUNC void LJ_FASTCALL lj_udata_free(global_State *g, GCudata =
*ud);
>>> +#if LJ_64
>>> +LJ_FUNC void * LJ_FASTCALL lj_lightud_intern(lua_State *L, void =
*p);
>>> +#endif
>>>=20
>>> #endif
>>> --=20
>>> 2.31.0
>>>=20
>>=20
>=20
> --=20
> Best regards,
> Sergey Kaplun


--Apple-Mail=_02150FFD-83EB-461C-871B-6B01554BDF72
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" =
class=3D"">Thanks!<div class=3D""><br class=3D""></div><div =
class=3D"">LGTM.</div><div class=3D""><br class=3D""></div><div =
class=3D"">Sergos<br class=3D""><div><br class=3D""><blockquote =
type=3D"cite" class=3D""><div class=3D"">On 20 Sep 2021, at 11:32, =
Sergey Kaplun &lt;<a href=3D"mailto:skaplun@tarantool.org" =
class=3D"">skaplun@tarantool.org</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><meta =
charset=3D"UTF-8" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">Hi, Sergos!</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">Thanks for the review!</span><br style=3D"caret-color: rgb(0, =
0, 0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">On 15.09.21, sergos wrote:</span><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 11px; font-style: =
normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
normal; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><blockquote type=3D"cite" =
style=3D"font-family: Menlo-Regular; font-size: 11px; font-style: =
normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D"">Hi! Thanks for the patch!<br =
class=3D""><br class=3D"">I would put something in description about the =
fact it=E2=80=99s pulled in just<br class=3D"">to ease following the =
upstream - in particular, the following 3/3 is done<br class=3D"">in =
this very moved code.<br class=3D""><br class=3D"">LGTM with above.<br =
class=3D""></blockquote><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">Updated the commit message to the following:</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 11px; font-style: normal; font-variant-caps: normal; =
font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" =
class=3D"">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 11px; font-style: normal; font-variant-caps: normal; =
font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">Reorganize =
lightuserdata interning code.</span><br style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">This patch only performs a code movement of lightuserdata =
interning to</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" =
class=3D"">&lt;lj_udata.c&gt; file and does nothing else. This patch is =
backported to</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">simplify =
syncing with the upstream.</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">Sergey Kaplun:</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">* added the description for the patch</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 11px; font-style: normal; font-variant-caps: normal; =
font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">Needed for =
tarantool/tarantool#5629</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 11px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;" =
class=3D"">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 11px; font-style: normal; font-variant-caps: normal; =
font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">Branch is =
force pushed.</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><blockquote type=3D"cite" style=3D"font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; =
-webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><br =
class=3D"">Sergos<br class=3D""><br class=3D""><br class=3D""><blockquote =
type=3D"cite" class=3D"">On 9 Sep 2021, at 10:03, Sergey Kaplun &lt;<a =
href=3D"mailto:skaplun@tarantool.org" =
class=3D"">skaplun@tarantool.org</a>&gt; wrote:<br class=3D""><br =
class=3D"">From: Mike Pall &lt;mike&gt;<br class=3D""><br class=3D"">This =
patch only performs a code movement of lightuserdata interning to<br =
class=3D"">&lt;lj_udata.c&gt; file and does nothing else.<br =
class=3D""><br class=3D"">Sergey Kaplun:<br class=3D"">* added the =
description for the patch<br class=3D""><br class=3D"">Needed for =
tarantool/tarantool#5629<br class=3D"">---<br class=3D"">src/lj_api.c =
&nbsp;&nbsp;| 30 ++----------------------------<br =
class=3D"">src/lj_udata.c | 27 +++++++++++++++++++++++++++<br =
class=3D"">src/lj_udata.h | &nbsp;3 +++<br class=3D"">3 files changed, =
32 insertions(+), 28 deletions(-)<br class=3D""><br class=3D"">diff =
--git a/src/lj_api.c b/src/lj_api.c<br class=3D"">index =
c7a0b327..b6655e5a 100644<br class=3D"">--- a/src/lj_api.c<br =
class=3D"">+++ b/src/lj_api.c<br class=3D"">@@ -716,36 +716,10 @@ =
LUA_API void lua_pushboolean(lua_State *L, int b)<br =
class=3D"">&nbsp;incr_top(L);<br class=3D"">}<br class=3D""><br =
class=3D"">-#if LJ_64<br class=3D"">-static void =
*lightud_intern(lua_State *L, void *p)<br class=3D"">-{<br class=3D"">- =
&nbsp;global_State *g =3D G(L);<br class=3D"">- &nbsp;uint64_t u =3D =
(uint64_t)p;<br class=3D"">- &nbsp;uint32_t up =3D lightudup(u);<br =
class=3D"">- &nbsp;uint32_t *segmap =3D mref(g-&gt;gc.lightudseg, =
uint32_t);<br class=3D"">- &nbsp;MSize segnum =3D =
g-&gt;gc.lightudnum;<br class=3D"">- &nbsp;if (segmap) {<br class=3D"">- =
&nbsp;&nbsp;&nbsp;MSize seg;<br class=3D"">- &nbsp;&nbsp;&nbsp;for (seg =
=3D 0; seg &lt;=3D segnum; seg++)<br class=3D"">- =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (segmap[seg] =3D=3D up) &nbsp;/* Fast =
path. */<br class=3D"">-<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>return (void *)(((uint64_t)seg =
&lt;&lt; LJ_LIGHTUD_BITS_LO) | lightudlo(u));<br class=3D"">- =
&nbsp;&nbsp;&nbsp;segnum++;<br class=3D"">- &nbsp;}<br class=3D"">- =
&nbsp;if (!((segnum-1) &amp; segnum) &amp;&amp; segnum !=3D 1) {<br =
class=3D"">- &nbsp;&nbsp;&nbsp;if (segnum &gt;=3D (1 &lt;&lt; =
LJ_LIGHTUD_BITS_SEG)) lj_err_msg(L, LJ_ERR_BADLU);<br class=3D"">- =
&nbsp;&nbsp;&nbsp;lj_mem_reallocvec(L, segmap, segnum, segnum ? 2*segnum =
: 2u, uint32_t);<br class=3D"">- =
&nbsp;&nbsp;&nbsp;setmref(g-&gt;gc.lightudseg, segmap);<br class=3D"">- =
&nbsp;}<br class=3D"">- &nbsp;g-&gt;gc.lightudnum =3D segnum;<br =
class=3D"">- &nbsp;segmap[segnum] =3D up;<br class=3D"">- &nbsp;return =
(void *)(((uint64_t)segnum &lt;&lt; LJ_LIGHTUD_BITS_LO) | =
lightudlo(u));<br class=3D"">-}<br class=3D"">-#endif<br class=3D"">-<br =
class=3D"">LUA_API void lua_pushlightuserdata(lua_State *L, void *p)<br =
class=3D"">{<br class=3D"">#if LJ_64<br class=3D"">- &nbsp;p =3D =
lightud_intern(L, p);<br class=3D"">+ &nbsp;p =3D lj_lightud_intern(L, =
p);<br class=3D"">#endif<br class=3D"">&nbsp;setrawlightudV(L-&gt;top, =
p);<br class=3D"">&nbsp;incr_top(L);<br class=3D"">@@ -1197,7 +1171,7 @@ =
static TValue *cpcall(lua_State *L, lua_CFunction func, void *ud)<br =
class=3D"">&nbsp;setfuncV(L, top++, fn);<br class=3D"">&nbsp;if (LJ_FR2) =
setnilV(top++);<br class=3D"">#if LJ_64<br class=3D"">- &nbsp;ud =3D =
lightud_intern(L, ud);<br class=3D"">+ &nbsp;ud =3D lj_lightud_intern(L, =
ud);<br class=3D"">#endif<br class=3D"">&nbsp;setrawlightudV(top++, =
ud);<br class=3D"">&nbsp;cframe_nres(L-&gt;cframe) =3D 1+0; &nbsp;/* =
Zero results. */<br class=3D"">diff --git a/src/lj_udata.c =
b/src/lj_udata.c<br class=3D"">index 70c722a3..6808b1bc 100644<br =
class=3D"">--- a/src/lj_udata.c<br class=3D"">+++ b/src/lj_udata.c<br =
class=3D"">@@ -8,6 +8,7 @@<br class=3D""><br class=3D"">#include =
"lj_obj.h"<br class=3D"">#include "lj_gc.h"<br class=3D"">+#include =
"lj_err.h"<br class=3D"">#include "lj_udata.h"<br class=3D""><br =
class=3D"">GCudata *lj_udata_new(lua_State *L, MSize sz, GCtab *env)<br =
class=3D"">@@ -34,3 +35,29 @@ void LJ_FASTCALL =
lj_udata_free(global_State *g, GCudata *ud)<br =
class=3D"">&nbsp;lj_mem_free(g, ud, sizeudata(ud));<br class=3D"">}<br =
class=3D""><br class=3D"">+#if LJ_64<br class=3D"">+void =
*lj_lightud_intern(lua_State *L, void *p)<br class=3D"">+{<br class=3D"">+=
 &nbsp;global_State *g =3D G(L);<br class=3D"">+ &nbsp;uint64_t u =3D =
(uint64_t)p;<br class=3D"">+ &nbsp;uint32_t up =3D lightudup(u);<br =
class=3D"">+ &nbsp;uint32_t *segmap =3D mref(g-&gt;gc.lightudseg, =
uint32_t);<br class=3D"">+ &nbsp;MSize segnum =3D =
g-&gt;gc.lightudnum;<br class=3D"">+ &nbsp;if (segmap) {<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;MSize seg;<br class=3D"">+ &nbsp;&nbsp;&nbsp;for (seg =
=3D 0; seg &lt;=3D segnum; seg++)<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (segmap[seg] =3D=3D up) &nbsp;/* Fast =
path. */<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>return (void *)(((uint64_t)seg =
&lt;&lt; LJ_LIGHTUD_BITS_LO) | lightudlo(u));<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;segnum++;<br class=3D"">+ &nbsp;}<br class=3D"">+ =
&nbsp;if (!((segnum-1) &amp; segnum) &amp;&amp; segnum !=3D 1) {<br =
class=3D"">+ &nbsp;&nbsp;&nbsp;if (segnum &gt;=3D (1 &lt;&lt; =
LJ_LIGHTUD_BITS_SEG)) lj_err_msg(L, LJ_ERR_BADLU);<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;lj_mem_reallocvec(L, segmap, segnum, segnum ? 2*segnum =
: 2u, uint32_t);<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;setmref(g-&gt;gc.lightudseg, segmap);<br class=3D"">+ =
&nbsp;}<br class=3D"">+ &nbsp;g-&gt;gc.lightudnum =3D segnum;<br =
class=3D"">+ &nbsp;segmap[segnum] =3D up;<br class=3D"">+ &nbsp;return =
(void *)(((uint64_t)segnum &lt;&lt; LJ_LIGHTUD_BITS_LO) | =
lightudlo(u));<br class=3D"">+}<br class=3D"">+#endif<br class=3D"">+<br =
class=3D"">diff --git a/src/lj_udata.h b/src/lj_udata.h<br =
class=3D"">index f271a42d..d97936d4 100644<br class=3D"">--- =
a/src/lj_udata.h<br class=3D"">+++ b/src/lj_udata.h<br class=3D"">@@ =
-10,5 +10,8 @@<br class=3D""><br class=3D"">LJ_FUNC GCudata =
*lj_udata_new(lua_State *L, MSize sz, GCtab *env);<br class=3D"">LJ_FUNC =
void LJ_FASTCALL lj_udata_free(global_State *g, GCudata *ud);<br =
class=3D"">+#if LJ_64<br class=3D"">+LJ_FUNC void * LJ_FASTCALL =
lj_lightud_intern(lua_State *L, void *p);<br class=3D"">+#endif<br =
class=3D""><br class=3D"">#endif<br class=3D"">--<span =
class=3D"Apple-converted-space">&nbsp;</span><br class=3D"">2.31.0<br =
class=3D""><br class=3D""></blockquote><br class=3D""></blockquote><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 11px; font-style: normal; font-variant-caps: normal; =
font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">--<span =
class=3D"Apple-converted-space">&nbsp;</span></span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 11px; font-style: normal; font-variant-caps: normal; =
font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">Best =
regards,</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">Sergey =
Kaplun</span></div></blockquote></div><br class=3D""></div></body></html>=

--Apple-Mail=_02150FFD-83EB-461C-871B-6B01554BDF72--