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 E3096BA7833; Thu, 13 Jun 2024 17:37:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E3096BA7833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1718289453; bh=NuvmhPdlJ9JisZyHrHQj5hRs3iB9JJ5yU170EPj6L6A=; 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=j2p0dX6T1g+jdvcAhI5HZEY8c/zJyw8A+z37o6rF0QpyBTKVrCHe78EnSIYQYPmws NsvL4adLtZf1v+9ZNyMxAqqV+l2wnjHHukfLk1EsMZATRV8Jsg/5bPFFXdc91px0A6 nhhIahKDMjoO1/03PujvkVDjgytYoMWK+p39oVaU= Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [95.163.41.77]) (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 DE9BD4A6671 for ; Thu, 13 Jun 2024 17:37:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DE9BD4A6671 Received: by smtp36.i.mail.ru with esmtpa (envelope-from ) id 1sHlZz-00000009O6j-0hqi; Thu, 13 Jun 2024 17:37:31 +0300 Content-Type: multipart/alternative; boundary="------------hLzbqhUwLb7u108PToGGgk0T" Message-ID: <5645c95e-d7cf-4480-8c1f-fe7c2691e874@tarantool.org> Date: Thu, 13 Jun 2024 17:37:30 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun References: <87a4c5c213df4e9f85eeb77d6cbb98dc2047c084.1713773432.git.skaplun@tarantool.org> In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9923B2AA154DF63C69F83E24FDF70A404D569FCF785121A5C1313CFAB8367EF908E2BE116634AD74DCD0F33C517DD4F79E0E8C1EE4C78EB89E9BE23ED84C84CA60A31DF553637B61119B76541BFBA1C79 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7D9C4478D0B876341EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637160171C9EBC7AFE48638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D869314E2BF242F04202A47B941C454FE023066BBF46CCDF28CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F3E38EE449E3E2AE389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8A9FF340AA05FB58CF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C632EDEA9CD5989A303F1AB874ED890284AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3C8D5B1C4346A1CEDBA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF17B107DEF921CE791DD303D21008E298D5E8D9A59859A8B64854413538E1713F75ECD9A6C639B01B78DA827A17800CE70012B0FBE38D23AE731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5562E21ACE0C7111C5002B1117B3ED696BEEB716ACA52018AB2920F75BA9A967F823CB91A9FED034534781492E4B8EEAD85CCBA673D36D1A4BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D349EC559D073CA5B6816898F3E3D3CB8ED8C79D4F4021114E672E344619DE70D158738CFF33FF376741D7E09C32AA3244C477707C4AA0FDDAEE70D6F05539DA95A04B608578F07FCFBEA455F16B58544A2557BDE0DD54B3590A5AE236DF995FB59978A700BF655EAEEED6A17656DB59BCAD427812AF56FC65B X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojP/c/PTD82AmayqNAvXKjiQ== X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D6140CD0F33C517DD4F79E0E8C1EE4C78EB8959D4FE0264A95A800152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v1 1/5] build: introduce option LUAJIT_ENABLE_TABLE_BUMP 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 Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------hLzbqhUwLb7u108PToGGgk0T Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey thanks for the answer. LGTM On 13.06.2024 12:51, Sergey Kaplun wrote: > Hi, Sergey! > Thanks for the review! > > On 06.06.24, Sergey Bronnikov wrote: >> Hi, Sergey >> >> >> thanks for the patch! Please see a question below. >> >> On 22.04.2024 11:49, Sergey Kaplun wrote: >>> This option enables table bump optimization if sink optimization is >>> enabled. The table bump optimization patches the bytecodes with a table >>> allocation on the trace recording if the recorded trace exceeds the size >>> of the allocated table. This optimization still has some bugs, so it is >>> disabled by default. For more details, see the comment in >>> . >>> >>> Needed for tarantool/tarantool#9924 >>> --- >>> CMakeLists.txt | 17 +++++++++++++++++ >>> 1 file changed, 17 insertions(+) >>> >>> diff --git a/CMakeLists.txt b/CMakeLists.txt >>> index 2355ce17..52014296 100644 >>> --- a/CMakeLists.txt >>> +++ b/CMakeLists.txt >>> @@ -307,6 +307,23 @@ if(LUAJIT_ENABLE_COVERAGE) >>> include(CodeCoverage) >>> endif() >>> >>> +# Enable table bump optimization. This optimization patches the >>> +# bytecodes with a table allocation on the trace recording if the >>> +# recorded trace exceeds the size of the allocated table. >>> +# This optimization still has some bugs, so it is disabled by >>> +# default. See also:https://github.com/LuaJIT/LuaJIT/issues/606. >>> +option(LUAJIT_ENABLE_TABLE_BUMP "Enable table bump optimization" OFF) >>> +if(LUAJIT_ENABLE_TABLE_BUMP) >>> + # Within table bump optimization enabled (and due to our >>> + # modification related to metrics), some offsets in `GG_State` >>> + # stop fit in 12bit immediate. Hence, the build failed due to >>> + # the DASM error (DASM_S_RANGE_I). >>> + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") >>> + message(FATAL_ERROR "Table Bump optimization is unsupported for aarch64") >> Table optimization works on all architectures supported by LuaJIT except >> aarch64, right? > In the upstream, it works on all architectures. We have a problem > building LuaJIT for aarch64 due to our metrics that too grows the > `GG_State`. > >> >>> + endif() >>> + AppendFlags(TARGET_C_FLAGS -DLUAJIT_ENABLE_TABLE_BUMP) >>> +endif() >>> + >>> # --- Main source tree --------------------------------------------------------- >>> >>> add_subdirectory(src) --------------hLzbqhUwLb7u108PToGGgk0T Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey


