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 CC6E35C571F; Tue, 15 Aug 2023 14:58:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CC6E35C571F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1692100690; bh=v2rp9Sm+Vce83d6ydLp2GhJWJfh/OjMWcWiho2ECT9Y=; 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=UZJSld2NFXqTMYPwSIyonpellclcJzVYL+0gZiIP0uojZnU+HmNhUgq+gNu94tTW9 LWeKerL27uYS3FzJyHt+9vm7mVcZDkzrE51xQiIQJ+aXEQvC0c+FSxDrMcWajjLXO4 dN5KP2GHLV6mI8D0LmYJY7u2UFMpfcbkjg9CYhqs= Received: from smtp46.i.mail.ru (smtp46.i.mail.ru [95.163.41.84]) (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 0EA715C571F for ; Tue, 15 Aug 2023 14:58:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0EA715C571F Received: by smtp46.i.mail.ru with esmtpa (envelope-from ) id 1qVsgb-005KJ6-1c; Tue, 15 Aug 2023 14:58:09 +0300 Date: Tue, 15 Aug 2023 14:58:09 +0300 To: Sergey Kaplun Message-ID: References: <3307d2d7a9e4a959c0c5e5f51a222bd9e5201c3b.1691592488.git.skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3307d2d7a9e4a959c0c5e5f51a222bd9e5201c3b.1691592488.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD969E04B5EED670DC8BEB87106826C459512B2000DD660D84D182A05F53808504073F885424C0231F13BBEF860FA1D78CA15DF2214899DE0A3C84FC468AE4FF3FD X-C1DE0DAB: 0D63561A33F958A5312D83E8639654B7C3F70E7B3BF1BBF06EF70D9CB5795A30F87CCE6106E1FC07E67D4AC08A07B9B0CF7CD7A0D5AA5F25CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0AD5177F0B940C8B66ECE892A7B2722663E91682638B966EB3F662256BEEFA9527F32A85013259371A1393AAF489638EFA4EF0C7DBA0BDF1E7F4121D8D32A74B7D3E011D753D9B948DD37FD76D11AF80A0DAC75BDCCD5833328B4BDE9A43B642FF5EA455F16B58544A21C197AAF4D2E4732965026E5D17F6739C77C69D99B9914278E50E1F0597A6FD5CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojHVl7ekwB6hhjth+dVNXrXg== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE4074FD5E58099A8DFED24A9E48081DA5B46CB83A82A306BA1DAD51284F0FE6F529ABC7555A253F5B200DF104D74F62EE79D27EC13EC74F6107F4198E0F3ECE9B5443453F38A29522196 X-Mras: OK Subject: Re: [Tarantool-patches] [PATCH luajit 07/19] build: fix non-Linux/macOS builds 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the patch! LGTM, except for a few typos below. On Wed, Aug 09, 2023 at 06:35:56PM +0300, Sergey Kaplun via Tarantool-patches wrote: > This patch is a follow-up for the commit > a170eb8be9475295f4f67a086e25ed665b95c8ea ("core: separate the profiling > timer from lj_profile"). It moves the timer machinery to the separate Typo: s/to the/to a/ > module. Unfortunately, the `profile_{un}lock()` calls for Windows and > PS3 wasn't updated to access `lj_profile_timer` structure instead of Typo: s/wasn't/weren't/ > `ProfileState`. > > Also, it is a follow-up to the commit > f8fa8f4bbd103ab07697487ca5cab08d57cdebf5 ("memprof: add profile common > section"). Since this commit the system-dependent header and > `write()`, `open()`, `close()` functions are used. They are undefining Typo: s/undefining/undefined/ > on Windows, so this leads to error during the build. Typo: s/error/errors/ > > This patch fixes the aforementioned misbehaviour. After it our fork may > be built on Windows at least. > --- > src/lib_misc.c | 16 ++++++++++++---- > src/lj_profile_timer.h | 8 ++++---- > 2 files changed, 16 insertions(+), 8 deletions(-) > > diff --git a/src/lib_misc.c b/src/lib_misc.c > index c18d297e..1913a622 100644 > --- a/src/lib_misc.c > +++ b/src/lib_misc.c > @@ -8,10 +8,6 @@ > #define lib_misc_c > #define LUA_LIB > > -#include > -#include > -#include > - > #include "lua.h" > #include "lmisclib.h" > #include "lauxlib.h" > @@ -25,6 +21,12 @@ > > #include "lj_memprof.h" > > +#include > +#include > +#if !LJ_TARGET_WINDOWS > +#include > +#endif > + > /* ------------------------------------------------------------------------ */ > > static LJ_AINLINE void setnumfield(struct lua_State *L, GCtab *t, > @@ -78,6 +80,7 @@ LJLIB_CF(misc_getmetrics) > > /* --------- profile common section --------------------------------------- */ > > +#if !LJ_TARGET_WINDOWS > /* > ** Yep, 8Mb. Tuned in order not to bother the platform with too often flushes. > */ > @@ -434,6 +437,7 @@ LJLIB_CF(misc_memprof_stop) > lua_pushboolean(L, 1); > return 1; > } > +#endif /* !LJ_TARGET_WINDOWS */ > > #include "lj_libdef.h" > > @@ -441,6 +445,7 @@ LJLIB_CF(misc_memprof_stop) > > LUALIB_API int luaopen_misc(struct lua_State *L) > { > +#if !LJ_TARGET_WINDOWS > luaM_sysprof_set_writer(buffer_writer_default); > luaM_sysprof_set_on_stop(on_stop_cb_default); > /* > @@ -448,9 +453,12 @@ LUALIB_API int luaopen_misc(struct lua_State *L) > ** backtracing function. > */ > luaM_sysprof_set_backtracer(NULL); > +#endif /* !LJ_TARGET_WINDOWS */ > > LJ_LIB_REG(L, LUAM_MISCLIBNAME, misc); > +#if !LJ_TARGET_WINDOWS > LJ_LIB_REG(L, LUAM_MISCLIBNAME ".memprof", misc_memprof); > LJ_LIB_REG(L, LUAM_MISCLIBNAME ".sysprof", misc_sysprof); > +#endif /* !LJ_TARGET_WINDOWS */ > return 1; > } > diff --git a/src/lj_profile_timer.h b/src/lj_profile_timer.h > index 1deeea53..b3e1a6e9 100644 > --- a/src/lj_profile_timer.h > +++ b/src/lj_profile_timer.h > @@ -25,8 +25,8 @@ > #if LJ_TARGET_PS3 > #include > #endif > -#define profile_lock(ps) pthread_mutex_lock(&ps->lock) > -#define profile_unlock(ps) pthread_mutex_unlock(&ps->lock) > +#define profile_lock(ps) pthread_mutex_lock(&ps->timer.lock) > +#define profile_unlock(ps) pthread_mutex_unlock(&ps->timer.lock) > > #elif LJ_PROFILE_WTHREAD > > @@ -38,8 +38,8 @@ > #include > #endif > typedef unsigned int (WINAPI *WMM_TPFUNC)(unsigned int); > -#define profile_lock(ps) EnterCriticalSection(&ps->lock) > -#define profile_unlock(ps) LeaveCriticalSection(&ps->lock) > +#define profile_lock(ps) EnterCriticalSection(&ps->timer.lock) > +#define profile_unlock(ps) LeaveCriticalSection(&ps->timer.lock) > > #endif > > -- > 2.41.0 >