From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp53.i.mail.ru (smtp53.i.mail.ru [94.100.177.113]) (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 6D9244765E0 for ; Sat, 26 Dec 2020 22:12:58 +0300 (MSK) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) From: Sergey Ostanevich In-Reply-To: <47fe3e90153279081caedd4799a0e0dffdfac7be.1608907726.git.skaplun@tarantool.org> Date: Sat, 26 Dec 2020 22:12:56 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <47fe3e90153279081caedd4799a0e0dffdfac7be.1608907726.git.skaplun@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH luajit v2 4/7] core: introduce new mem_L field List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Hi! Just some nits in the message, LGTM. Sergos. > On 25 Dec 2020, at 18:26, Sergey Kaplun wrote: >=20 > To determine currently allocating coroutine (that may not be equal to > currently executed one) a new field called mem_L is added to remove^^^^^^^ ^ the > global_State structure. This field is set on each allocation event and > stores the coroutine address that is used for allocation. >=20 > Part of tarantool/tarantool#5442 > --- > src/lj_gc.c | 2 ++ > src/lj_obj.h | 1 + > 2 files changed, 3 insertions(+) >=20 > diff --git a/src/lj_gc.c b/src/lj_gc.c > index 44c8aa1..800fb2c 100644 > --- a/src/lj_gc.c > +++ b/src/lj_gc.c > @@ -852,6 +852,8 @@ void *lj_mem_realloc(lua_State *L, void *p, GCSize = osz, GCSize nsz) > { > global_State *g =3D G(L); > lua_assert((osz =3D=3D 0) =3D=3D (p =3D=3D NULL)); > + > + setgcref(g->mem_L, obj2gco(L)); > p =3D g->allocf(g->allocd, p, osz, nsz); > if (p =3D=3D NULL && nsz > 0) > lj_err_mem(L); > diff --git a/src/lj_obj.h b/src/lj_obj.h > index 7fb715e..c94617d 100644 > --- a/src/lj_obj.h > +++ b/src/lj_obj.h > @@ -649,6 +649,7 @@ typedef struct global_State { > BCIns bc_cfunc_int; /* Bytecode for internal C function calls. */ > BCIns bc_cfunc_ext; /* Bytecode for external C function calls. */ > GCRef cur_L; /* Currently executing lua_State. */ > + GCRef mem_L; /* Currently allocating lua_State. */ > MRef jit_base; /* Current JIT code L->base or NULL. */ > MRef ctype_state; /* Pointer to C type state. */ > GCRef gcroot[GCROOT_MAX]; /* GC roots. */ > --=20 > 2.28.0 >=20