thanks for the answer. LGTM

On 13.06.2024 12:51, Sergey Kaplun wrote:
Hi, Sergey!
Thanks for the review!

On 06.06.24, Sergey Bronnikov wrote:
Hi, Sergey


thanks for the patch! Please see a question below.

On 22.04.2024 11:49, Sergey Kaplun wrote:
This option enables table bump optimization if sink optimization is
enabled. The table bump optimization patches the bytecodes with a table
allocation on the trace recording if the recorded trace exceeds the size
of the allocated table. This optimization still has some bugs, so it is
disabled by default. For more details, see the comment in
<CMakeLists.txt>.

Needed for tarantool/tarantool#9924
---
  CMakeLists.txt | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2355ce17..52014296 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -307,6 +307,23 @@ if(LUAJIT_ENABLE_COVERAGE)
    include(CodeCoverage)
  endif()
  
+# Enable table bump optimization. This optimization patches the
+# bytecodes with a table allocation on the trace recording if the
+# recorded trace exceeds the size of the allocated table.
+# This optimization still has some bugs, so it is disabled by
+# default. See also:https://github.com/LuaJIT/LuaJIT/issues/606.
+option(LUAJIT_ENABLE_TABLE_BUMP "Enable table bump optimization" OFF)
+if(LUAJIT_ENABLE_TABLE_BUMP)
+  # Within table bump optimization enabled (and due to our
+  # modification related to metrics), some offsets in `GG_State`
+  # stop fit in 12bit immediate. Hence, the build failed due to
+  # the DASM error (DASM_S_RANGE_I).
+  if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+    message(FATAL_ERROR "Table Bump optimization is unsupported for aarch64")
Table optimization works on all architectures supported by LuaJIT except 
aarch64, right?
In the upstream, it works on all architectures. We have a problem
building LuaJIT for aarch64 due to our metrics that too grows the
`GG_State`.


+  endif()
+  AppendFlags(TARGET_C_FLAGS -DLUAJIT_ENABLE_TABLE_BUMP)
+endif()
+
  # --- Main source tree ---------------------------------------------------------
  
  add_subdirectory(src)

    
--------------hLzbqhUwLb7u108PToGGgk0T--