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 5D2175C2EC5; Thu, 17 Aug 2023 17:31:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5D2175C2EC5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1692282680; bh=E9kMROvICDlmqKGQ6n5OZSVZCrtXdBwI29zE+LgOyhQ=; 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=KeK3qkRe73FO45/XD8B4Kn0VVnkzgXL90o6zWDxUFjNgLLEcX65auxLCRkZAGd584 Ce/wu2PjQMqEmeliSf7endPHAWQskqJY4TGM2jaheFYXomT05Yc5zTjl1XIaLwP0og H/8WvTfMeFCCn4Hi/EdD7KZUYHeJLSX/3cMyKo8U= Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [95.163.41.81]) (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 84E5C5C2EC5 for ; Thu, 17 Aug 2023 17:31:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 84E5C5C2EC5 Received: by smtp40.i.mail.ru with esmtpa (envelope-from ) id 1qWe1t-00DQuu-2y; Thu, 17 Aug 2023 17:31:18 +0300 Message-ID: <7b4843d2-0bd1-58c7-30f9-39ce95c3fee1@tarantool.org> Date: Thu, 17 Aug 2023 17:31:17 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Sergey Kaplun , Igor Munkin Cc: tarantool-patches@dev.tarantool.org References: <3307d2d7a9e4a959c0c5e5f51a222bd9e5201c3b.1691592488.git.skaplun@tarantool.org> In-Reply-To: <3307d2d7a9e4a959c0c5e5f51a222bd9e5201c3b.1691592488.git.skaplun@tarantool.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9700E0DCE2907754D77D6FA938422CA5F653AC3988EEC6B12182A05F538085040E10C9146C2D3FF2BC0DBB384D0796F51A34E5E271DE8AD0924559E7198A68693 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73B44982FA5E78411EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637416EC277BB71E4518638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D841E1E7E385555C7850D186DD2E32936D117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC1F3D1E7C87716A07A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE9647ADFADE5905B10CB8D3112395442FD8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE34E7D9683544204AF2D242C3BD2E3F4C6C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407978DA827A17800CE705056152E029236E2DBA43225CD8A89FB26E97DCB74E6252CE5475246E174218B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A58B5F25B006A8DFA8DFE15050FD5AD9192E5E8D42E22D1635F87CCE6106E1FC07E67D4AC08A07B9B064E7220B7C550592CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFA9D4ACE9EDF28DFA1E99F5F67FC891E12A955CA7B8D36C965E2200108B4D657ABF40353A1B84A45024F7434E9608BF9F199F7D748AA7CA13323AAF4F4B5E77ADE48CAC7CA610320002C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojFRrmMqSMPxqituEuxDMXSw== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769C72F7F8E82B87515C0DBB384D0796F510D95629463F16A6AEBA65886582A37BD66FEC6BF5C9C28D98A98C1125256619760D574B6FC815AB872D6B4FCE48DF648AE208404248635DF 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: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey thanks for the patch! LGTM On 8/9/23 18:35, Sergey Kaplun 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 > module. Unfortunately, the `profile_{un}lock()` calls for Windows and > PS3 wasn't updated to access `lj_profile_timer` structure instead of > `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 > on Windows, so this leads to error during the build. > > 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 >