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 575A8131B092; Wed, 5 Mar 2025 17:49:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 575A8131B092 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1741186180; bh=JTsaTv9pnUeWpZwcxiSBCYd1HXxu4SpfOFc1sdSjexA=; 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=HbHR/j2hYvcoPaL7iT/OedPJzHGTt5tNCJub/bQ7FqSY6Tq/tSEQpmIU+t3rdChAU Zaq8iO+7X7ziz+0itpsvHYcZaf6TcL4+ljSS5mXsYpVF4bm0681HRJPLExPx9WJEAe TcYGD9BMGbsAuFrwi//CBvBlO5nxAmWxdNkuRMGc= Received: from send128.i.mail.ru (send128.i.mail.ru [89.221.237.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 8F962131B092 for ; Wed, 5 Mar 2025 17:49:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8F962131B092 Received: by exim-smtp-8cb569c79-m2k9t with esmtpa (envelope-from ) id 1tpq41-00000000OBj-1Azg; Wed, 05 Mar 2025 17:49:37 +0300 Date: Wed, 5 Mar 2025 17:49:37 +0300 To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Message-ID: References: <24b8d43f6ce2796ba2cb9e6740182c82ea0ddf35.1740468394.git.sergeyb@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24b8d43f6ce2796ba2cb9e6740182c82ea0ddf35.1740468394.git.sergeyb@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9C8AED3E6A44DB6AB71859AA6756D3A98774FB5197ED18BC0182A05F5380850400748C2B06D85ECF33DE06ABAFEAF67058A4550FD3694882F8754E696E3EE2A9670B57125E92D9390 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F65C230EDDCD559EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566AE3F01DD33DDBDC8F7252FF899089798231B1BC0BBF19E5B78CF2AF79BF7D876389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0B27420F9988F54058941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C0259A6D7820E4F02E7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F0AC5B80A05675ACD4D0DA9BD313A0613B3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BAEB924C2B054B06E75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A55E8FFE8E1913AAC55002B1117B3ED696D6460D58A1DC440D466072E6821086B3823CB91A9FED034534781492E4B8EEAD5DF1C2DF01CE7211BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF1C6AE7B32D9541AFE93C406A5514AAD98DDC624D39B0842CD8BB096E330E0617C6BFA615E6C3782A2C10F42E4F22A8B6087E3E38DD0152971AC9A5D25D259F5C1D6BB0083661E7E7111DC66A97D0BFE2913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVQiWK+2I7Y2snmiflACaW7k= X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B59B95874CD2E8217513DE06ABAFEAF67058A4550FD3694882FB7CBEF92542CD7C88B0A2698F12F5C9EC77752E0C033A69E86920BD37369036789A8C6A0E60D2BB63A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/3] misc: use prof_error for handling errors 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the patch! LGTM, except 1 minor comment and 1 reminder below. On 25.02.25, Sergey Bronnikov wrote: > The patch consolidates handling profilers errors into a single > place - in a function `prof_error()` and handles PROFILE_ERRIO, > generated in a function `misc_memprof_start`, in a `prof_error()`. > --- > src/lib_misc.c | 49 +++++++++---------------------------------------- > 1 file changed, 9 insertions(+), 40 deletions(-) > > diff --git a/src/lib_misc.c b/src/lib_misc.c > index b4b58509..c4b40996 100644 > --- a/src/lib_misc.c > +++ b/src/lib_misc.c > @@ -286,14 +286,14 @@ static int prof_error(lua_State *L, int status, const char *err_details) > lua_pushstring(L, err2msg(LJ_ERR_PROF_MISUSE)); > lua_pushinteger(L, EINVAL); > return 3; > -#if LJ_HASSYSPROF > +#if LJ_HASSYSPROF || LJ_HASMEMPROF > case PROFILE_ERRRUN: > lua_pushnil(L); > lua_pushstring(L, err2msg(LJ_ERR_PROF_ISRUNNING)); > lua_pushinteger(L, EINVAL); > return 3; > case PROFILE_ERRIO: > - return luaL_fileresult(L, 0, NULL); > + return luaL_fileresult(L, 0, err_details); Discussed offline that this should be done in the previous patch-set. > #endif > + if (LJ_UNLIKELY(status == PROFILE_ERRRUN)) { > lua_pushnil(L); > lua_pushstring(L, err2msg(LJ_ERR_PROF_NOTRUNNING)); > lua_pushinteger(L, EINVAL); > return 3; > - case PROFILE_ERRIO: > - return luaL_fileresult(L, 0, NULL); > -#endif > - default: > - lj_assertL(0, "bad memprof error %d", status); > - return 0; > - } > } > + if (LJ_UNLIKELY(status != PROFILE_SUCCESS)) Minor: Looks like more natural to use `else if` here? Feel free to ignore. > + return prof_error(L, status, NULL); > + > lua_pushboolean(L, 1); > return 1; > #endif /* !LJ_HASMEMPROF */ > -- > 2.43.0 > -- Best regards, Sergey Kaplun