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 AB4F46B3EEB; Tue, 31 Oct 2023 16:26:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AB4F46B3EEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1698758783; bh=F2oq5ld5x+9VHybMKpZjxYZFcbfgOV6yjxLh97QDkBE=; 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=as7dvWRp8dJFQKT5XAyQDes98CJRQ6zTr7bDM4jl9B6ZuTQrrzysoTKTaL0/4VZDt g66kJ9nlqUrYX/40odnDPU/jGmdYJivJGFpkOo6WoIrOMPCHOb3K40mF70ZdkLdlbm CObuUZ/FAgdbVqZzOl0VE4LP0IQ8aNs+R1nGj2xo= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 A30976AFC2F for ; Tue, 31 Oct 2023 16:26:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A30976AFC2F Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1qxolB-0006vb-S1; Tue, 31 Oct 2023 16:26:22 +0300 Date: Tue, 31 Oct 2023 16:21:50 +0300 To: Sergey Bronnikov Cc: Sergey Bronnikov , tarantool-patches@dev.tarantool.org, max.kokryashkin@gmail.com Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9C931D0C4A91E7130F333D6F3C33D48C9F7A892AE3F7E098900894C459B0CD1B9E182BA9A5C6174AECD04E72F6B0330D30B10E2AA7778652316538BC1624513DC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AC43A7B4C36B769DEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370E0E628E5A2670BA8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8A8A918B1C21BC3D0DBE61675C95C4974117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC5FC25ED3FCEC3375A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B1593CA6EC85F86DF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE33AC447995A7AD183FC91FA280E0CE3D3A03B725D353964B2FFDA4F57982C5F435872C767BF85DA227C277FBC8AE2E8BB835E6E385EA5AF075ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5197604C579FABB65159BB5A87AD8A0A80983BEA9A9FB1434F87CCE6106E1FC07E67D4AC08A07B9B06A1CB4668A9CA5FACB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF9089352A3BB4EB0B715B04D3BECDA7817F6FE9061C2C7ACC3557635855CCD3E8F85183ADB301C8A8516A7BA5748856628EF71313B95C433D1C38554B880F7A28A74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojPJ6ruIekffLqZt9KcYAUCw== X-DA7885C5: F9BEF8652D36CEFF5B9676662E1587B3AE7A769B099B1E90A2A95FD738CD7625262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986B549330472CE7D1334126EEAE55A88BD20FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Fix C file generation in jit.bcsave. 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" Hello, Sergey! Thanks for the fixes! See my comment below. On 31.10.23, Sergey Bronnikov wrote: > Hello, > > On 10/23/23 14:12, Sergey Kaplun wrote: > > Hi, Sergey! > > Thanks for the patch! > > Please consider my comments below. > > > > On 19.10.23, Sergey Bronnikov wrote: > >> From: Sergey Bronnikov > >> > >> Thanks to codicodi. > >> > >> (cherry picked from commit 62903bacf4abbb1c6df0f395553eeaf1f68352c6) > >> > > > > Also, may you please add a comment why `LUA_PATH` is better here instead > > `LUA_TEST_ENV` (we need only to run the corresponding `jit.` modules)? > > > > I suppose that this test is passes even before the patch because its > > required Lua library instead compiled C library. Maybe it is better to > > use different names for them to avoid collisions? > > This is a good observation, thanks! > > We cannot use different for exported C file and Lua module, > > because file name is used as a symbol in shared library: > > > $ nm > build/test/tarantool-tests/lj-551-bytecode-c-broken-macro/bcsaved_clib.so > > > > 0000000000002000 R luaJIT_BC_bcsaved_clib > > > > > I did it in the following way: Lua module in source dir has name > bcsaved.lua, then we copying this file to > > a current binary dir with another name bcsaved_clib.lua, then we export > bc code to C and *remove* Lua module > > in a current binary dir: > > > diff --git > a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt > b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt > index cd685b5b..45857386 100644 > --- a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt > +++ b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt > @@ -1,5 +1,6 @@ >  set(LIB_NAME "bcsaved_clib") > -set(LUA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_NAME}.lua) > +set(LUA_FILE_ORIG ${CMAKE_CURRENT_SOURCE_DIR}/bcsaved.lua) > +set(LUA_FILE ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.lua) >  set(C_FILE ${LIB_NAME}.c) > >  make_lua_path(LUA_PATH > @@ -8,11 +9,24 @@ make_lua_path(LUA_PATH >      ${PROJECT_SOURCE_DIR}/src/jit/?.lua >  ) > > +add_custom_target(copy_lua > +  COMMAND ${CMAKE_COMMAND} -E > +    copy > +      ${LUA_FILE_ORIG} > +      ${LUA_FILE} > +  DEPENDS ${LUA_FILE_ORIG} > +  BYPRODUCTS ${LUA_FILE} > +  COMMENT "Copying Lua module" > +  VERBATIM > +) > + >  add_custom_target(export_bc >    COMMAND ${CMAKE_COMMAND} -E >      env >        LUA_PATH=${LUA_PATH} >      ${LUAJIT_BINARY} -b ${LUA_FILE} ${C_FILE} > +  COMMAND ${CMAKE_COMMAND} -E > +    remove ${LUA_FILE} >    DEPENDS luajit-main ${LUA_FILE} >    BYPRODUCTS ${C_FILE} >    COMMENT "Exporting bytecode to a C file" The test still doesn't fail before the commit. The reason is that the C file is compiled by C compiler, not the C++ compiler (so this macro is irrelevant). I suppose that we should add a .cpp file for the test too (and add the LINKER_LANGUAGE CXX [1] property for this target if its necessary). [1]: https://cmake.org/cmake/help/latest/prop_tgt/LINKER_LANGUAGE.html#linker-language -- Best regards, Sergey Kaplun