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 65C625764AA; Wed, 9 Aug 2023 18:44:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 65C625764AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1691595869; bh=G+wnNWXdVUGtdcDt8a0FYh7xG4Q6rLTbTtpwZBQ7z6c=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=xPF0n1sP0n09OB2OhUDpx8gK4ySrjef2MhySVFiQ8/VOJcGk5TwY1sDkjfPpKaT2p 8DEXgmjaBFPaYQMF2iQzGy1Ywgsv4Jnp2JmEBpBwHMYTadW7FUA9ajNnil2rbPTwJA J29TCZOpvRGxnXvCJGlcR1mpuNWzh8X2NYFDVX/o= Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [95.163.41.73]) (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 8E354576496 for ; Wed, 9 Aug 2023 18:41:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8E354576496 Received: by smtp32.i.mail.ru with esmtpa (envelope-from ) id 1qTlJ1-003Nbf-1s; Wed, 09 Aug 2023 18:41:03 +0300 To: Igor Munkin , Sergey Bronnikov Date: Wed, 9 Aug 2023 18:35:56 +0300 Message-ID: <3307d2d7a9e4a959c0c5e5f51a222bd9e5201c3b.1691592488.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD969E04B5EED670DC804E38A5F9341E5D89B81E0241E25E490182A05F538085040DAFC34472AA842C539BC923D1AD8FECE09EC9ACA1AE31519E28EAE23C5EDA6D4 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79145AB6E9E75F07EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E0B09B181166DBFC8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E479731B453F40ECE32768BB5AB59F8D117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC20302DFC78685446A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751F28451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4B9100238FE36DC7A2D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE360910C30DCD593B16136E347CC761E07C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637B8F435DEDE9E76EBEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5DECC454AFFE0AD522F6BEBBAB7CE8134F03BE6AF0DAC99A5F87CCE6106E1FC07E67D4AC08A07B9B0AD74539164518AE59C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF5DD3B388D6B73DF347CD1D51360872D87746A515069B6FF25D9389301DBDA744329B3AFCBA1AB93D1529AA6C8ABD04CAB4F5044B9E60AD653BFCEA711D84A50BA74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojUzxoxvtYX2p0sHOXeoSD/w== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769037B70E2716A360439BC923D1AD8FECE2F2E01304D987C7FDEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: [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 Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 -- 2.41.0